/* =====================================================
   MatchMovies - Estilo principal
   Visual: cinema, tema escuro, acento âmbar
   Reaproveitado e refinado do protótipo MovieMatch AI
   Fontes: Playfair Display (display) + DM Sans (corpo)
   ===================================================== */

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

:root {
    --bg: #0a0a0b;
    --surface: #111113;
    --surface2: #1a1a1e;
    --surface3: #222228;
    --amber: #e8a838;
    --amber-dim: #a06f1a;
    --amber-glow: rgba(232, 168, 56, 0.12);
    --text: #f0ede8;
    --text-muted: #8a8680;
    --text-dim: #5a5752;
    --border: rgba(255, 255, 255, 0.07);
    --border-amber: rgba(232, 168, 56, 0.25);
    --danger: #f09595;
    --success: #7fc98a;
    --radius: 12px;
    --radius-lg: 20px;
}

html { scroll-behavior: smooth; }

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

/* Grão de filme sobre a tela toda */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 1000;
    opacity: 0.4;
}

/* Tira de filme lateral */
.film-strip {
    position: fixed;
    top: 0;
    left: 0;
    width: 28px;
    height: 100vh;
    background: #0d0d0f;
    border-right: 1px solid var(--border);
    z-index: 10;
    overflow: hidden;
}
.film-strip::before {
    content: '';
    display: block;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px, transparent 8px,
        rgba(255, 255, 255, 0.04) 8px, rgba(255, 255, 255, 0.04) 22px,
        transparent 22px, transparent 30px
    );
}

/* Telas */
.screen { display: none; min-height: 100vh; padding: 0 28px 0 56px; animation: fadeSlideIn 0.5s ease; }
.screen.active { display: block; }

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

.inner { max-width: 680px; margin: 0 auto; padding: 60px 20px; }

/* Cabeçalho / logo */
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 48px;
}
.brand-icon {
    width: 32px; height: 32px;
    border: 1.5px solid var(--amber);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
}
.brand-icon svg { width: 14px; height: 14px; fill: var(--amber); }
.brand-name { font-family: 'Playfair Display', serif; font-size: 15px; color: var(--amber); letter-spacing: 0.08em; }

/* Barra de topo: login + apoio */
.topbar {
    position: fixed;
    top: 20px; right: 20px;
    z-index: 50;
    display: flex; gap: 10px; align-items: center;
}
.topbar-btn {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-family: 'DM Sans', sans-serif; font-size: 13px;
    padding: 8px 14px;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.2s;
}
.topbar-btn:hover { border-color: var(--border-amber); color: var(--amber); }

/* Botão de apoio - sempre visível, discreto (Fase 6) */
.support-btn {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 13px;
    padding: 8px 14px;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}
.support-btn:hover { border-color: var(--border-amber); color: var(--amber); }
.support-btn.highlighted {
    background: var(--amber-glow);
    border-color: var(--amber);
    color: var(--amber);
}

/* Painel do cliente */
.panel-card {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
}
.panel-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}
.panel-row:last-child { border-bottom: none; }
.panel-label { font-size: 14px; color: var(--text-muted); }
.panel-value { font-size: 14px; color: var(--text); font-weight: 500; }
.panel-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 40px; }
.panel-history-title {
    font-family: 'Playfair Display', serif; font-size: 22px;
    color: var(--text); margin-bottom: 20px;
}
.history-group { margin-bottom: 16px; }
.history-date-toggle {
    width: 100%;
    display: flex; justify-content: space-between; align-items: center;
    background: var(--surface2); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 12px 16px;
    cursor: pointer; transition: all 0.2s;
    margin-bottom: 10px;
    font-family: 'DM Sans', sans-serif;
}
.history-date-toggle:hover { border-color: var(--border-amber); }
.history-toggle-meta { display: flex; align-items: center; gap: 12px; }
.history-count { font-size: 12px; color: var(--text-dim); }
.history-chevron {
    font-size: 12px; color: var(--text-muted);
    transition: transform 0.2s;
}
.history-date-toggle.expanded .history-chevron { transform: rotate(180deg); }
.history-date {
    font-size: 12px; color: var(--amber); letter-spacing: 0.05em;
    text-transform: uppercase; margin-bottom: 0;
}
.history-items { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.history-item {
    display: flex; gap: 12px; align-items: center;
    background: var(--surface2); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 10px 14px;
}
.history-poster { width: 40px; height: 60px; border-radius: 4px; object-fit: cover; }
.history-poster-fallback {
    width: 40px; height: 60px; border-radius: 4px; background: var(--surface3);
    display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.history-item-info { flex: 1; }
.history-item-title { font-size: 15px; color: var(--text); font-weight: 500; }
.history-item-meta { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* Boas-vindas */
.welcome-eyebrow {
    font-size: 11px; font-weight: 500; letter-spacing: 0.2em;
    text-transform: uppercase; color: var(--amber); margin-bottom: 20px;
}
.welcome-title {
    font-family: 'Playfair Display', serif;
    font-size: clamp(38px, 6vw, 64px);
    font-weight: 600; line-height: 1.1; margin-bottom: 24px; color: var(--text);
}
.welcome-title em { font-style: italic; color: var(--amber); }
.welcome-desc {
    font-size: 17px; color: var(--text-muted); font-weight: 300;
    line-height: 1.7; max-width: 480px; margin-bottom: 48px;
}

/* Botões */
.btn-primary {
    display: inline-flex; align-items: center; gap: 10px;
    background: var(--amber); color: #0a0a0b;
    font-family: 'DM Sans', sans-serif; font-weight: 500; font-size: 15px;
    padding: 14px 28px; border: none; border-radius: var(--radius);
    cursor: pointer; transition: all 0.2s;
}
.btn-primary:hover { background: #f0b840; transform: translateY(-1px); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-ghost {
    display: inline-flex; align-items: center; gap: 8px;
    background: transparent; color: var(--text-muted);
    font-family: 'DM Sans', sans-serif; font-weight: 400; font-size: 14px;
    padding: 10px 18px; border: 1px solid var(--border);
    border-radius: var(--radius); cursor: pointer; transition: all 0.2s;
}
.btn-ghost:hover { border-color: rgba(255, 255, 255, 0.15); color: var(--text); }

/* Formulário / progresso */
.form-header { margin-bottom: 40px; }
.progress-track {
    width: 100%; height: 2px; background: var(--surface3);
    border-radius: 2px; overflow: hidden; margin-top: 12px;
}
.progress-fill { height: 100%; background: var(--amber); border-radius: 2px; transition: width 0.4s ease; }
.step-label { font-size: 12px; color: var(--text-dim); letter-spacing: 0.05em; }

.form-block { display: none; animation: fadeSlideIn 0.4s ease; }
.form-block.active { display: block; }

.block-tag {
    font-size: 10px; font-weight: 500; letter-spacing: 0.2em;
    text-transform: uppercase; color: var(--amber-dim); margin-bottom: 12px;
}
.block-question {
    font-family: 'Playfair Display', serif;
    font-size: clamp(22px, 4vw, 30px); font-weight: 600;
    line-height: 1.25; margin-bottom: 8px; color: var(--text);
}
.block-hint { font-size: 14px; color: var(--text-muted); margin-bottom: 32px; }

/* Grade de opções */
.options-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.options-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.options-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }

.option-card {
    position: relative;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 16px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.option-card:hover { border-color: var(--border-amber); }
.option-card.selected { border-color: var(--amber); background: var(--amber-glow); }
.option-emoji { font-size: 26px; }
.option-label { font-size: 14px; font-weight: 500; color: var(--text); }
.option-desc { font-size: 11px; color: var(--text-dim); }

.text-input {
    width: 100%;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    font-family: 'DM Sans', sans-serif; font-size: 15px;
    color: var(--text); outline: none; resize: vertical;
    transition: border-color 0.2s;
}
.text-input:focus { border-color: var(--border-amber); }

.form-nav { display: flex; justify-content: space-between; margin-top: 40px; }

/* Loading */
.loading-center {
    min-height: 100vh; display: flex; flex-direction: column;
    align-items: center; justify-content: center; text-align: center; gap: 16px;
}
.film-loader {
    width: 48px; height: 48px;
    border: 3px solid var(--surface3);
    border-top-color: var(--amber);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-title { font-family: 'Playfair Display', serif; font-size: 22px; color: var(--text); }
.loading-sub { font-size: 14px; color: var(--text-muted); }

/* Resultados */
.results-header { margin-bottom: 32px; }
.results-eyebrow {
    font-size: 11px; font-weight: 500; letter-spacing: 0.2em;
    text-transform: uppercase; color: var(--amber); margin-bottom: 12px;
}
.results-title {
    font-family: 'Playfair Display', serif;
    font-size: clamp(28px, 5vw, 40px); font-weight: 600;
    line-height: 1.15; color: var(--text); margin-bottom: 8px;
}
.results-subtitle { font-size: 15px; color: var(--text-muted); }

.result-card {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 16px;
    transition: border-color 0.2s;
}
.result-card.top-pick { border-color: var(--border-amber); }

.card-top { display: flex; gap: 16px; align-items: flex-start; }
.card-poster {
    width: 72px; height: 108px; flex-shrink: 0;
    border-radius: 8px; object-fit: cover; background: var(--surface3);
}
.card-poster-fallback {
    width: 72px; height: 108px; flex-shrink: 0;
    border-radius: 8px; background: var(--surface3);
    display: flex; align-items: center; justify-content: center;
    font-size: 28px;
}
.card-info { flex: 1; min-width: 0; }
.card-rank {
    display: inline-block;
    font-family: 'Playfair Display', serif; font-size: 13px;
    color: var(--amber); margin-bottom: 6px;
}
.card-title {
    font-family: 'Playfair Display', serif; font-size: 20px;
    font-weight: 600; color: var(--text); margin-bottom: 6px; line-height: 1.2;
}
.card-meta { font-size: 13px; color: var(--text-muted); display: flex; gap: 8px; flex-wrap: wrap; }
.card-meta .sep { color: var(--text-dim); }
.card-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.badge {
    font-size: 11px; padding: 3px 10px; border-radius: 999px;
    background: var(--surface3); color: var(--text-muted);
}
.badge-chef { background: var(--amber-glow); color: var(--amber); }
.card-synopsis { font-size: 14px; color: var(--text-muted); margin-top: 12px; line-height: 1.6; }
.card-explanation {
    font-size: 14px; color: var(--text); margin-top: 12px;
    padding: 12px 14px; background: var(--surface); border-radius: 8px;
    border-left: 2px solid var(--amber);
}
.affiliate-btn {
    display: inline-block; margin-top: 12px;
    background: transparent; border: 1px solid var(--border-amber);
    color: var(--amber); text-decoration: none;
    font-size: 13px; font-weight: 500; padding: 8px 16px; border-radius: 999px;
    transition: all 0.2s;
}
.affiliate-btn:hover { background: var(--amber-glow); }
.chef-note {
    font-size: 13px; color: var(--amber); font-style: italic;
    margin-top: 10px; display: flex; gap: 6px; align-items: flex-start;
}

/* Feedback: joinha + estrelas (Fase 6) */
.card-feedback {
    display: flex; align-items: center; gap: 16px;
    margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border);
    flex-wrap: wrap;
}
.feedback-thumbs { display: flex; gap: 8px; }
.thumb-btn {
    background: var(--surface3); border: 1px solid var(--border);
    border-radius: 999px; width: 40px; height: 40px;
    font-size: 18px; cursor: pointer; transition: all 0.2s;
    display: flex; align-items: center; justify-content: center;
}
.thumb-btn:hover { border-color: var(--border-amber); }
.thumb-btn.active-up { background: rgba(127, 201, 138, 0.15); border-color: var(--success); }
.thumb-btn.active-down { background: rgba(240, 149, 149, 0.15); border-color: var(--danger); }

.feedback-stars-toggle {
    font-size: 13px; color: var(--text-dim); cursor: pointer;
    background: none; border: none; text-decoration: underline;
}
.feedback-stars { display: none; gap: 4px; }
.feedback-stars.visible { display: flex; }
.star-btn {
    font-size: 20px; background: none; border: none; cursor: pointer;
    opacity: 0.3; transition: all 0.15s; color: var(--amber); padding: 2px;
}
.star-btn.active { opacity: 1; transform: scale(1.1); }
.feedback-done { font-size: 13px; color: var(--success); }

.results-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 24px; }

/* Mensagens de erro / vazio */
.notice {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px; margin: 20px 0;
    font-size: 15px; color: var(--text-muted);
}
.notice.error { border-color: rgba(240, 149, 149, 0.3); color: var(--danger); }

/* Modais (cadastro / apoio) */
.modal-overlay {
    display: none;
    position: fixed; inset: 0; z-index: 100;
    background: rgba(0, 0, 0, 0.7);
    align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.active { display: flex; }
.modal {
    background: var(--surface); border: 1px solid var(--border-amber);
    border-radius: var(--radius-lg); padding: 32px;
    max-width: 420px; width: 100%; animation: fadeSlideIn 0.3s ease;
}
.modal-title {
    font-family: 'Playfair Display', serif; font-size: 24px;
    color: var(--text); margin-bottom: 8px;
}
.modal-desc { font-size: 15px; color: var(--text-muted); margin-bottom: 24px; }
.modal-field { margin-bottom: 16px; }
.modal-field label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 6px; }
.modal-field input {
    width: 100%; background: var(--surface2); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 12px 14px;
    font-family: 'DM Sans', sans-serif; font-size: 15px; color: var(--text); outline: none;
}
.modal-field input:focus { border-color: var(--border-amber); }
.modal-actions { display: flex; gap: 10px; margin-top: 24px; }
.modal-close { background: none; border: none; color: var(--text-dim); cursor: pointer; font-size: 14px; }

/* Abas de cadastro/login no modal */
.auth-tabs { display: flex; gap: 8px; margin-bottom: 20px; }
.auth-tab {
    flex: 1; background: var(--surface2); border: 1px solid var(--border);
    color: var(--text-muted); font-family: 'DM Sans', sans-serif; font-size: 14px;
    padding: 10px; border-radius: var(--radius); cursor: pointer; transition: all 0.2s;
}
.auth-tab-active { background: var(--amber-glow); border-color: var(--amber); color: var(--amber); }
.modal-error { color: var(--danger); font-size: 13px; margin-top: 12px; min-height: 18px; }
.modal-success { color: var(--success); font-size: 13px; margin-top: 8px; min-height: 18px; }
.hidden-box { display: none !important; }
.link-btn { background: none; border: none; color: var(--text-muted); font-size: 13px; cursor: pointer; text-decoration: underline; font-family: 'DM Sans', sans-serif; }
.link-btn:hover { color: var(--amber); }
.checkbox-field { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 16px; cursor: pointer; }
.checkbox-field input { width: auto; margin-top: 3px; }
.checkbox-field span { font-size: 13px; color: var(--text-muted); line-height: 1.5; }

/* Botões de valor de contribuição */
.support-amounts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 16px; }
.amount-btn {
    background: var(--surface2); border: 1px solid var(--border);
    color: var(--text); font-family: 'DM Sans', sans-serif; font-size: 15px; font-weight: 500;
    padding: 14px 8px; border-radius: var(--radius); cursor: pointer; transition: all 0.2s;
}
.amount-btn:hover { border-color: var(--border-amber); }
.amount-btn.selected { background: var(--amber-glow); border-color: var(--amber); color: var(--amber); }

/* Responsivo */
@media (max-width: 600px) {
    .screen { padding: 0 0 0 36px; }
    .inner { padding: 40px 16px; }
    .options-grid, .options-grid.cols-3 { grid-template-columns: repeat(2, 1fr); }
    .options-grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
    .card-top { flex-wrap: nowrap; }
    .support-btn { top: 12px; right: 12px; }
    /* Desativa o grão no mobile (melhora performance/velocidade) */
    body::before { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* Rodapé */
.site-footer {
    text-align: center; padding: 40px 20px 32px 56px;
    font-size: 12px; color: var(--text-dim);
    display: flex; flex-direction: column; align-items: center; gap: 10px;
    border-top: 1px solid var(--border); margin-top: 60px;
}
.footer-links a { color: var(--text-muted); text-decoration: none; font-size: 13px; }
.footer-links a:hover { color: var(--amber); }
.footer-credit { color: var(--text-dim); font-size: 12px; line-height: 1.6; }
.footer-credit a { color: var(--amber); text-decoration: none; }
.footer-credit a:hover { text-decoration: underline; }
