/* ============================================
   TriVale - Frontend Styles
   ============================================ */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --tv-bg: #F0F2F5;
    --tv-white: #FFFFFF;
    --tv-text: #333333;
    --tv-text-muted: #9E9E9E;
    --tv-green: #4CAF50;
    --tv-green-hover: #43A047;
    --tv-orange: #FF9800;
    --tv-orange-hover: #FB8C00;
    --tv-grey: #9E9E9E;
    --tv-grey-hover: #757575;
    --tv-purple: #673AB7;
    --tv-purple-dark: #804674;
    --tv-purple-btn: #804674;
    --tv-input-border: #E0E0E0;
    --tv-radius-pill: 999px;
    --tv-radius: 16px;
    --tv-font: 'Segoe UI', Roboto, -apple-system, BlinkMacSystemFont, sans-serif;
    --tv-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--tv-font);
    background: var(--tv-bg);
    color: var(--tv-text);
    min-height: 100vh;
    line-height: 1.5;
}

a {
    color: var(--tv-purple);
    text-decoration: none;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ---- Splash / Entrada (fullscreen) ---- */
html.splash-html,
html.splash-html body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #e91e8c;
}

.splash-page {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    display: block;
    margin: 0;
    padding: 0;
    background: #e91e8c;
    cursor: pointer;
    overflow: hidden;
}

.splash-page__img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    object-fit: cover;
    object-position: center center;
    display: block;
    border-radius: 0;
    box-shadow: none;
}

.splash-page__hint {
    position: fixed;
    bottom: max(20px, env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.85rem;
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.35);
    animation: pulse 2s infinite;
    pointer-events: none;
}

@keyframes pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* ---- Layout geral ---- */
.page {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 32px 20px 40px;
}

.page__inner {
    width: 100%;
    max-width: 400px;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 400px;
    margin-bottom: 24px;
}

.page-header__back {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(128, 70, 116, 0.12);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--tv-purple-dark);
    cursor: pointer;
    text-decoration: none;
    font-size: 1.2rem;
}

.page-header__title {
    text-align: center;
    flex: 1;
}

.page-header__title small {
    display: block;
    font-size: 0.75rem;
    color: var(--tv-text-muted);
    font-weight: 400;
}

.page-header__title strong {
    display: block;
    font-size: 1.1rem;
    color: var(--tv-text);
}

.page-header__help {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #2196F3;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #2196F3;
    cursor: pointer;
    text-decoration: none;
    font-weight: 700;
    font-size: 1rem;
}

/* ---- Logo ---- */
.logo-block {
    text-align: center;
    margin-bottom: 36px;
}

.logo-block__img {
    width: 100%;
    max-width: 280px;
    margin: 0 auto;
}

.logo-block--sm {
    margin-bottom: 24px;
}

.logo-block--sm .logo-block__img {
    max-width: 220px;
}

/* ---- Formulários ---- */
.form-section-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--tv-text);
    margin-bottom: 20px;
}

.form-stack {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.form-field {
    position: relative;
}

.form-field input,
.form-field select,
.form-field textarea {
    width: 100%;
    padding: 16px 20px;
    border: 1px solid var(--tv-input-border);
    border-radius: var(--tv-radius-pill);
    background: var(--tv-white);
    font-family: var(--tv-font);
    font-size: 1rem;
    color: var(--tv-text);
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

.form-field input::placeholder {
    color: var(--tv-text-muted);
}

.form-field input:focus {
    border-color: var(--tv-purple-dark);
    box-shadow: 0 0 0 3px rgba(128, 70, 116, 0.12);
}

.form-field--password input {
    padding-right: 52px;
}

.form-field__toggle {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--tv-text-muted);
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.form-field__toggle svg {
    width: 22px;
    height: 22px;
}

.form-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    color: var(--tv-text);
    cursor: pointer;
}

.form-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--tv-purple-dark);
}

.form-link {
    display: block;
    text-align: right;
    font-size: 0.9rem;
    color: var(--tv-purple);
    margin-top: -4px;
    margin-bottom: 8px;
}

.form-error {
    background: #FFF5F5;
    color: #C62828;
    border: 1px solid #FFCDD2;
    border-radius: var(--tv-radius);
    padding: 12px 16px;
    font-size: 0.9rem;
    margin-bottom: 16px;
}

.form-success {
    background: #E8F5E9;
    color: #2E7D32;
    border: 1px solid #C8E6C9;
    border-radius: var(--tv-radius);
    padding: 12px 16px;
    font-size: 0.9rem;
    margin-bottom: 16px;
}

/* ---- Botões ---- */
.btn-tv {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 16px 24px;
    border: none;
    border-radius: var(--tv-radius-pill);
    font-family: var(--tv-font);
    font-size: 1rem;
    font-weight: 700;
    color: var(--tv-white);
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
    text-decoration: none;
    text-align: center;
}

.btn-tv:active {
    transform: scale(0.98);
}

.btn-tv--green {
    background: var(--tv-green);
}

.btn-tv--green:hover {
    background: var(--tv-green-hover);
}

.btn-tv--orange {
    background: var(--tv-orange);
}

.btn-tv--orange:hover {
    background: var(--tv-orange-hover);
}

.btn-tv--grey {
    background: var(--tv-grey);
}

.btn-tv--grey:hover {
    background: var(--tv-grey-hover);
}

.btn-tv--purple {
    background: var(--tv-purple-btn);
}

.btn-tv--purple:hover {
    background: #6B3D62;
}

.btn-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

.btn-group--spaced {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid #E8E8E8;
}

/* ---- Painel do ganhador ---- */
.prize-card {
    background: var(--tv-white);
    border-radius: var(--tv-radius);
    padding: 24px;
    box-shadow: var(--tv-shadow);
    margin-bottom: 16px;
}

.prize-card__badge {
    display: inline-block;
    background: linear-gradient(135deg, #FF097F, #804674);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: var(--tv-radius-pill);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.prize-card__title {
    font-size: 1.25rem;
    font-weight: 800;
    margin-bottom: 8px;
}

.prize-card__value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--tv-green);
    margin-bottom: 8px;
}

.prize-card__desc {
    color: var(--tv-text-muted);
    font-size: 0.9rem;
}

.prize-card__meta {
    display: flex;
    justify-content: space-between;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #F0F0F0;
    font-size: 0.85rem;
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: var(--tv-radius-pill);
    font-size: 0.8rem;
    font-weight: 600;
}

.status-badge--pendente { background: #FFF3E0; color: #E65100; }
.status-badge--aprovado { background: #E8F5E9; color: #2E7D32; }
.status-badge--resgatado { background: #E3F2FD; color: #1565C0; }

.prize-celebration {
    text-align: center;
    margin-bottom: 20px;
}

.prize-celebration__emoji {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 8px;
}

.prize-celebration__subtitle {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.prize-card--highlight {
    border: 2px solid #804674;
    background: linear-gradient(180deg, #fff 0%, #fdf5fc 100%);
}

/* ---- Loading ---- */
.loading-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    padding: 40px;
    text-align: center;
}

.loading-spinner {
    width: 56px;
    height: 56px;
    border: 4px solid #E0E0E0;
    border-top-color: var(--tv-purple-dark);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-page p {
    color: var(--tv-text-muted);
    font-size: 0.95rem;
    max-width: 280px;
}

/* ---- PIX / Pagamento ---- */
.pix-box {
    background: var(--tv-white);
    border-radius: var(--tv-radius);
    padding: 24px;
    box-shadow: var(--tv-shadow);
    margin-bottom: 20px;
}

.pix-box__value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--tv-green);
    text-align: center;
    margin-bottom: 16px;
}

.pix-box__code {
    background: #F5F5F5;
    border-radius: 8px;
    padding: 12px;
    font-family: monospace;
    font-size: 0.8rem;
    word-break: break-all;
    margin-bottom: 12px;
}

.pix-box__copy {
    width: 100%;
}

.info-box {
    background: var(--tv-white);
    border-radius: var(--tv-radius);
    padding: 20px;
    box-shadow: var(--tv-shadow);
    margin-bottom: 16px;
}

.info-box h3 {
    font-size: 1rem;
    margin-bottom: 12px;
    color: var(--tv-purple-dark);
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #F0F0F0;
    font-size: 0.9rem;
}

.info-row:last-child {
    border-bottom: none;
}

.info-row span:first-child {
    color: var(--tv-text-muted);
}

/* ---- Final / Success ---- */
.success-page {
    text-align: center;
    padding: 40px 20px;
}

.success-icon {
    width: 80px;
    height: 80px;
    background: var(--tv-green);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    margin: 0 auto 24px;
}

.success-page h2 {
    font-size: 1.5rem;
    margin-bottom: 12px;
}

.success-page p {
    color: var(--tv-text-muted);
    margin-bottom: 24px;
}

@media (min-width: 768px) {
    .page {
        padding-top: 48px;
    }

    .splash-page__img {
        object-fit: contain;
        background: #e91e8c;
    }
}
