@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800&family=Inter:wght@400;500;600&display=swap');
@import url('components/pulse-widget.css');

/* App Shell & Sidebar Variables */
:root {
    /* Dimensions */
    --sidebar-width: 260px;
    --sidebar-width-collapsed: 72px;
    --header-height: 64px;

    /* Layout Z-Index */
    --z-sidebar: 3000;
    /* Must be higher than header (2005) */
    --z-mobile-overlay: 2500;
    /* Above header, below sidebar */
    --z-mobile-toggle: 3001;
    /* Above everything */

    /* Colors are now inherited from styles.css (synced with Main App) */
}

/* HIde Rogue Hamburger Menu */
#mobile-toggle,
.mobile-toggle {
    display: none !important;
}

/* Base App Shell Layout */
.app-body {
    display: flex;
    min-height: 100vh;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

/* Sidebar Container */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    background: var(--sidebar-gradient, var(--sidebar-bg));
    /* Use app canonical var */
    color: var(--sidebar-text);
    height: 100vh;
    height: 100dvh;
    position: fixed;
    left: 0;
    top: 0;
    transition: width var(--transition-normal);
    z-index: var(--z-sidebar);
    overflow-y: auto;
    border-right: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
}

.sidebar.collapsed {
    width: var(--sidebar-width-collapsed);
}

/* Page Shell (Main Content Area) */
.page-shell {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: margin-left var(--transition-normal);
    width: calc(100% - var(--sidebar-width));
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-primary);
    padding-top: var(--header-height);
    /* Account for fixed header */
}

.sidebar.collapsed~.page-shell {
    margin-left: var(--sidebar-width-collapsed);
    width: calc(100% - var(--sidebar-width-collapsed));
}

/* Header */
.sidebar-header {
    height: var(--header-height);
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--sidebar-border);
    flex-shrink: 0;
    background-color: transparent;
    flex-wrap: nowrap;
    /* Prevent wrapping */
}

.sidebar.collapsed .sidebar-header {
    padding: 0;
    flex-direction: column;
    /* Only vertical when collapsed */
    justify-content: center;
    gap: 0.5rem;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    overflow: hidden;
    /* Prevent text overflow */
}

/* Ensure text truncates if too long */
.brand-text {
    font-size: 1.1rem;
    font-weight: 700;
    color: #ffffff;
    /* White on Navy background */
    letter-spacing: -0.025em;
    font-family: 'Montserrat', system-ui, sans-serif;
    white-space: nowrap;
}

.brand-text-short {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--brand-primary);
    /* Brand color for short logo */
    font-family: 'Montserrat', system-ui, sans-serif;
    display: none;
    /* Hidden by default */
}

.sidebar.collapsed .brand-text {
    display: none;
}

.sidebar.collapsed .brand-text-short {
    display: inline-block;
}

.sidebar.collapsed .nav-text,
.sidebar.collapsed .section-title {
    display: none;
}

/* Navigation */
.sidebar-nav {
    flex: 1;
    padding: 1.5rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    /* Tighter gap like dashboard */
}

.nav-section {
    padding: 0 1rem;
    margin-bottom: 1.5rem;
}

.sidebar.collapsed .nav-section {
    padding: 0 0.5rem;
    margin-bottom: 1rem;
}

.section-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--sidebar-text-muted);
    margin-bottom: 0.5rem;
    padding-left: 0.75rem;
    font-weight: 600;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 0.625rem 0.75rem;
    border-radius: var(--radius-md);
    color: var(--sidebar-text);
    text-decoration: none;
    transition: all var(--transition-fast);
}

.nav-item:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text);
}

.nav-item.active {
    background: var(--sidebar-active);
    color: var(--sidebar-text);
}

.nav-icon {
    width: 20px;
    display: flex;
    justify-content: center;
    margin-right: 0.75rem;
    font-size: 1rem;
    opacity: 1;
}

.nav-text {
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
}

/* Collapsed State Overrides */
.sidebar.collapsed .nav-item {
    padding: 0.75rem;
    justify-content: center;
}

.sidebar.collapsed .nav-icon {
    margin-right: 0;
    font-size: 1.1rem;
}

/* Collapse Button */
/* Collapse Button - Part of Sidebar Header */
.collapse-btn {
    background: transparent;
    border: none;
    color: var(--sidebar-text);
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.collapse-btn:hover {
    color: var(--sidebar-text);
    background: var(--sidebar-hover);
}

/* Ensure Short Brand fits in collapsed state */
.sidebar.collapsed .brand-logo {
    display: flex;
    /* Show short logo */
    justify-content: center;
    margin-bottom: 0.5rem;
    /* Stack above collapse btn if needed, or row */
}

/* Adjust header layout for collapsed state to stack Logo/Btn column or center */
.sidebar.collapsed .sidebar-header {
    padding: 1rem 0;
    flex-direction: column;
    gap: 0.5rem;
    height: auto;
}

/* Mobile Toggle (Hamburger) */
.mobile-nav-toggle {
    display: none;
    /* Hidden on desktop */
    z-index: var(--z-mobile-toggle);
    background: white;
    /* Solid background to cover header line */
    border: 1px solid var(--border-subtle);
    color: #2a4066;
    padding: 0.5rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 1.2rem;
    /* Fixed Positioning for Mobile */
    position: fixed;
    top: 1rem;
    left: 1rem;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* Footer Styling */
.app-footer {
    border-top: 1px solid var(--border-subtle);
    background-color: var(--bg-secondary);
    color: var(--text-muted);
    margin-top: auto;
}

.social-links-bottom {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.social-links-bottom a {
    color: var(--text-muted);
    font-size: 1.5rem;
    transition: color 0.2s ease;
}

.social-links-bottom a:hover {
    color: var(--brand-primary);
    transform: translateY(-2px);
}

.app-footer a:hover {
    color: var(--brand-primary) !important;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .mobile-nav-toggle {
        display: block;
    }

    /* Hide the chevron collapse button on mobile - use hamburger only */
    .collapse-btn {
        display: none !important;
    }

    .page-shell {
        margin-left: 0 !important;
        width: 100% !important;
    }

    .sidebar {
        transform: translateX(-100%);
        width: 260px !important;
        /* Always full width on mobile when open */
        box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
        /* Stronger shadow for mobile drawer */
        z-index: 2001;
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    /* Overlay for mobile */
    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.8);
        /* Slate 900 with opacity */
        z-index: 2000;
        opacity: 0;
        pointer-events: none;
        transition: opacity var(--transition-normal);
        backdrop-filter: blur(2px);
        -webkit-backdrop-filter: blur(2px);
    }

    .sidebar.mobile-open+.sidebar-overlay {
        opacity: 1;
        pointer-events: auto;
    }
}

/* App Header (Top Bar) */
.app-header {
    height: var(--header-height);
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    padding: 0 2rem;
    position: fixed;
    top: 0;
    right: 0;
    left: var(--sidebar-width);
    width: auto;
    z-index: 2005;
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border-subtle);
    transition: background-color 0.3s ease, border-color 0.3s ease, left 0.3s ease;
}

/* Header Main - Container for greeting and actions */
.header-main {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    flex: 1 !important;
    gap: 1rem !important;
}

/* Ensure secondary header rules are outside the main block */
.sidebar.collapsed~.page-shell .app-header {
    left: var(--sidebar-width-collapsed);
}

/* On Mobile, add spacing for the fixed hamburger */
@media (max-width: 768px) {
    .app-header {
        left: 0;
        /* Full width on mobile */
        padding-left: 1rem;
        padding-right: 1rem;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem;
    }

    /* Hamburger is now part of header, not floating */
    .mobile-nav-toggle {
        position: static !important;
        box-shadow: none;
        border: none;
        background: transparent;
        color: var(--text-primary);
        padding: 0.5rem;
        font-size: 1.25rem;
        order: -1;
        /* Put hamburger first */
    }

    /* Hide register/beta button on mobile */
    .header-actions .btn,
    .header-actions .btn-primary,
    .header-actions a[href*="register"] {
        display: none !important;
    }

    /* Keep theme toggle visible */
    .header-actions .theme-toggle {
        display: flex !important;
    }

    /* Adjust greeting to not overlap with hamburger */
    .header-greeting {
        margin-left: 0;
        font-size: 0.9rem;
        flex: 1;
    }

    /* Header main on mobile - stack or compress as needed */
    .header-main {
        flex: 1;
        justify-content: space-between;
    }
}

.header-greeting {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    font-family: 'Montserrat', sans-serif;
    letter-spacing: -0.01em;
    margin-bottom: 0;
    line-height: 1.4;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    /* Removed bubble styling */
}

.header-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.2s;
}

.header-link:hover {
    color: var(--brand-primary);
}

.theme-toggle {
    background: transparent;
    border: none;
    color: var(--text-muted);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.theme-toggle:hover {
    color: var(--primary-color);
    background: var(--bg-tertiary);
}

/* =============================================================================
   FOOTER STYLES
   ============================================================================= */
/* =============================================================================
   FOOTER STYLES
   ============================================================================= */
.site-footer {
    border-top: 1px solid var(--border-primary);
    background: var(--bg-card);
    padding: 4rem 2rem 2rem;
    margin-top: auto;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
}

/* Link Columns Container */
.footer-links {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    width: 100%;
}

.footer-column {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    text-align: center;
    align-items: center;
    min-height: 180px;
}

.footer-column h4 {
    color: #2a4066;
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    width: 100%;
}

.footer-column a {
    color: var(--text-secondary);
    font-size: 0.95rem;
    text-decoration: none;
    transition: color 0.2s;
}

.footer-column a:hover {
    color: var(--brand-primary);
    padding-left: 4px;
    /* Subtle hover glide */
}

/* Bottom Section */
.footer-bottom {
    max-width: 1200px;
    margin: 4rem auto 0;
    padding-top: 2rem;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.social-links-bottom {
    display: flex;
    gap: 1.5rem;
}

.social-links-bottom a {
    color: var(--text-muted);
    font-size: 1.25rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-secondary);
    text-decoration: none;
}

.social-links-bottom a:hover {
    color: var(--brand-primary);
    background: var(--bg-tertiary);
    transform: translateY(-2px);
}

/* Responsive */
@media (max-width: 768px) {
    .site-footer {
        padding: 3rem 1.5rem 2rem;
    }

    .footer-links {
        grid-template-columns: 1fr;
        /* Stack vertically on small screens */
        gap: 2.5rem;
        text-align: center;
    }

    .footer-column {
        text-align: center;
        align-items: center;
    }

    .footer-bottom {
        margin-top: 3rem;
        gap: 1.5rem;
    }
}



@media (min-width: 769px) {

    /* Desktop optimization */
    .footer-bottom p {
        width: 100%;
        text-align: center;
        /* User requested copyright centered */
    }
}