/* ============================================
   BetAnalytics — Design System Principal
   Tema: Luxury Minimal (Gold + Dark/Light)
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@400;600&family=DM+Sans:wght@300;400;500&display=swap');

/* =====================
   Tokens: Tema Escuro (padrão)
   ===================== */
:root,
[data-theme="dark"] {
    /* Cores base */
    --bg-primary:    #0e0e10;
    --bg-secondary:  #161618;
    --bg-tertiary:   #1e1e21;
    --bg-card:       #1a1a1d;
    --bg-input:      #232328;
    --bg-hover:      #25252a;

    /* Ouro — cor primária */
    --gold-50:       #fdf8ed;
    --gold-100:      #f7e9c3;
    --gold-200:      #edd48a;
    --gold-300:      #e0bc52;
    --gold-400:      #c9a227;   /* primário */
    --gold-500:      #a8851a;
    --gold-600:      #846712;
    --gold-700:      #5e490c;

    --accent:        var(--gold-400);
    --accent-hover:  var(--gold-300);
    --accent-muted:  rgba(201, 162, 39, 0.12);
    --accent-border: rgba(201, 162, 39, 0.30);

    /* Texto */
    --text-primary:   #f0ede8;
    --text-secondary: #8e8b84;
    --text-muted:     #5a5754;
    --text-inverse:   #0e0e10;

    /* Bordas */
    --border:         rgba(255, 255, 255, 0.07);
    --border-strong:  rgba(255, 255, 255, 0.14);

    /* Estado */
    --success:        #2e7d52;
    --success-bg:     rgba(46, 125, 82, 0.12);
    --danger:         #c0392b;
    --danger-bg:      rgba(192, 57, 43, 0.12);
    --warning:        #c9a227;
    --warning-bg:     rgba(201, 162, 39, 0.10);
    --info:           #2980b9;
    --info-bg:        rgba(41, 128, 185, 0.12);

    /* Sombras */
    --shadow-sm:  0 1px 3px rgba(0,0,0,0.4);
    --shadow-md:  0 4px 16px rgba(0,0,0,0.5);
    --shadow-lg:  0 8px 32px rgba(0,0,0,0.6);
    --shadow-gold: 0 0 24px rgba(201, 162, 39, 0.15);

    /* Outros */
    --radius-sm:  6px;
    --radius-md:  10px;
    --radius-lg:  16px;
    --radius-xl:  24px;

    --font-display: 'Cormorant Garamond', Georgia, serif;
    --font-body:    'DM Sans', system-ui, sans-serif;

    --transition: 200ms ease;
}

/* =====================
   Tokens: Tema Claro
   ===================== */
[data-theme="light"] {
    --bg-primary:    #faf9f7;
    --bg-secondary:  #f3f1ec;
    --bg-tertiary:   #ebe8e0;
    --bg-card:       #ffffff;
    --bg-input:      #f3f1ec;
    --bg-hover:      #ede9e0;

    --accent:        var(--gold-500);
    --accent-hover:  var(--gold-600);
    --accent-muted:  rgba(168, 133, 26, 0.10);
    --accent-border: rgba(168, 133, 26, 0.25);

    --text-primary:   #1a1814;
    --text-secondary: #6b6760;
    --text-muted:     #a09d97;
    --text-inverse:   #faf9f7;

    --border:         rgba(0, 0, 0, 0.08);
    --border-strong:  rgba(0, 0, 0, 0.16);

    --shadow-sm:  0 1px 3px rgba(0,0,0,0.08);
    --shadow-md:  0 4px 16px rgba(0,0,0,0.10);
    --shadow-lg:  0 8px 32px rgba(0,0,0,0.12);
    --shadow-gold: 0 0 24px rgba(168, 133, 26, 0.12);
}

/* =====================
   Reset e Base
   ===================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 15px;
    line-height: 1.6;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover { color: var(--accent-hover); }

a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 3px;
}

img { max-width: 100%; display: block; }

/* =====================
   Tipografia
   ===================== */
.font-display {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: -0.01em;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.2;
    color: var(--text-primary);
}

.text-sm      { font-size: 13px; }
.text-muted   { color: var(--text-secondary); }
.text-accent  { color: var(--accent); }
.text-danger  { color: var(--danger); }
.text-success { color: var(--success); }

/* =====================
   Layout Principal
   ===================== */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* =====================
   Sidebar
   ===================== */
.sidebar {
    width: 240px;
    min-height: 100vh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    transition: transform 0.3s ease, background-color 0.3s ease;
}

.sidebar-logo {
    padding: 28px 24px 20px;
    border-bottom: 1px solid var(--border);
}

.sidebar-logo-text {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 600;
    color: var(--accent);
    letter-spacing: -0.02em;
}

.sidebar-logo-sub {
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-top: 2px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-section-label {
    font-size: 10px;
    letter-spacing: 0.10em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 12px 12px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 400;
    transition: background var(--transition), color var(--transition);
    position: relative;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--accent-muted);
    color: var(--accent);
    font-weight: 500;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 20%;
    height: 60%;
    width: 3px;
    background: var(--accent);
    border-radius: 0 3px 3px 0;
}

.nav-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.7;
}

.nav-item.active .nav-icon,
.nav-item:hover .nav-icon { opacity: 1; }

.sidebar-footer {
    padding: 16px 12px;
    border-top: 1px solid var(--border);
}

.user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    transition: background var(--transition);
}

.user-card:hover { background: var(--bg-hover); }

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--accent-muted);
    border: 1px solid var(--accent-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 500;
    color: var(--accent);
    flex-shrink: 0;
    font-family: var(--font-body);
}

.user-info { min-width: 0; flex: 1; }

.user-name {
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-email {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* =====================
   Conteúdo Principal
   ===================== */
.main-content {
    flex: 1;
    margin-left: 240px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-primary);
    position: sticky;
    top: 0;
    z-index: 50;
    transition: background-color 0.3s ease;
}

.topbar-title {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 600;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-content {
    flex: 1;
    padding: 32px;
    max-width: 1100px;
    width: 100%;
    margin: 0 auto;
}

/* =====================
   Botão de Tema
   ===================== */
.theme-toggle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.theme-toggle:hover {
    border-color: var(--accent-border);
    color: var(--accent);
    background: var(--accent-muted);
}

.theme-toggle:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

/* =====================
   Cards
   ===================== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.card:hover {
    border-color: var(--border-strong);
}

.card-gold {
    border-color: var(--accent-border);
    box-shadow: var(--shadow-gold);
}

/* =====================
   Formulários
   ===================== */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 20px;
}

label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: 0.01em;
}

.input {
    width: 100%;
    padding: 11px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 15px;
    transition: border-color var(--transition), box-shadow var(--transition);
    -webkit-appearance: none;
}

.input::placeholder { color: var(--text-muted); }

.input:hover { border-color: var(--border-strong); }

.input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-muted);
}

.input.error {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.10);
}

select.input {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238e8b84' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

/* =====================
   Botões
   ===================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 22px;
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    border: none;
    text-decoration: none;
    white-space: nowrap;
    user-select: none;
    -webkit-appearance: none;
}

.btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Primário (Ouro) */
.btn-primary {
    background: var(--accent);
    color: var(--text-inverse);
}

.btn-primary:hover {
    background: var(--accent-hover);
    box-shadow: var(--shadow-gold);
}

/* Secundário */
.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--border-strong);
}

/* Ghost */
.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Danger */
.btn-danger {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid rgba(192, 57, 43, 0.20);
}

.btn-danger:hover {
    background: var(--danger);
    color: #fff;
}

.btn-lg { padding: 14px 28px; font-size: 15px; }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-full { width: 100%; }

/* =====================
   Alertas
   ===================== */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 20px;
    border: 1px solid transparent;
}

.alert-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    margin-top: 1px;
}

.alert-danger {
    background: var(--danger-bg);
    color: var(--danger);
    border-color: rgba(192, 57, 43, 0.20);
}

.alert-success {
    background: var(--success-bg);
    color: var(--success);
    border-color: rgba(46, 125, 82, 0.20);
}

.alert-warning {
    background: var(--warning-bg);
    color: var(--warning);
    border-color: rgba(201, 162, 39, 0.20);
}

.alert-info {
    background: var(--info-bg);
    color: var(--info);
    border-color: rgba(41, 128, 185, 0.20);
}

/* =====================
   Página de Autenticação
   ===================== */
.auth-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: var(--bg-primary);
}

@media (max-width: 768px) {
    .auth-page { grid-template-columns: 1fr; }
    .auth-panel-left { display: none; }
}

.auth-panel-left {
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 48px;
    position: relative;
    overflow: hidden;
}

.auth-panel-left::before {
    content: '';
    position: absolute;
    top: -80px;
    right: -80px;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: var(--accent-muted);
    filter: blur(60px);
    pointer-events: none;
}

.auth-panel-left::after {
    content: '';
    position: absolute;
    bottom: -60px;
    left: -60px;
    width: 240px;
    height: 240px;
    border-radius: 50%;
    background: var(--accent-muted);
    filter: blur(80px);
    pointer-events: none;
}

.auth-brand {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 600;
    color: var(--accent);
    letter-spacing: -0.02em;
}

.auth-brand-tag {
    font-size: 12px;
    color: var(--text-muted);
    letter-spacing: 0.10em;
    text-transform: uppercase;
    margin-top: 4px;
    font-family: var(--font-body);
}

.auth-tagline {
    font-family: var(--font-display);
    font-size: 32px;
    font-weight: 600;
    line-height: 1.25;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.auth-tagline em {
    color: var(--accent);
    font-style: normal;
}

.auth-tagline-sub {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.auth-stats {
    display: flex;
    gap: 32px;
    padding-top: 32px;
    border-top: 1px solid var(--border);
}

.auth-stat-number {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 600;
    color: var(--accent);
}

.auth-stat-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.auth-panel-right {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 48px;
}

.auth-form-wrap {
    width: 100%;
    max-width: 380px;
}

.auth-theme-toggle {
    position: absolute;
    top: 24px;
    right: 24px;
}

.auth-form-header {
    margin-bottom: 32px;
}

.auth-form-title {
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.auth-form-sub {
    font-size: 14px;
    color: var(--text-secondary);
}

.auth-divider {
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    margin: 20px 0;
    position: relative;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background: var(--border);
}

.auth-divider::before { left: 0; }
.auth-divider::after  { right: 0; }

.auth-footer-link {
    text-align: center;
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 24px;
}

/* =====================
   Spinner de loading
   ===================== */
@keyframes spin {
    to { transform: rotate(360deg); }
}

.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: inline-block;
}

/* =====================
   Responsividade
   ===================== */
@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }

    .main-content {
        margin-left: 0;
    }

    .page-content {
        padding: 20px 16px;
    }

    .topbar {
        padding: 0 16px;
    }
}

@media (max-width: 480px) {
    .auth-panel-right {
        padding: 24px 20px;
    }
}

/* =====================
   Utilitários
   ===================== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.flex          { display: flex; }
.flex-col      { flex-direction: column; }
.items-center  { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8         { gap: 8px; }
.gap-12        { gap: 12px; }
.gap-16        { gap: 16px; }
.mt-4          { margin-top: 4px; }
.mt-8          { margin-top: 8px; }
.mt-16         { margin-top: 16px; }
.mb-8          { margin-bottom: 8px; }
.mb-16         { margin-bottom: 16px; }
.mb-24         { margin-bottom: 24px; }
.w-full        { width: 100%; }

/* =====================
   Acessibilidade: Skip link
   ===================== */
.skip-link {
    position: absolute;
    top: -100%;
    left: 8px;
    background: var(--accent);
    color: var(--text-inverse);
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    z-index: 9999;
    text-decoration: none;
    transition: top 0.2s;
}

.skip-link:focus {
    top: 8px;
}

/* Animação de entrada suave */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.animate-fade-up {
    animation: fadeUp 0.4s ease forwards;
}
