:root {
    --app-accent: #7c3aed;
}

/* ================== VARIABLES & BASE SETUP ================== */
:root {
    --primary-color: #4f46e5;
    --primary-dark: #4338ca;
    --secondary-color: #10b981;
    --danger-color: #ef4444;
    --bg-light: #f3f4f6;
    --bg-white: #ffffff;
    --text-dark: #1f2937;
    --text-light: #6b7280;
    --border-color: #e5e7eb;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --sidebar-width: 260px;
    --focus-ring: 0 0 0 2px var(--primary-color);
    --transition-fast: 0.15s ease-in-out;
    --transition-normal: 0.3s ease-in-out;
    --transition-slow: 0.5s ease-in-out;
}

[data-theme="dark"] {
    --bg-light: #111827;
    --bg-white: #1f2937;
    --text-dark: #f9fafb;
    --text-light: #9ca3af;
    --border-color: #374151;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-dark);
    transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* ================== ACCESSIBILITY ================== */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--primary-color);
    color: white;
    padding: 8px;
    text-decoration: none;
    border-radius: 4px;
    z-index: 10000;
    transition: top var(--transition-fast);
}

.skip-link:focus {
    top: 6px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.focus-visible:focus-visible {
    outline: var(--focus-ring);
    outline-offset: 2px;
}

/* ================== ANIMATIONS ================== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInLeft {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

@keyframes slideInRight {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.fade-in { animation: fadeIn var(--transition-normal); }
.slide-in-left { animation: slideInLeft var(--transition-normal); }
.slide-in-right { animation: slideInRight var(--transition-normal); }
.pulse { animation: pulse 2s infinite; }

/* ================== LAYOUT STRUCTURE ================== */
#app-container { display: flex; min-height: 100vh; }
#app-container.no-sidebar { display: block; }
.sidebar { width: var(--sidebar-width); flex-shrink: 0; background-color: var(--bg-white); border-right: 1px solid var(--border-color); position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; }
.main-wrapper { flex-grow: 1; display: flex; flex-direction: column; }

/* ================== SIDEBAR STYLES ================== */
.sidebar-header { position: relative; padding: 1.5rem; border-bottom: 1px solid var(--border-color); flex-shrink: 0; display: flex; justify-content: space-between; align-items: center; }
.sidebar-logo { display: flex; align-items: center; gap: 0.75rem; font-size: 1.5rem; font-weight: 700; color: var(--text-dark); text-decoration: none; transition: color var(--transition-fast); }
.sidebar-logo:hover { color: var(--primary-color); }
.sidebar-logo i { color: var(--primary-color); transition: transform var(--transition-fast); }
.sidebar-logo:hover i { transform: scale(1.1); }
.sidebar-nav { padding: 1rem; flex-grow: 1; overflow-y: auto; }
.nav-link { display: flex; align-items: center; padding: 0.8rem 1rem; margin-bottom: 0.5rem; border-radius: 0.375rem; text-decoration: none; color: var(--text-light); font-weight: 500; transition: all var(--transition-fast); }
.nav-link:hover { background-color: var(--bg-light); color: var(--primary-color); transform: translateX(4px); }
.nav-link.active { background-color: var(--primary-color); color: white; }
.nav-icon { width: 20px; margin-right: 1rem; text-align: center; transition: transform var(--transition-fast); }
.nav-link:hover .nav-icon { transform: scale(1.1); }
.sidebar-footer { padding: 1.5rem; text-align: center; font-size: 0.8rem; color: var(--text-light); flex-shrink: 0; border-top: 1px solid var(--border-color); }

/* ================== HEADER & ACTIONS ================== */
.header { height: 70px; background-color: var(--bg-white); border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; padding: 0 2rem; position: sticky; top: 0; z-index: 900; }
.header-spacer { flex-grow: 1; }
.header-actions { display: flex; align-items: center; gap: 1rem; }
.action-btn { background: none; border: none; cursor: pointer; font-size: 1.25rem; color: var(--text-light); position: relative; width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; transition: all var(--transition-fast); }
.action-btn:hover { background-color: var(--bg-light); transform: scale(1.05); }
.action-btn:active { transform: scale(0.95); }

/* --- Notification Bell Styles --- */
.notification-btn { position: relative; }
.notification-toggle { background: none; border: none; cursor: pointer; font-size: inherit; color: inherit; padding: 0; }
.notification-count { position: absolute; top: 0px; right: 0px; min-width: 20px; height: 20px; background-color: var(--danger-color); border-radius: 10px; border: 2px solid var(--bg-white); color: white; font-size: 0.75rem; font-weight: 700; display: flex; align-items: center; justify-content: center; padding: 0 5px; }
.notification-dropdown { position: absolute; top: 140%; right: 0; width: 360px; background-color: var(--bg-white); border-radius: 0.5rem; box-shadow: var(--shadow); border: 1px solid var(--border-color); opacity: 0; visibility: hidden; transform: translateY(-10px); transition: opacity 0.2s, transform 0.2s; z-index: 1010; }
.notification-dropdown.show { opacity: 1; visibility: visible; transform: translateY(0); }
.notification-dropdown .dropdown-header { padding: 1rem; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border-color); }
.notification-dropdown .dropdown-header h5 { margin: 0; }
.notification-list { max-height: 320px; overflow-y: auto; }
.notification-item { display: flex; gap: 1rem; padding: 1rem; border-bottom: 1px solid var(--border-color); text-decoration: none; color: var(--text-dark); }
.notification-item:hover { background-color: var(--bg-light); }
.notification-footer { text-align: center; padding: 0.75rem; border-top: 1px solid var(--border-color); }

/* --- User Menu Styles --- */
.user-menu { position: relative; }
.user-menu-toggle { width: 40px; height: 40px; border-radius: 50%; cursor: pointer; border: none; padding: 0; background: none; }
.user-menu-toggle img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.user-dropdown { position: absolute; top: 140%; right: 0; width: 240px; background-color: var(--bg-white); border-radius: 0.5rem; box-shadow: var(--shadow); border: 1px solid var(--border-color); opacity: 0; visibility: hidden; transform: translateY(-10px); transition: opacity 0.2s, transform 0.2s; z-index: 1010; }
.user-dropdown.show { opacity: 1; visibility: visible; transform: translateY(0); }
.dropdown-header { padding: 1rem; border-bottom: 1px solid var(--border-color); }
.dropdown-header h5 { margin: 0; font-size: 1rem; }
.dropdown-header p { margin: 0; font-size: 0.8rem; color: var(--text-light); }
.dropdown-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem; text-decoration: none; color: var(--text-dark); }
.dropdown-item:hover { background-color: var(--bg-light); }
.dropdown-item i { width: 16px; color: var(--text-light); }

/* ================== CONTENT & FOOTER ================== */
.content-area { padding: 2rem; flex-grow: 1; }
.footer { background-color: var(--bg-white); padding: 2rem; border-top: 1px solid var(--border-color); flex-shrink: 0; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 2rem; margin-bottom: 2rem; }
.footer-col h4 { margin-bottom: 1rem; font-weight: 600; }
.footer-col p, .footer-col a { color: var(--text-light); text-decoration: none; display: block; margin-bottom: 0.5rem; }
.footer-col a:hover { color: var(--primary-color); }
.social-links a { display: inline-block; margin-right: 1rem; font-size: 1.25rem; }
.footer-copyright { text-align: center; padding-top: 2rem; border-top: 1px solid var(--border-color); color: var(--text-light); }

/* ================== RESPONSIVE STYLES ================== */
.mobile-menu-toggle { display: none; }
.close-button { display: none; }
.nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-normal), visibility var(--transition-fast);
}

.nav-overlay.active {
    opacity: 1;
    visibility: visible;
}

@media (max-width: 1024px) {
    .sidebar {
        position: fixed;
        transform: translateX(-100%);
        transition: transform var(--transition-normal);
        z-index: 1000;
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-wrapper {
        width: 100%;
    }
    .header {
        justify-content: space-between;
        padding: 0 1.5rem;
    }
    .header-spacer { display: none; }
    .mobile-menu-toggle {
        display: block;
        background: none;
        border: none;
        font-size: 1.5rem;
        cursor: pointer;
        color: var(--text-dark);
        width: 44px;
        height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        transition: all var(--transition-fast);
    }
    .mobile-menu-toggle:hover {
        background-color: var(--bg-light);
        transform: scale(1.05);
    }
    .mobile-menu-toggle:active {
        transform: scale(0.95);
    }
    .close-button {
        display: block;
        background: none;
        border: none;
        cursor: pointer;
        color: var(--text-dark);
        font-size: 1.5rem;
        width: 44px;
        height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        transition: all var(--transition-fast);
    }
    .close-button:hover {
        background-color: var(--bg-light);
        transform: scale(1.05);
    }
    .close-button:active {
        transform: scale(0.95);
    }
    .content-area {
        padding: 1.5rem;
    }
    .footer {
        padding: 1.5rem;
    }
    .footer-grid {
        gap: 1.5rem;
    }
}
