/* ===================================
   Isola Dashboard - Styles
   =================================== */

/* Light Mode (Default) */
:root,
.light-mode {
    --primary-color: #007BFF;
    --primary-dark: #0062CC;
    --accent-color: #FD7E14;
    --bg-color: #f7f9fc;
    --card-bg: #FFFFFF;
    --text-dark: #141922;
    --text-light: #5d6776;
    --shadow: 0 4px 14px rgba(16, 30, 54, 0.08), 0 2px 4px rgba(16, 30, 54, 0.05);
    --shadow-lg: 0 16px 36px rgba(16, 30, 54, 0.14), 0 6px 12px rgba(16, 30, 54, 0.08);
    --border-color: #e3e8ef;
    --input-bg: #f7f9fc;
    --table-hover: #f7f9fc;
    --table-header: #eef1f6;
}

/* Dark Mode */
.dark-mode {
    --primary-color: #3392FF;
    --primary-dark: #0062CC;
    --accent-color: #FD8F35;
    --bg-color: #0d1117;
    --card-bg: #161c25;
    --text-dark: #e7edf4;
    --text-light: #9aa6b6;
    --shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 16px 36px rgba(0, 0, 0, 0.55);
    --border-color: #26303c;
    --input-bg: #1f2630;
    --table-hover: #1b222c;
    --table-header: #161c25;
}

/* Smooth transition for theme switching */
html {
    transition: background-color 0.3s ease, color 0.3s ease;
}

body,
.dashboard-container,
.stats-section,
.chart-card,
.stat-card,
.table-section,
.login-card,
.dashboard-header,
.tab-navigation,
.modal-content,
input,
select,
textarea {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Cairo', 'Segoe UI', Tahoma, sans-serif;
    background: var(--bg-color);
    color: var(--text-dark);
    line-height: 1.6;
    overflow-x: hidden;
    max-width: 100vw;
}

html {
    overflow-x: hidden;
}

/* ===================================
   Login Screen
   =================================== */

.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    padding: 20px;
}

.login-card {
    background: var(--card-bg);
    padding: 40px;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    max-width: 400px;
    width: 100%;
    text-align: center;
    animation: fadeInUp 0.6s ease-out;
}

.login-logo {
    width: 80px;
    height: auto;
    margin-bottom: 20px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.logo {
    width: 60px;
    height: auto;
    margin-bottom: 20px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.login-card h1 {
    color: #007BFF;
    font-size: 32px;
    margin-bottom: 10px;
    font-weight: 600;
}

.login-card p {
    color: #888;
    margin-bottom: 40px;
    font-size: 16px;
}

.login-card p.subtitle {
    color: #888;
    font-size: 15px;
    margin-bottom: 40px;
}

.form-group {
    margin-bottom: 25px;
    text-align: right;
}

.form-group label {
    display: block;
    margin-bottom: 10px;
    color: #333;
    font-size: 16px;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.3s ease;
    background: #f9f9f9;
}

.form-group input:focus {
    outline: none;
    border-color: #007BFF;
    background: white;
}

.error-message {
    background: #FFEBEE;
    color: #F44336;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-size: 14px;
    text-align: center;
}

.error-message.hidden {
    display: none;
}

.error-message.active {
    display: block;
    animation: shake 0.5s;
}

.btn-login {
    width: 100%;
    padding: 16px;
    background: #007BFF;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
}

.btn-login:hover {
    background: #0062CC;
}

/* ===================================
   Dashboard Layout
   =================================== */

.dashboard-container {
    min-height: 100vh;
    background: var(--bg-color);
    max-width: 100%;
    overflow-x: hidden;
}

.hidden {
    display: none !important;
}

/* Header */
.dashboard-header {
    background: var(--card-bg);
    padding: 30px 40px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 100%;
    overflow: visible;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 20px;
}

.header-logo {
    width: 60px;
    height: auto;
}

.header-text h1 {
    color: var(--primary-color);
    font-size: 28px;
    margin-bottom: 5px;
}

.header-text p {
    color: var(--text-light);
    font-size: 14px;
}

.header-actions {
    display: flex;
    gap: 15px;
    align-items: center;
}

.btn-complaints {
    padding: 12px 24px;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-complaints:hover {
    background: #E36A05;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 167, 38, 0.4);
}

.btn-logout {
    padding: 12px 24px;
    background: #e53935;
    color: #fff;
    border: 2px solid #e53935;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-logout:hover {
    background: #c62828;
    border-color: #c62828;
    color: #fff;
}

.btn-change-password {
    padding: 10px 14px;
    background: transparent;
    color: #757575;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-change-password:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.success-message {
    background: #E6F2FF;
    color: #0062CC;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 15px;
    text-align: center;
    font-weight: 600;
}

.modal-small {
    max-width: 400px;
}

.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-wrapper input {
    flex: 1;
    padding-right: 45px;
}

.toggle-password {
    position: absolute;
    left: 10px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    padding: 5px;
    opacity: 0.6;
    transition: opacity 0.3s;
}

.toggle-password:hover {
    opacity: 1;
}

/* ===================================
   Tab Navigation
   =================================== */

.tab-navigation {
    background: var(--card-bg);
    padding: 0 40px;
    display: flex;
    gap: 10px;
    border-bottom: 2px solid #F0F0F0;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tab-btn {
    padding: 16px 32px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.3s ease;
}

.tab-btn:hover {
    color: var(--primary-color);
    background: #F9F9F9;
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

/* ===================================
   Loading State
   =================================== */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    gap: 20px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #E0E0E0;
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Dashboard Content */
.dashboard-content {
    padding: 40px;
    max-width: 1400px;
    margin: 0 auto;
}

/* ===================================
   Statistics Cards
   =================================== */

.stats-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--card-bg);
    padding: 24px;
    border-radius: 16px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    opacity: 0;
}

.stat-card[data-animation="fade-in-up"] {
    animation: fadeInUp 0.6s ease-out forwards;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.stat-card-highlight {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
}

.stat-card-highlight .stat-info h3,
.stat-card-highlight .stat-number {
    color: white;
}

.stat-subtitle {
    display: block;
    font-size: 13px;
    margin-top: 8px;
    opacity: 0.9;
    font-weight: 500;
}

.stat-icon {
    font-size: 48px;
    line-height: 1;
}

.stat-info h3 {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 8px;
    font-weight: 500;
}

.stat-number {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1;
}

/* ===================================
   Charts Section
   =================================== */

.charts-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.chart-card {
    background: var(--card-bg);
    padding: 24px;
    border-radius: 16px;
    box-shadow: var(--shadow);
    opacity: 0;
}

.chart-card[data-animation="fade-in-up"] {
    animation: fadeInUp 0.6s ease-out forwards;
}

.chart-card h3 {
    margin-bottom: 20px;
    color: var(--text-dark);
    font-size: 18px;
}

.chart-card canvas {
    max-height: 300px;
}

/* ===================================
   Data Table
   =================================== */

.table-section {
    background: var(--card-bg);
    padding: 24px;
    border-radius: 16px;
    box-shadow: var(--shadow);
    opacity: 0;
}

.table-section[data-animation="fade-in-up"] {
    animation: fadeInUp 0.6s ease-out forwards;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 16px;
}

.table-header h3 {
    font-size: 20px;
    color: var(--text-dark);
}

.table-actions {
    display: flex;
    gap: 12px;
}

#searchInput {
    padding: 10px 16px;
    border: 2px solid #E0E0E0;
    border-radius: 8px;
    font-size: 14px;
    min-width: 250px;
    transition: border-color 0.3s ease;
}

#searchInput:focus {
    outline: none;
    border-color: var(--primary-color);
}

.btn-export {
    padding: 10px 20px;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-export:hover {
    background: #E36A05;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 167, 38, 0.4);
}

.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: #F5F5F5;
}

th {
    padding: 14px;
    text-align: right;
    font-weight: 600;
    color: var(--text-dark);
    cursor: pointer;
    user-select: none;
    transition: background 0.3s ease;
}

th:hover {
    background: #EEEEEE;
}

tbody tr {
    border-bottom: 1px solid #E0E0E0;
    transition: background 0.3s ease;
}

tbody tr:hover {
    background: #FAFAFA;
}

td {
    padding: 14px;
    text-align: right;
    color: var(--text-dark);
}

/* ===================================
   Status Badges
   =================================== */

.status-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 13px;
}

.status-badge.status-occupied {
    background: #0062CC;
    color: white;
}

.status-badge.status-vacant {
    background: #FD7E14;
    color: white;
}

/* ===================================
   Priority Badges (Complaints)
   =================================== */

.priority-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 12px;
}

.priority-badge.priority-عاجل {
    background: #F44336;
    color: white;
}

.priority-badge.priority-متوسط {
    background: #FFC107;
    color: #333;
}

.priority-badge.priority-عادي {
    background: #3392FF;
    color: white;
}

/* ===================================
   Animations
   =================================== */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.5);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-5px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(5px);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===================================
   Responsive Design
   =================================== */

@media (max-width: 768px) {

    /* Fix header layout */
    .dashboard-header {
        padding: 16px;
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }

    .header-content {
        flex-direction: column;
        gap: 10px;
    }

    .header-logo {
        width: 50px;
    }

    .header-text h1 {
        font-size: 18px;
    }

    .header-text p {
        font-size: 12px;
    }

    .header-actions {
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
        width: 100%;
    }

    .btn-complaints,
    .btn-logout {
        padding: 10px 16px;
        font-size: 13px;
        flex: 1;
        min-width: 120px;
        text-align: center;
    }

    /* Fix tab navigation - stack vertically on mobile */
    .tab-navigation {
        padding: 10px;
        flex-direction: column;
        gap: 8px;
        overflow-x: visible;
        border-bottom: none;
    }

    .tab-btn {
        padding: 12px 16px;
        font-size: 14px;
        white-space: normal;
        flex-shrink: 0;
        width: 100%;
        text-align: center;
        border-radius: 8px;
        background: #f5f5f5;
        border-bottom: none;
    }

    .tab-btn.active {
        background: var(--primary-color);
        color: white;
        border-bottom: none;
    }

    /* Fix dashboard content */
    .dashboard-content {
        padding: 16px;
    }

    .stats-section {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .stat-card {
        padding: 16px;
        gap: 12px;
    }

    .stat-icon {
        font-size: 36px;
    }

    .stat-number {
        font-size: 24px;
    }

    .stat-info h3 {
        font-size: 12px;
    }

    .charts-section {
        grid-template-columns: 1fr;
    }

    .chart-card {
        padding: 16px;
    }

    .chart-card canvas {
        max-height: 250px;
    }

    /* Fix table */
    .table-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .table-header h3 {
        font-size: 16px;
        text-align: center;
    }

    .table-actions {
        flex-direction: column;
        gap: 10px;
    }

    #searchInput {
        min-width: 100%;
    }

    .table-container {
        margin: 0 -16px;
        padding: 0 16px;
    }

    th,
    td {
        padding: 10px 8px;
        font-size: 13px;
    }

    /* Loading state */
    .loading {
        min-height: 300px;
    }

    .loading p {
        font-size: 14px;
    }
}

/* Extra small devices */
@media (max-width: 480px) {
    .dashboard-header {
        padding: 12px;
    }

    .header-text h1 {
        font-size: 16px;
    }

    .tab-btn {
        padding: 10px 12px;
        font-size: 12px;
    }

    .stat-card {
        padding: 12px;
    }

    .stat-icon {
        font-size: 28px;
    }

    .stat-number {
        font-size: 20px;
    }

    .btn-complaints,
    .btn-logout {
        padding: 8px 12px;
        font-size: 12px;
    }
}


/* ===================================
   Contact Popup
   =================================== */
.owner-name-cell {
    cursor: pointer;
    color: var(--primary-color);
    font-weight: 600;
    transition: all 0.3s ease;
}

.owner-name-cell:hover {
    text-decoration: underline;
    color: var(--primary-dark);
}

.contact-popup {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.contact-popup-content {
    background: white;
    padding: 30px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 90%;
    position: relative;
    animation: slideUp 0.3s ease;
}

.popup-close {
    position: absolute;
    top: 15px;
    left: 15px;
    background: transparent;
    border: none;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.popup-close:hover {
    background: #f5f5f5;
    color: #333;
}

.contact-popup-content h3 {
    color: var(--primary-color);
    font-size: 22px;
    margin-bottom: 20px;
    text-align: right;
    padding-right: 10px;
}

.contact-info {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #f9f9f9;
    border-radius: 10px;
    direction: rtl;
}

.contact-icon {
    font-size: 24px;
}

.contact-label {
    font-weight: 600;
    color: var(--text-dark);
    min-width: 80px;
}

.contact-value {
    color: var(--text-light);
    flex: 1;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    /* Above the floating bottom buttons (SOS 9000, banner 8600,
       bottom-nav 9990, notify 9998, install 9999) so the modal's
       submit button is never hidden behind them. */
    z-index: 10001;
}

.modal.hidden {
    display: none;
}

/* When any modal is open, hide the floating bottom buttons so they don't
   interfere with — or peek through — the modal and its submit button. */
body:has(.modal:not(.hidden)) #enableNotificationsBtn,
body:has(.modal:not(.hidden)) #pwaInstallBtn,
body:has(.modal:not(.hidden)) .sos-fab,
body:has(.modal:not(.hidden)) .sticky-ann-stack {
    display: none !important;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content h2 {
    margin-top: 0;
    color: #333;
    text-align: center;
}

.modal .close {
    position: absolute;
    top: 15px;
    left: 15px;
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    transition: color 0.3s;
}

.modal .close:hover {
    color: #000;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.modal-actions button {
    flex: 1;
}

/* Sub-tabs for Users section */
.sub-tabs {
    display: flex;
    gap: 10px;
    margin-left: 20px;
}

.sub-tab-btn {
    padding: 8px 16px;
    border: 2px solid #007BFF;
    background: white;
    color: #007BFF;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s;
}

.sub-tab-btn:hover {
    background: #E6F2FF;
}

.sub-tab-btn.active {
    background: #007BFF;
    color: white;
}

.sub-tab-content.hidden {
    display: none;
}

/* Tags actions */
.tags-actions {
    margin-bottom: 20px;
}

/* Users checkbox list in tag modal */
.users-checkbox-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px;
    background: #f9f9f9;
}

.users-checkbox-list label {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    margin: 5px 0;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.users-checkbox-list label:hover {
    background: #E6F2FF;
}

.users-checkbox-list input[type="checkbox"] {
    margin-left: 10px;
    width: 18px;
    height: 18px;
    accent-color: #007BFF;
}

/* Tag badge in users table */
.tag-badge {
    display: inline-block;
    padding: 3px 8px;
    margin: 2px;
    background: #E6F2FF;
    color: #0062CC;
    border-radius: 12px;
    font-size: 11px;
}

.btn-small {
    padding: 5px 10px;
    font-size: 12px;
    margin: 0 2px;
    border: none;
    border-radius: 4px;
    background: #3392FF;
    color: white;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-small:hover {
    background: #0062CC;
}

.btn-small.btn-danger {
    background: #f44336;
}

.btn-small.btn-danger:hover {
    background: #da190b;
}

/* Permissions Checkboxes */
.permissions-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 5px;
}

.permissions-checkboxes label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    cursor: pointer;
}

.permissions-checkboxes input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Status Badges */
.status-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: bold;
}

.status-new {
    background-color: #E3F2FD;
    color: #1976D2;
}

.status-pending {
    background-color: #FFF3E9;
    color: #E36A05;
}

.status-resolved {
    background-color: #E6F2FF;
    color: #004A99;
}

/* Edit Button */
.btn-edit-small {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2em;
    margin-left: 5px;
}

.btn-edit-small:hover {
    transform: scale(1.1);
}

.btn-copy-link {
    background: #1976D2;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    margin: 0 4px;
    transition: all 0.3s ease;
}

.btn-copy-link:hover {
    background: #1565C0;
    transform: scale(1.1);
}

/* ===================================
   Access Logs Cards
   =================================== */

.access-logs-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
    padding: 20px 0;
}

.access-log-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.access-log-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f0f0f0;
}

.log-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: linear-gradient(135deg, #007BFF, #0062CC);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
}

.user-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.username {
    font-weight: 600;
    font-size: 16px;
    color: #333;
}

.timestamp {
    font-size: 13px;
    color: #999;
}

.log-status {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
}

.log-status.status-success {
    background: #E6F2FF;
    color: #0062CC;
}

.log-status.status-failed {
    background: #FFEBEE;
    color: #C62828;
}

.log-details {
    display: grid;
    gap: 12px;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
}

.detail-label {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

.detail-value {
    font-size: 14px;
    color: #333;
    font-weight: 600;
    text-align: left;
}

@media (max-width: 768px) {
    .access-logs-container {
        grid-template-columns: 1fr;
    }
    /* Stack label/value vertically so values always render on iOS Safari
       (its flex + RTL + space-between can otherwise hide the value). */
    .log-details .detail-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    .log-details .detail-value {
        text-align: right;
        width: 100%;
        word-break: break-word;
    }
}

/* ===================================
   Notification Bell & Dropdown
   =================================== */

.notification-bell-container {
    position: relative;
    display: inline-block;
}

.notification-bell {
    background: transparent;
    border: none;
    font-size: 24px;
    cursor: pointer;
    position: relative;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.3s;
}

.notification-bell:hover {
    background: rgba(0, 0, 0, 0.1);
}

.notification-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: #e74c3c;
    color: white;
    font-size: 11px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 50%;
    min-width: 18px;
    text-align: center;
}

.notification-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 350px;
    max-height: 450px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    overflow: hidden;
    animation: slideDown 0.2s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.notification-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: linear-gradient(135deg, #007BFF, #0062CC);
    color: white;
}

.notification-header h3 {
    margin: 0;
    font-size: 16px;
}

.notification-actions-header {
    display: flex;
    gap: 8px;
}

.notification-actions-header button {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.notification-actions-header button:hover {
    background: rgba(255, 255, 255, 0.3);
}

.notification-list {
    max-height: 380px;
    overflow-y: auto;
    background: white;
}

.notification-item {
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    background: white;
}

.notification-item:hover {
    background: #f8f9fa;
}

.notification-item.unread {
    background: #E6F2FF;
    border-right: 3px solid #007BFF;
}

.notification-content {
    flex: 1;
}

.notification-title {
    font-weight: 600;
    font-size: 14px;
    color: #333;
    margin-bottom: 4px;
}

.notification-body {
    font-size: 13px;
    color: #666;
    margin-bottom: 4px;
}

.notification-time {
    font-size: 11px;
    color: #999;
}

.notification-delete {
    background: none;
    border: none;
    color: #ccc;
    cursor: pointer;
    padding: 5px;
    font-size: 16px;
    transition: color 0.2s;
}

.notification-delete:hover {
    color: #e74c3c;
}

.notification-empty {
    padding: 40px;
    text-align: center;
    color: #999;
}

/* Close button in notification header */
.notification-close-btn {
    background: rgba(255, 255, 255, 0.2) !important;
    border-radius: 50% !important;
    width: 28px !important;
    height: 28px !important;
    padding: 0 !important;
    font-size: 16px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin-right: -5px !important;
}

.notification-close-btn:hover {
    background: rgba(255, 255, 255, 0.4) !important;
}

@media (max-width: 768px) {
    .notification-dropdown {
        position: fixed;
        top: 60px;
        left: 10px;
        right: 10px;
        width: auto;
        max-height: 70vh;
    }

    .notification-list {
        max-height: 50vh;
        overflow-y: auto;
    }
}

/* ===================================
   Send Notification Button & Modal
   =================================== */

.btn-send-notification {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-left: 10px;
}

.btn-send-notification:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.send-notification-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    justify-content: center;
    align-items: center;
}

.send-notification-modal.active {
    display: flex;
}

.send-notification-content {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlide 0.3s ease;
}

@keyframes modalSlide {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.send-notification-header {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 16px 16px 0 0;
}

.send-notification-header h2 {
    margin: 0;
    font-size: 18px;
}

.send-notification-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    transition: background 0.2s;
}

.send-notification-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.send-notification-form {
    padding: 20px;
}

.send-notification-form .form-group {
    margin-bottom: 20px;
}

.send-notification-form label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
}

.send-notification-form input[type="text"],
.send-notification-form textarea,
.send-notification-form select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.send-notification-form input:focus,
.send-notification-form textarea:focus,
.send-notification-form select:focus {
    border-color: #667eea;
    outline: none;
}

.send-notification-form textarea {
    resize: vertical;
    min-height: 80px;
}

.target-options {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.target-option {
    flex: 1;
    min-width: 120px;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.target-option:hover {
    border-color: #667eea;
}

.target-option.selected {
    border-color: #667eea;
    background: #f0f4ff;
}

.target-option .icon {
    font-size: 24px;
    display: block;
    margin-bottom: 5px;
}

.tags-select-container,
.users-select-container {
    display: none;
    margin-top: 15px;
}

.tags-select-container.active,
.users-select-container.active {
    display: block;
}

.tags-list,
.users-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-height: 150px;
    overflow-y: auto;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 10px;
}

.tag-chip,
.user-chip {
    padding: 8px 15px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
}

.tag-chip:hover,
.user-chip:hover {
    border-color: #667eea;
}

.tag-chip.selected,
.user-chip.selected {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.send-notification-submit {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.send-notification-submit:hover {
    transform: scale(1.02);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.send-notification-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.checkbox-option {
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox-option input[type="checkbox"] {
    width: 20px;
    height: 20px;
}

/* ===================================
   Polls Styles
   =================================== */

.poll-option-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
}

.poll-option-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s;
}

.poll-option-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.btn-remove-option {
    width: 36px;
    height: 36px;
    border: none;
    background: #ffebee;
    color: #e53935;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s;
    flex-shrink: 0;
}

.btn-remove-option:hover {
    background: #e53935;
    color: white;
}

.btn-add-option {
    width: 100%;
    padding: 12px;
    margin-top: 10px;
    border: 2px dashed #e0e0e0;
    background: transparent;
    color: var(--primary-color);
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    transition: all 0.3s;
}

.btn-add-option:hover {
    border-color: var(--primary-color);
    background: rgba(124, 179, 66, 0.05);
}

#createPollModal textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.3s;
}

#createPollModal textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.modal-actions .btn-login {
    flex: 2;
}

.modal-actions .btn-logout {
    flex: 1;
}

.btn-action {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 5px 8px;
    border-radius: 6px;
    transition: all 0.2s;
}

.btn-action:hover {
    background: #f5f5f5;
    transform: scale(1.1);
}

.btn-action.btn-delete:hover {
    background: #ffebee;
}

/* ===================================
   Theme Toggle Button
   =================================== */

.btn-theme-toggle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.btn-theme-toggle:hover {
    transform: scale(1.1);
    border-color: var(--primary-color);
}

/* ===================================
   Dark Mode Overrides
   =================================== */

/* Dark Mode Body & Container */
.dark-mode,
.dark-mode body {
    background-color: #121212 !important;
    color: #E0E0E0 !important;
}

.dark-mode .dashboard-container {
    background-color: #121212 !important;
}

.dark-mode .login-card h1,
.dark-mode .chart-card h3,
.dark-mode .table-header h3 {
    color: #fff;
}

.dark-mode .login-card p,
.dark-mode .login-card p.subtitle {
    color: #aaa;
}

.dark-mode .form-group label {
    color: var(--text-dark);
}

.dark-mode .form-group input,
.dark-mode .form-group select,
.dark-mode .form-group textarea {
    background: var(--input-bg);
    border-color: var(--border-color);
    color: var(--text-dark);
}

.dark-mode .form-group input:focus,
.dark-mode .form-group select:focus {
    background: var(--card-bg);
}

/* Dark Mode Table Styles */
.dark-mode .table-section {
    background: var(--card-bg);
}

.dark-mode thead {
    background: #2D2D2D !important;
}

.dark-mode th {
    color: #fff;
    background: #2D2D2D !important;
}

.dark-mode th:hover {
    background: #3D3D3D !important;
}

.dark-mode tbody {
    background: #1E1E1E !important;
}

.dark-mode tbody tr {
    border-bottom: 1px solid #333;
    background: #1E1E1E !important;
}

.dark-mode tbody tr:nth-child(even) {
    background: #252525 !important;
}

.dark-mode tbody tr:hover {
    background: #333 !important;
}

.dark-mode td {
    color: #E0E0E0;
}

/* Dark Mode Status Badges */
.dark-mode .status-badge.status-occupied {
    background: #0062CC;
    color: #fff;
}

.dark-mode .status-badge.status-vacant {
    background: #E36A05;
    color: #fff;
}

/* Dark Mode Cards & Charts */
.dark-mode .stat-card {
    background: var(--card-bg);
    border: 1px solid #333;
}

.dark-mode .chart-card {
    background: var(--card-bg);
    border: 1px solid #333;
}

.dark-mode #searchInput {
    background: #2D2D2D;
    border-color: #444;
    color: #fff;
}

.dark-mode #searchInput::placeholder {
    color: #888;
}

/* Dark Mode Tabs */
.dark-mode .tab-navigation {
    background: var(--card-bg);
    border-bottom-color: #333;
}

.dark-mode .tab-btn {
    color: #aaa;
}

.dark-mode .tab-btn:hover {
    background: #2A2A2A;
    color: #fff;
}

.dark-mode .tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

/* Dark Mode Messages */
.dark-mode .error-message {
    background: rgba(244, 67, 54, 0.2);
    color: #ef5350;
}

.dark-mode .success-message {
    background: rgba(76, 175, 80, 0.2);
    color: #3392FF;
}

/* Dark Mode Modals */
.dark-mode .modal-content {
    background: #1E1E1E;
    border: 1px solid #333;
}

.dark-mode .modal-header {
    border-bottom-color: #333;
}

.dark-mode .modal-header h2 {
    color: #fff;
}

/* Dark Mode Buttons */
.dark-mode .btn-action:hover {
    background: #333;
}

.dark-mode .btn-action.btn-delete:hover {
    background: rgba(244, 67, 54, 0.3);
}

.dark-mode .btn-export {
    background: #E36A05;
}

/* Dark Mode Header */
.dark-mode .dashboard-header {
    background: var(--card-bg);
    border-bottom: 1px solid #333;
}

.dark-mode .btn-logout {
    background: #e53935;
    color: #fff;
    border-color: #e53935;
}

.dark-mode .btn-logout:hover {
    background: #c62828;
    border-color: #c62828;
    color: #fff;
}

/* Dark Mode Notification Bell */
.dark-mode .notification-bell {
    color: #ccc;
}

/* Dark mode mobile tabs */
@media (max-width: 768px) {
    .dark-mode .tab-btn {
        background: #252525;
    }

    .dark-mode .tab-btn.active {
        background: var(--primary-color);
        color: white;
    }
}
/* Technician service-type checkboxes (user management forms) */
.maint-types-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    max-height: 130px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px 12px;
}
.maint-types-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
}
.maint-types-group input { cursor: pointer; }

/* Small user avatar in the users management table */
.user-cell { display: inline-flex; align-items: center; gap: 8px; }
.user-avatar-sm {
    width: 30px; height: 30px; border-radius: 50%;
    object-fit: cover; flex-shrink: 0; border: 1px solid #ddd;
}
.user-avatar-ph {
    display: inline-flex; align-items: center; justify-content: center;
    background: #007BFF; color: #fff; font-weight: 700; font-size: 13px; border: none;
}

/* ===== Sleek WhatsApp "send code" button ===== */
.btn-whatsapp {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 20px;
    border: none;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    box-shadow: 0 6px 18px rgba(37, 211, 102, 0.35);
    transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}
.btn-whatsapp:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(37, 211, 102, 0.45);
    filter: brightness(1.05);
}
.btn-whatsapp:active {
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.35);
}
.btn-whatsapp:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}
.btn-whatsapp svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}
