/**
 * Pocket-Sommelier - Welcome Screen + Home Layout v6
 * Splash Screen (unverändert) + Redesign: 3-Zonen Home mit Scanner, Taste Stream, Engagement
 */

/* ==================================================================
   WELCOME / SPLASH SCREEN (unverändert)
   ================================================================== */

.welcome-screen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background-color: #4B0D18;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.6s ease;
    overflow: hidden;
}

.welcome-screen.fade-out {
    opacity: 0;
    pointer-events: none;
}

.welcome-screen.hidden {
    display: none;
}

.welcome-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    transform: translateY(-8vh);
    padding: 0 2rem;
}

.welcome-logo-wrap {
    width: 150px;
    height: 150px;
    margin-bottom: 1.75rem;
    opacity: 0;
    transform: scale(0.92);
    animation: welcomeLogoIn 0.8s ease 0.2s forwards;
}

.welcome-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 1.25rem;
}

.welcome-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: #D4AF37;
    margin: 0 0 0.4rem 0;
    text-align: center;
    opacity: 0;
    transform: translateY(12px);
    animation: welcomeTextIn 0.7s ease 0.6s forwards;
}

.welcome-subtitle {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.9375rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.7);
    letter-spacing: 0.03em;
    margin: 0;
    text-align: center;
    opacity: 0;
    transform: translateY(10px);
    animation: welcomeTextIn 0.7s ease 0.9s forwards;
}

@keyframes welcomeLogoIn {
    to { opacity: 1; transform: scale(1); }
}

@keyframes welcomeTextIn {
    to { opacity: 1; transform: translateY(0); }
}


/* ==================================================================
   HOME SCREEN — REDESIGN v6 (3-Zonen Layout)
   ================================================================== */

.home-main {
    padding: calc(var(--safe-area-top, 0px) + 0.75rem) 1rem 0 1rem;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 1rem;
}


/* ---- Header: Headline + Profil-Ring ---- */

.home-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.625rem;
}

.home-headline {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.625rem;
    font-weight: 700;
    color: var(--text-primary, var(--gray-900));
    line-height: 1.15;
    letter-spacing: -0.01em;
    margin: 0;
}

/* Profil-Ring */
.home-profile-ring {
    position: relative;
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    cursor: pointer;
}

.profile-ring-svg {
    position: absolute;
    inset: -3px;
    width: 48px;
    height: 48px;
    transform: rotate(-90deg);
}

.ring-track {
    stroke: var(--border-color, var(--gray-200));
}

.ring-progress {
    stroke: var(--gold);
    stroke-dasharray: 126;
    stroke-dashoffset: 38; /* ~70% filled */
    transition: stroke-dashoffset 1.2s ease;
}

.profile-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f3e8d5 0%, #e8d5b8 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

[data-theme="dark"] .profile-avatar {
    background: linear-gradient(135deg, #3a2f1e 0%, #4a3b28 100%);
}


/* ==================================================================
   ZONE 1: SCANNER
   ================================================================== */

.zone-scanner {
    margin-bottom: 0.5rem;
}

.scan-layout {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* ---- Hero: Im Restaurant ---- */
.scan-hero {
    position: relative;
    border-radius: var(--radius-lg, 1rem);
    padding: 1.25rem 1.125rem 1.125rem;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.25s ease;
    overflow: hidden;
    background: var(--gold-gradient);
    color: white;
}

.scan-hero:active { transform: scale(0.98); }
.scan-hero:hover { box-shadow: 0 8px 30px rgba(197, 160, 89, 0.35); }

.scan-hero::before {
    content: '';
    position: absolute;
    top: -40%;
    right: -15%;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: rgba(255,255,255,0.07);
    pointer-events: none;
}

.scan-hero::after {
    content: '';
    position: absolute;
    bottom: -35%;
    left: -10%;
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: rgba(255,255,255,0.04);
    pointer-events: none;
}

.scan-hero-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    position: relative;
    z-index: 1;
}

.scan-hero-icon {
    width: 48px;
    height: 48px;
    border-radius: 13px;
    background: rgba(255,255,255,0.18);
    display: flex;
    align-items: center;
    justify-content: center;
}

.scan-hero-cta {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: rgba(255,255,255,0.22);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 0.75rem 1.375rem;
    border-radius: 9999px;
    font-size: 1.0625rem;
    font-weight: 600;
    color: white;
}

.scan-hero-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.375rem;
    font-weight: 700;
    line-height: 1.2;
    margin: 0 0 0.375rem 0;
    position: relative;
    z-index: 1;
    color: white;
}

.scan-hero-desc {
    font-size: 0.875rem;
    line-height: 1.45;
    opacity: 0.88;
    position: relative;
    z-index: 1;
    margin: 0 0 0.875rem 0;
}

.scan-hero-features {
    display: flex;
    gap: 0.4375rem;
    flex-wrap: nowrap;
    position: relative;
    z-index: 1;
}

.feature-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: rgba(255,255,255,0.16);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    padding: 0.5rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
    color: white;
    white-space: nowrap;
}

.feature-pill svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    opacity: 0.9;
}

/* ---- Scan Row: 2 Cards ---- */
.scan-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.scan-card {
    position: relative;
    border-radius: var(--radius-lg, 1rem);
    padding: 1rem 0.875rem 0.875rem;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.25s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary, white);
    border: 1.5px solid var(--border-color, var(--gray-200));
    color: var(--text-primary, var(--gray-900));
    min-height: 120px;
}

.scan-card:active { transform: scale(0.97); }
.scan-card:hover {
    border-color: var(--gold);
    box-shadow: 0 4px 20px rgba(197, 160, 89, 0.12);
}

.scan-card-icon {
    width: 42px;
    height: 42px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.625rem;
    flex-shrink: 0;
    background: rgba(197, 160, 89, 0.1);
    color: var(--gold-dark);
}

[data-theme="dark"] .scan-card-icon {
    background: rgba(197, 160, 89, 0.15);
}

.scan-card-label {
    font-size: 0.9375rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 0.125rem;
    color: var(--text-primary, var(--gray-900));
}

.scan-card-sub {
    font-size: 0.78rem;
    color: var(--text-secondary, var(--gray-600));
    line-height: 1.35;
}

.scan-card-arrow {
    position: absolute;
    bottom: 12px;
    right: 12px;
    opacity: 0.35;
    color: var(--text-tertiary, var(--gray-400));
}

.scan-new-tag {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 0.58rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.125rem 0.4375rem;
    border-radius: 9999px;
    z-index: 2;
    background: rgba(197, 160, 89, 0.12);
    color: var(--gold-dark);
}

[data-theme="dark"] .scan-new-tag {
    background: rgba(197, 160, 89, 0.2);
}


/* ==================================================================
   ZONE 2: TASTE STREAM (text-only wine cards)
   ================================================================== */

.zone-taste {
    padding-top: 0.75rem;
    display: none; /* Standardmäßig versteckt bis Bedingung erfüllt */
}

.zone-taste.visible {
    display: block;
}

.zone-taste-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.zone-taste-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary, var(--gray-900));
    margin: 0;
}

.zone-taste-link {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--gold);
    text-decoration: none;
}

.taste-carousel {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.375rem;
    margin: 0 -1rem;
    padding-left: 1rem;
    padding-right: 1rem;
    scrollbar-width: none;
}

.taste-carousel::-webkit-scrollbar { display: none; }

/* ---- Wine Card (text-only) ---- */
.wine-card {
    flex: 0 0 215px;
    scroll-snap-align: start;
    background: var(--bg-secondary, white);
    border-radius: var(--radius-lg, 1rem);
    border: 1px solid var(--border-color, var(--gray-200));
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.wine-card:active { transform: scale(0.97); }
.wine-card:hover { box-shadow: 0 6px 24px rgba(0,0,0,0.08); }

/* Color stripe */
.wine-card-stripe {
    height: 5px;
    width: 100%;
    flex-shrink: 0;
}

.wine-card--red .wine-card-stripe { background: linear-gradient(90deg, #4B0D18, #722F37, #8c2942); }
.wine-card--white .wine-card-stripe { background: linear-gradient(90deg, #D4C07A, #E8D5A0, #C5A059); }

.wine-card-body {
    padding: 0.875rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.wine-card-top-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.375rem;
}

.wine-card-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex-shrink: 0;
}

.wine-card--red .wine-card-type-badge {
    background: var(--wine-50, #fdf2f4);
    color: #9f1239;
}

.wine-card--white .wine-card-type-badge {
    background: #FFFBEB;
    color: #92400E;
}

[data-theme="dark"] .wine-card--red .wine-card-type-badge {
    background: rgba(159, 18, 57, 0.15);
    color: #fda4af;
}

[data-theme="dark"] .wine-card--white .wine-card-type-badge {
    background: rgba(212, 175, 55, 0.12);
    color: #D4AF37;
}

.wine-card-type-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.wine-card--red .wine-card-type-dot { background: #9f1239; }
.wine-card--white .wine-card-type-dot { background: #D4AF37; }

[data-theme="dark"] .wine-card--red .wine-card-type-dot { background: #fda4af; }
[data-theme="dark"] .wine-card--white .wine-card-type-dot { background: #D4AF37; }

.wine-card-price {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-primary, var(--gray-900));
    white-space: nowrap;
}

.wine-card-price span {
    font-size: 0.65rem;
    font-weight: 400;
    color: var(--text-tertiary, var(--gray-400));
}

.wine-card-name {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.025rem;
    font-weight: 700;
    color: var(--text-primary, var(--gray-900));
    line-height: 1.25;
    margin-bottom: 0.125rem;
}

.wine-card-region {
    font-size: 0.72rem;
    color: var(--text-tertiary, var(--gray-400));
    margin-bottom: 0.1875rem;
}

.wine-card-reason {
    font-size: 0.72rem;
    color: var(--text-secondary, var(--gray-600));
    line-height: 1.4;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.wine-card-footer {
    margin-top: 0.625rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color, var(--gray-200));
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.wine-card-match {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.7rem;
    font-weight: 600;
}

.wine-card-match--top { color: var(--gold-dark); }

.wine-card-match-icon { width: 14px; height: 14px; }

.wine-card-more {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--gold);
    display: flex;
    align-items: center;
    gap: 0.125rem;
}


/* ==================================================================
   ZONE 3: ENGAGEMENT
   ================================================================== */

.zone-engage {
    padding-top: 0;
}

/* Micro Task CTA */
.micro-task {
    background: var(--bg-secondary, white);
    border: 1.5px solid var(--border-color, var(--gray-200));
    border-radius: var(--radius-lg, 1rem);
    padding: 0.875rem;
    display: flex;
    gap: 0.75rem;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.micro-task:hover {
    border-color: var(--gold);
    box-shadow: 0 4px 16px rgba(197, 160, 89, 0.12);
}

.micro-task:active { transform: scale(0.98); }

.micro-task-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-light) 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.micro-task-body { flex: 1; min-width: 0; }

.micro-task-title {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary, var(--gray-900));
}

.micro-task-sub {
    display: block;
    font-size: 0.78rem;
    color: var(--text-secondary, var(--gray-600));
}

.micro-task-arrow {
    color: var(--gold);
    flex-shrink: 0;
}

/* Quick Links Grid */
.home-quick-links {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.quick-link {
    background: var(--bg-secondary, white);
    border: 1px solid var(--border-color, var(--gray-200));
    border-radius: var(--radius-lg, 1rem);
    padding: 0.875rem 0.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.quick-link:active { transform: scale(0.96); }
.quick-link:hover { border-color: var(--gold); }

.quick-link-icon {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    margin: 0 auto 0.4375rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ql-wine { background: var(--wine-50, #fdf2f4); color: var(--wine-600, #c83a5a); }
.ql-quiz { background: #FFFBEB; color: #D97706; }
.ql-learn { background: #EFF6FF; color: #2563EB; }

[data-theme="dark"] .ql-wine { background: rgba(200, 58, 90, 0.15); }
[data-theme="dark"] .ql-quiz { background: rgba(217, 119, 6, 0.15); }
[data-theme="dark"] .ql-learn { background: rgba(37, 99, 235, 0.15); }

.quick-link-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary, var(--gray-900));
}

.quick-link-sub {
    display: block;
    font-size: 0.68rem;
    color: var(--text-secondary, var(--gray-600));
    margin-top: 1px;
}


/* ==================================================================
   ANIMATIONS
   ================================================================== */

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

.home-header     { animation: homeEntryFadeUp 0.5s ease 0.04s both; }
.zone-scanner    { animation: homeEntryFadeUp 0.5s ease 0.1s both; }
.zone-taste      { animation: homeEntryFadeUp 0.5s ease 0.2s both; }
.zone-engage     { animation: homeEntryFadeUp 0.5s ease 0.3s both; }


/* ==================================================================
   RESPONSIVE
   ================================================================== */

@media (max-height: 680px) {
    .scan-hero { padding: 1rem 0.875rem; }
    .scan-hero-title { font-size: 1.15rem; }
    .scan-hero-desc { font-size: 0.8125rem; }
    .scan-card { min-height: 105px; padding: 0.875rem 0.75rem; }
    .wine-card { flex: 0 0 195px; }
    .home-headline { font-size: 1.375rem; }
    .zone-taste { padding-top: 0.625rem; }
    .zone-engage { padding-top: 0; }
}

@media (max-width: 340px) {
    .scan-card-label { font-size: 0.8125rem; }
    .scan-card-sub { font-size: 0.6875rem; }
    .feature-pill { font-size: 0.78rem; padding: 0.375rem 0.625rem; }
    .home-headline { font-size: 1.25rem; }
}

/* Splash responsive (unverändert) */
@media (max-width: 360px) {
    .welcome-logo-wrap { width: 120px; height: 120px; }
    .welcome-title { font-size: 1.2rem; }
}

@media (min-height: 800px) {
    .welcome-content { transform: translateY(-10vh); }
    .welcome-logo-wrap { width: 170px; height: 170px; margin-bottom: 2rem; }
}


/* ==================================================================
   Dark Mode (prefers-color-scheme fallback)
   ================================================================== */

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .profile-avatar {
        background: linear-gradient(135deg, #3a2f1e 0%, #4a3b28 100%);
    }
    :root:not([data-theme="light"]) .scan-card-icon {
        background: rgba(197, 160, 89, 0.15);
    }
    :root:not([data-theme="light"]) .scan-new-tag {
        background: rgba(197, 160, 89, 0.2);
    }
    :root:not([data-theme="light"]) .wine-card--red .wine-card-type-badge {
        background: rgba(159, 18, 57, 0.15);
        color: #fda4af;
    }
    :root:not([data-theme="light"]) .wine-card--white .wine-card-type-badge {
        background: rgba(212, 175, 55, 0.12);
        color: #D4AF37;
    }
    :root:not([data-theme="light"]) .wine-card--red .wine-card-type-dot { background: #fda4af; }
    :root:not([data-theme="light"]) .wine-card--white .wine-card-type-dot { background: #D4AF37; }
    :root:not([data-theme="light"]) .ql-wine { background: rgba(200, 58, 90, 0.15); }
    :root:not([data-theme="light"]) .ql-quiz { background: rgba(217, 119, 6, 0.15); }
    :root:not([data-theme="light"]) .ql-learn { background: rgba(37, 99, 235, 0.15); }
}
