/* =====================================================
   BR PIX - Stylesheet principal
   Tema: dark blue + cyan accents + gold highlights
   ===================================================== */

/* Reset & base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}
button, input, select, textarea { font-family: inherit; font-size: inherit; }
button { cursor: pointer; border: none; background: transparent; color: inherit; }
a { color: var(--accent); text-decoration: none; transition: color .2s; }
a:hover { color: var(--accent-light); }
img { max-width: 100%; height: auto; display: block; }
ul { list-style: none; }

/* Variáveis de tema */
:root {
    /* Backgrounds */
    --bg: #0a1024;
    --bg-elevated: #111a37;
    --bg-card: #131e3f;
    --bg-card-hover: #1a2750;
    --bg-input: #0d1530;

    /* Borders */
    --border: rgba(255,255,255,0.08);
    --border-strong: rgba(255,255,255,0.16);

    /* Text */
    --text: #ffffff;
    --text-muted: #94a3c4;
    --text-dim: #5a6890;

    /* Accent (cyan azul) */
    --accent: #2dd4ff;
    --accent-light: #6ee7ff;
    --accent-dark: #0099cc;
    --accent-glow: rgba(45, 212, 255, 0.4);

    /* Gold */
    --gold: #ffc83d;
    --gold-light: #ffd96b;
    --gold-dark: #d99e00;

    /* Status */
    --success: #22c55e;
    --success-bg: rgba(34, 197, 94, 0.12);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.12);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.12);
    --info: #3b82f6;

    /* Layout */
    --header-h: 64px;
    --bottom-nav-h: 64px;
    --container: 1200px;
    --radius: 12px;
    --radius-lg: 18px;
    --radius-sm: 8px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
    --shadow: 0 4px 12px rgba(0,0,0,0.3);
    --shadow-lg: 0 12px 32px rgba(0,0,0,0.4);
    --shadow-glow: 0 0 24px var(--accent-glow);

    /* Transitions */
    --t: 0.2s cubic-bezier(.4,0,.2,1);
}

/* Background pattern decorativo */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at 20% 0%, rgba(45, 212, 255, 0.08), transparent 40%),
        radial-gradient(circle at 80% 100%, rgba(255, 200, 61, 0.05), transparent 40%);
    pointer-events: none;
    z-index: 0;
}

/* =====================================================
   Container
   ===================================================== */
.container {
    width: 100%;
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 16px;
    position: relative;
    z-index: 1;
}

/* =====================================================
   Header
   ===================================================== */
.header {
    position: sticky;
    top: 0;
    height: var(--header-h);
    background: rgba(10, 16, 36, 0.85);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border-bottom: 1px solid var(--border);
    z-index: 100;
    display: flex;
    align-items: center;
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 16px;
}
.logo {
    font-family: 'Bebas Neue', 'Impact', sans-serif;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 1px;
    background: linear-gradient(135deg, #fff, var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 24px var(--accent-glow);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.logo .dot {
    color: var(--gold);
    -webkit-text-fill-color: var(--gold);
}
.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Ícone de presente */
.gift-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #1a1500;
    box-shadow: 0 4px 12px rgba(255, 200, 61, 0.3);
    transition: transform var(--t);
}
.gift-btn:hover { transform: scale(1.05); }

/* Saldo no header */
.balance-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    font-weight: 600;
    color: var(--accent);
    font-size: 14px;
}
.balance-pill svg { opacity: .8; }

/* Botão depositar com badge */
.deposit-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: #002d3d;
    font-weight: 700;
    border-radius: 999px;
    box-shadow: 0 4px 12px var(--accent-glow);
    transition: transform var(--t), box-shadow var(--t);
    font-size: 14px;
}
.deposit-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 20px var(--accent-glow); color: #002d3d; }
.deposit-btn .badge {
    position: absolute;
    top: -8px;
    right: -4px;
    background: var(--gold);
    color: #1a1500;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

/* Avatar link no header (envolve o componente .avatar do avatars.php) */
.header-avatar-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    text-decoration: none;
    border-radius: 50%;
    border: 2px solid var(--border-strong);
    overflow: visible;
    transition: transform .15s, box-shadow .15s;
    /* Força dimensões fixas pra não distorcer em layouts flex apertados */
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
    flex-shrink: 0;
    flex-grow: 0;
    aspect-ratio: 1 / 1;
    box-sizing: border-box;
    position: relative;
}
.header-avatar-link .avatar {
    border-radius: 50%;
    overflow: hidden;
}
.header-avatar-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: linear-gradient(135deg, #ffc83d, #ff9500);
    color: #0a1024;
    font-size: 10px;
    font-weight: 800;
    min-width: 20px;
    height: 20px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    border: 2px solid #0a1024;
    box-shadow: 0 0 0 1px rgba(255,200,61,0.4), 0 4px 10px rgba(255,200,61,0.4);
    animation: badgePulse 2s ease-in-out infinite;
    z-index: 2;
}
@keyframes badgePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}
.header-avatar-link:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(45,212,255,0.3);
}
.header-avatar-link .avatar {
    box-shadow: none;
    /* Garante que o avatar interno preenche o link completamente */
    width: 100% !important;
    height: 100% !important;
    flex-shrink: 0;
}
@media (max-width: 480px) {
    .header-avatar-link {
        width: 40px;
        height: 40px;
        min-width: 40px;
        min-height: 40px;
    }
}

/* Botões de auth (Login / Registrar) */
.btn-ghost {
    padding: 8px 16px;
    font-weight: 600;
    color: var(--accent);
    border-radius: var(--radius-sm);
    transition: background var(--t);
}
.btn-ghost:hover { background: rgba(45,212,255,0.08); }

/* =====================================================
   Botões base
   ===================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 14px;
    transition: all var(--t);
    border: none;
    cursor: pointer;
    line-height: 1;
}
.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: #002d3d;
    box-shadow: 0 4px 12px var(--accent-glow);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 20px var(--accent-glow); color: #002d3d; }
.btn-gold {
    background: linear-gradient(135deg, var(--gold-light), var(--gold-dark));
    color: #1a1500;
    box-shadow: 0 4px 12px rgba(255,200,61,0.3);
}
.btn-gold:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(255,200,61,0.5); color: #1a1500; }
.btn-outline {
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--accent);
}
.btn-outline:hover { background: rgba(45,212,255,0.08); }
.btn-block { width: 100%; }
.btn-lg { padding: 16px 32px; font-size: 16px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* =====================================================
   Forms
   ===================================================== */
.form-group { margin-bottom: 16px; position: relative; }
.form-label {
    display: block;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 6px;
    font-weight: 500;
}
.form-input, .form-select {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 15px;
    transition: border var(--t), box-shadow var(--t);
}
.form-input:focus, .form-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-input::placeholder { color: var(--text-dim); }

.input-group {
    position: relative;
    display: flex;
    align-items: center;
}
.input-group .form-input { padding-right: 48px; }
.input-group-prefix {
    position: absolute;
    left: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    font-weight: 600;
    pointer-events: none;
    z-index: 1;
}
.input-group .form-input.has-prefix { padding-left: 80px; }
.input-toggle {
    position: absolute;
    right: 12px;
    color: var(--text-muted);
    background: none;
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    z-index: 2;
}
.input-toggle:hover { color: var(--text); }

.checkbox {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.4;
}
.checkbox input { display: none; }
.checkbox-box {
    flex: 0 0 20px;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-strong);
    border-radius: 4px;
    transition: all var(--t);
    margin-top: 2px;
    position: relative;
}
.checkbox input:checked + .checkbox-box {
    background: var(--accent);
    border-color: var(--accent);
}
.checkbox input:checked + .checkbox-box::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 1px;
    width: 6px;
    height: 11px;
    border: solid #002d3d;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.field-error {
    color: var(--danger);
    font-size: 12px;
    margin-top: 4px;
    display: none;
}
.form-group.has-error .form-input {
    border-color: var(--danger);
}
.form-group.has-error .field-error { display: block; }

/* Strength meter (senha) */
.strength-bar {
    height: 4px;
    background: var(--bg-input);
    border-radius: 2px;
    margin-top: 8px;
    overflow: hidden;
}
.strength-bar > div {
    height: 100%;
    width: 0%;
    transition: all .3s;
    border-radius: 2px;
}
.strength-1 > div { width: 25%; background: var(--danger); }
.strength-2 > div { width: 50%; background: var(--warning); }
.strength-3 > div { width: 75%; background: var(--accent); }
.strength-4 > div { width: 100%; background: var(--success); }

/* =====================================================
   Cards
   ===================================================== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
}

/* =====================================================
   Alerts
   ===================================================== */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.alert-error { background: var(--danger-bg); color: #fecaca; border: 1px solid rgba(239,68,68,0.3); }
.alert-success { background: var(--success-bg); color: #bbf7d0; border: 1px solid rgba(34,197,94,0.3); }
.alert-warning { background: var(--warning-bg); color: #fde68a; border: 1px solid rgba(245,158,11,0.3); }
.alert-info { background: rgba(59,130,246,0.12); color: #bfdbfe; border: 1px solid rgba(59,130,246,0.3); }

/* =====================================================
   Auth pages (login / cadastro)
   ===================================================== */
.auth-page {
    min-height: calc(100vh - var(--header-h));
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}
.auth-card {
    width: 100%;
    max-width: 440px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    animation: fadeUp .5s ease-out;
}
.auth-banner {
    height: 140px;
    background:
        linear-gradient(135deg, rgba(45,212,255,0.2), rgba(255,200,61,0.2)),
        linear-gradient(180deg, #1a2750, #0a1024);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    overflow: hidden;
}
.auth-banner.has-image {
    background: #0a1024;
    padding: 0;
}
.auth-banner.has-image::before { content: none; }
.auth-banner-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.auth-banner::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 30%, rgba(255,200,61,0.3), transparent 50%);
}
.auth-banner-content {
    position: relative;
    z-index: 1;
    padding: 0 24px;
}
.auth-banner h2 {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 28px;
    letter-spacing: 1px;
    line-height: 1.1;
    color: #fff;
    margin-bottom: 6px;
}
.auth-banner h2 span {
    color: var(--gold);
    text-shadow: 0 0 20px rgba(255,200,61,0.5);
}
.auth-banner p {
    color: rgba(255,255,255,0.85);
    font-size: 13px;
}
.auth-body { padding: 28px 24px; }
.auth-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 4px;
    color: #fff;
}
.auth-subtitle {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 24px;
}
.auth-footer {
    text-align: center;
    margin-top: 16px;
    font-size: 14px;
    color: var(--text-muted);
}

/* =====================================================
   Bottom Nav (mobile)
   ===================================================== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottom-nav-h);
    background: rgba(10, 16, 36, 0.95);
    backdrop-filter: blur(16px);
    border-top: 1px solid var(--border);
    display: none;
    z-index: 90;
}
.bottom-nav-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    height: 100%;
}
.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: var(--text-muted);
    font-size: 11px;
    transition: color var(--t);
}
.bottom-nav-item.active { color: var(--accent); }
.bottom-nav-item:hover { color: var(--accent); }

@media (max-width: 768px) {
    .bottom-nav { display: block; }
    body { padding-bottom: var(--bottom-nav-h); }
}

/* =====================================================
   Animações
   ===================================================== */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
@keyframes shimmer {
    0% { background-position: -1000px 0; }
    100% { background-position: 1000px 0; }
}

.skeleton {
    background: linear-gradient(90deg, var(--bg-card) 0%, var(--bg-card-hover) 50%, var(--bg-card) 100%);
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
    border-radius: var(--radius-sm);
}

/* =====================================================
   Utilities
   ===================================================== */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.text-gold { color: var(--gold); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.font-bold { font-weight: 700; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 8px; } .gap-2 { gap: 16px; }
.hidden { display: none !important; }

/* Loading spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.2);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Scrollbar custom */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--bg-card-hover); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-dark); }

/* === Logo customizada === */
.logo-img {
    height: 36px;
    max-width: 160px;
    object-fit: contain;
    display: block;
    background: transparent;
    border: 0;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
}
@media (max-width: 480px) {
    .logo-img { height: 30px; max-width: 130px; }
}

/* === Banner global (faixa de aviso topo) === */
.global-banner {
    padding: 10px 16px;
    text-align: center;
    color: #002d3d;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.3;
}
.global-banner a {
    color: inherit;
    text-decoration: underline;
}
