/* ===== CSS Variables & Root Styles ===== */
:root {
    --primary-color: #1a5f7a;
    --primary-dark: #0d3c4d;
    --primary-light: #2196f3;
    --secondary-color: #c1a35f;
    --secondary-dark: #8b7355;
    --accent-color: #ff6b35;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --info-color: #17a2b8;
    --light-bg: #f8f9fa;
    --dark-bg: #1a1a2e;
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --card-shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --gradient-primary: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    --gradient-secondary: linear-gradient(135deg, var(--secondary-color) 0%, var(--secondary-dark) 100%);
    --gradient-accent: linear-gradient(135deg, var(--accent-color) 0%, #ff8f00 100%);
    --border-radius: 0.75rem;
    --transition-speed: 0.3s;
}

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

body {
    font-family: 'Cairo', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: var(--light-bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Arabic Font Support */
html[dir="rtl"] body {
    font-family: 'Cairo', 'Segoe UI', Tahoma, Arial, sans-serif;
}

/* ===== Focus States ===== */
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.2rem rgba(26, 95, 122, 0.25);
}

/* ===== Navbar Styles ===== */
.navbar {
    background: linear-gradient(135deg, #1a5f7a 0%, #0d3c4d 100%) !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    padding: 0.5rem 1rem;
    position: relative;
    z-index: 1030;
}

/* Brand */
.navbar-brand {
    font-weight: 600;
    font-size: 1rem;
    color: white !important;
    padding: 0.25rem 0;
}

.brand-icon-wrapper {
    width: 34px;
    height: 34px;
    background: linear-gradient(135deg, #ffc107 0%, #ff9800 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.brand-icon-wrapper i {
    font-size: 1.1rem;
    color: #1a1a2e;
}

.brand-text {
    color: white;
    font-weight: 600;
}

/* Hamburger Button */
.navbar-toggler.custom-toggler {
    width: 40px;
    height: 40px;
    padding: 0;
    border: none !important;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.navbar-toggler.custom-toggler:focus {
    box-shadow: none !important;
}

.navbar-toggler.custom-toggler .toggler-line {
    width: 20px;
    height: 2px;
    background: white;
    border-radius: 2px;
    transition: 0.2s;
}

.navbar-toggler.custom-toggler[aria-expanded="true"] .toggler-line:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}
.navbar-toggler.custom-toggler[aria-expanded="true"] .toggler-line:nth-child(2) {
    opacity: 0;
}
.navbar-toggler.custom-toggler[aria-expanded="true"] .toggler-line:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* Nav Links - Desktop */
.navbar .nav-link {
    color: rgba(255, 255, 255, 0.9) !important;
    font-weight: 500;
    padding: 0.5rem 0.6rem !important;
    font-size: 0.82rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    border-radius: 6px;
    transition: 0.2s;
}

.navbar .nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white !important;
}

.navbar .nav-link.active {
    background: rgba(255, 255, 255, 0.15);
    color: white !important;
}

/* Dropdown Menu - Desktop */
.navbar .dropdown-menu {
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
    border: none;
    padding: 0.5rem;
    z-index: 1050;
}

/* Ensure dropdowns appear above other page content */
.navbar .nav-item.dropdown {
    position: relative;
}

.navbar .dropdown-menu.show {
    z-index: 1050;
}

.navbar .dropdown-item {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    border-radius: 6px;
}

.navbar .dropdown-item:hover {
    background: var(--primary-color);
    color: white;
}

/* ========== MOBILE STYLES ========== */
@media (max-width: 991.98px) {
    .navbar {
        padding: 0.5rem 0.75rem;
    }

    /* Simple dropdown - NO sidebar */
    .navbar-collapse {
        position: static !important;
        width: 100% !important;
        height: auto !important;
        background: linear-gradient(180deg, #1a5f7a 0%, #0d3c4d 100%);
        border-radius: 10px;
        margin-top: 0.5rem;
        padding: 0.5rem;
        max-height: 75vh;
        overflow-y: auto;
        box-shadow: none !important;
        transform: none !important;
        left: auto !important;
        right: auto !important;
        top: auto !important;
    }

    .navbar-nav {
        width: 100%;
    }

    .navbar .nav-item {
        width: 100%;
    }

    .navbar .nav-link {
        padding: 0.7rem 0.85rem !important;
        font-size: 0.9rem;
        justify-content: flex-start;
        width: 100%;
    }

    .navbar .nav-link i {
        width: 1.5rem;
    }

    /* Mobile dropdowns */
    .navbar .dropdown-menu {
        position: static !important;
        float: none !important;
        width: 100% !important;
        background: rgba(255, 255, 255, 0.05);
        box-shadow: none;
        margin: 0.25rem 0;
        padding: 0.25rem 0.5rem;
    }

    .navbar .dropdown-item {
        color: rgba(255, 255, 255, 0.85);
        padding: 0.6rem 0.75rem;
    }

    .navbar .dropdown-item:hover {
        background: rgba(255, 255, 255, 0.1);
        color: white;
    }

    .navbar .dropdown-divider {
        border-color: rgba(255, 255, 255, 0.1);
    }

    /* Mobile login section */
    .navbar-collapse > .d-lg-none {
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        padding-top: 0.5rem;
        margin-top: 0.5rem;
    }
}

/* Desktop centering */
@media (min-width: 992px) {
    .navbar .navbar-nav.mx-auto {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
    }

    .navbar .container-fluid {
        position: relative;
    }
}

/* RTL Support */
html[dir="rtl"] .navbar-nav {
    flex-direction: row;
}

html[dir="rtl"] .dropdown-menu {
    text-align: right;
}

@media (max-width: 991.98px) {
    html[dir="rtl"] .navbar-nav {
        flex-direction: column;
    }
}

/* ===== Sidebar Styles ===== */
.sidebar {
    min-height: calc(100vh - 60px);
    background: white;
    box-shadow: var(--card-shadow);
    padding: 1rem 0;
}

.sidebar .nav-link {
    color: #333;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all var(--transition-speed) ease;
    border-left: 3px solid transparent;
}

.sidebar .nav-link:hover {
    background-color: rgba(26, 95, 122, 0.08);
    color: var(--primary-color);
    border-left-color: var(--primary-color);
}

.sidebar .nav-link.active {
    background-color: rgba(26, 95, 122, 0.12);
    color: var(--primary-color);
    border-left-color: var(--primary-color);
    font-weight: 600;
}

.sidebar .nav-link i {
    width: 1.5rem;
    text-align: center;
    font-size: 1.1rem;
}

.sidebar-header {
    padding: 0.5rem 1.5rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05rem;
    color: #888;
    margin-top: 1rem;
}

/* ===== Card Styles ===== */
.card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    transition: all var(--transition-speed) ease;
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--card-shadow-hover);
    transform: translateY(-2px);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    font-weight: 600;
    padding: 1rem 1.25rem;
}

/* ===== Stat Cards ===== */
.stat-card {
    position: relative;
    overflow: hidden;
    border-radius: var(--border-radius);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transform: translate(30%, -30%);
}

.stat-card .stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: rgba(255, 255, 255, 0.2);
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.stat-card .stat-label {
    font-size: 0.875rem;
    opacity: 0.9;
}

.stat-card.primary {
    background: var(--gradient-primary);
    color: white;
}

.stat-card.secondary {
    background: var(--gradient-secondary);
    color: white;
}

.stat-card.success {
    background: linear-gradient(135deg, var(--success-color) 0%, #1e7e34 100%);
    color: white;
}

.stat-card.warning {
    background: linear-gradient(135deg, var(--warning-color) 0%, #e0a800 100%);
    color: #333;
}

.stat-card.danger {
    background: linear-gradient(135deg, var(--danger-color) 0%, #bd2130 100%);
    color: white;
}

.stat-card.info {
    background: linear-gradient(135deg, var(--info-color) 0%, #117a8b 100%);
    color: white;
}

.stat-card.accent {
    background: var(--gradient-accent);
    color: white;
}

.stat-card.purple {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
}

.stat-card.light {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    color: #333;
}

/* ===== Button Styles ===== */
.btn {
    border-radius: 0.5rem;
    font-weight: 500;
    padding: 0.5rem 1.25rem;
    transition: all var(--transition-speed) ease;
}

.btn-primary {
    background: var(--gradient-primary);
    border: none;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(26, 95, 122, 0.4);
}

.btn-secondary {
    background: var(--gradient-secondary);
    border: none;
    color: white;
}

.btn-secondary:hover {
    background: var(--secondary-dark);
    color: white;
}

.btn-accent {
    background: var(--gradient-accent);
    border: none;
    color: white;
}

.btn-accent:hover {
    background: #e65a2d;
    color: white;
}

.btn-outline-primary {
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline-primary:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

/* ===== Form Styles ===== */
.form-control, .form-select {
    border-radius: 0.5rem;
    border: 1px solid #dee2e6;
    padding: 0.625rem 1rem;
    transition: all var(--transition-speed) ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(26, 95, 122, 0.15);
}

.form-label {
    font-weight: 500;
    color: #495057;
    margin-bottom: 0.5rem;
}

.form-floating > .form-control-plaintext::placeholder,
.form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder,
.form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* ===== Table Styles ===== */
.table {
    margin-bottom: 0;
}

.table thead th {
    background-color: var(--light-bg);
    border-bottom: 2px solid var(--primary-color);
    font-weight: 600;
    color: var(--primary-dark);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    padding: 1rem;
}

.table tbody tr {
    transition: background-color var(--transition-speed) ease;
}

.table tbody tr:hover {
    background-color: rgba(26, 95, 122, 0.04);
}

.table td {
    vertical-align: middle;
    padding: 1rem;
}

/* ===== Badge Styles ===== */
.badge {
    font-weight: 500;
    padding: 0.5em 0.85em;
    border-radius: 0.375rem;
}

.badge-status {
    font-size: 0.75rem;
    padding: 0.35em 0.65em;
}

/* ===== Status Colors ===== */
.status-pending { background-color: #ffc107; color: #333; }
.status-approved { background-color: #28a745; color: white; }
.status-rejected { background-color: #dc3545; color: white; }
.status-review { background-color: #17a2b8; color: white; }
.status-scheduled { background-color: #6c757d; color: white; }
.status-inprogress { background-color: #007bff; color: white; }
.status-completed { background-color: #28a745; color: white; }
.status-cancelled { background-color: #dc3545; color: white; }

/* ===== Hero Section ===== */
.hero-section {
    background: var(--gradient-primary);
    color: white;
    padding: 4rem 0;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 60%;
    height: 200%;
    background: rgba(255, 255, 255, 0.05);
    transform: rotate(15deg);
}

.hero-section h1 {
    font-weight: 700;
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.hero-section p {
    font-size: 1.1rem;
    opacity: 0.9;
    max-width: 600px;
}

/* ===== Page Header ===== */
.page-header {
    background: white;
    padding: 1.5rem 0;
    margin-bottom: 2rem;
    box-shadow: var(--card-shadow);
    position: relative;
    z-index: 1;
}

.page-title {
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 0.25rem;
}

.page-subtitle {
    color: #6c757d;
    font-size: 0.9rem;
}

.breadcrumb {
    background: transparent;
    padding: 0;
    margin-bottom: 0;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: "›";
    font-weight: bold;
    color: #6c757d;
}

/* ===== Feature Cards ===== */
.feature-card {
    text-align: center;
    padding: 2rem;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    transition: all var(--transition-speed) ease;
    height: 100%;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--card-shadow-hover);
}

.feature-card .icon-wrapper {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
}

.feature-card .icon-wrapper.primary {
    background: rgba(26, 95, 122, 0.1);
    color: var(--primary-color);
}

.feature-card .icon-wrapper.secondary {
    background: rgba(193, 163, 95, 0.1);
    color: var(--secondary-color);
}

.feature-card .icon-wrapper.accent {
    background: rgba(255, 107, 53, 0.1);
    color: var(--accent-color);
}

.feature-card h5 {
    font-weight: 600;
    color: var(--primary-dark);
    margin-bottom: 0.75rem;
}

.feature-card p {
    color: #6c757d;
    font-size: 0.9rem;
    margin-bottom: 0;
}

/* ===== Timeline ===== */
.timeline {
    position: relative;
    padding-left: 30px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, var(--primary-color), var(--secondary-color));
}

.timeline-item {
    position: relative;
    padding-bottom: 1.5rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -34px;
    top: 0;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary-color);
    border: 2px solid white;
    box-shadow: 0 0 0 3px rgba(26, 95, 122, 0.2);
}

.timeline-item.completed::before {
    background: var(--success-color);
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.2);
}

/* ===== Avatar ===== */
.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.avatar-sm { width: 32px; height: 32px; }
.avatar-lg { width: 60px; height: 60px; }
.avatar-xl { width: 100px; height: 100px; }

.avatar-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-primary);
    color: white;
    font-weight: 600;
}

/* ===== Progress Bars ===== */
.progress {
    height: 0.75rem;
    border-radius: 1rem;
    background-color: #e9ecef;
}

.progress-bar {
    border-radius: 1rem;
    background: var(--gradient-primary);
}

/* ===== Alerts ===== */
.alert {
    border: none;
    border-radius: var(--border-radius);
    border-left: 4px solid;
}

.alert-success { border-left-color: var(--success-color); background-color: rgba(40, 167, 69, 0.1); }
.alert-warning { border-left-color: var(--warning-color); background-color: rgba(255, 193, 7, 0.1); }
.alert-danger { border-left-color: var(--danger-color); background-color: rgba(220, 53, 69, 0.1); }
.alert-info { border-left-color: var(--info-color); background-color: rgba(23, 162, 184, 0.1); }

/* ===== Footer ===== */
footer {
    margin-top: auto;
    background: var(--dark-bg);
    color: rgba(255, 255, 255, 0.8);
    padding: 1.5rem 0;
}

footer a {
    color: var(--secondary-color);
    text-decoration: none;
}

footer a:hover {
    color: white;
}

/* ===== Animations ===== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-30px); }
    to { opacity: 1; transform: translateX(0); }
}

.animate-fade-in {
    animation: fadeIn 0.5s ease forwards;
}

.animate-pulse {
    animation: pulse 2s infinite;
}

.animate-slide-in {
    animation: slideInLeft 0.5s ease forwards;
}

/* Animation delays */
.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }

/* ===== Responsive Utilities ===== */
@media (max-width: 768px) {
    .hero-section {
        padding: 2rem 0;
    }

    .hero-section h1 {
        font-size: 1.75rem;
    }

    .stat-card .stat-value {
        font-size: 1.5rem;
    }

    .sidebar {
        min-height: auto;
    }
}

/* ===== Loading Spinner ===== */
.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.spinner-border-lg {
    width: 3rem;
    height: 3rem;
}

/* ===== Document Upload Area ===== */
.upload-area {
    border: 2px dashed #dee2e6;
    border-radius: var(--border-radius);
    padding: 2rem;
    text-align: center;
    transition: all var(--transition-speed) ease;
    cursor: pointer;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--primary-color);
    background-color: rgba(26, 95, 122, 0.05);
}

.upload-area i {
    font-size: 3rem;
    color: #6c757d;
    margin-bottom: 1rem;
}

/* ===== WhatsApp Badge ===== */
.whatsapp-badge {
    background-color: #25D366;
    color: white;
}

.whatsapp-icon {
    color: #25D366;
}

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: #6c757d;
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h5 {
    color: #495057;
    margin-bottom: 0.5rem;
}

/* ===== Social Login Buttons ===== */
.btn-google {
    background-color: #fff;
    color: #757575;
    border: 1px solid #ddd;
    transition: all var(--transition-speed);
}

.btn-google:hover {
    background-color: #f8f8f8;
    border-color: #4285F4;
    color: #4285F4;
}

.btn-google i {
    color: #4285F4;
}

.btn-facebook {
    background-color: #1877F2;
    color: #fff;
    border: none;
    transition: all var(--transition-speed);
}

.btn-facebook:hover {
    background-color: #0d65d9;
    color: #fff;
}

.external-login-section .btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
}

.external-login-section .btn i {
    font-size: 1.25rem;
}

/* ===== Privacy & Legal Pages ===== */
.timeline {
    position: relative;
    padding-left: 30px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #dee2e6;
}

[dir="rtl"] .timeline {
    padding-left: 0;
    padding-right: 30px;
}

[dir="rtl"] .timeline::before {
    left: auto;
    right: 7px;
}

.timeline-item {
    position: relative;
    padding-bottom: 20px;
}

.timeline-item i {
    position: absolute;
    left: -26px;
    font-size: 0.8rem;
}

[dir="rtl"] .timeline-item i {
    left: auto;
    right: -26px;
}

