/* ==========================================
   BASE STYLES - Reset, Variables, Typography
   ========================================== */

/* ==========================================
   RESPONSIVE BREAKPOINTS REFERENCE
   ==========================================

   Standard screen sizes for mortgage brokers:

   | Screen  | Common Resolution | Breakpoint   | Sidebar Width |
   |---------|-------------------|--------------|---------------|
   | 27"+ 4K | 2560x1440         | > 1920px     | 480px         |
   | 24-27"  | 1920x1080         | 1441-1920px  | 360px         |
   | 20"     | 1680x1050         | 1367-1440px  | 340px         |
   | 17"     | 1440x900          | 1281-1366px  | 320px         |
   | 14-16"  | 1366x768          | 1025-1280px  | 300px         |
   | 11-13"  | 1280x800          | 769-1024px   | 280px         |
   | Tablet  | 768px             | < 768px      | 100vw (mobile)|

   BREAKPOINT VALUES (use in @media queries):
   --bp-4k:      1920px  (min-width for 4K/large displays)
   --bp-desktop: 1440px  (standard desktop)
   --bp-laptop:  1366px  (standard laptop)
   --bp-laptop-s: 1280px (small laptop)
   --bp-tablet:  1024px  (tablet landscape / 11")
   --bp-tablet-s: 768px  (tablet portrait / mobile breakpoint)
   --bp-mobile:  480px   (mobile large)
   --bp-mobile-s: 320px  (mobile small)
   ========================================== */

:root {
    /* Sidebar widths for each breakpoint */
    --sidebar-width-4k: 480px;      /* > 1920px */
    --sidebar-width-desktop: 360px; /* 1441-1920px (1920x1080) */
    --sidebar-width-laptop: 340px;  /* 1367-1440px (1680x1050) */
    --sidebar-width-laptop-s: 320px; /* 1281-1366px (1440x900) */
    --sidebar-width-tablet: 300px;  /* 1025-1280px */
    --sidebar-width-tablet-s: 280px; /* 769-1024px */

    /* Header heights */
    --header-height: 64px;
    --header-height-compact: 52px;

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

    /* Font sizes responsive */
    --font-xs: 0.7rem;
    --font-sm: 0.8rem;
    --font-base: 0.9rem;
    --font-md: 1rem;
    --font-lg: 1.1rem;
    --font-xl: 1.25rem;

    /* ==========================================
       UNIFIED FRAME DESIGN TOKENS
       (Header, Sidebar, Footer cohesion)
       ========================================== */
    
    /* Unified backgrounds */
    --frame-bg-primary: rgba(15, 23, 42, 0.95);
    --frame-bg-secondary: rgba(30, 41, 59, 0.8);
    
    /* Unified borders */
    --frame-border-subtle: rgba(96, 165, 250, 0.1);
    --frame-border-medium: rgba(96, 165, 250, 0.15);
    --frame-border-strong: rgba(96, 165, 250, 0.2);
    
    /* Unified text colors */
    --frame-text-primary: #e2e8f0;
    --frame-text-secondary: #94a3b8;
    --frame-text-tertiary: #64748b;
    --frame-text-accent: #60a5fa;
    
    /* Unified spacing for frame elements */
    --frame-padding-x: 1.5rem;
    --frame-padding-y: 0.75rem;
    
    /* Unified transitions */
    --frame-transition: all 0.2s ease;
}

/* Smooth scrolling for entire app */
html {
    scroll-behavior: smooth;
}

/* Global zoom-out for screens 24" and smaller (≤1920px) */
/* 27"+ screens (>1920px) keep default zoom */
@media (max-width: 1920px) {
    html {
        zoom: 0.8;
    }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", Arial, sans-serif;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: #e2e8f0;
    line-height: 1.6;
    overflow: hidden;
}

body {
    display: flex;
    flex-direction: column;
}

/* ==========================================
   SITE FOOTER (Unified with Header/Sidebar)
   ========================================== */
.site-footer {
    padding: var(--frame-padding-y) var(--frame-padding-x);
    color: var(--frame-text-tertiary);
    font-size: var(--font-sm);
    background: linear-gradient(to bottom, rgba(15, 23, 42, 0) 0%, var(--frame-bg-primary) 40%);
    margin-top: auto;
    flex-shrink: 0;
    position: relative;
    /* backdrop-filter: removed for performance */
}

.site-footer-container {
    max-width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    flex-wrap: wrap;
}

.site-footer-container > p {
    margin: 0;
    color: #64748b;
    font-size: 0.8rem;
    white-space: nowrap;
}

.site-footer-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.site-footer-link {
    color: var(--frame-text-secondary);
    text-decoration: none;
    font-size: var(--font-sm);
    font-weight: 500;
    transition: var(--frame-transition);
    white-space: nowrap;
}

.site-footer-link:hover {
    color: var(--frame-text-accent);
}

.developed-by {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    opacity: 0.8;
    transition: opacity 0.3s ease;
    white-space: nowrap;
}

.developed-by:hover {
    opacity: 1;
}

.developed-by span {
    font-size: 0.8rem;
    color: #cbd5e1;
    font-weight: 500;
}

.madera-logo {
    height: 32px;
    width: auto;
    filter: brightness(0.9);
    transition: all 0.3s ease;
}

.madera-logo:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
}

/* Responsive */
@media (max-width: 1024px) {
    .site-footer-container {
        gap: 1.5rem;
    }
}

@media (max-width: 768px) {
    .site-footer {
        padding: 0.6rem 1rem;
    }
    
    .site-footer-container {
        gap: 1rem;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .site-footer-container > p {
        font-size: 0.75rem;
    }
    
    .site-footer-links {
        gap: 1rem;
    }
    
    .site-footer-link {
        font-size: 0.75rem;
    }
    
    .developed-by {
        gap: 6px;
    }
    
    .developed-by span {
        font-size: 0.75rem;
    }
    
    .madera-logo {
        height: 28px;
    }
}

@media (max-width: 480px) {
    .site-footer {
        padding: 0.5rem 0.75rem;
    }
    
    .site-footer-container {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .site-footer-links {
        gap: 0.75rem;
        flex-wrap: wrap;
    }
    
    .site-footer-link {
        font-size: 0.7rem;
    }
    
    .madera-logo {
        height: 24px;
    }
}

/* ==========================================
   MOBILE ELEMENTS - Hide on Desktop
   ========================================== */
/* Force hide mobile elements on desktop - Highest priority */
@media (min-width: 768px) {
    #mobile-warning-banner,
    #mobile-header-toggle,
    #mobile-fab,
    #mobile-fab-menu {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
        position: absolute !important;
        left: -9999px !important;
    }
}

/* ==========================================
   OFFLINE INDICATOR BANNER (PWA)
   ========================================== */
.offline-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 99999;
    background: linear-gradient(90deg, #dc2626 0%, #b91c1c 100%);
    color: white;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transform: translateY(0);
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.offline-banner.hidden {
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
}

.offline-banner.dismissed {
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
}

.offline-banner .offline-icon {
    font-size: 1.2rem;
    animation: pulse-offline 2s infinite;
}

@keyframes pulse-offline {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.offline-banner .offline-text {
    flex: 1;
    text-align: center;
}

.offline-banner .offline-dismiss {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.offline-banner .offline-dismiss:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Adjust body when offline banner is visible */
body.is-offline {
    padding-top: 48px;
}

/* Hidden modals by default - CSS loaded dynamically */
.scrybe-preferences-modal {
    display: none;
}
