 @import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;700&family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #f97316;
    --primary-dark: #ea580c;
    --primary-light: #fff7ed;
    --accent: #fbbf24;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #0ea5e9;
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --sidebar-w: 260px;
    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius: 16px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);

    /* Light Mode Badges */
    --badge-success-bg: #dcfce7;
    --badge-success-text: #166534;
    --badge-info-bg: #e0f2fe;
    --badge-info-text: #075985;
    --badge-danger-bg: #fee2e2;
    --badge-danger-text: #991b1b;
    --badge-warning-bg: #fef3c7;
    --badge-warning-text: #92400e;
}

[data-theme="dark"] {
    --bg-main: #0f172a; /* Slate 900 */
    --bg-card: #1e293b; /* Slate 800 */
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: #334155; /* Slate 700 */
    --primary-light: #2d1808;
    --shadow-sm: 0 4px 6px -1px rgb(0 0 0 / 0.5);
    --shadow-md: 0 10px 15px -3px rgb(0 0 0 / 0.5);
    --shadow-lg: 0 20px 25px -5px rgb(0 0 0 / 0.6);
    
    /* Dark Mode Badges */
    --badge-success-bg: rgba(16, 185, 129, 0.2);
    --badge-success-text: #34d399;
    --badge-info-bg: rgba(56, 189, 248, 0.2);
    --badge-info-text: #7dd3fc;
    --badge-danger-bg: rgba(239, 68, 68, 0.2);
    --badge-danger-text: #fca5a5;
    --badge-warning-bg: rgba(245, 158, 11, 0.2);
    --badge-warning-text: #fcd34d;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Plus Jakarta Sans', sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.5;
    overflow-x: hidden;
}

/* --- Layout Structure --- */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-w);
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: all 0.3s ease;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-w);
    padding: 2rem;
    transition: all 0.3s ease;
}

/* --- Sidebar Design --- */
.sidebar-header {
    padding: 2rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
    box-shadow: 0 4px 10px rgba(249, 115, 22, 0.3);
}

.brand-name {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.5px;
}

.nav-links {
    flex: 1;
    padding: 1rem 0.75rem;
    list-style: none;
}

.nav-item {
    margin-bottom: 0.25rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 10px;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-link i {
    width: 20px;
    font-size: 1.1rem;
}

.nav-link:hover,
.nav-link.active {
    background: var(--primary-light);
    color: var(--primary);
}

.nav-link.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.2);
}

.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.user-profile-small {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1rem;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-weight: 700;
}

/* --- Cards & UI Elements --- */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border-radius: var(--radius);
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
    transition: var(--transition);
    animation: cardEntrance 0.3s ease-out both;
    will-change: transform, opacity;
}

.fade-in-up {
    animation: fadeInUp 0.8s ease-out both;
}

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

.eco-card {
    background: linear-gradient(135deg, #fffcf0 0%, #fff7ed 100%);
    border: 1px solid #ffedd5;
    transition: transform 0.3s ease;
}

.eco-card:hover {
    transform: translateY(-5px);
}

.logout-btn-top {
    padding: 0.5rem;
    height: 38px;
    width: 38px;
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    border: 1px solid rgba(239, 68, 68, 0.1);
    cursor: pointer;
}

.logout-btn-top:hover {
    background: var(--danger);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

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

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

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    font-size: 0.9rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(249, 115, 22, 0.25);
}

.btn-secondary {
    background: #f1f5f9;
    color: var(--text-main);
}

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

/* --- Login Page --- */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #fffaf5 0%, #ffedd5 100%);
    position: relative;
    overflow: hidden;
}

.login-screen::before {
    content: '';
    position: absolute;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(249, 115, 22, 0.05) 0%, transparent 70%);
    top: -50%;
    left: -50%;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 3.5rem;
    border-radius: 32px;
    box-shadow: 0 25px 50px -12px rgba(124, 45, 18, 0.15);
    position: relative;
    z-index: 1;
    animation: slideUp 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-main);
    transition: all 0.2s;
    font-size: 1rem;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.1);
    background: white;
}

/* --- Dashboard Welcome Component --- */
.hero-welcome {
    background: linear-gradient(135deg, #ea580c, #9a3412);
    color: white;
    padding: 3rem;
    border-radius: 20px;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

.hero-welcome::after {
    content: 'WH';
    position: absolute;
    right: -20px;
    bottom: -40px;
    font-size: 15rem;
    font-weight: 900;
    opacity: 0.05;
}

.hero-title {
    font-size: 2.5rem;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    margin-bottom: 1rem;
}

.hero-subtitle {
    font-size: 1.1rem;
    opacity: 0.8;
    max-width: 600px;
}

/* --- Table Styles --- */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

th {
    text-align: left;
    padding: 1rem;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 1rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
}

tr:last-child td {
    border-bottom: none;
}

/* --- Animations --- */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

#router-view {
    animation: fadeIn 0.4s ease-out;
}

.loader-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    /* Aumentar z-index para estar sobre todo */
    backdrop-filter: blur(4px);
}

.loader-overlay.active {
    display: flex;
}

.loader {
    width: 48px;
    height: 48px;
    border: 5px solid var(--primary-light);
    border-bottom-color: var(--primary);
    border-radius: 50%;
    animation: rotation 1s linear infinite;
    will-change: transform;
}

@keyframes rotation {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* --- Skeleton Loader --- */
.skeleton {
    background: linear-gradient(90deg, var(--border-color) 25%, var(--bg-main) 50%, var(--border-color) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite linear;
    border-radius: 4px;
    height: 1em;
    width: 100%;
    display: inline-block;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text { width: 80%; margin-bottom: 0.5rem; }
.skeleton-title { width: 40%; height: 2rem; margin-bottom: 1rem; }
.skeleton-card { height: 200px; width: 100%; border-radius: var(--radius); }

.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    background: #1e293b;
    color: white;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    z-index: 2000;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }

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

/* --- Utility Classes --- */
.text-primary {
    color: var(--primary);
}

.text-success {
    color: var(--success);
}

.text-danger {
    color: var(--danger);
}

.text-warning {
    color: var(--warning);
}

.text-info {
    color: var(--info);
}

.bg-primary {
    background-color: var(--primary);
}

.bg-success {
    background-color: var(--success);
}

.bg-danger {
    background-color: var(--danger);
}

.w-full {
    width: 100%;
}

.mt-4 {
    margin-top: 1rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.p-4 {
    padding: 1rem;
}

.font-bold {
    font-weight: 700;
}

.uppercase {
    text-transform: uppercase;
}

.text-sm {
    font-size: 0.875rem;
}

.text-muted {
    color: var(--text-muted);
}

.shadow-sm {
    box-shadow: var(--shadow-sm);
}

.shadow-md {
    box-shadow: var(--shadow-md);
}

/* Custom Badge Colors */
.badge-success {
    background: var(--badge-success-bg);
    color: var(--badge-success-text);
}

.badge-info {
    background: var(--badge-info-bg);
    color: var(--badge-info-text);
}

.badge-danger {
    background: var(--badge-danger-bg);
    color: var(--badge-danger-text);
}

.badge-warning {
    background: var(--badge-warning-bg);
    color: var(--badge-warning-text);
}

/* --- Floating WhatsApp --- */
.wa-floating {
    position: fixed;
    bottom: 2rem;
    right: 6.5rem;
    width: 60px;
    height: 60px;
    background: #25d366;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
    z-index: 1000;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.wa-floating:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 6px 16px rgba(37, 211, 102, 0.5);
}

/* --- Calendar Enhancements --- */
.calendar-grid-cell {
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem;
    min-height: 120px;
    transition: var(--transition);
}

.calendar-grid-cell:hover {
    background: var(--primary-light);
    cursor: default;
}

.calendar-day-number {
    font-weight: 700;
    font-family: 'Plus Jakarta Sans', sans-serif;
    color: var(--text-main);
    font-size: 1rem;
}

.upcoming-item {
    border-radius: 12px;
    padding: 1rem !important;
    margin-bottom: 0.5rem;
    transition: var(--transition);
    border: 1px solid transparent;
}

.upcoming-item:hover {
    background: var(--bg-main);
    border-color: var(--border-color);
    transform: translateY(-2px);
}

.wa-menu {
    position: fixed;
    bottom: 5.5rem;
    right: 6.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 0.75rem;
    box-shadow: var(--shadow-lg);
    display: none;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 1001;
    min-width: 220px;
    animation: slideUp 0.3s ease-out;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.wa-menu.active {
    display: flex;
}

.wa-menu-header {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.25rem 0.5rem;
    margin-bottom: 0.25rem;
    border-bottom: 1px solid var(--border-color);
}

.wa-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-main);
    text-decoration: none;
    border-radius: 10px;
    transition: var(--transition);
    font-weight: 500;
}

.wa-menu-item:hover {
    background: var(--primary-light);
    color: var(--primary);
    transform: translateX(5px);
}

.wa-menu-item i {
    font-size: 1.25rem;
    color: #25d366;
}

.wa-menu-item .contact-info {
    display: flex;
    flex-direction: column;
}

.wa-menu-item .contact-name {
    font-size: 0.9rem;
    font-weight: 600;
}

.wa-menu-item .contact-role {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* --- Mobile Nav Toggle Button --- */
.mobile-nav-toggle {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    margin-right: 1rem;
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 90;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* --- Responsiveness (PWA & Mobile) --- */
@media (max-width: 768px) {
    :root {
        --sidebar-w: 280px;
    }

    .sidebar {
        transform: translateX(-100%);
        box-shadow: 20px 0 50px rgba(0,0,0,0.1);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding: 1rem;
        width: 100%;
    }
    
    .mobile-nav-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    header {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 1rem;
    }
    
    #section-title-wrapper {
        display: flex;
        align-items: center;
        width: 100%;
        justify-content: space-between;
    }

    header > div:last-child {
        width: 100%;
        justify-content: space-between;
        background: var(--bg-card);
        padding: 0.75rem;
        border-radius: 12px;
        border: 1px solid var(--border-color);
    }

    .hero-welcome {
        padding: 1.5rem;
        border-radius: 16px;
    }

    .hero-title {
        font-size: 1.75rem;
    }

    .login-card {
        padding: 2rem 1.5rem;
        margin: 1rem;
        border-radius: 24px;
    }

    /* Stack grids on mobile */
    .responsive-grid {
        grid-template-columns: 1fr !important;
    }

    /* Table Improvements */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-bottom: 1rem;
        border-radius: 12px;
        border: 1px solid var(--border-color);
        background: var(--bg-card);
    }

    table {
        min-width: 600px;
    }

    /* Modal adjustments */
    .modal-content {
        width: 95% !important;
        padding: 1.5rem !important;
    }

    /* Calendar Mobile Overrides */
    .calendar-grid-cell {
        min-height: 60px !important;
        padding: 0.25rem !important;
    }
    .calendar-day-number {
        font-size: 0.8rem !important;
        margin-bottom: 0.2rem !important;
    }
    .calendar-grid-cell .badge {
        font-size: 0.55rem !important;
        padding: 1px 3px !important;
        margin-bottom: 2px !important;
        text-overflow: ellipsis;
        overflow: hidden;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 1.5rem;
    }
    
    .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
}

/* Custom dashboard layout responsive grids */
.admin-dashboard-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 2rem;
}
.admin-charts-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 1024px) {
    .admin-dashboard-layout {
        grid-template-columns: 1fr !important;
    }
    .admin-charts-layout {
        grid-template-columns: 1fr !important;
    }
}

/* --- Professional Upgrades --- */

/* View Transitions */
.view-enter {
    animation: slideInRight 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Breadcrumbs */
.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.breadcrumb-item:not(:last-child)::after {
    content: "/";
    margin-left: 0.5rem;
    opacity: 0.5;
}

.breadcrumb-item.active {
    color: var(--primary);
    font-weight: 600;
}

/* Global Search Bar */
.search-container {
    position: relative;
    width: 100%;
    max-width: 400px;
}

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

.search-input-wrapper i {
    position: absolute;
    left: 1rem;
    color: var(--text-muted);
}

.search-input-wrapper .search-input {
    width: 100%;
    padding: 0.6rem 1rem 0.6rem 2.5rem;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    font-size: 0.9rem;
    transition: var(--transition);
}

.search-input-wrapper .search-input:focus {
    outline: none;
    background: var(--bg-card);
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.1);
}

.search-shortcut {
    position: absolute;
    right: 0.75rem;
    background: var(--border-color);
    color: var(--text-muted);
    padding: 0.2rem 0.4rem;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    pointer-events: none;
}

/* Command Palette */
.command-palette-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    z-index: 3000;
    display: flex;
    justify-content: center;
    padding-top: 10vh;
}

.command-palette {
    width: 100%;
    max-width: 600px;
    background: var(--bg-card);
    border-radius: 20px;
    border: 1px solid var(--border-color);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    height: fit-content;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
}

.command-palette-search {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.command-palette-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 1.25rem;
    color: var(--text-main);
    outline: none;
}

.command-palette-results {
    overflow-y: auto;
    padding: 0.75rem;
}

.command-result-item {
    padding: 0.75rem 1rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    transition: var(--transition);
}

.command-result-item:hover,
.command-result-item.selected {
    background: var(--primary-light);
    color: var(--primary);
}

.command-result-icon {
    width: 36px;
    height: 36px;
    background: var(--bg-main);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Activity Feed */
.activity-feed {
    list-style: none;
}

.activity-item {
    display: flex;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.activity-content {
    flex: 1;
}

.activity-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Notification Popover */
.notification-popover {
    position: absolute;
    top: 100%;
    right: 0;
    width: 320px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    margin-top: 1rem;
    z-index: 1000;
    display: none;
    overflow: hidden;
}

.notification-popover.active {
    display: block;
    animation: slideUp 0.3s ease-out;
}

.notification-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    font-weight: 700;
    display: flex;
    justify-content: space-between;
}

/* Settings Tabs */
.settings-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 2rem;
}

.settings-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.settings-nav-item {
    padding: 0.75rem 1rem;
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
}

.settings-nav-item.active {
    background: var(--primary);
    color: white;
}

@media (max-width: 768px) {
    .settings-layout {
        grid-template-columns: 1fr;
    }
    
    .search-container {
        max-width: 100%;
    }
    
    .search-shortcut {
        display: none;
    }
}

/* Avatar Dropdown Menu */
.user-menu-container {
    position: relative;
}

.avatar-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 8px;
    transition: background 0.2s;
}

.avatar-wrapper:hover {
    background: var(--bg-main);
}

.user-menu-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    width: 200px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
    transition: all 0.2s ease;
}

.user-menu-dropdown.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.user-menu-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.85rem;
    transition: background 0.2s;
}

.user-menu-item:hover {
    background: var(--bg-main);
}

.user-menu-item i {
    width: 16px;
    color: var(--text-muted);
}


/* Status Dots */
.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 5px rgba(0,0,0,0.1);
}


/* Mila AI Assistant Styles */
.mila-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: rgba(249, 115, 22, 0.05);
    border-radius: 16px;
    border: 1px solid rgba(249, 115, 22, 0.1);
    margin: 1rem 0;
}

.mila-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary);
    background: white;
}

.mila-bubble {
    position: relative;
    background: white;
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    font-size: 0.9rem;
    color: var(--text-main);
    flex: 1;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.mila-bubble-arrow {
    position: absolute;
    left: -8px;
    top: 20px;
    width: 0;
    height: 0;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-right: 8px solid white;
}

.mila-bubble-arrow::after {
    content: "";
    position: absolute;
    left: 1px;
    top: -8px;
    width: 0;
    height: 0;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-right: 8px solid var(--border-color);
    z-index: -1;
}


/* Dark Mode Overrides */
[data-theme="dark"] {
    --bg-main: #0f172a;
    --bg-card: #1e293b;
    --bg-hover: #334155;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --primary-light: #431407;
}

[data-theme="dark"] body {
    background-color: var(--bg-main);
    color: var(--text-main);
}

[data-theme="dark"] .card {
    background-color: var(--bg-card);
    border-color: var(--border-color);
}

[data-theme="dark"] .sidebar {
    background-color: #020617;
    border-right-color: #1e293b;
}

[data-theme="dark"] header {
    background-color: rgba(15, 23, 42, 0.8);
    border-bottom-color: #1e293b;
}

[data-theme="dark"] .form-control {
    background-color: #0f172a;
    border-color: #334155;
    color: white;
}

[data-theme="dark"] table thead {
    background-color: #1e293b !important;
}

[data-theme="dark"] tr:hover {
    background-color: #1e293b;
}

/* Skeleton Loading Effect */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
}

[data-theme="dark"] .skeleton {
    background: linear-gradient(90deg, #1e293b 25%, #334155 50%, #1e293b 75%);
    background-size: 200% 100%;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}


/* Floating Mila Chat Button */
.mila-floating-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 60px;
    height: 60px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 10px 15px -3px rgba(249, 115, 22, 0.4);
    z-index: 1000;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 3px solid white;
}

.mila-floating-btn:hover {
    transform: scale(1.1) rotate(5deg);
}

.mila-floating-btn img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.mila-floating-chat {
    position: fixed;
    bottom: 6.5rem;
    right: 2rem;
    width: 320px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    z-index: 999;
    overflow: hidden;
    display: none;
    animation: slideInUp 0.3s ease-out;
}

.mila-floating-chat.active {
    display: block;
}

.mila-chat-header {
    background: var(--primary);
    padding: 1rem;
    color: white;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.mila-chat-body {
    height: 350px;
    display: flex;
    flex-direction: column;
    background: var(--bg-main);
}

.mila-messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    scroll-behavior: smooth;
}

.mila-msg {
    max-width: 85%;
    padding: 0.75rem 1rem;
    border-radius: 16px;
    font-size: 0.85rem;
    line-height: 1.4;
    position: relative;
    animation: slideUp 0.3s ease-out;
}

.mila-msg-bot {
    align-self: flex-start;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    border-bottom-left-radius: 4px;
}

.mila-msg-user {
    align-self: flex-end;
    background: var(--primary);
    color: white;
    border-bottom-right-radius: 4px;
}

.mila-chat-input-area {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-card);
    display: flex;
    gap: 0.5rem;
}

.mila-chat-input {
    flex: 1;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    color: var(--text-main);
    outline: none;
    transition: var(--transition);
}

.mila-chat-input:focus {
    border-color: var(--primary);
}

.mila-send-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

.mila-send-btn:hover {
    transform: scale(1.1);
}

/* Typing Indicator */
.typing {
    display: flex;
    gap: 4px;
    padding: 0.5rem 1rem;
}

.typing span {
    width: 6px;
    height: 6px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: typing 1s infinite alternate;
}

.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    from { opacity: 0.3; transform: translateY(0); }
    to { opacity: 1; transform: translateY(-4px); }
}

@keyframes slideInUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ============================================================
   MILA WELCOME SPLASH SCREEN
   ============================================================ */

.mila-splash {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
    overflow: hidden;
    transition: opacity 0.6s ease, transform 0.6s ease;
}

/* Animated orbs in the background */
.mila-splash::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(249,115,22,0.15) 0%, transparent 70%);
    top: -100px;
    left: -100px;
    animation: orbFloat 6s ease-in-out infinite;
}
.mila-splash::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(251,191,36,0.1) 0%, transparent 70%);
    bottom: -50px;
    right: -50px;
    animation: orbFloat 8s ease-in-out infinite reverse;
}

@keyframes orbFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33%       { transform: translate(30px, -20px) scale(1.05); }
    66%       { transform: translate(-20px, 15px) scale(0.97); }
}

.mila-splash.hiding {
    opacity: 0;
    transform: scale(1.04);
    pointer-events: none;
}

/* The card in the center */
.mila-splash-card {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 3rem 4rem;
    max-width: 480px;
    width: 90%;
}

/* Floating rings behind Mila avatar */
.mila-splash-rings {
    position: relative;
    width: 140px;
    height: 140px;
    margin: 0 auto 2rem;
}

.mila-splash-rings::before,
.mila-splash-rings::after {
    content: '';
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    border: 2px solid transparent;
    animation: ringPulse 2.5s ease-in-out infinite;
}
.mila-splash-rings::before {
    border-color: rgba(249,115,22,0.5);
    animation-delay: 0s;
}
.mila-splash-rings::after {
    inset: -20px;
    border-color: rgba(249,115,22,0.2);
    animation-delay: 0.4s;
}

@keyframes ringPulse {
    0%, 100% { transform: scale(1);   opacity: 1; }
    50%       { transform: scale(1.1); opacity: 0.4; }
}

.mila-splash-avatar {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: white;
    padding: 6px;
    box-shadow: 0 0 40px rgba(249,115,22,0.4);
    object-fit: contain;
    animation: milaHover 3s ease-in-out infinite;
}

@keyframes milaHover {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-10px); }
}

/* Typing bubble */
.mila-splash-bubble {
    background: rgba(255,255,255,0.07);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 20px;
    padding: 1.25rem 1.75rem;
    color: white;
    font-size: 1.05rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
    min-height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: cardEntrance 0.5s ease-out 0.3s both;
}

.mila-splash-bubble strong {
    color: #fb923c;
}

/* Typed cursor blink */
.mila-splash-cursor {
    display: inline-block;
    width: 2px;
    height: 1.1em;
    background: #fb923c;
    margin-left: 2px;
    vertical-align: middle;
    animation: cursorBlink 0.7s step-end infinite;
}
@keyframes cursorBlink {
    50% { opacity: 0; }
}

/* Stats row */
.mila-splash-stats {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 2rem;
    animation: cardEntrance 0.5s ease-out 0.6s both;
}

.mila-splash-stat {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 14px;
    padding: 0.75rem 1.25rem;
    color: white;
    min-width: 90px;
}

.mila-splash-stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: #fb923c;
    line-height: 1;
    margin-bottom: 0.25rem;
}

.mila-splash-stat-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.6;
}

/* Enter button */
.mila-splash-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.85rem 2.5rem;
    background: linear-gradient(135deg, #f97316, #ea580c);
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(249,115,22,0.4);
    transition: all 0.25s ease;
    animation: cardEntrance 0.5s ease-out 0.9s both;
}

.mila-splash-btn:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 12px 32px rgba(249,115,22,0.5);
}

/* Dots loader inside splash while loading */
.mila-splash-dots {
    display: flex;
    gap: 6px;
    justify-content: center;
    align-items: center;
    height: 24px;
}
.mila-splash-dots span {
    width: 8px;
    height: 8px;
    background: #fb923c;
    border-radius: 50%;
    animation: dotBounce 1.2s ease-in-out infinite;
}
.mila-splash-dots span:nth-child(2) { animation-delay: 0.2s; }
.mila-splash-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotBounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
    40%           { transform: scale(1);   opacity: 1; }
} 

