@import url('https://fonts.googleapis.com/css2?family=PT+Serif:ital,wght@0,400;0,700;1,400&display=swap');

:root {
    --black: #101010;
    --white: #ffffff;
    --gray-light: #f5f5f5;
    --gray-mid: #aeaeae;
    --gray-dark: #333333;
    --accent: #08a1f6;
    --accent-dark: #0c00f3;
    --accent-light: #00f2f3;
    --gradient: linear-gradient(135deg, #0c00f3 0%, #08a1f6 50%, #00f2f3 100%);
    --shadow: 0 4px 24px rgba(8, 161, 246, 0.15);
    --shadow-lg: 0 8px 40px rgba(8, 161, 246, 0.2);
    --radius: 8px;
    --radius-lg: 16px;
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'PT Serif', Georgia, serif;
    color: var(--black);
    background: var(--white);
    line-height: 1.65;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--gray-light); }
::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 3px; }

/* ===================== HEADER ===================== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(16, 16, 16, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    padding: 0 40px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-size: 20px;
    font-weight: 700;
    color: var(--white);
    text-transform: uppercase;
    letter-spacing: 3px;
}

.logo span {
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-contact {
    color: var(--gray-mid);
    font-size: 14px;
    letter-spacing: 0.5px;
}

.header-contact a {
    color: var(--accent);
    text-decoration: none;
    transition: var(--transition);
}

.header-contact a:hover {
    color: var(--accent-light);
}

/* ===================== LAYOUT ===================== */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 24px;
}

main {
    padding-top: 70px;
    min-height: 100vh;
}

/* ===================== SCREENS ===================== */
.screen {
    display: none;
    animation: fadeIn 0.5s ease;
}

.screen.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(40px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===================== WELCOME SCREEN ===================== */
.welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: calc(100dvh - 70px);
    text-align: center;
    padding: 40px 24px;
}

.welcome-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--accent);
    border: 1px solid var(--accent);
    padding: 6px 20px;
    border-radius: 30px;
    margin-bottom: 24px;
}

.welcome h1 {
    font-size: 48px;
    font-weight: 700;
    line-height: 1.15;
    margin-bottom: 20px;
    color: var(--black);
}

.welcome h1 span {
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.welcome p {
    font-size: 18px;
    color: var(--gray-dark);
    max-width: 560px;
    margin-bottom: 36px;
    line-height: 1.75;
}

/* ===================== BUTTONS ===================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: 'PT Serif', serif;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    border-radius: var(--radius);
    padding: 16px 48px;
    text-decoration: none;
}

.btn-primary {
    background: var(--gradient);
    color: var(--white);
    box-shadow: var(--shadow);
}

.btn-primary:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.btn-outline {
    background: transparent;
    color: var(--black);
    border: 2px solid var(--black);
}

.btn-outline:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.btn-small {
    padding: 10px 28px;
    font-size: 13px;
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
}

/* ===================== SURVEY SCREEN ===================== */
.survey-section {
    min-height: calc(100dvh - 70px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
}

.survey-card {
    width: 100%;
    max-width: 680px;
    animation: slideUp 0.5s ease;
}

.survey-progress {
    display: flex;
    gap: 6px;
    margin-bottom: 32px;
}

.survey-progress .dot {
    flex: 1;
    height: 3px;
    background: var(--gray-light);
    border-radius: 2px;
    transition: var(--transition);
}

.survey-progress .dot.filled {
    background: var(--gradient);
}

.survey-progress .dot.current {
    background: var(--accent);
    box-shadow: 0 0 8px rgba(8, 161, 246, 0.5);
}

.survey-step-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 12px;
}

.survey-card h2 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 24px;
    line-height: 1.35;
}

.survey-image {
    width: 100%;
    max-height: 320px;
    object-fit: contain;
    border-radius: var(--radius-lg);
    margin-bottom: 24px;
    border: 1px solid var(--gray-light);
}

.survey-image.survey-image-hero {
    max-height: 420px;
    border: none;
}

/* When question has no image, vertically center the card so
   the buttons aren't stuck at the top of the viewport. */
.survey-section.no-image {
    align-items: center;
}

.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.options-grid.single-col {
    grid-template-columns: 1fr;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.option-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 14px 20px;
    background: var(--white);
    border: 2px solid #e0e0e0;
    border-radius: var(--radius);
    font-family: 'PT Serif', serif;
    font-size: 15px;
    color: var(--black);
    cursor: pointer;
    transition: var(--transition);
    min-height: 52px;
}

.option-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(8, 161, 246, 0.04);
}

.option-btn.selected {
    border-color: var(--accent);
    background: rgba(8, 161, 246, 0.08);
    color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
}

.option-btn-cta {
    background: var(--gradient);
    color: var(--white);
    border: none;
    box-shadow: var(--shadow);
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 700;
    font-size: 16px;
    padding: 16px 48px;
    min-height: 56px;
}

.option-btn-cta:hover {
    background: var(--gradient);
    color: var(--white);
    border: none;
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.option-btn-cta.selected {
    background: var(--gradient);
    color: var(--white);
    border: none;
    box-shadow: var(--shadow-lg);
}

/* ===================== RESULTS SCREEN ===================== */
.results-section {
    padding: 80px 24px 60px;
}

.results-header {
    text-align: center;
    margin-bottom: 60px;
}

.results-header h1 {
    font-size: 38px;
    font-weight: 700;
    margin-bottom: 12px;
}

.results-header p {
    font-size: 16px;
    color: var(--gray-dark);
}

.result-block {
    background: var(--white);
    border: 1px solid #e8e8e8;
    border-radius: var(--radius-lg);
    padding: 40px;
    margin-bottom: 32px;
    animation: slideUp 0.5s ease;
}

.result-block-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 12px;
}

.result-block h2 {
    font-size: 26px;
    margin-bottom: 16px;
}

.result-block p {
    font-size: 15px;
    color: var(--gray-dark);
    line-height: 1.75;
    margin-bottom: 12px;
}

.result-block .recommendation-text {
    background: var(--gray-light);
    border-left: 3px solid var(--accent);
    padding: 20px 24px;
    border-radius: 0 var(--radius) var(--radius) 0;
    margin-top: 20px;
    font-size: 15px;
    line-height: 1.75;
    color: var(--black);
}

/* Reference images gallery */
.ref-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    margin-top: 24px;
}

.ref-gallery img {
    width: 100%;
    aspect-ratio: 3/4;
    object-fit: cover;
    border-radius: var(--radius);
    border: 1px solid #e8e8e8;
    transition: var(--transition);
    cursor: pointer;
}

.ref-gallery img:hover {
    transform: scale(1.03);
    box-shadow: var(--shadow);
}

/* Divider */
.divider-section {
    text-align: center;
    padding: 60px 0;
}

.divider-section .line {
    width: 60px;
    height: 2px;
    background: var(--gradient);
    margin: 0 auto 32px;
}

.divider-section h2 {
    font-size: 32px;
    margin-bottom: 16px;
}

.divider-section p {
    font-size: 16px;
    color: var(--gray-dark);
    max-width: 500px;
    margin: 0 auto 32px;
}

/* ===================== GENERATE SCREEN ===================== */
.generate-section {
    padding: 60px 24px 40px;
}

.generate-header {
    text-align: center;
    margin-bottom: 48px;
}

.generate-header h1 {
    font-size: 34px;
    margin-bottom: 12px;
}

.generate-header p {
    color: var(--gray-dark);
    font-size: 16px;
}

.upload-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 40px;
}

.upload-card {
    border: 2px dashed #d0d0d0;
    border-radius: var(--radius-lg);
    padding: 40px 24px;
    text-align: center;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    min-height: 280px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.upload-card:hover {
    border-color: var(--accent);
    background: rgba(8, 161, 246, 0.02);
}

.upload-card.has-image {
    border-style: solid;
    border-color: var(--accent);
    padding: 8px;
}

.upload-card .upload-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.upload-card .upload-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 8px;
}

.upload-card .upload-hint {
    font-size: 14px;
    color: var(--gray-mid);
}

.upload-card input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.upload-card .preview-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: calc(var(--radius-lg) - 4px);
}

/* Recommended hairstyles in generate screen */
.recommended-hairstyles {
    margin-bottom: 32px;
}

.recommend-hint {
    font-size: 14px;
    color: var(--gray-dark);
    text-align: center;
    margin-bottom: 16px;
}

.recommend-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
}

.recommend-gallery img {
    width: 100%;
    aspect-ratio: 3/4;
    object-fit: cover;
    border-radius: var(--radius);
    border: 2px solid transparent;
    transition: var(--transition);
    cursor: pointer;
}

.recommend-gallery img:hover {
    border-color: var(--accent);
    transform: scale(1.03);
    box-shadow: var(--shadow);
}

.recommend-gallery img.selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent);
}

.generate-actions {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}

/* Result */
.result-image-container {
    text-align: center;
    margin-top: 40px;
    animation: slideUp 0.5s ease;
}

.result-image-container img {
    max-width: 100%;
    max-height: 600px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.result-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-top: 32px;
}

/* ===================== LOADING ===================== */
.loader-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(16, 16, 16, 0.85);
    backdrop-filter: blur(12px);
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.loader-overlay.active {
    display: flex;
}

.loader-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(255,255,255,0.15);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 24px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loader-text {
    color: var(--white);
    font-size: 16px;
    letter-spacing: 1px;
}

/* ===================== CONSULTATION ===================== */
.consultation-block {
    background: var(--black);
    color: var(--white);
    border-radius: var(--radius-lg);
    padding: 48px;
    text-align: center;
    margin-top: 48px;
}

.consultation-block h2 {
    font-size: 28px;
    margin-bottom: 12px;
}

.consultation-block p {
    color: var(--gray-mid);
    font-size: 15px;
    margin-bottom: 28px;
    line-height: 1.7;
}

.contact-links {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.contact-links a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: var(--radius);
    color: var(--white);
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.5px;
    transition: var(--transition);
}

.contact-links a:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* ===================== LIGHTBOX ===================== */
.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 300;
    background: rgba(0,0,0,0.92);
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.lightbox.active {
    display: flex;
}

.lightbox img {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: var(--radius);
    object-fit: contain;
}

/* ===================== RESPONSIVE ===================== */
@media (max-width: 768px) {
    .header { padding: 0 16px; height: 52px; }
    .logo { font-size: 16px; letter-spacing: 2px; }
    main { padding-top: 52px; }
    .header-contact { display: none; }

    /* Welcome — fit in viewport */
    .welcome {
        min-height: calc(100dvh - 52px);
        padding: 24px 20px;
        justify-content: center;
    }
    .welcome-badge { margin-bottom: 16px; padding: 5px 16px; font-size: 10px; }
    .welcome h1 { font-size: 28px; margin-bottom: 14px; }
    .welcome p { font-size: 15px; margin-bottom: 24px; line-height: 1.6; }
    .btn { padding: 14px 36px; font-size: 13px; }

    /* Survey — compact to fit */
    .survey-section {
        min-height: calc(100dvh - 52px);
        padding: 16px 16px;
        align-items: flex-start;
    }
    .survey-progress { margin-bottom: 16px; }
    .survey-step-label { margin-bottom: 8px; font-size: 10px; }
    .survey-card h2 { font-size: 18px; margin-bottom: 12px; line-height: 1.3; }
    .survey-image { max-height: 180px; margin-bottom: 12px; border-radius: var(--radius); }
    .survey-image.survey-image-hero { max-height: 260px; border: none; }
    /* On mobile survey is top-aligned by default; when there's no image
       center it instead so the options don't sit too high on the screen. */
    .survey-section.no-image { align-items: center; }
    .options-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .options-grid.single-col { grid-template-columns: 1fr; }
    .option-btn { padding: 10px 12px; font-size: 13px; min-height: 40px; border-width: 1.5px; }

    /* Generate — compact */
    .generate-section { padding: 16px 16px 24px; }
    .generate-header { margin-bottom: 16px; }
    .generate-header h1 { font-size: 24px; margin-bottom: 8px; }
    .generate-header p { font-size: 14px; }
    .upload-grid { grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
    .upload-card { min-height: 160px; padding: 20px 12px; border-radius: var(--radius); }
    .upload-card .upload-icon { width: 36px; height: 36px; margin-bottom: 10px; }
    .upload-card .upload-label { font-size: 10px; letter-spacing: 1.5px; margin-bottom: 4px; }
    .upload-card .upload-hint { font-size: 12px; }
    .recommended-hairstyles { margin-bottom: 16px; }
    .recommend-hint { font-size: 13px; margin-bottom: 10px; }
    .recommend-gallery { grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 8px; }
    .generate-actions .btn { padding: 12px 28px; }
    .btn-small { padding: 8px 20px; font-size: 12px; }

    /* Results — compact but scrollable */
    .results-section { padding: 16px 16px 32px; }
    .results-header { margin-bottom: 24px; }
    .results-header h1 { font-size: 24px; margin-bottom: 8px; }
    .results-header p { font-size: 14px; }
    .result-block { padding: 20px; margin-bottom: 16px; border-radius: var(--radius); }
    .result-block-label { font-size: 10px; margin-bottom: 8px; }
    .result-block h2 { font-size: 20px; margin-bottom: 10px; }
    .result-block p { font-size: 14px; line-height: 1.6; margin-bottom: 8px; }
    .result-block .recommendation-text { padding: 14px 16px; font-size: 14px; line-height: 1.6; margin-top: 12px; }
    .ref-gallery { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 8px; margin-top: 16px; }
    .divider-section { padding: 32px 0; }
    .divider-section .line { margin: 0 auto 20px; }
    .divider-section h2 { font-size: 22px; margin-bottom: 10px; }
    .divider-section p { font-size: 14px; margin: 0 auto 20px; }
    .consultation-block { padding: 24px 16px; margin-top: 24px; border-radius: var(--radius); }
    .consultation-block h2 { font-size: 20px; margin-bottom: 8px; }
    .consultation-block p { font-size: 13px; margin-bottom: 20px; }
    .contact-links { gap: 10px; }
    .contact-links a { padding: 10px 20px; font-size: 13px; }

    /* Result image */
    .result-image-container { margin-top: 24px; }
    .result-image-container img { max-height: 400px; }
    .result-actions { margin-top: 20px; gap: 10px; }
}

@media (max-width: 380px) {
    .welcome h1 { font-size: 24px; }
    .welcome p { font-size: 14px; line-height: 1.5; margin-bottom: 20px; }
    .survey-card h2 { font-size: 16px; margin-bottom: 10px; }
    .survey-image { max-height: 140px; margin-bottom: 10px; }
    .option-btn { padding: 8px 10px; font-size: 12px; min-height: 36px; }
    .upload-card { min-height: 130px; padding: 16px 10px; }
    .generate-header h1 { font-size: 20px; }
}
