/* Light Theme (Default) - Global Variables */
:root {
    /* Sidebar */
    --sidebar-bg: #ffffff;
    --sidebar-border: #f0f0f0;
    --sidebar-shadow: 0 0 30px rgba(0, 0, 0, 0.04);
    --sidebar-brand-border: #f5f5f5;
    --sidebar-section-title: #a1a1aa;
    --sidebar-link-color: #52525b;
    --sidebar-link-hover-bg: #f4faf7;
    --sidebar-link-hover-color: #18181b;
    --sidebar-link-active-bg: #ecfdf5;
    --sidebar-link-active-color: #059669;
    --sidebar-accent: #10b981;
    --sidebar-footer-border: #f5f5f5;
    --sidebar-footer-bg: #fafafa;
    --sidebar-user-color: #3f3f46;

    /* Brand */
    --brand-name-color: #18181b;
    --brand-tagline-color: #a1a1aa;

    /* General */
    --color-primary: #10b981;
    --color-primary-dark: #059669;
    --color-primary-light: #d1fae5;
    --color-surface-light: #fafafa;
    --color-surface-card: #ffffff;
    --color-text-primary: #18181b;
    --color-text-secondary: #71717a;
    --color-text-light: #a1a1aa;
    --color-border: #e4e4e7;

    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;

    /* Radius */
    --border-radius-sm: 8px;
    --border-radius-md: 12px;
    --border-radius-lg: 16px;
    --border-radius-xl: 24px;

    /* Sidebar sizing */
    --sidebar-width: 280px;
    --sidebar-collapsed-width: 70px;
}

/* Dark Theme */
[data-theme="dark"] {
    --sidebar-bg: #18181b;
    --sidebar-border: #27272a;
    --sidebar-shadow: 0 0 30px rgba(0, 0, 0, 0.4);
    --sidebar-brand-border: #27272a;
    --sidebar-section-title: #71717a;
    --sidebar-link-color: #d4d4d8;
    --sidebar-link-hover-bg: #27272a;
    --sidebar-link-hover-color: #ffffff;
    --sidebar-link-active-bg: rgba(16, 185, 129, 0.12);
    --sidebar-link-active-color: #34d399;
    --sidebar-accent: #34d399;
    --sidebar-footer-border: #27272a;
    --sidebar-footer-bg: #0f0f11;
    --sidebar-user-color: #e4e4e7;

    --brand-name-color: #fafafa;
    --brand-tagline-color: #71717a;

    --color-primary: #34d399;
    --color-primary-dark: #10b981;
    --color-primary-light: #064e3b;
    --color-surface-light: #09090b;
    --color-surface-card: #18181b;
    --color-text-primary: #fafafa;
    --color-text-secondary: #a1a1aa;
    --color-text-light: #71717a;
    --color-border: #3f3f46;
}

/* Body Layout with Sidebar */
body {
    background: var(--color-surface-light) !important;
    color: var(--color-text-primary);
    margin: 0;
    padding: 0;
}

body.has-sidebar {
    display: flex;
    min-height: 100vh;
}

/* ============================================
   SIDEBAR - MOBILE FIRST DESIGN
   ============================================ */

/* Sidebar Styles - Mobile First (Hidden by default) */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: min(85%, 320px);
    height: 100vh;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    box-shadow: 4px 0 20px var(--sidebar-shadow);
    z-index: 1062;
    display: flex;
    flex-direction: column;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-x: hidden;
    overflow-y: auto;
    transform: translateX(-100%);
}

/* Show sidebar when active on mobile */
.sidebar.show {
    transform: translateX(0);
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 3px;
}

/* Sidebar Header/Brand */
.sidebar-brand {
    padding: 1.5rem 1rem;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid var(--sidebar-brand-border);
    transition: all 0.3s ease;
}

.sidebar-brand:hover {
    background: var(--sidebar-link-hover-bg);
}

/* Enhanced Brand Icon with Gradient Background and Shimmer */
.sidebar-brand-icon {
    font-size: 2.5rem;
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--sidebar-link-hover-bg);
    border-radius: 16px;
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Pulse animation on hover */
.sidebar-brand:hover .sidebar-brand-icon {
    transform: scale(1.05);
    background: var(--sidebar-link-active-bg);
}

.sidebar-brand-text {
    overflow: hidden;
    transition: opacity 0.3s ease;
}

.sidebar-collapsed .sidebar-brand-text {
    opacity: 0;
    width: 0;
}

.sidebar-brand-name {
    font-size: 1.25rem;
    font-weight: 900;
    margin: 0;
    color: var(--brand-name-color);
    letter-spacing: -0.02em;
    line-height: 1;
    white-space: nowrap;
}

.sidebar-brand-tagline {
    font-size: 0.55rem;
    margin: 0.25rem 0 0 0;
    color: var(--brand-tagline-color);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    white-space: nowrap;
}

/* Sidebar Toggle Button */
.sidebar-toggle {
    position: absolute;
    top: 1.5rem;
    right: 12px;
    width: 32px;
    height: 32px;
    background: var(--color-primary);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 0.85rem;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
    transition: all 0.3s ease;
    z-index: 1051;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}

.sidebar-toggle:hover {
    background: var(--color-primary-dark);
    transform: scale(1.1);
}

/* Services Section in Sidebar */
.sidebar-section {
    padding: 1.5rem 0;
}

.sidebar-section-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--sidebar-section-title);
    padding: 0 1.5rem;
    margin-bottom: 1rem;
    transition: opacity 0.3s ease;
}

.sidebar-collapsed .sidebar-section-title {
    opacity: 0;
    height: 0;
    padding: 0;
    margin: 0;
}

/* Service Tabs */
.sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav-item {
    margin: 0.25rem 0;
}

.sidebar-nav-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1.5rem;
    color: var(--sidebar-link-color);
    text-decoration: none;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    border-radius: 0;
}

.sidebar-nav-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--sidebar-accent);
    transform: scaleY(0);
    transition: transform 0.2s ease;
}

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

.sidebar-nav-link.active {
    background: var(--sidebar-link-active-bg);
    color: var(--sidebar-link-active-color);
}

.sidebar-nav-link:hover::before,
.sidebar-nav-link.active::before {
    transform: scaleY(1);
}

.sidebar-nav-icon {
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.sidebar-nav-link:hover .sidebar-nav-icon {
    transform: scale(1.1) rotate(5deg);
}

.sidebar-nav-content {
    flex: 1;
    overflow: hidden;
    transition: opacity 0.3s ease;
}

.sidebar-collapsed .sidebar-nav-content {
    opacity: 0;
    width: 0;
}

.sidebar-nav-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0;
    white-space: nowrap;
}

.sidebar-nav-description {
    font-size: 0.75rem;
    margin: 0.25rem 0 0 0;
    opacity: 0.7;
    white-space: nowrap;
}

/* Sidebar Footer */
.sidebar-footer {
    margin-top: auto;
    padding: 1rem;
    border-top: 1px solid var(--sidebar-footer-border);
    background: var(--sidebar-footer-bg);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: transparent;
    border-radius: var(--border-radius-md);
    color: var(--sidebar-user-color);
    text-decoration: none;
    transition: all 0.2s ease;
}

.sidebar-user:hover {
    background: var(--sidebar-link-hover-bg);
    color: var(--sidebar-link-hover-color);
}

.sidebar-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: white;
    flex-shrink: 0;
}

.sidebar-user-info {
    flex: 1;
    overflow: hidden;
    transition: opacity 0.3s ease;
}

.sidebar-collapsed .sidebar-user-info {
    opacity: 0;
    width: 0;
}

.sidebar-user-name {
    font-size: 0.875rem;
    font-weight: 600;
    margin: 0;
    white-space: nowrap;
}

.sidebar-user-role {
    font-size: 0.75rem;
    margin: 0;
    opacity: 0.7;
    white-space: nowrap;
}

/* Main Content Wrapper - Mobile First */
.main-wrapper {
    flex: 1;
    margin-left: 0; /* No margin on mobile */
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: 100%;
    transition: margin-left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Top Navigation (simplified) */
.top-nav {
    background: var(--color-surface-card);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border-bottom: 1px solid var(--color-border);
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1040;
}

.top-nav-menu {
    display: flex;
    align-items: center;
    gap: 2rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.top-nav-link {
    color: var(--color-text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.top-nav-link:hover {
    color: var(--color-primary);
}

.top-nav-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Main Container */
main.main-content {
    flex: 1;
    padding: 2rem;
    background: var(--color-surface-light);
}

/* Announcement Banner */
.announcement-banner {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    border-radius: var(--border-radius-lg);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
    box-shadow: 0 8px 30px rgba(16, 185, 129, 0.2);
}

.banner-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-md);
    flex-wrap: wrap;
    color: white;
}

.banner-icon {
    font-size: 2rem;
    animation: bounce 2s infinite;
}

.banner-content p {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 500;
}

.banner-content .highlight {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-weight: 700;
}

.banner-link {
    background: white;
    color: var(--color-primary-dark);
    padding: 0.5rem 1.5rem;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
}

.banner-link:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(255, 255, 255, 0.3);
}

/* Values Section */
.values-section {
    background: var(--color-surface-card);
    padding: var(--spacing-xl) var(--spacing-lg);
    border-radius: var(--border-radius-lg);
    margin: var(--spacing-xl) 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.values-section h2 {
    text-align: center;
    color: var(--color-text-primary);
    font-weight: 800;
    font-size: 2.5rem;
    margin-bottom: var(--spacing-xl);
    letter-spacing: -0.02em;
}

.values-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-lg);
}

.value-card {
    background: var(--color-surface-light);
    padding: var(--spacing-lg);
    border-radius: var(--border-radius-md);
    text-align: center;
    transition: all 0.3s ease;
    border: 1px solid var(--color-border);
}

.value-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    border-color: var(--color-primary);
}

.value-card h3 {
    color: var(--color-primary-dark);
    font-weight: 700;
    font-size: 1.5rem;
    margin-bottom: var(--spacing-sm);
}

.value-card p {
    color: var(--color-text-secondary);
    margin: 0;
    line-height: 1.6;
}

/* Footer */
.footer {
    background: var(--color-surface-card);
    border-top: 1px solid var(--color-border);
    padding: 2rem;
    margin-top: auto;
}

.footer a {
    color: var(--color-text-secondary);
    transition: color 0.2s ease;
    font-weight: 500;
    text-decoration: none;
}

.footer a:hover {
    color: var(--color-primary);
}

/* Animations */
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* Tooltips for Collapsed Sidebar */
.sidebar-collapsed .sidebar-nav-link {
    position: relative;
}

.sidebar-collapsed .sidebar-nav-link::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--color-text-primary);
    color: var(--color-surface-card);
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius-sm);
    white-space: nowrap;
    font-size: 0.875rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1052;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.sidebar-collapsed .sidebar-nav-link:hover::after {
    opacity: 1;
}

/* ============================================
   MOBILE OVERLAY - MOBILE FIRST (FIXED FOR ALL VIEWS)
   ============================================ */

/* Mobile Sidebar Overlay - Proper z-index and visibility */
.mobile-sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
    z-index: 1060; /* Higher than navbar to work everywhere */
    opacity: 0;
    visibility: hidden;
    pointer-events: none; /* Don't block clicks when hidden */
    transition: opacity 0.3s ease, visibility 0.3s ease;
    cursor: pointer;
}

.mobile-sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto; /* Allow clicks when visible */
}

/* Mobile Menu Toggle Button - Always visible on mobile */
.mobile-menu-toggle {
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1063;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: 12px;
    width: 44px;
    height: 44px;
    font-size: 1.1rem;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-menu-toggle:hover {
    background: var(--color-primary-dark);
    transform: scale(1.05);
}

.mobile-menu-toggle:active {
    transform: scale(0.95);
}

/* Ensure toggle button is visible on mobile for ALL views */
@media (max-width: 991px) {
    .mobile-menu-toggle {
        display: flex !important;
    }
}

/* Smaller brand icon on mobile */
.sidebar-brand-icon {
    width: 48px;
    height: 48px;
    font-size: 1.75rem;
}

/* ============================================
   TABLET RESPONSIVENESS (min-width: 768px)
   ============================================ */
@media (min-width: 768px) {
    .sidebar {
        width: min(75%, 280px);
    }

    .mobile-menu-toggle {
        width: 46px;
        height: 46px;
        font-size: 1.15rem;
    }

    .sidebar-brand-icon {
        width: 52px;
        height: 52px;
        font-size: 2rem;
    }
}

/* ============================================
   DESKTOP RESPONSIVENESS (min-width: 992px)
   ============================================ */
@media (min-width: 992px) {
    /* Desktop sidebar - always visible */
    .sidebar {
        width: var(--sidebar-width);
        transform: translateX(0);
    }

    /* Collapsed sidebar state */
    .sidebar-collapsed .sidebar {
        width: var(--sidebar-collapsed-width);
    }

    .sidebar-collapsed .sidebar-brand {
        padding: 1.25rem 0.5rem;
        justify-content: center;
    }

    .sidebar-collapsed .sidebar-brand-icon {
        width: 40px;
        height: 40px;
        font-size: 1.5rem;
    }

    .sidebar-collapsed .sidebar-nav-link {
        padding: 0.75rem;
        justify-content: center;
    }

    .sidebar-collapsed .sidebar-nav-icon {
        width: 36px;
        height: 36px;
        font-size: 1.1rem;
    }

    .sidebar-collapsed .sidebar-footer {
        padding: 0.75rem 0.5rem;
    }

    .sidebar-collapsed .theme-toggle {
        justify-content: center;
        padding: 0.5rem;
    }

    .sidebar-collapsed .theme-toggle-label {
        display: none;
    }

    .sidebar-collapsed .sidebar-user {
        justify-content: center;
        padding: 0.5rem;
    }

    .sidebar-collapsed .sidebar-toggle {
        right: 50%;
        transform: translateX(50%);
    }

    /* Desktop main wrapper with sidebar margin */
    .main-wrapper {
        margin-left: var(--sidebar-width);
    }

    .sidebar-collapsed .main-wrapper {
        margin-left: var(--sidebar-collapsed-width);
    }

    /* Hide mobile controls on desktop */
    .mobile-menu-toggle {
        display: none !important;
    }

    .mobile-sidebar-overlay {
        display: none !important;
        pointer-events: none !important;
    }

    /* Show sidebar toggle button on desktop */
    .sidebar-toggle {
        display: flex !important;
    }

    /* Full-size brand icon on desktop */
    .sidebar-brand-icon {
        width: 52px;
        height: 52px;
        font-size: 2rem;
    }
}

/* ============================================
   SMALL MOBILE ADJUSTMENTS (max-width: 576px)
   ============================================ */
@media (max-width: 576px) {
    .top-nav {
        padding: 0.75rem 1rem;
    }

    .top-nav-menu {
        gap: 0.75rem;
        font-size: 0.875rem;
    }

    main.main-content {
        padding: 1rem;
    }

    .values-section {
        padding: var(--spacing-md);
    }

    .values-section h2 {
        font-size: 1.75rem;
    }

    .values-grid {
        grid-template-columns: 1fr;
    }

    .banner-content {
        text-align: center;
        font-size: 0.9rem;
        flex-direction: column;
        gap: var(--spacing-sm);
    }

    .banner-icon {
        font-size: 1.5rem;
    }

    .sidebar {
        width: 90%;
    }

    .mobile-menu-toggle {
        top: 0.75rem;
        left: 0.75rem;
        width: 40px;
        height: 40px;
    }
}

/* Theme transition for dark mode toggle */
.sidebar,
.sidebar-brand,
.sidebar-nav-link,
.sidebar-footer,
.top-nav,
.footer {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Theme Toggle Button */
.theme-toggle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.625rem 0.75rem;
    background: var(--sidebar-link-hover-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-sm);
    color: var(--sidebar-link-color);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 0.75rem;
}

.theme-toggle:hover {
    background: var(--sidebar-link-active-bg);
    color: var(--sidebar-link-active-color);
}

.theme-toggle .theme-icon-light {
    display: none;
}

[data-theme="dark"] .theme-toggle .theme-icon-dark {
    display: none;
}

[data-theme="dark"] .theme-toggle .theme-icon-light {
    display: inline;
}

.theme-toggle-label {
    flex: 1;
    text-align: left;
}

[data-theme="dark"] .theme-toggle-label::after {
    content: ' ✓';
    color: var(--color-primary);
}
