/* =============================================
   Asra Aid System - نظام مساعدات عوائل الأسرى
   Main Stylesheet
   ============================================= */

/* ===== أساسيات ===== */
:root {
    --primary: #1a73e8;
    --primary-dark: #1557b0;
    --primary-light: #e8f0fe;
    --success: #0d9488;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;
    --dark: #1e293b;
    --light: #f8fafc;
    --gray: #64748b;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
    --radius: 12px;
    --radius-sm: 8px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Cairo', sans-serif;
    background: #f0f2f5;
    color: var(--dark);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== شريط التنقل ===== */
.navbar {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%) !important;
    padding: 0.6rem 1rem;
    position: sticky;
    top: 0;
    z-index: 1030;
}

.navbar-brand {
    font-size: 1.2rem;
    letter-spacing: 0.5px;
}

.navbar .nav-link {
    padding: 0.7rem 1rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    font-weight: 500;
    margin: 0 2px;
}

.navbar .nav-link:hover,
.navbar .nav-link.active {
    background: rgba(255,255,255,0.15);
}

/* ===== المحتوى الرئيسي ===== */
.main-content {
    flex: 1;
    padding-top: 0;
}

.container-fluid {
    max-width: 1400px;
}

/* ===== رأس الصفحة ===== */
.page-header h2 {
    font-weight: 700;
    color: var(--dark);
    font-size: 1.6rem;
}

.page-header p {
    font-size: 0.9rem;
}

/* ===== البطاقات الإحصائية ===== */
.stat-card {
    border-radius: var(--radius);
    border: none;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    background: white;
    box-shadow: var(--shadow);
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.stat-card-body {
    display: flex;
    align-items: center;
    padding: 1.5rem;
    gap: 1rem;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.stat-card-primary .stat-icon { background: var(--primary-light); color: var(--primary); }
.stat-card-success .stat-icon { background: #d1fae5; color: var(--success); }
.stat-card-warning .stat-icon { background: #fef3c7; color: var(--warning); }
.stat-card-info .stat-icon { background: #cffafe; color: var(--info); }

.stat-info h3 {
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 0.3rem;
    color: var(--dark);
}

.stat-info p {
    font-size: 0.85rem;
    color: var(--gray);
    margin-bottom: 0;
}

.stat-card-footer {
    padding: 0.7rem 1.5rem;
    background: var(--light);
    border-top: 1px solid var(--border);
    font-size: 0.8rem;
}

/* ===== البطاقات العامة ===== */
.card {
    border-radius: var(--radius);
    border: none;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-header {
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.5rem;
    font-weight: 600;
}

.card-body {
    padding: 1.5rem;
}

/* ===== الجداول ===== */
.table {
    margin-bottom: 0;
}

.table thead th {
    font-weight: 600;
    font-size: 0.85rem;
    padding: 0.9rem 1rem;
    border: none;
    white-space: nowrap;
}

.table tbody td {
    padding: 0.8rem 1rem;
    vertical-align: middle;
    font-size: 0.9rem;
}

.table-hover tbody tr:hover {
    background: var(--primary-light);
}

.table-dark {
    background: var(--dark);
}

/* ===== النماذج ===== */
.form-control, .form-select {
    border-radius: var(--radius-sm);
    border: 2px solid var(--border);
    padding: 0.6rem 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    font-size: 0.95rem;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,115,232,0.1);
}

.form-control-lg, .form-select-lg {
    padding: 0.75rem 1.2rem;
    font-size: 1rem;
}

.form-label {
    font-size: 0.9rem;
    margin-bottom: 0.4rem;
    color: var(--dark);
}

/* ===== الأزرار ===== */
.btn {
    border-radius: var(--radius-sm);
    font-weight: 600;
    padding: 0.5rem 1.2rem;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.btn-lg {
    padding: 0.7rem 1.5rem;
    font-size: 1rem;
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-success {
    background: var(--success);
    border-color: var(--success);
}

.btn-success:hover {
    background: #0f766e;
    transform: translateY(-1px);
}

/* ===== Wizard (مراحل التسجيل) ===== */
.wizard-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.wizard-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    position: relative;
}

.step-number {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    background: #e2e8f0;
    color: var(--gray);
    transition: all 0.3s ease;
}

.wizard-step.active .step-number {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(26,115,232,0.3);
}

.wizard-step.completed .step-number {
    background: var(--success);
    color: white;
}

.step-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray);
}

.wizard-step.active .step-label {
    color: var(--primary);
}

.wizard-step.completed .step-label {
    color: var(--success);
}

.wizard-connector {
    width: 80px;
    height: 3px;
    background: #e2e8f0;
    margin: 0 1rem;
    margin-bottom: 1.5rem;
    border-radius: 2px;
    transition: background 0.3s ease;
}

.wizard-connector.active {
    background: var(--success);
}

/* ===== صفحة تسجيل الدخول ===== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f2f5;
    padding: 0;
}

.login-page .login-container {
    display: flex;
    width: 100%;
    max-width: 950px;
    min-height: 580px;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 25px 80px rgba(0,0,0,0.15);
    margin: 2rem;
}

.login-side {
    flex: 1;
    background: linear-gradient(135deg, #1a73e8 0%, #0d47a1 60%, #1557b0 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 2.5rem;
    position: relative;
    overflow: hidden;
}

.login-side::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%);
    border-radius: 50%;
}

.login-side::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -30%;
    width: 80%;
    height: 80%;
    background: radial-gradient(circle, rgba(255,255,255,0.05) 0%, transparent 70%);
    border-radius: 50%;
}

.login-side-content {
    position: relative;
    z-index: 1;
    text-align: center;
}

.login-side-icon {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    margin: 0 auto 1.5rem;
    border: 2px solid rgba(255,255,255,0.2);
}

.login-side-content h2 {
    font-size: 1.6rem;
    font-weight: 800;
    margin-bottom: 0.8rem;
}

.login-side-content p {
    font-size: 0.95rem;
    opacity: 0.85;
    margin-bottom: 2rem;
    line-height: 1.7;
}

.login-side-features {
    text-align: right;
}

.login-feature {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    font-size: 0.9rem;
    opacity: 0.9;
}

.login-feature i {
    color: #81d4fa;
    font-size: 0.85rem;
}

.login-form-side {
    flex: 1;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem;
}

.login-card {
    width: 100%;
    max-width: 380px;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    width: 70px;
    height: 70px;
    object-fit: contain;
    margin-bottom: 1rem;
    border-radius: 14px;
}

.login-icon {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: linear-gradient(135deg, #1a73e8, #4285f4);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    margin: 0 auto 1rem;
    box-shadow: 0 8px 25px rgba(26,115,232,0.25);
}

.login-header h1 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--dark);
    margin-bottom: 0.3rem;
}

.login-header p {
    color: var(--gray);
    font-size: 0.85rem;
}

.alert-login {
    font-size: 0.85rem;
    border-radius: 10px;
    padding: 0.7rem 1rem;
}

.login-btn {
    border-radius: 12px;
    padding: 0.75rem;
    font-size: 1.05rem;
    font-weight: 700;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(26,115,232,0.3);
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(26,115,232,0.4);
}

.login-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

@media (max-width: 768px) {
    .login-page .login-container {
        flex-direction: column;
        margin: 0;
        min-height: 100vh;
        border-radius: 0;
    }
    .login-side {
        padding: 2rem 1.5rem;
        min-height: auto;
    }
    .login-side-features {
        display: none;
    }
    .login-side-content p {
        margin-bottom: 0;
    }
    .login-form-side {
        padding: 2rem 1.5rem;
    }
}

/* Dark mode login */
[data-bs-theme="dark"] .login-page {
    background: #1a1a2e;
}
[data-bs-theme="dark"] .login-form-side {
    background: #16213e;
}
[data-bs-theme="dark"] .login-card {
    background: transparent;
}
[data-bs-theme="dark"] .login-header h1 {
    color: #e0e0e0;
}
[data-bs-theme="dark"] .login-footer {
    border-color: rgba(255,255,255,0.1);
}

/* ===== Badges ===== */
.badge {
    font-weight: 600;
    font-size: 0.78rem;
    padding: 0.35em 0.7em;
    border-radius: 6px;
}

/* ===== التنبيهات ===== */
.alert {
    border-radius: var(--radius-sm);
    border: none;
    font-weight: 500;
}

/* ===== صفوف أفراد العائلة ===== */
.family-member-row,
.attachment-row {
    transition: all 0.2s ease;
}

.family-member-row:hover,
.attachment-row:hover {
    border-color: var(--primary) !important;
}

/* ===== الفوتر ===== */
.footer {
    font-size: 0.85rem;
    margin-top: auto;
}

/* ===== Dropdown ===== */
.dropdown-menu {
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    padding: 0.5rem;
}

.dropdown-item {
    border-radius: 6px;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.dropdown-item:hover {
    background: var(--primary-light);
}

/* ===== كود ===== */
code {
    background: #f1f5f9;
    color: var(--primary-dark);
    padding: 0.15em 0.5em;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: 600;
}

/* ===== التصميم المتجاوب ===== */
@media (max-width: 768px) {
    .wizard-steps {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .wizard-connector {
        width: 3px;
        height: 30px;
        margin: 0;
    }

    .stat-card-body {
        padding: 1rem;
    }

    .stat-info h3 {
        font-size: 1.4rem;
    }

    .page-header h2 {
        font-size: 1.3rem;
    }

    .navbar .nav-link {
        padding: 0.5rem;
    }
}

/* ===== الرسوم المتحركة ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card, .stat-card {
    animation: fadeInUp 0.4s ease;
}

/* ===== تلميحات الأدوات ===== */
[title] {
    cursor: pointer;
}

/* ===== List Group ===== */
.list-group-item {
    border: none;
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.5rem;
}

.list-group-item:last-child {
    border-bottom: none;
}

/* ===== Form Check Switch ===== */
.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

/* ===== Print Styles ===== */
@media print {
    .navbar, .footer, .btn, .page-header .btn {
        display: none !important;
    }
    
    .card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* ===== Selection ===== */
::selection {
    background: var(--primary);
    color: white;
}

/* ===== Pagination ===== */
.page-item.active .page-link {
    background-color: var(--primary);
    border-color: var(--primary);
}

.page-link {
    border-radius: var(--radius-sm) !important;
    margin: 0 2px;
    color: var(--primary);
}

/* =============================================
   الصفحات العامة - Public Pages
   ============================================= */

/* ===== Public Body ===== */
.public-body {
    background: linear-gradient(135deg, #f0f4ff 0%, #e8f0fe 50%, #f0fdf4 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== Public Navbar ===== */
.public-navbar {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%) !important;
    box-shadow: var(--shadow-lg);
    padding: 0.8rem 0;
}

.public-navbar .navbar-brand {
    font-weight: 800;
    font-size: 1.4rem;
    letter-spacing: -0.5px;
}

.brand-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    background: rgba(255,255,255,0.2);
    border-radius: 10px;
    margin-left: 10px;
    font-size: 1.2rem;
}

.public-navbar .nav-link {
    color: rgba(255,255,255,0.85) !important;
    font-weight: 600;
    padding: 0.5rem 1rem !important;
    border-radius: var(--radius-sm);
    transition: all 0.3s;
}

.public-navbar .nav-link:hover,
.public-navbar .nav-link.active {
    color: #fff !important;
    background: rgba(255,255,255,0.15);
}

/* ===== Public Main Content ===== */
.public-main {
    flex: 1;
    padding: 2rem 0;
}

/* ===== Public Hero Section ===== */
.public-hero {
    background: linear-gradient(135deg, var(--primary) 0%, #2563eb 100%);
    border-radius: var(--radius);
    padding: 3rem 2rem;
    color: white;
    position: relative;
    overflow: hidden;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-lg);
}

.public-hero::before {
    content: '';
    position: absolute;
    top: -30%;
    left: -10%;
    width: 300px;
    height: 300px;
    background: rgba(255,255,255,0.05);
    border-radius: 50%;
}

.public-hero::after {
    content: '';
    position: absolute;
    bottom: -40%;
    right: -5%;
    width: 400px;
    height: 400px;
    background: rgba(255,255,255,0.03);
    border-radius: 50%;
}

.public-hero h1 {
    font-weight: 800;
    font-size: 2.2rem;
    position: relative;
    z-index: 1;
}

.public-hero p {
    font-size: 1.15rem;
    opacity: 0.9;
    position: relative;
    z-index: 1;
}

/* ===== Step Info Cards ===== */
.step-info-card {
    background: white;
    border-radius: var(--radius);
    padding: 2rem 1.5rem;
    text-align: center;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: all 0.3s ease;
    height: 100%;
}

.step-info-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.step-info-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
}

.step-info-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    display: block;
}

/* ===== Public Footer ===== */
.public-footer {
    background: var(--dark);
    color: rgba(255,255,255,0.7);
    padding: 1.5rem 0;
    margin-top: auto;
    font-size: 0.9rem;
}

.public-footer a {
    color: rgba(255,255,255,0.85);
    text-decoration: none;
}

.public-footer a:hover {
    color: white;
}

/* ===== Registration Card Enhancement ===== */
.public-body .card-header {
    border-radius: var(--radius) var(--radius) 0 0 !important;
}

.public-body .form-control:focus,
.public-body .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(26, 115, 232, 0.15);
}

/* ===== Tracking Result ===== */
.font-monospace {
    letter-spacing: 2px;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .public-hero {
        padding: 2rem 1.5rem;
    }
    .public-hero h1 {
        font-size: 1.6rem;
    }
    .step-info-card {
        padding: 1.5rem 1rem;
    }
}

/* =============================================
   Dark Mode v2.0
   ============================================= */
[data-bs-theme="dark"] {
    --primary: #4da3ff;
    --primary-dark: #1a73e8;
    --primary-light: #1e3a5f;
    --dark: #e2e8f0;
    --light: #1a1d23;
    --border: #2d3748;
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.4);
}

[data-bs-theme="dark"] body {
    background: #121318;
    color: #e2e8f0;
}

[data-bs-theme="dark"] .navbar {
    background: linear-gradient(135deg, #1e3a5f 0%, #0d1b2a 100%) !important;
}

[data-bs-theme="dark"] .stat-card,
[data-bs-theme="dark"] .card {
    background: #1a1d23;
    border-color: #2d3748;
}

[data-bs-theme="dark"] .card-header.bg-white {
    background: #1e2128 !important;
    color: #e2e8f0;
}

[data-bs-theme="dark"] .table {
    color: #e2e8f0;
}

[data-bs-theme="dark"] .table-light {
    background-color: #1e2128;
    color: #e2e8f0;
}

[data-bs-theme="dark"] .text-muted {
    color: #8899aa !important;
}

[data-bs-theme="dark"] .bg-light {
    background: #1a1d23 !important;
}

[data-bs-theme="dark"] .stat-card-footer {
    background: rgba(255,255,255,0.03);
    border-top-color: #2d3748;
}

[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select {
    background: #1e2128;
    border-color: #2d3748;
    color: #e2e8f0;
}

[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-select:focus {
    background: #232830;
    border-color: #4da3ff;
    color: #e2e8f0;
}

[data-bs-theme="dark"] .alert-warning {
    background: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.3);
    color: #fbbf24;
}

[data-bs-theme="dark"] .alert-success {
    background: rgba(13, 148, 136, 0.15);
    border-color: rgba(13, 148, 136, 0.3);
    color: #2dd4bf;
}

[data-bs-theme="dark"] .alert-danger {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

[data-bs-theme="dark"] .dropdown-menu {
    background: #1e2128;
    border-color: #2d3748;
}

[data-bs-theme="dark"] .dropdown-item {
    color: #e2e8f0;
}

[data-bs-theme="dark"] .dropdown-item:hover {
    background: #2d3748;
}

[data-bs-theme="dark"] .list-group-item {
    background: #1a1d23;
    border-color: #2d3748;
    color: #e2e8f0;
}

[data-bs-theme="dark"] .footer {
    background: #0d1117 !important;
    border-color: #2d3748 !important;
}

[data-bs-theme="dark"] .page-header h2 {
    color: #e2e8f0;
}

[data-bs-theme="dark"] .modal-content {
    background: #1a1d23;
    border-color: #2d3748;
}

[data-bs-theme="dark"] .public-body {
    background: #121318;
}

[data-bs-theme="dark"] .public-navbar {
    background: linear-gradient(135deg, #1e3a5f 0%, #0d1b2a 100%) !important;
}

[data-bs-theme="dark"] .public-footer {
    background: #0d1117;
}

/* ===== Search Input in Navbar ===== */
#globalSearch::placeholder {
    color: rgba(255,255,255,0.5);
}

/* ===== Priority Badge ===== */
.priority-high { background: #ef4444; }
.priority-medium { background: #f59e0b; }
.priority-low { background: #64748b; }

/* ===== Progress Bar Enhancement ===== */
.progress {
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar {
    transition: width 0.6s ease;
}

/* ===== Chart Cards ===== */
canvas {
    max-height: 300px;
}

/* =============================================
   Autocomplete Search
   ============================================= */
.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    z-index: 1050;
    max-height: 420px;
    overflow-y: auto;
    margin-top: 2px;
    min-width: 380px;
}

.autocomplete-item {
    display: flex;
    align-items: center;
    padding: 0.6rem 1rem;
    text-decoration: none;
    color: var(--dark);
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
    gap: 0.75rem;
}

.autocomplete-item:hover,
.autocomplete-item.active {
    background: var(--primary-light);
    color: var(--dark);
}

.autocomplete-item .ac-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.85rem;
}

.autocomplete-item .ac-info {
    flex: 1;
    min-width: 0;
}

.autocomplete-item .ac-title {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.autocomplete-item .ac-subtitle {
    font-size: 0.75rem;
    color: var(--gray);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.autocomplete-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    background: var(--light);
    border-top: 1px solid var(--border);
    font-size: 0.8rem;
}

.autocomplete-loading {
    text-align: center;
    padding: 1.5rem;
    color: var(--gray);
}

.autocomplete-empty {
    text-align: center;
    padding: 1.5rem;
    color: var(--gray);
    font-size: 0.9rem;
}

.autocomplete-category {
    padding: 0.35rem 1rem;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--gray);
    background: var(--light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

[data-bs-theme="dark"] .autocomplete-dropdown {
    background: #1e2128;
    border-color: #2d3748;
}

[data-bs-theme="dark"] .autocomplete-item {
    color: #e2e8f0;
    border-bottom-color: #2d3748;
}

[data-bs-theme="dark"] .autocomplete-item:hover,
[data-bs-theme="dark"] .autocomplete-item.active {
    background: #2d3748;
}

[data-bs-theme="dark"] .autocomplete-footer {
    background: #1a1d23;
    border-top-color: #2d3748;
}

[data-bs-theme="dark"] .autocomplete-category {
    background: #1a1d23;
}

/* =============================================
   Notification Badge
   ============================================= */
.notification-badge {
    font-size: 0.6rem;
    padding: 0.25em 0.5em;
    animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.1); }
}

/* =============================================
   Progress Tracker (Public)
   ============================================= */
.progress-tracker {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 2rem 0;
    position: relative;
}

.progress-tracker::before {
    content: '';
    position: absolute;
    top: 22px;
    left: 15%;
    right: 15%;
    height: 3px;
    background: #e2e8f0;
    z-index: 0;
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 1;
    flex: 1;
}

.progress-step-icon {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    background: #e2e8f0;
    color: var(--gray);
    margin-bottom: 0.5rem;
    transition: all 0.3s;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.progress-step.active .progress-step-icon {
    background: var(--warning);
    color: white;
    animation: pulse-step 2s infinite;
}

.progress-step.completed .progress-step-icon {
    background: var(--success);
    color: white;
}

.progress-step.rejected .progress-step-icon {
    background: var(--danger);
    color: white;
}

@keyframes pulse-step {
    0%, 100% { box-shadow: 0 0 0 0 rgba(245,158,11,0.4); }
    50% { box-shadow: 0 0 0 10px rgba(245,158,11,0); }
}

.progress-step-label {
    font-size: 0.78rem;
    font-weight: 600;
    text-align: center;
    color: var(--gray);
}

.progress-step.active .progress-step-label,
.progress-step.completed .progress-step-label {
    color: var(--dark);
}

/* =============================================
   Print Mode Enhanced
   ============================================= */
@media print {
    .navbar, .footer, .public-navbar, .public-footer,
    .btn, .page-header .btn, .no-print,
    .autocomplete-dropdown, #searchWrapper,
    .notification-badge, .form-check,
    .pagination, .alert-dismissible .btn-close {
        display: none !important;
    }
    
    body {
        background: white !important;
        font-size: 12pt;
        color: black !important;
    }
    
    .card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
        break-inside: avoid;
    }

    .card-header {
        background: #f5f5f5 !important;
        color: black !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    .stat-card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
    
    .table {
        font-size: 10pt;
    }
    
    .main-content {
        padding: 0 !important;
    }
    
    .container-fluid {
        max-width: 100% !important;
        padding: 0 !important;
    }
    
    .badge {
        border: 1px solid #999 !important;
        color: black !important;
        background: transparent !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    a {
        text-decoration: none !important;
        color: black !important;
    }
    
    .print-header {
        display: block !important;
        text-align: center;
        margin-bottom: 1rem;
        padding-bottom: 0.5rem;
        border-bottom: 2px solid black;
    }
    
    .print-header h2 {
        font-size: 16pt;
        margin: 0;
    }
    
    .print-header p {
        font-size: 10pt;
        margin: 0;
    }
    
    @page {
        margin: 1.5cm;
        size: A4;
    }
}

.print-header {
    display: none;
}

/* =============================================
   Reports Page
   ============================================= */
.report-card {
    transition: all 0.3s;
    cursor: pointer;
}

.report-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.report-metric {
    font-size: 2.2rem;
    font-weight: 800;
    line-height: 1.1;
}

.report-change {
    font-size: 0.8rem;
    font-weight: 600;
}

.report-change.up { color: var(--success); }
.report-change.down { color: var(--danger); }

/* =============================================
   Aid History Timeline
   ============================================= */
.aid-timeline {
    position: relative;
    padding-right: 2rem;
}

.aid-timeline::before {
    content: '';
    position: absolute;
    right: 8px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border);
}

.aid-timeline-item {
    position: relative;
    padding-bottom: 1.5rem;
    padding-right: 1.5rem;
}

.aid-timeline-item::before {
    content: '';
    position: absolute;
    right: -2rem;
    top: 6px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid white;
    box-shadow: 0 0 0 2px var(--primary);
    z-index: 1;
}

.aid-timeline-item.delivered::before { background: var(--success); box-shadow: 0 0 0 2px var(--success); }
.aid-timeline-item.pending::before { background: var(--warning); box-shadow: 0 0 0 2px var(--warning); }
.aid-timeline-item.rejected::before { background: var(--danger); box-shadow: 0 0 0 2px var(--danger); }
.aid-timeline-item.approved::before { background: var(--info); box-shadow: 0 0 0 2px var(--info); }

/* =============================================
   Performance Comparison
   ============================================= */
.kpi-card {
    transition: all 0.3s;
    border-radius: var(--radius);
}
.kpi-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

/* =============================================
   Saved Filters
   ============================================= */
.saved-filter-badge {
    cursor: pointer;
    transition: all 0.2s;
}
.saved-filter-badge:hover {
    transform: scale(1.05);
}

/* =============================================
   Priority Indicator
   ============================================= */
.priority-high { border-right: 4px solid var(--danger) !important; }
.priority-medium { border-right: 4px solid var(--warning) !important; }
.priority-low { border-right: 4px solid var(--success) !important; }

/* =============================================
   Offline Banner
   ============================================= */
#offlineBanner {
    animation: slideUp 0.3s ease-out;
}
@keyframes slideUp {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* =============================================
   Responsive Improvements
   ============================================= */
@media (max-width: 768px) {
    .progress-tracker {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    .progress-step {
        flex: 0 0 23%;
    }
    .progress-step-label {
        font-size: 0.65rem;
    }
    .progress-step-icon {
        width: 35px;
        height: 35px;
        font-size: 0.8rem;
    }
    .page-header {
        flex-direction: column;
        text-align: center;
    }
    .page-header .d-flex {
        justify-content: center;
    }
}

/* =============================================
   Top Loading Bar
   ============================================= */
.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
}

.page-loader.active {
    opacity: 1;
}

.page-loader-bar {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #4da3ff, #06b6d4, #0d9488, #4da3ff);
    background-size: 300% 100%;
    border-radius: 0 2px 2px 0;
    animation: loader-grow 1.8s ease-in-out forwards, loader-shimmer 1.5s linear infinite;
    box-shadow: 0 0 10px rgba(77, 163, 255, 0.5);
}

@keyframes loader-grow {
    0%   { width: 0; }
    20%  { width: 35%; }
    50%  { width: 65%; }
    80%  { width: 88%; }
    100% { width: 95%; }
}

@keyframes loader-shimmer {
    0%   { background-position: 0% 50%; }
    100% { background-position: 300% 50%; }
}

.page-loader.done .page-loader-bar {
    width: 100% !important;
    animation: loader-finish 0.3s ease forwards;
}

@keyframes loader-finish {
    0%   { width: 95%; opacity: 1; }
    100% { width: 100%; opacity: 0; }
}

/* =============================================
   Toast Notifications
   ============================================= */
.toast-container {
    position: fixed;
    top: 80px;
    left: 20px;
    z-index: 9998;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 420px;
    width: calc(100% - 40px);
    pointer-events: none;
}

.toast-notification {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    background: white;
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
    border-right: 4px solid;
    animation: toast-in 0.4s cubic-bezier(0.22, 1, 0.36, 1);
    pointer-events: auto;
    position: relative;
    overflow: hidden;
}

.toast-notification.toast-out {
    animation: toast-out 0.3s ease forwards;
}

.toast-notification.toast-success { border-right-color: var(--success); }
.toast-notification.toast-danger  { border-right-color: var(--danger); }
.toast-notification.toast-warning { border-right-color: var(--warning); }
.toast-notification.toast-info    { border-right-color: var(--info); }

.toast-notification .toast-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.95rem;
}

.toast-success .toast-icon { background: #d1fae5; color: var(--success); }
.toast-danger  .toast-icon { background: #fee2e2; color: var(--danger); }
.toast-warning .toast-icon { background: #fef3c7; color: var(--warning); }
.toast-info    .toast-icon { background: #cffafe; color: var(--info); }

.toast-notification .toast-body {
    flex: 1;
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--dark);
    line-height: 1.5;
}

.toast-notification .toast-close {
    background: none;
    border: none;
    color: var(--gray);
    font-size: 1rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.toast-notification .toast-close:hover { opacity: 1; }

.toast-notification .toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    border-radius: 0 0 0 var(--radius-sm);
}

.toast-success .toast-progress { background: var(--success); }
.toast-danger  .toast-progress { background: var(--danger); }
.toast-warning .toast-progress { background: var(--warning); }
.toast-info    .toast-progress { background: var(--info); }

@keyframes toast-in {
    0%   { transform: translateX(-30px); opacity: 0; }
    100% { transform: translateX(0); opacity: 1; }
}

@keyframes toast-out {
    0%   { transform: translateX(0); opacity: 1; max-height: 120px; margin-bottom: 0; }
    100% { transform: translateX(-40px); opacity: 0; max-height: 0; margin-bottom: -10px; }
}

@keyframes toast-progress {
    0%   { width: 100%; }
    100% { width: 0%; }
}

/* =============================================
   Back to Top Button
   ============================================= */
.back-to-top {
    position: fixed;
    bottom: 30px;
    left: 30px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(26, 115, 232, 0.35);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    background: var(--primary-dark);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(26, 115, 232, 0.45);
}

/* =============================================
   Empty States
   ============================================= */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
}

.empty-state-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin: 0 auto 1.2rem;
    opacity: 0.7;
}

.empty-state-icon.success { background: #d1fae5; color: var(--success); }
.empty-state-icon.warning { background: #fef3c7; color: var(--warning); }
.empty-state-icon.info    { background: #cffafe; color: var(--info); }
.empty-state-icon.danger  { background: #fee2e2; color: var(--danger); }

.empty-state h5 {
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.empty-state p {
    color: var(--gray);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    max-width: 360px;
    margin-left: auto;
    margin-right: auto;
}

/* Dark mode for new features */
[data-bs-theme="dark"] .toast-notification {
    background: #1e2128;
    box-shadow: 0 8px 30px rgba(0,0,0,0.4);
}
[data-bs-theme="dark"] .toast-notification .toast-body { color: #e2e8f0; }
[data-bs-theme="dark"] .back-to-top { background: #4da3ff; }
[data-bs-theme="dark"] .back-to-top:hover { background: #1a73e8; }
[data-bs-theme="dark"] .empty-state h5 { color: #e2e8f0; }

