/* ============================================================
   Tokens
   ============================================================ */
:root {
    --bg: #0B0E14;
    --surface: #131722;
    --surface-2: #1B2130;
    --border: #262D3D;
    --text: #EDEFF3;
    --muted: #8992A6;

    --brand: #E4362A;
    --brand-dark: #A81D14;

    --pc: #7C5CFC;
    --xbox: #3FCB53;
    --ps5: #2E8BFF;
    --danger: #FF5470;
    --danger-2: #FF7A8F;

    --radius: 14px;
    --radius-sm: 8px;

    --font-display: 'Space Grotesk', sans-serif;
    --font-body: 'Inter', sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    min-height: 100vh;
}

body {
    background-image:
        radial-gradient(circle at 15% 10%, rgba(228, 54, 42, 0.12), transparent 40%),
        radial-gradient(circle at 85% 90%, rgba(168, 29, 20, 0.10), transparent 40%);
}

h1, h2, h3 { font-family: var(--font-display); margin: 0; }
p { margin: 0; color: var(--muted); }

button { font-family: var(--font-body); cursor: pointer; }

a { color: inherit; }

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

:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

/* ============================================================
   Layout genérico — página de autenticação
   ============================================================ */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.auth-card {
    width: 100%;
    max-width: 440px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 36px 32px;
    box-shadow: 0 30px 60px -20px rgba(0,0,0,0.6);
}

.auth-brand {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 6px;
}

.auth-brand .dot { color: var(--brand); }

.auth-brand h1 {
    font-size: 22px;
    letter-spacing: -0.01em;
}

.auth-sub {
    margin-bottom: 28px;
    font-size: 14px;
}

/* --- Tabs Login / Registar --- */
.auth-tabs {
    display: flex;
    background: var(--surface-2);
    border-radius: 999px;
    padding: 4px;
    margin-bottom: 28px;
}

.auth-tab {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--muted);
    padding: 10px 0;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.2s, color 0.2s;
}

.auth-tab.active {
    background: var(--brand);
    color: #fff;
}

.auth-view { display: none; }
.auth-view.active { display: block; }

/* --- Campos --- */
.field {
    margin-bottom: 16px;
}

.field label {
    display: block;
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 6px;
}

.field input {
    width: 100%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-size: 15px;
    transition: border-color 0.2s;
}

.field input:focus {
    border-color: var(--brand);
    outline: none;
}

.field input[type="file"] {
    padding: 8px 10px;
    font-size: 13px;
    color: var(--muted);
}

.btn {
    width: 100%;
    border: none;
    border-radius: var(--radius-sm);
    padding: 13px 18px;
    font-size: 15px;
    font-weight: 600;
    transition: filter 0.15s, transform 0.1s;
}

.btn:hover { filter: brightness(1.1); }
.btn:active { transform: scale(0.99); }

.btn-primary {
    background: var(--brand);
    color: #fff;
}

.btn-secondary {
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-danger {
    background: transparent;
    color: var(--danger-2);
    border: 1px solid rgba(255, 84, 112, 0.35);
}

.btn-danger:hover { background: rgba(255, 84, 112, 0.08); }

.btn-row {
    display: flex;
    gap: 10px;
    margin-top: 22px;
}

.form-msg {
    font-size: 13px;
    margin-top: 14px;
    min-height: 16px;
}

.form-msg.error { color: var(--danger-2); }
.form-msg.success { color: var(--xbox); }

/* --- Wizard de registo (escolha da plataforma) --- */
.wizard-steps {
    display: flex;
    gap: 6px;
    margin-bottom: 24px;
}

.wizard-steps span {
    height: 3px;
    flex: 1;
    background: var(--border);
    border-radius: 2px;
    transition: background 0.2s;
}

.wizard-steps span.done { background: var(--brand); }

.wizard-step { display: none; }
.wizard-step.active { display: block; }

.wizard-title {
    font-size: 16px;
    margin-bottom: 4px;
}

.wizard-hint {
    font-size: 13px;
    margin-bottom: 20px;
}

.platform-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 8px;
}

.platform-card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 18px 8px;
    text-align: center;
    color: var(--muted);
    font-family: var(--font-display);
    font-size: 13px;
    letter-spacing: 0.02em;
    transition: border-color 0.15s, box-shadow 0.15s, color 0.15s;
}

.platform-card .glyph {
    display: block;
    font-size: 22px;
    margin-bottom: 8px;
}

.platform-card[data-platform="PC"]:hover,
.platform-card[data-platform="PC"].selected {
    border-color: var(--pc);
    color: var(--text);
    box-shadow: 0 0 0 3px rgba(124, 92, 252, 0.18);
}

.platform-card[data-platform="XBOX"]:hover,
.platform-card[data-platform="XBOX"].selected {
    border-color: var(--xbox);
    color: var(--text);
    box-shadow: 0 0 0 3px rgba(63, 203, 83, 0.18);
}

.platform-card[data-platform="PS5"]:hover,
.platform-card[data-platform="PS5"].selected {
    border-color: var(--ps5);
    color: var(--text);
    box-shadow: 0 0 0 3px rgba(46, 139, 255, 0.18);
}

/* ============================================================
   Dashboard
   ============================================================ */
.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 28px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.topbar h1 {
    font-size: 18px;
}

.topbar h1 .dot { color: var(--brand); }

#logout-btn {
    width: auto;
    padding: 9px 18px;
    font-size: 13px;
}

.tabs-nav {
    display: flex;
    gap: 4px;
    padding: 0 28px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    overflow-x: auto;
}

.tab-btn {
    border: none;
    background: transparent;
    color: var(--muted);
    padding: 14px 18px;
    font-size: 14px;
    font-weight: 600;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
}

.tab-btn.active {
    color: var(--text);
    border-bottom-color: var(--brand);
}

.tab-panels {
    flex: 1;
    padding: 32px 28px;
    max-width: 780px;
    width: 100%;
    margin: 0 auto;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.panel-title {
    font-size: 20px;
    margin-bottom: 20px;
}

/* --- Perfil --- */
.profile-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
}

.profile-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

.profile-row:last-of-type { border-bottom: none; }

.profile-row span:first-child { color: var(--muted); }

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    font-family: var(--font-display);
}

.badge-PC { background: rgba(124, 92, 252, 0.15); color: var(--pc); }
.badge-XBOX { background: rgba(63, 203, 83, 0.15); color: var(--xbox); }
.badge-PS5 { background: rgba(46, 139, 255, 0.15); color: var(--ps5); }

.badge-admin {
    background: rgba(255, 200, 0, 0.15);
    color: #FFC800;
}

.profile-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 22px;
}

.profile-actions .btn {
    width: auto;
    flex: none;
    padding: 8px 14px;
    font-size: 13px;
    border-radius: 999px;
}

/* --- Placeholders (Sessões / Eventos / Formulários) --- */
.empty-state {
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    padding: 48px 24px;
    text-align: center;
    color: var(--muted);
    font-size: 14px;
}

.empty-state strong {
    display: block;
    color: var(--text);
    font-family: var(--font-display);
    font-size: 16px;
    margin-bottom: 8px;
}

/* --- Sessões / Eventos: listas de cartões --- */
.card-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.status-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 26px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.status-card .info {
    display: flex;
    align-items: center;
    gap: 18px;
}

.session-logo {
    width: 52px;
    height: 52px;
    object-fit: contain;
    border-radius: 10px;
    flex-shrink: 0;
    background: var(--surface-2);
    border: 1px solid var(--border);
    padding: 5px;
}

.event-image {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 10px;
    flex-shrink: 0;
    border: 1px solid var(--border);
}

.status-card .info strong {
    display: block;
    font-family: var(--font-display);
    font-size: 18px;
    margin-bottom: 6px;
}

.status-card .info span {
    font-size: 14px;
    color: var(--muted);
}

.state-pill {
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 700;
    padding: 5px 12px;
    border-radius: 999px;
    white-space: nowrap;
    letter-spacing: 0.03em;
}

.state-on { background: rgba(63, 203, 83, 0.15); color: var(--xbox); }
.state-off { background: rgba(137, 146, 166, 0.15); color: var(--muted); }
.state-live { background: rgba(255, 200, 0, 0.15); color: #FFC800; }
.state-closed { background: rgba(255, 84, 112, 0.15); color: var(--danger-2); }
.state-scheduled { background: rgba(228, 54, 42, 0.15); color: var(--brand); }

/* ============================================================
   Painel admin
   ============================================================ */
.admin-shell .tab-panels { max-width: 920px; }

.admin-section {
    margin-bottom: 40px;
}

.admin-section h2 {
    font-size: 18px;
    margin-bottom: 16px;
}

.admin-form {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    margin-bottom: 18px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px 16px;
}

.form-grid .field { margin-bottom: 0; }
.form-grid .field.full { grid-column: 1 / -1; }

.admin-form .btn {
    width: auto;
    padding: 10px 20px;
    font-size: 14px;
    margin-top: 6px;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    font-size: 14px;
}

.admin-table th, .admin-table td {
    text-align: left;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.admin-table th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}

.admin-table tr:last-child td { border-bottom: none; }

.btn-pill {
    width: auto;
    padding: 6px 14px;
    font-size: 12px;
    border-radius: 999px;
}

.admin-empty {
    font-size: 13px;
    color: var(--muted);
    padding: 8px 0;
}

/* --- Modal (mudar senha) --- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(6, 8, 12, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 50;
}

.modal-backdrop.active { display: flex; }

.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    width: 100%;
    max-width: 380px;
}

.modal h2 { font-size: 17px; margin-bottom: 18px; }

@media (max-width: 480px) {
    .auth-card { padding: 28px 20px; }
    .platform-card { padding: 14px 4px; font-size: 11px; }
}
