/**
 * Home Page Styles
 * Extracted from index.html inline styles to comply with 800 line limit.
 */

        /* Design tokens */
        :root {
          --hh-color-base-black: #000000;
          --hh-color-base-cloud: #F5F5F5;
          --hh-color-base-iron: #4A4A4A;
          --hh-color-base-offWhite: #FAFAFA;
          --hh-color-base-stone: #B0B0B0;
          --hh-color-base-white: #FFFFFF;
          --hh-color-borders-default: #E6E6E6;
          --hh-color-borders-strong: #BDBDBD;
          --hh-color-borders-subtle: #F0F0F0;
          --hh-color-brand-primary-300: #F2B8A6;
          --hh-color-brand-primary-600: #C35E46;
          --hh-color-brand-primary: #E07A5F;
          --hh-color-brand-sage-300: #B3CFC0;
          --hh-color-brand-sage-700: #5F8C79;
          --hh-color-brand-sage: #81B29A;
          --hh-color-brand-slate-300: #6C6E85;
          --hh-color-brand-slate-800: #2B2C3F;
          --hh-color-brand-slate: #3D405B;
          --hh-color-status-error: #D95D48;
          --hh-color-status-info: #5A6FA6;
          --hh-color-status-success: #6DAF8F;
          --hh-color-status-warning: #E8B26B;
          --hh-color-text-inverse: #FFFFFF;
          --hh-color-text-primary: #000000;
          --hh-color-text-secondary: #4A4A4A;
          --hh-color-text-tertiary: #B0B0B0;
          --hh-radius-full: 999px;
          --hh-radius-lg: 16px;
          --hh-radius-md: 12px;
          --hh-radius-sm: 8px;
          --hh-radius-xl: 20px;
          --hh-shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
          --hh-shadow-md: 0 2px 8px rgba(0,0,0,0.08);
          --hh-shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
          --hh-space-2xl: 32px;
          --hh-space-3xl: 40px;
          --hh-space-lg: 16px;
          --hh-space-md: 12px;
          --hh-space-sm: 8px;
          --hh-space-xl: 24px;
          --hh-space-xs: 4px;
          --hh-type-body-lh: 24px;
          --hh-type-body-size: 16px;
          --hh-type-body-weight: 400;
          --hh-type-h1-lh: 40px;
          --hh-type-h1-size: 32px;
          --hh-type-h1-weight: 700;
          --hh-type-h2-lh: 32px;
          --hh-type-h2-size: 24px;
          --hh-type-h2-weight: 600;
          --hh-type-h3-lh: 28px;
          --hh-type-h3-size: 20px;
          --hh-type-h3-weight: 600;
          --hh-type-h4-lh: 24px;
          --hh-type-h4-size: 18px;
          --hh-type-h4-weight: 500;
          --hh-type-helper-lh: 16px;
          --hh-type-helper-size: 12px;
          --hh-type-helper-weight: 400;
          --hh-type-small-lh: 20px;
          --hh-type-small-size: 14px;
          --hh-type-small-weight: 400;
          --hh-font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
          --hh-font-feature-settings: 'tnum';
        }

        /* Global styles */
        * { margin: 0; padding: 0; box-sizing: border-box; }
        body {
            font-family: var(--hh-font-family);
            line-height: var(--hh-type-body-lh);
            color: var(--hh-color-text-primary);
            background: var(--hh-color-base-offWhite);
            min-height: 100vh;
            min-height: 100dvh; /* Dynamic viewport height for mobile */
            display: flex;
            flex-direction: column;
        }

        /* Navbar styles */
        .navbar { background: var(--hh-color-base-white); border-bottom: 1px solid var(--hh-color-borders-default); padding: 12px 0; position: sticky; top: 0; z-index: 1000; box-shadow: var(--hh-shadow-sm); }
        .navbar-container { max-width: 1200px; margin: 0 auto; padding: 0 20px; display: flex; justify-content: space-between; align-items: center; }
        .navbar-brand { font-size: var(--hh-type-h4-size); font-weight: var(--hh-type-h4-weight); color: var(--hh-color-text-primary); text-decoration: none; display: flex; align-items: center; gap: var(--hh-space-sm); }
        .navbar-brand img { width: 40px !important; height: 40px !important; object-fit: contain; }
        .navbar-nav { display: flex; gap: 24px; align-items: center; }
        .nav-link { color: var(--hh-color-text-secondary); text-decoration: none; font-weight: var(--hh-type-small-weight); font-size: var(--hh-type-small-size); padding: var(--hh-space-sm) var(--hh-space-md); border-radius: var(--hh-radius-sm); transition: all 0.2s ease; }
        .nav-link:hover { color: var(--hh-color-text-primary); background: var(--hh-color-base-cloud); }
        .login-btn { padding: 8px 16px; border-radius: 6px; font-size: 14px; font-weight: 500; text-decoration: none; background: var(--hh-color-brand-slate); color: var(--hh-color-text-inverse); }

        /* Layout styles */
        .main-content {
            padding: 40px 20px;
            flex: 1;
            display: flex;
            flex-direction: column;
            justify-content: center;
        }
        .container { max-width: 500px; margin: 0 auto; background: var(--hh-color-base-white); border-radius: var(--hh-radius-lg); border: 1px solid var(--hh-color-borders-default); overflow: hidden; box-shadow: var(--hh-shadow-md); }

        /* Search form styles - Segmented control design */
        .search-tabs { display: flex; background: var(--hh-color-base-cloud); margin: 24px 24px 0; padding: 4px; gap: 0; border-radius: var(--hh-radius-lg); border: 1px solid var(--hh-color-borders-default); }
        .tab-button { flex: 1; padding: var(--hh-space-md) var(--hh-space-lg); background: transparent; border: none; border-radius: var(--hh-radius-md); font-size: var(--hh-type-small-size); color: var(--hh-color-text-secondary); cursor: pointer; transition: all 0.2s ease; display: flex; align-items: center; justify-content: center; gap: var(--hh-space-sm); }
        .tab-button:hover:not(.active) { color: var(--hh-color-text-primary); }
        .tab-button.active { background: var(--hh-color-brand-slate); color: var(--hh-color-text-inverse); font-weight: 500; box-shadow: var(--hh-shadow-sm); }
        .form-container { padding: 24px; background: var(--hh-color-base-white); }
        .tab-content { display: none; }
        .tab-content.active { display: block; }
        .form-group { margin-bottom: 24px; }
        label { display: block; margin-bottom: 6px; font-weight: 500; color: #1a1a1a; font-size: 14px; }
        input[type="url"], input[type="text"], input[type="number"] { width: 100%; padding: 12px 14px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 16px; background: #ffffff; }
        input:focus, select:focus { outline: none; border-color: #1a1a1a; box-shadow: 0 0 0 3px rgba(26, 26, 26, 0.06); }
        select { width: 100%; padding: 12px 14px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 16px; background: #ffffff; }
        .submit-btn { display: flex; align-items: center; justify-content: center; gap: var(--hh-space-sm); width: 100%; padding: var(--hh-space-lg); background: var(--hh-color-brand-primary); color: var(--hh-color-text-inverse); border: none; border-radius: var(--hh-radius-lg); font-size: var(--hh-type-body-size); font-weight: 500; cursor: pointer; box-shadow: var(--hh-shadow-md); }
        .submit-btn:hover { background: var(--hh-color-brand-primary-600); }

        /* Loading/progress styles */
        .loading { display: none; max-width: 500px; margin: 0 auto; background: #ffffff; border-radius: 12px; border: 1px solid #e5e5e5; overflow: hidden; padding: 32px; }
        .progress-dashboard { background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 8px; padding: 24px; }
        .progress-header { text-align: center; margin-bottom: 24px; }
        .progress-header h3 { color: #1a1a1a; font-size: 1.1em; font-weight: 600; margin-bottom: 8px; }
        .overall-progress { margin-bottom: 24px; }
        .overall-progress-label { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
        .progress-bar-container { background: #e5e7eb; border-radius: 4px; height: 8px; overflow: hidden; position: relative; min-height: 8px; }
        .progress-bar { background: linear-gradient(90deg, #10b981, #059669); height: 100%; width: 0%; transition: width 0.3s ease; border-radius: 4px; min-height: 8px; display: block; position: relative; }
        
        /* Mobile fixes for progress bar */
        @media (max-width: 768px) {
            .progress-bar-container { 
                height: 10px !important; 
                min-height: 10px !important;
                background: #e5e7eb !important;
                border-radius: 5px !important;
            }
            .progress-bar { 
                height: 100% !important; 
                min-height: 10px !important;
                display: block !important;
                visibility: visible !important;
                opacity: 1 !important;
                background: linear-gradient(90deg, #10b981, #059669) !important;
            }
            .loading { 
                padding: 24px 20px !important;
                margin: 0 16px !important;
            }
            .progress-dashboard {
                padding: 20px 16px !important;
            }
        }
        .stages-container { display: grid; gap: 16px; }
        .stage { background: #ffffff; border: 1px solid #e5e7eb; border-radius: 6px; padding: 16px; transition: all 0.2s ease; }
        .stage.pending { opacity: 0.6; }
        .stage.in_progress { border-color: #3b82f6; box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.1); }
        .stage.completed { border-color: #10b981; background: #f0fdf4; }
        .stage.failed { border-color: #ef4444; background: #fef2f2; }
        .stage-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
        .stage-title { font-weight: 500; color: #1a1a1a; font-size: 14px; display: flex; align-items: center; gap: 8px; }
        .stage-status { font-size: 12px; padding: 3px 8px; border-radius: 12px; font-weight: 500; text-transform: uppercase; }
        .stage-status.pending { background: #f3f4f6; color: #6b7280; }
        .stage-status.in_progress { background: #dbeafe; color: #3b82f6; }
        .stage-status.completed { background: #dcfce7; color: #16a34a; }
        .stage-message { color: #6b7280; font-size: 13px; margin-bottom: 12px; }

        /* Footer styles */
        footer {
            text-align: center;
            padding: 40px 20px;
            color: var(--hh-color-text-tertiary);
            font-size: var(--hh-type-small-size);
            margin-top: auto; /* Push to bottom with flexbox */
        }
        footer a { color: var(--hh-color-brand-primary); text-decoration: none; }
        footer a:hover { text-decoration: underline; }

        /* Safe area handling for notched phones */
        @supports (padding-bottom: env(safe-area-inset-bottom)) {
            footer {
                padding-bottom: calc(20px + env(safe-area-inset-bottom));
            }
        }

        /* Collapsible Sections (Saved Markets, Recent Searches) */
        .collapsible-section {
            margin-top: 12px;
            border: 1px solid var(--hh-color-borders-default);
            border-radius: var(--hh-radius-md);
            overflow: hidden;
        }
        .collapsible-section:first-of-type { margin-top: 20px; }
        .section-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 10px 12px;
            background: var(--hh-color-base-cloud);
            cursor: pointer;
            user-select: none;
            transition: background 0.2s;
        }
        .section-header:hover { background: var(--hh-color-borders-subtle); }
        .section-header-left {
            display: flex;
            align-items: center;
            gap: 8px;
        }
        .section-chevron {
            width: 14px;
            height: 14px;
            color: var(--hh-color-text-tertiary);
            transition: transform 0.2s ease;
        }
        .collapsible-section.expanded .section-chevron { transform: rotate(90deg); }
        .section-title {
            font-size: 13px;
            font-weight: 600;
            color: var(--hh-color-text-primary);
        }
        .section-count {
            font-size: 11px;
            font-weight: 500;
            padding: 2px 7px;
            border-radius: 10px;
            background: var(--hh-color-text-tertiary);
            color: white;
        }
        .section-refresh {
            background: none;
            border: none;
            cursor: pointer;
            padding: 4px;
            color: var(--hh-color-text-tertiary);
            border-radius: var(--hh-radius-sm);
            transition: all 0.2s;
        }
        .section-refresh:hover {
            color: var(--hh-color-text-primary);
            background: rgba(0,0,0,0.05);
        }
        .section-content {
            max-height: 0;
            overflow: hidden;
            transition: max-height 0.3s ease;
        }
        .collapsible-section.expanded .section-content { max-height: 280px; }
        .section-list {
            display: flex;
            flex-direction: column;
            padding: 8px;
            gap: 6px;
            max-height: 240px;
            overflow-y: auto;
        }
        .section-item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 10px 12px;
            background: var(--hh-color-base-white);
            border: 1px solid var(--hh-color-borders-default);
            border-radius: var(--hh-radius-sm);
            cursor: pointer;
            transition: all 0.2s;
        }
        .section-item:hover {
            background: var(--hh-color-base-cloud);
            border-color: var(--hh-color-borders-strong);
        }
        .item-info {
            display: flex;
            flex-direction: column;
            gap: 2px;
            flex: 1;
            min-width: 0;
        }
        .item-name {
            font-size: 13px;
            font-weight: 500;
            color: var(--hh-color-text-primary);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        .item-meta {
            font-size: 11px;
            color: var(--hh-color-text-tertiary);
            display: flex;
            gap: 8px;
            align-items: center;
        }
        .item-badge {
            font-size: 10px;
            font-weight: 600;
            padding: 2px 6px;
            border-radius: 10px;
            background: var(--hh-color-brand-primary);
            color: white;
        }
        .item-badge.new { background: var(--hh-color-status-success); }
        .section-loading, .section-empty {
            text-align: center;
            padding: 14px;
            color: var(--hh-color-text-tertiary);
            font-size: 13px;
        }
        /* Minimal variant - no border, no background */
        .collapsible-section.minimal {
            border: none;
            margin-top: 16px;
        }
        .collapsible-section.minimal .section-header {
            background: transparent;
            padding: 8px 0;
            gap: 8px;
            justify-content: flex-start;
        }
        .collapsible-section.minimal .section-header:hover {
            background: transparent;
        }
        .collapsible-section.minimal .section-title {
            color: var(--hh-color-text-secondary);
            font-weight: 500;
        }
        .collapsible-section.minimal .section-content {
            padding-left: 0;
        }
        .collapsible-section.minimal .section-list {
            padding: 4px 0;
        }

        /* Force hide mobile elements on desktop */
        @media (min-width: 769px) {
            .mobile-menu-overlay,
            .mobile-menu,
            .hamburger-menu-trigger {
                display: none !important;
                visibility: hidden !important;
                opacity: 0 !important;
                pointer-events: none !important;
                position: absolute !important;
                left: -9999px !important;
            }
        }

        /* =================================================================
           MOBILE HEIGHT-BASED RESPONSIVE SPACING
           Use extra vertical space on tall phones for better UX
           ================================================================= */

        /* Tall mobile phones (>700px viewport height) */
        @media (max-width: 768px) and (min-height: 700px) {
            .main-content {
                padding-top: 32px;
                padding-bottom: 24px;
            }

            .form-container {
                padding: 28px 24px;
            }

            .form-group {
                margin-bottom: 26px;
            }

            input[type="text"],
            input[type="url"],
            input[type="number"],
            select {
                padding: 14px 16px;
                font-size: 17px;
            }

            .submit-btn {
                padding: 16px;
                font-size: 17px;
            }

            .search-tabs {
                margin: 28px 24px 0;
            }

            .tab-button {
                padding: 14px 16px;
            }
        }

        /* Extra tall phones (>800px like iPhone 14 Pro Max, Pixel 7) */
        @media (max-width: 768px) and (min-height: 800px) {
            .main-content {
                padding-top: 48px;
                padding-bottom: 32px;
            }

            .form-container {
                padding: 32px 24px;
            }

            .form-group {
                margin-bottom: 28px;
            }

            .submit-btn {
                padding: 18px;
            }

            .search-tabs {
                margin: 32px 24px 0;
            }

            .collapsible-section {
                margin-top: 20px;
            }

            .collapsible-section.minimal {
                margin-top: 24px;
            }
        }

        /* Very tall phones (>900px) - maximize comfort */
        @media (max-width: 768px) and (min-height: 900px) {
            .main-content {
                padding-top: 56px;
            }

            .form-container {
                padding: 36px 28px;
            }

            .form-group {
                margin-bottom: 32px;
            }

            input[type="text"],
            input[type="url"],
            input[type="number"],
            select {
                padding: 16px 18px;
            }
        }
