/* Color Themes */
:root, [data-theme="DEEP_NAVY"] {
    --primary-color: #1A237E;
    --primary-light: #3F51B5;
    --primary-bg: #E8EAF6;
    --accent-amber: #F59E0B;
    --accent-green: #10B981;
    --accent-red: #EF4444;
    --accent-blue: #0284C7;
    --bg-light: #F4F6F9;
    --surface-white: #FFFFFF;
    --text-dark: #1F2937;
    --text-muted: #6B7280;
    --border-color: #E5E7EB;
    --font-cairo: 'Cairo', sans-serif;
}

[data-theme="EMERALD_FOREST"] {
    --primary-color: #1B5E20;
    --primary-light: #2E7D32;
    --primary-bg: #E8F5E9;
    --accent-amber: #F59E0B;
    --accent-green: #10B981;
    --accent-red: #EF4444;
    --accent-blue: #0284C7;
    --bg-light: #F7FBF7;
    --surface-white: #FFFFFF;
    --text-dark: #1B5E20;
    --text-muted: #4F7942;
    --border-color: #C8E6C9;
}

[data-theme="SUNSET_GOLD"] {
    --primary-color: #E65100;
    --primary-light: #F57C00;
    --primary-bg: #FFF3E0;
    --accent-amber: #F59E0B;
    --accent-green: #10B981;
    --accent-red: #EF4444;
    --accent-blue: #0284C7;
    --bg-light: #FFFAF2;
    --surface-white: #FFFFFF;
    --text-dark: #371B00;
    --text-muted: #8C532B;
    --border-color: #FFE0B2;
}

[data-theme="MIDNIGHT_LUXURY"] {
    --primary-color: #001F22;
    --primary-light: #004D40;
    --primary-bg: #002B2E;
    --accent-amber: #F59E0B;
    --accent-green: #10B981;
    --accent-red: #EF4444;
    --accent-blue: #80CBC4;
    --bg-light: #001214;
    --surface-white: #001F22;
    --text-dark: #E0F2F1;
    --text-muted: #80CBC4;
    --border-color: #004D40;
}

[data-theme="INDUSTRIAL_BLUE"] {
    --primary-color: #0284C7;
    --primary-light: #0369A1;
    --primary-bg: #E0F2FE;
    --accent-amber: #F59E0B;
    --accent-green: #10B981;
    --accent-red: #EF4444;
    --accent-blue: #0284C7;
    --bg-light: #F0F9FF;
    --surface-white: #FFFFFF;
    --text-dark: #0C4A6E;
    --text-muted: #0369A1;
    --border-color: #BAE6FD;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-cairo);
}

body {
    background-color: var(--bg-light);
    color: var(--text-dark);
    direction: rtl;
    min-height: 100vh;
}

.hidden {
    display: none !important;
}

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

.login-card {
    background: var(--surface-white);
    padding: 32px 24px;
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 440px;
}

.login-header {
    text-align: center;
    margin-bottom: 24px;
}

.logo-icon {
    font-size: 44px;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.login-header h2 {
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 6px;
}

.login-header p {
    color: var(--text-muted);
    font-size: 13px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-weight: 700;
    font-size: 13px;
    margin-bottom: 6px;
    color: var(--text-dark);
}

.form-group input, .form-group textarea, .form-group select {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--border-color);
    border-radius: 12px;
    font-size: 14px;
    outline: none;
    transition: all 0.25s ease-in-out;
    background: var(--surface-white);
    color: var(--text-dark);
}

.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 4px rgba(63, 81, 181, 0.15);
}

/* Custom Range Slider */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: #E5E7EB;
    outline: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.btn-primary {
    width: 100%;
    background-color: var(--primary-color);
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
}

.btn-primary:hover {
    background-color: var(--primary-light);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.error-msg {
    color: var(--accent-red);
    font-size: 13px;
    margin-top: 12px;
    text-align: center;
    font-weight: 700;
}

/* Dashboard Layout */
.dashboard-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background-color: var(--primary-color);
    color: white;
    display: flex;
    flex-direction: column;
    padding: 20px 14px;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 800;
    margin-bottom: 28px;
    padding: 0 8px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-weight: 700;
    font-size: 14px;
    border-radius: 12px;
    transition: all 0.2s;
}

.nav-item:hover, .nav-item.active {
    background-color: rgba(255, 255, 255, 0.15);
    color: white;
}

.user-profile-widget {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.1);
    padding: 10px;
    border-radius: 14px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--accent-amber);
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 800;
    font-size: 14px;
}

.user-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.user-role-badge {
    font-size: 10px;
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 6px;
    border-radius: 6px;
    width: fit-content;
    margin-top: 2px;
}

.btn-logout {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 16px;
    padding: 6px;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

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

.header-title h1 {
    font-size: 22px;
    font-weight: 800;
}

.code-badge {
    background-color: var(--primary-bg);
    color: var(--primary-color);
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 800;
}

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

.btn-secondary {
    background: var(--surface-white);
    border: 1px solid var(--border-color);
    color: var(--text-dark);
    padding: 8px 14px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 40px;
}

.btn-location {
    background: var(--primary-bg);
    border: 1px solid var(--primary-light);
    color: var(--primary-color);
    padding: 8px 14px;
    border-radius: 10px;
    font-weight: 800;
    font-size: 13px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 40px;
}

.theme-selector-box {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--surface-white);
    border: 1px solid var(--border-color);
    padding: 6px 10px;
    border-radius: 10px;
    min-height: 40px;
}

.theme-selector-box select {
    border: none;
    outline: none;
    font-weight: 700;
    font-size: 12px;
    background: transparent;
    color: var(--text-dark);
    cursor: pointer;
}

/* Material 3 Category Pill Bar */
.pill-category-bar {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 4px 2px 12px 2px;
    margin-bottom: 16px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.pill-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--surface-white);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-dark);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.pill-item.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.pill-item:hover:not(.active) {
    background-color: var(--primary-bg);
    color: var(--primary-color);
}

/* Alert Banners */
.alert-banner {
    padding: 12px 16px;
    border-radius: 14px;
    margin-bottom: 16px;
    border: 1px solid transparent;
}

.amber-banner {
    background-color: #FEF3C7;
    border-color: #F59E0B;
    color: #78350F;
}

.red-banner {
    background-color: #FEE2E2;
    border-color: #EF4444;
    color: #7F1D1D;
}

.alert-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 800;
    font-size: 13px;
}

.btn-icon {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    color: inherit;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--surface-white);
    padding: 20px;
    border-radius: 18px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.chart-container {
    position: relative;
    width: 160px;
    height: 160px;
    margin: 16px auto;
}

.chart-center-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 26px;
    font-weight: 900;
    color: var(--primary-color);
}

.grid-two-cols {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 16px;
}

.card {
    background: var(--surface-white);
    border-radius: 18px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

/* Print Media Styles for Official Dedicated Single Report Printing */
.print-only-report {
    display: none;
}

@media print {
    body {
        background: white !important;
        color: black !important;
    }

    .sidebar, .top-header, .pill-category-bar, .modal-overlay, .btn-primary, .btn-secondary, .btn-logout, .alert-banner, .schedule-prompt-card, .main-content {
        display: none !important;
    }

    .print-only-report {
        display: block !important;
        visibility: visible !important;
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        background: white !important;
        color: #1E293B !important;
        padding: 20px !important;
        font-family: 'Cairo', sans-serif !important;
    }
}
    margin-bottom: 16px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.btn-text {
    background: none;
    border: none;
    color: var(--primary-light);
    font-weight: 700;
    cursor: pointer;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    overflow-x: auto;
    display: block;
}

.data-table th, .data-table td {
    padding: 10px 12px;
    text-align: right;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
    white-space: nowrap;
}

.data-table th {
    background-color: var(--bg-light);
    font-weight: 800;
}

.status-pill {
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
}

.status-done { background: #DCFCE7; color: #15803D; }
.status-progress { background: #FEF08A; color: #854D0E; }
.status-notstarted { background: #F3F4F6; color: #4B5563; }

/* Attachments Grid */
.attachments-grid {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.attachment-thumb {
    width: 80px;
    height: 80px;
    border-radius: 10px;
    object-fit: cover;
    cursor: pointer;
    border: 1px solid var(--border-color);
    transition: transform 0.2s;
}

.attachment-thumb:hover {
    transform: scale(1.05);
}

/* Lightbox Modal */
.lightbox-card {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
}

.lightbox-card img {
    max-width: 100%;
    max-height: 85vh;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.btn-close-lightbox {
    position: absolute;
    top: -15px;
    right: -15px;
    background: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* Modal Dialog Styles Responsive for Mobile/Tablet/Desktop */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 12px;
}

.modal-card {
    background: var(--surface-white);
    padding: 20px;
    border-radius: 20px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0,0,0,0.25);
    color: var(--text-dark);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.modal-header h3 {
    font-size: 17px;
    font-weight: 800;
    color: var(--primary-color);
}

.btn-close {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: var(--text-muted);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 16px;
    border-top: 1px solid var(--border-color);
    padding-top: 12px;
}

.modal-footer .btn-primary {
    width: auto;
    padding: 8px 20px;
}

/* Mobile Responsive Media Queries */
@media (max-width: 768px) {
    .dashboard-container {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        padding: 12px 16px;
    }
    .sidebar-nav {
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 6px;
    }
    .nav-item {
        white-space: nowrap;
        padding: 8px 12px;
        font-size: 12px;
    }
    .main-content {
        padding: 16px;
    }
    .top-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .header-actions {
        width: 100%;
        justify-content: space-between;
    }
    .modal-card {
        padding: 16px;
        border-radius: 16px;
    }
}

/* Print Styles for PDF Generation */
@media print {
    .sidebar, .top-header .header-actions, .btn-primary, .btn-secondary, .btn-text, .modal-overlay, .pill-category-bar {
        display: none !important;
    }
    .main-content {
        padding: 0 !important;
    }
    .dashboard-container {
        display: block !important;
    }
    .card {
        box-shadow: none !important;
        border: 1px solid #ccc !important;
        page-break-inside: avoid;
    }
}
