/* cc_mobile_responsive.css - Mobile/Tablet Responsive Fixes */
/* Targets: < 768px (phone), 768-1023px (tablet), preserves 1024px+ (desktop) */
/* Typography on mobile: 3 sizes only — 18px titles, 14px body, 12px labels */

/* ==========================================================================
   MOBILE HAMBURGER TOGGLE + OVERLAY - Base (hidden on desktop)
   ========================================================================== */
.cc-sidebar-toggle {
    display: none !important;
}

.cc-sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s ease;
    -webkit-tap-highlight-color: transparent;
}

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

/* ==========================================================================
   TABLET BREAKPOINT (< 1024px)
   ========================================================================== */
@media (max-width: 1023px) {
    /* Hamburger toggle: compact pill */
    .cc-sidebar-toggle {
        display: inline-flex !important;
        align-items: center;
        gap: 10px;
        padding: 10px 18px;
        margin: 8px 12px 0;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-radius: 10px;
        border: 2px solid rgba(24, 30, 87, 0.15);
        box-shadow: 0 2px 8px rgb(0 0 0 / 0.08);
        cursor: pointer;
        z-index: 10;
        transition: all 0.2s ease;
        width: auto !important;
        -webkit-tap-highlight-color: transparent;
    }

    .cc-sidebar-toggle:active {
        transform: scale(0.97);
    }

    .cc-hamburger-icon {
        display: flex;
        flex-direction: column;
        gap: 3px;
        width: 18px;
    }

    .cc-hamburger-line {
        width: 100%;
        height: 2px;
        background: var(--brand-primary, #181E57);
        border-radius: 2px;
        transition: all 0.3s ease;
    }

    .cc-sidebar-toggle.active .cc-hamburger-line:nth-child(1) {
        transform: rotate(45deg) translate(3px, 4px);
    }
    .cc-sidebar-toggle.active .cc-hamburger-line:nth-child(2) {
        opacity: 0;
    }
    .cc-sidebar-toggle.active .cc-hamburger-line:nth-child(3) {
        transform: rotate(-45deg) translate(3px, -4px);
    }

    .cc-hamburger-label {
        font-size: 13px;
        font-weight: 700;
        color: var(--brand-primary, #181E57);
        letter-spacing: -0.01em;
    }

    /* Calculator sidebar: slide-out panel */
    .cc-sidebar {
        position: fixed !important;
        top: 0 !important;
        left: -320px !important;
        width: 300px !important;
        max-width: 85vw !important;
        height: 100vh !important;
        z-index: 999 !important;
        border-radius: 0 var(--radius-2xl, 20px) var(--radius-2xl, 20px) 0 !important;
        padding: 32px 24px !important;
        overflow-y: auto !important;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        box-shadow: none !important;
    }

    .cc-sidebar.mobile-open {
        left: 0 !important;
        box-shadow: 4px 0 30px rgba(0, 0, 0, 0.2) !important;
    }

    .cc-sidebar:hover {
        transform: none !important;
    }

    .cc-sidebar.mobile-open .cc-nav-menu {
        flex-direction: column !important;
        overflow-x: visible !important;
    }

    .cc-sidebar.mobile-open .cc-nav-item {
        white-space: normal !important;
    }

    .cc-sidebar.mobile-open .cc-nav-link {
        padding: 14px 20px !important;
        font-size: 14px !important;
        min-width: unset !important;
    }

    .cc-nav-link:hover {
        transform: none !important;
    }
}

/* ==========================================================================
   PHONE BREAKPOINT (< 768px)
   ========================================================================== */
@media (max-width: 767px) {

    /* -- Outer app mobile hamburger: small icon pinned top-left of welcome bar -- */
    #mobile-menu-toggle,
    .mobile-menu-toggle {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        position: fixed !important;
        top: 8px !important;
        left: 8px !important;
        width: 36px !important;
        height: 36px !important;
        padding: 0 !important;
        font-size: 16px !important;
        border-radius: 8px !important;
        z-index: 1001 !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
        background: linear-gradient(135deg, #0018ff 0%, #181E57 100%) !important;
        color: white !important;
        border: none !important;
    }

    /* -- Outer sidebar: off-screen by default, slides in when toggled -- */
    .wind-sidebar,
    .professional-wind-sidebar,
    #sidebar {
        transform: translateX(-100%) !important;
        z-index: 10001 !important;
    }

    .sidebar-wrapper {
        position: fixed !important;
        left: -100% !important;
        width: 80% !important;
        max-width: 300px !important;
        height: 100vh !important;
        z-index: 10000 !important;
        transition: left 0.3s ease-in-out !important;
    }

    .sidebar-wrapper.mobile-open {
        left: 0 !important;
    }

    /* -- Content wrapper: full width, no left margin -- */
    .content-wrapper,
    .content-wrapper.expanded,
    .content-wrapper.collapsed-right {
        margin-left: 0 !important;
        width: 100vw !important;
        max-width: 100vw !important;
        overflow-x: hidden !important;
    }

    /* -- WELCOME HEADER: Slim single-line top bar, left padding for menu icon -- */
    .welcome-header {
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        justify-content: space-between !important;
        padding: 8px 12px 8px 50px !important; /* 50px left for menu icon */
        gap: 8px !important;
    }

    .welcome-header h4 {
        font-size: 14px !important;
        margin: 0 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        flex: 1 !important;
        min-width: 0 !important;
    }

    .welcome-header p {
        display: none !important;
    }

    .welcome-header button {
        width: auto !important;
        padding: 6px 14px !important;
        font-size: 13px !important;
        flex-shrink: 0 !important;
    }

    /* -- HIDE LOGO BAR: Redundant on mobile -- */
    .fixed-header {
        display: none !important;
    }

    /* -- HIDE BLUE HEADER CARD: Redundant on mobile -- */
    .cc-header {
        display: none !important;
    }

    /* -- HAMBURGER: Compact pill -- */
    .cc-sidebar-toggle {
        margin: 6px 12px 0 !important;
        padding: 8px 14px !important;
    }

    /* -- MAIN CONTAINER -- */
    .cc-main-container {
        padding: 8px !important;
        gap: 10px !important;
        min-height: auto !important;
        overflow-y: auto !important;
    }

    /* -- PANELS -- */
    .cc-panel {
        border-radius: 12px !important;
        padding: 16px !important;
    }

    .cc-panel:hover {
        transform: none !important;
    }

    /* -- TYPOGRAPHY: 3 sizes — 18px title, 14px body, 12px label -- */
    .cc-panel-title {
        font-size: 18px !important;
        gap: 8px !important;
        margin-bottom: 10px !important;
        letter-spacing: -0.01em !important;
    }

    .cc-panel-icon {
        font-size: 16px !important;
    }

    .cc-panel-description {
        font-size: 14px !important;
        margin-bottom: 16px !important;
        line-height: 1.5 !important;
    }

    /* Section titles: consistent with panel titles */
    .structure-location-title,
    h3.structure-location-title,
    .parameter-section h5,
    .section-title,
    .wind-parameter-title,
    .speed-type-title,
    .design-wind-speed-title,
    .risk-category-title,
    .exposure-category-title,
    .enclosure-classification-title {
        font-size: 16px !important;
        margin-bottom: 10px !important;
        margin-top: 8px !important;
    }

    /* Labels */
    .cc-form-label {
        font-size: 12px !important;
        font-weight: 700 !important;
        text-transform: uppercase !important;
        letter-spacing: 0.03em !important;
    }

    /* Forms */
    .cc-form-row {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    .cc-form-group {
        margin-bottom: 14px !important;
    }

    /* Cards */
    .parameter-grid.risk-categories {
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
    }

    .cc-selection-card {
        min-height: 80px !important;
        padding: 12px !important;
    }

    .cc-selection-card .cc-card-title,
    .cc-selection-card h4,
    .cc-selection-card strong {
        font-size: 14px !important;
    }

    .cc-selection-card .cc-card-description,
    .cc-selection-card p,
    .cc-selection-card small {
        font-size: 12px !important;
    }

    .location-display-card {
        flex-direction: column !important;
        text-align: center !important;
        padding: 14px !important;
    }

    .location-analysis-grid {
        grid-template-columns: 1fr !important;
    }

    .compliance-indicator {
        flex-direction: column !important;
        text-align: center !important;
        padding: 12px !important;
    }

    /* -- PROJECT BUTTONS -- */
    .flex.gap-md.justify-center {
        flex-wrap: wrap !important;
        gap: 8px !important;
        justify-content: center !important;
    }

    #load-projects-btn,
    #new-project-btn,
    #save-project {
        padding: 10px 14px !important;
        font-size: 13px !important;
        white-space: nowrap !important;
    }

    div[style*="position: relative"][style*="inline-block"] {
        display: inline-flex !important;
    }

    #projects-dropdown-menu {
        min-width: unset !important;
        width: calc(100vw - 32px) !important;
        left: 0 !important;
        position: fixed !important;
    }

    /* -- SCROLLABILITY -- */
    html, body {
        overflow-x: hidden !important;
        overflow-y: auto !important;
    }

    .main-content-container {
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
}

/* ==========================================================================
   EXTRA SMALL PHONES (< 375px)
   ========================================================================== */
@media (max-width: 374px) {
    .welcome-header h4 {
        font-size: 12px !important;
    }

    .cc-panel {
        padding: 10px !important;
    }

    .cc-panel-title {
        font-size: 16px !important;
    }

    .parameter-grid.risk-categories {
        grid-template-columns: 1fr !important;
    }

    #load-projects-btn,
    #new-project-btn,
    #save-project {
        padding: 8px 10px !important;
        font-size: 11px !important;
    }
}
