/* =========================================================================
   Escolinha de Futebol — Design System (DARK ONLY)
   Camada de estilo profissional sobre o Tailwind (CDN).
   As regras usam o prefixo html.dark / seletores específicos para prevalecer
   sobre as utilitárias, unificando toda a aplicação em um único tema escuro.
   ========================================================================= */

:root {
    /* Superfícies */
    --bg:            #0a0e17;   /* fundo da aplicação */
    --bg-soft:       #0e131f;   /* faixas / cabeçalhos de tabela */
    --sidebar:       #0c111b;   /* painel lateral */
    --surface:       #141b28;   /* cards */
    --surface-2:     #1a2333;   /* inputs / elementos elevados */
    --surface-3:     #212c40;   /* hover */
    --border:        #26324a;   /* bordas */
    --border-strong: #33425f;

    /* Texto */
    --text:   #e7ecf4;
    --muted:  #96a3ba;
    --faint:  #6b7890;

    /* Marca (esmeralda) */
    --brand:        #10b981;
    --brand-2:      #34d399;
    --brand-strong: #059669;
    --brand-soft:   rgba(16, 185, 129, .12);
    --brand-ring:   rgba(16, 185, 129, .35);

    /* Estados */
    --danger: #fb7185; --danger-bg: rgba(244, 63, 94, .12); --danger-bd: rgba(244, 63, 94, .30);
    --success:#34d399; --success-bg: rgba(16, 185, 129, .12); --success-bd: rgba(16, 185, 129, .30);
    --warn:   #fbbf24; --warn-bg: rgba(245, 158, 11, .12); --warn-bd: rgba(245, 158, 11, .30);
    --info:   #38bdf8; --info-bg: rgba(56, 189, 248, .12); --info-bd: rgba(56, 189, 248, .30);

    --radius:    12px;
    --radius-sm: 9px;
    --shadow:    0 1px 2px rgba(0,0,0,.35), 0 12px 30px -18px rgba(0,0,0,.75);
    --shadow-lg: 0 24px 60px -24px rgba(0,0,0,.85);
    color-scheme: dark;
}

/* --------------------------------- Base ---------------------------------- */
html, body { background: var(--bg); }
html.dark body,
body {
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    letter-spacing: .1px;
    background-color: var(--bg);
    background-image:
        radial-gradient(1200px 600px at 100% -10%, rgba(16,185,129,.06), transparent 60%),
        radial-gradient(900px 500px at -10% 110%, rgba(56,189,248,.05), transparent 55%);
    background-attachment: fixed;
    min-height: 100vh;
}

h1, h2, h3, h4 { color: var(--text); letter-spacing: -.01em; }
hr { border-color: var(--border); }

::selection { background: var(--brand-ring); color: #fff; }

/* Scrollbar */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #45577a; }

/* ----------------------- Overrides de superfície ------------------------- */
html.dark .bg-white,
html.dark .bg-gray-50,
html.dark .bg-gray-100,
html.dark .dark\:bg-gray-800,
html.dark .dark\:bg-gray-900 { background-color: var(--surface) !important; }

html.dark body,
html.dark .bg-gray-100.dark\:bg-gray-900,
html.dark .min-h-screen { background-color: var(--bg); }

/* Zebras / cabeçalhos de tabela / inputs escuros já existentes */
html.dark .bg-gray-50,
html.dark thead,
html.dark .dark\:bg-gray-700\/50 { background-color: var(--bg-soft) !important; }

html.dark .dark\:bg-gray-700 { background-color: var(--surface-2) !important; }

/* ---------------------------- Overrides de texto ------------------------- */
html.dark .text-gray-900,
html.dark .text-gray-800,
html.dark .text-gray-700,
html.dark .dark\:text-gray-100,
html.dark .dark\:text-gray-200 { color: var(--text) !important; }

html.dark .text-gray-600,
html.dark .text-gray-500,
html.dark .dark\:text-gray-300,
html.dark .dark\:text-gray-400 { color: var(--muted) !important; }

html.dark .text-gray-400,
html.dark .text-gray-300 { color: var(--faint) !important; }

/* --------------------------- Overrides de borda -------------------------- */
html.dark .border,
html.dark .border-gray-100,
html.dark .border-gray-200,
html.dark .border-gray-300,
html.dark .dark\:border-gray-700,
html.dark .divide-gray-200 > * { border-color: var(--border) !important; }

/* -------------------------------- Cards ---------------------------------- */
html.dark .rounded-xl.shadow,
html.dark .rounded-2xl.shadow,
html.dark .rounded-xl.shadow-lg,
html.dark .shadow,
html.dark .shadow-lg,
html.dark .shadow-2xl {
    background-color: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow) !important;
}
html.dark .rounded-xl { border-radius: var(--radius); }

/* -------------------------------- Sidebar -------------------------------- */
html.dark #sidebar {
    background: var(--sidebar) !important;
    border-right: 1px solid var(--border);
    box-shadow: 0 0 40px rgba(0,0,0,.35);
}
html.dark #sidebar .border-green-700,
html.dark #sidebar .border-b,
html.dark #sidebar .border-t { border-color: var(--border) !important; }

html.dark #sidebar nav a {
    color: var(--muted);
    border-left: 3px solid transparent;
    border-radius: 0 8px 8px 0;
    margin-right: 10px;
    transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
html.dark #sidebar nav a:hover { background: var(--surface-2) !important; color: var(--text); }
html.dark #sidebar nav a.bg-green-700 {
    background: var(--brand-soft) !important;
    color: var(--brand-2) !important;
    border-left-color: var(--brand);
}
html.dark #sidebar .bg-green-600 {                 /* logo */
    background: linear-gradient(135deg, var(--brand), var(--brand-strong)) !important;
    box-shadow: 0 6px 16px -6px var(--brand);
}
html.dark #sidebar .text-green-200 { color: var(--faint) !important; }

/* -------------------------------- Header --------------------------------- */
html.dark header {
    background: rgba(15, 20, 32, .8) !important;
    border-bottom: 1px solid var(--border);
    backdrop-filter: saturate(140%) blur(10px);
    box-shadow: none !important;
}

/* -------------------------------- Botões --------------------------------- */
html.dark .bg-green-600,
html.dark .bg-green-700 {
    background-image: linear-gradient(135deg, var(--brand), var(--brand-strong)) !important;
    background-color: var(--brand) !important;
    color: #04140d !important;
    font-weight: 600;
    box-shadow: 0 8px 20px -12px var(--brand);
}
html.dark .hover\:bg-green-700:hover,
html.dark .bg-green-600:hover { filter: brightness(1.07); }

html.dark .bg-red-500, html.dark .bg-red-600 {
    background-image: linear-gradient(135deg, #f43f5e, #e11d48) !important;
    background-color: #e11d48 !important; color: #fff !important; box-shadow: 0 8px 20px -12px #f43f5e;
}
html.dark .bg-blue-600 { background-color: #2563eb !important; }

/* Botões / links com aparência de botão: raio e transição consistentes */
html.dark a[class*="bg-green-6"],
html.dark a[class*="bg-red-5"],
html.dark button,
html.dark .rounded { transition: filter .15s ease, background-color .15s ease, box-shadow .15s ease, transform .05s ease; }
html.dark button:active { transform: translateY(1px); }

/* Links de texto */
html.dark .text-green-600,
html.dark .text-green-700,
html.dark a.text-green-700,
html.dark .hover\:underline.text-green-600 { color: var(--brand-2) !important; }
html.dark a:hover { text-decoration-color: var(--brand); }

/* ---------------------------- Campos de formulário ----------------------- */
html.dark input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
html.dark select,
html.dark textarea {
    background-color: var(--surface-2) !important;
    border: 1px solid var(--border) !important;
    color: var(--text) !important;
    border-radius: var(--radius-sm) !important;
    padding: .55rem .7rem;
    transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
html.dark input::placeholder,
html.dark textarea::placeholder { color: var(--faint); }

html.dark input:not([type="checkbox"]):not([type="radio"]):focus,
html.dark select:focus,
html.dark textarea:focus {
    outline: none;
    border-color: var(--brand) !important;
    box-shadow: 0 0 0 3px var(--brand-ring) !important;
    background-color: var(--surface) !important;
}
html.dark label { color: var(--muted); }
html.dark select option { background: var(--surface-2); color: var(--text); }
html.dark input[type="file"] { color: var(--muted); }
html.dark input[type="file"]::file-selector-button {
    background: var(--surface-3); color: var(--text); border: 1px solid var(--border);
    border-radius: 8px; padding: .4rem .7rem; margin-right: .6rem; cursor: pointer;
}
html.dark input[type="checkbox"], html.dark input[type="radio"] { accent-color: var(--brand); width: 1rem; height: 1rem; }
/* Ícone de date/calendário visível no escuro */
html.dark input[type="date"]::-webkit-calendar-picker-indicator,
html.dark input[type="time"]::-webkit-calendar-picker-indicator { filter: invert(.85); opacity: .7; cursor: pointer; }

/* -------------------------------- Tabelas -------------------------------- */
html.dark table { border-collapse: collapse; width: 100%; }
html.dark thead th,
html.dark table th {
    color: var(--muted) !important;
    font-weight: 600;
    text-transform: uppercase;
    font-size: .72rem;
    letter-spacing: .04em;
    background: var(--bg-soft);
    border-bottom: 1px solid var(--border) !important;
}
html.dark tbody td { border-bottom: 1px solid var(--border) !important; color: var(--text); }
html.dark tbody tr { transition: background-color .12s ease; }
html.dark tbody tr:hover { background: rgba(255,255,255,.025); }

/* --------------------------- Alertas (flash) ----------------------------- */
html.dark .bg-red-100    { background: var(--danger-bg) !important;  border-color: var(--danger-bd) !important; }
html.dark .text-red-700, html.dark .text-red-600 { color: var(--danger) !important; }
html.dark .bg-green-100  { background: var(--success-bg) !important; border-color: var(--success-bd) !important; }
html.dark .bg-green-100.text-green-700, html.dark .text-green-700.bg-green-100 { }
html.dark .bg-blue-100   { background: var(--info-bg) !important;    border-color: var(--info-bd) !important; }
html.dark .text-blue-700 { color: var(--info) !important; }
html.dark .bg-yellow-100, html.dark .bg-amber-100 { background: var(--warn-bg) !important; border-color: var(--warn-bd) !important; }
html.dark .text-yellow-700, html.dark .text-amber-700 { color: var(--warn) !important; }

/* Emblemas / status coloridos suaves */
html.dark .bg-green-50, html.dark .bg-green-200 { background: var(--success-bg) !important; color: var(--success) !important; }
html.dark .bg-red-50,   html.dark .bg-red-200   { background: var(--danger-bg) !important;  color: var(--danger)  !important; }
html.dark .bg-yellow-50,html.dark .bg-yellow-200{ background: var(--warn-bg) !important;    color: var(--warn)    !important; }
html.dark .text-green-800 { color: var(--success) !important; }
html.dark .text-red-800   { color: var(--danger) !important; }
html.dark .text-yellow-800{ color: var(--warn) !important; }

/* ------------------------ Componentes auxiliares ------------------------- */
.required::after { content: " *"; color: var(--danger); }
.table-responsive { overflow-x: auto; }
.modal { display: none; }
.modal.open { display: flex; }
.toast-container { position: fixed; bottom: 1rem; right: 1rem; z-index: 50; }

/* Foco acessível geral */
html.dark a:focus-visible,
html.dark button:focus-visible { outline: 2px solid var(--brand-ring); outline-offset: 2px; border-radius: 6px; }

/* ----------------------- Cartão de autenticação -------------------------- */
.auth-shell {
    min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem;
    background:
        radial-gradient(900px 500px at 100% -10%, rgba(16,185,129,.14), transparent 60%),
        radial-gradient(800px 500px at -10% 110%, rgba(56,189,248,.10), transparent 55%),
        var(--bg);
}
.auth-card {
    width: 100%; max-width: 26rem; background: var(--surface);
    border: 1px solid var(--border); border-radius: 18px; padding: 2rem;
    box-shadow: var(--shadow-lg);
}
.auth-logo {
    width: 4rem; height: 4rem; display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.9rem; border-radius: 16px; color: #04140d;
    background: linear-gradient(135deg, var(--brand), var(--brand-strong));
    box-shadow: 0 12px 28px -10px var(--brand);
}
.auth-input {
    width: 100%; background: var(--surface-2); color: var(--text);
    border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .6rem .75rem;
}
.auth-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }
.auth-btn {
    width: 100%; padding: .65rem 1rem; border: 0; border-radius: var(--radius-sm); cursor: pointer;
    font-weight: 600; color: #04140d; background: linear-gradient(135deg, var(--brand), var(--brand-strong));
    box-shadow: 0 10px 24px -12px var(--brand); transition: filter .15s ease;
}
.auth-btn:hover { filter: brightness(1.07); }
.auth-link { color: var(--brand-2); }
.auth-alert { border-radius: var(--radius-sm); padding: .6rem .8rem; font-size: .85rem; border: 1px solid transparent; }
.auth-alert.err { background: var(--danger-bg); border-color: var(--danger-bd); color: var(--danger); }
.auth-alert.ok  { background: var(--success-bg); border-color: var(--success-bd); color: var(--success); }
