/* ============================================================
   BAILE DE SAPIÃOS — Design System
   Identidade visual alinhada ao cartaz oficial do evento:
   verde-tradição, vinho e dourado sobre uma base escura,
   com toque de "app profissional". Totalmente responsivo.
   ============================================================ */

/* ===== VARIÁVEIS ===== */
:root {
    --bg:          #12151a;
    --bg-card:     #1a1f24;
    --bg-input:    #222831;
    --bg-hover:    #272e38;
    --accent:      #e0a92e;
    --accent-dark: #b3820f;
    --brand-green: #1f6b4d;
    --brand-green-dark: #123c2b;
    --brand-red:   #a5342f;
    --text:        #eceef2;
    --text-muted:  #838a9c;
    --border:      #2a303c;
    --success:     #2fa374;
    --danger:      #d1483f;
    --info:        #3b82f6;
    --warning:     #e08a2c;
    --purple:      #8b5cf6;
    --navbar-h:    62px;
    --radius:      12px;
    --radius-sm:   7px;
    --shadow:      0 8px 28px rgba(0,0,0,.5);
    --shadow-sm:   0 2px 10px rgba(0,0,0,.32);
    --t:           0.18s ease;
    --font-display: 'Fraunces', 'Georgia', serif;
    --font-body:   'Inter', 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background:
        radial-gradient(1100px 500px at 12% -10%, rgba(31,107,77,.14), transparent 60%),
        radial-gradient(900px 480px at 100% 0%, rgba(224,169,46,.08), transparent 55%),
        var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { opacity: .85; }

h1, h2, h3, .page-title, .section-header, .form-title, .login-logo h1, .navbar-brand {
    font-family: var(--font-display);
}

/* ===== NAVBAR ===== */
.navbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--navbar-h);
    background: #12151ac2;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    border-image: linear-gradient(90deg, var(--brand-green), var(--accent), var(--brand-red)) 1;
    border-bottom-width: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 20px;
    gap: 8px;
    z-index: 1000;
}


.navbar-brand {
    color: var(--accent);
    font-weight: 600;
    font-size: 1.15em;
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
    flex-shrink: 0;
    text-decoration: none;
    letter-spacing: -.2px;
}
.navbar-brand i { font-size: 1.1em; }

.navbar-menu {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-left: auto;
    flex-wrap: nowrap;
}

.nav-link {
    color: var(--text-muted);
    font-size: 13.5px;
    font-weight: 500;
    padding: 7px 12px;
    border-radius: var(--radius-sm);
    transition: color var(--t), background var(--t);
    display: flex;
    align-items: center;
    gap: 7px;
    white-space: nowrap;
    text-decoration: none;
}
.nav-link:hover { color: var(--text); background: var(--bg-hover); opacity: 1; }
.nav-link.active { color: var(--accent); background: rgba(255,204,0,.1); }
.nav-link i { font-size: 13px; }

.nav-divider {
    width: 1px;
    height: 22px;
    background: var(--border);
    margin: 0 6px;
    flex-shrink: 0;
}

.nav-user {
    color: var(--text-muted);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 4px;
}

.nav-logout {
    color: var(--danger);
    margin-left: 2px;
}
.nav-logout:hover { background: rgba(239,68,68,.12); color: var(--danger); }

/* Hamburger toggle */
.navbar-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 38px;
    height: 38px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    margin-left: auto;
    border-radius: var(--radius-sm);
    transition: background var(--t);
}
.navbar-toggle:hover { background: var(--bg-hover); }
.navbar-toggle span {
    display: block;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: transform var(--t), opacity var(--t);
}
.navbar-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.navbar-toggle.open span:nth-child(2) { opacity: 0; }
.navbar-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ===== MAIN CONTENT ===== */
.main-content {
    padding: calc(var(--navbar-h) + 28px) 24px 48px;
    max-width: 1240px;
    margin: 0 auto;
}

/* ===== PAGE HEADER ===== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 28px;
}

.page-title {
    font-size: 1.75em;
    font-weight: 700;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 12px;
    line-height: 1.2;
}
.page-title i { font-size: .85em; opacity: .9; }

.badge-ano {
    background: var(--accent);
    color: #111;
    font-size: 0.5em;
    padding: 3px 10px;
    border-radius: 20px;
    font-weight: 700;
    vertical-align: middle;
    line-height: 1.8;
}

.page-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

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

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    border: none;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: filter var(--t), opacity var(--t);
    color: #fff;
    text-decoration: none;
    white-space: nowrap;
    line-height: 1.4;
}
.btn:hover { filter: brightness(1.15); opacity: 1; }
.btn i { font-size: 13px; }

.btn-success  { background: var(--success); }
.btn-danger   { background: var(--danger); }
.btn-info     { background: var(--info); }
.btn-secondary{ background: #4b5563; }
.btn-purple   { background: var(--purple); }
.btn-accent   { background: var(--accent); color: #111; }
.btn-warning  { background: var(--warning); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }

/* Active filter button state */
.btn-filter { background: #30344a; color: var(--text-muted); }
.btn-filter.active, .btn-filter:hover { background: var(--info); color: #fff; filter: none; }
.btn-filter.active { filter: none; opacity: 1; }

/* ===== SELECT STYLED ===== */
select.select-styled {
    background: var(--bg-input);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-size: 13.5px;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%237b7f9e' d='M1.41 0L6 4.58 10.59 0 12 1.41l-6 6-6-6z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 34px;
    transition: border-color var(--t);
}
select.select-styled:focus { outline: none; border-color: var(--accent); }

/* ===== FILTERS BAR ===== */
.filters-bar {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.filters-bar .divider {
    width: 1px; height: 28px;
    background: var(--border);
    flex-shrink: 0;
}

.totals-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
    padding-top: 14px;
    margin-top: 14px;
    border-top: 1px solid var(--border);
    font-size: 14px;
    font-weight: 600;
}
.total-label { color: var(--text-muted); font-weight: 400; }
.total-pago { color: var(--success); }
.total-nao-pago { color: var(--danger); }
.total-pendente { color: var(--warning); }

/* ===== TABLES ===== */
.table-wrapper {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    padding: 12px 16px;
    text-align: left;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    background: rgba(255,255,255,.02);
}

tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 14.5px;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--bg-hover); }

.td-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

/* Estado badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.badge-pago   { background: rgba(34,197,94,.15);  color: var(--success); }
.badge-nao-pago { background: rgba(239,68,68,.15); color: var(--danger); }
.badge-pendente { background: rgba(249,115,22,.15); color: var(--warning); }

/* ===== STATS GRID ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 22px;
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 4px; height: 100%;
    border-radius: 4px 0 0 4px;
}
.stat-card.c-accent::before  { background: var(--accent); }
.stat-card.c-success::before { background: var(--success); }
.stat-card.c-danger::before  { background: var(--danger); }
.stat-card.c-warning::before { background: var(--warning); }
.stat-card.c-info::before    { background: var(--info); }

.stat-icon {
    font-size: 1.6em;
    margin-bottom: 10px;
    opacity: .85;
}
.stat-icon.c-accent  { color: var(--accent); }
.stat-icon.c-success { color: var(--success); }
.stat-icon.c-danger  { color: var(--danger); }
.stat-icon.c-warning { color: var(--warning); }
.stat-icon.c-info    { color: var(--info); }

.stat-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 1.9em;
    font-weight: 700;
    line-height: 1.1;
}
.stat-value.c-success { color: var(--success); }
.stat-value.c-danger  { color: var(--danger); }
.stat-value.c-warning { color: var(--warning); }
.stat-value.c-accent  { color: var(--accent); }

/* ===== SECTION HEADER ===== */
.section-header {
    font-size: 1.1em;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.section-header i { color: var(--accent); }

/* ===== FORMS ===== */
.form-page {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    min-height: calc(100vh - var(--navbar-h));
    padding: calc(var(--navbar-h) + 28px) 20px 40px;
}

.form-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px 36px;
    width: 100%;
    max-width: 480px;
    box-shadow: var(--shadow);
}

.form-title {
    font-size: 1.4em;
    font-weight: 700;
    color: var(--accent);
    text-align: center;
    margin-bottom: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 18px;
}
.form-group:last-of-type { margin-bottom: 0; }

.form-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .5px;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="email"],
input[type="tel"],
select,
textarea {
    width: 100%;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text);
    font-size: 15px;
    transition: border-color var(--t), box-shadow var(--t);
    -webkit-appearance: none;
    appearance: none;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(255,204,0,.15);
}
input::placeholder { color: var(--text-muted); }

select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%237b7f9e' d='M1.41 0L6 4.58 10.59 0 12 1.41l-6 6-6-6z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 34px;
    cursor: pointer;
}

.form-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 24px;
}
.form-actions .btn { justify-content: center; width: 100%; padding: 13px; font-size: 15px; }

.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.alert-danger  { background: rgba(209,72,63,.15);  color: #f3a29c; border: 1px solid rgba(209,72,63,.35); }
.alert-success { background: rgba(47,163,116,.15);  color: #8fe0bf; border: 1px solid rgba(47,163,116,.35); }

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}
.empty-state i { font-size: 2.5em; margin-bottom: 12px; opacity: .4; display: block; }
.empty-state p { font-size: 1em; }

/* ===== LOGIN PAGE ===== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}
.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px 36px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow);
}
.login-logo {
    text-align: center;
    margin-bottom: 32px;
}
.login-logo i { font-size: 2.5em; color: var(--accent); display: block; margin-bottom: 10px; }
.login-logo h1 { font-size: 1.4em; color: var(--text); font-weight: 700; }
.login-logo p  { color: var(--text-muted); font-size: 13px; margin-top: 4px; }

/* ===== MENU CARDS (index.php) ===== */
.menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    max-width: 900px;
    margin: 0 auto;
}
.menu-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px 24px;
    text-align: center;
    color: var(--text);
    text-decoration: none;
    transition: border-color var(--t), background var(--t), transform var(--t);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}
.menu-card:hover {
    border-color: var(--accent);
    background: var(--bg-hover);
    transform: translateY(-2px);
    opacity: 1;
}
.menu-card i { font-size: 2em; color: var(--accent); }
.menu-card span { font-size: 1em; font-weight: 600; }

/* ===== BALANCO PAGE ===== */
.report-stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 460px;
    margin: 0 auto;
}
.report-btn {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    border-radius: var(--radius);
    color: #fff;
    text-decoration: none;
    font-size: 1em;
    font-weight: 600;
    transition: filter var(--t);
}
.report-btn:hover { filter: brightness(1.12); opacity: 1; }
.report-btn i { font-size: 1.4em; }

/* ===== RESPONSIVE ===== */
@media (max-width: 820px) {
    .navbar-toggle { display: flex; }

    .navbar-menu {
        display: none;
        position: fixed;
        top: var(--navbar-h);
        left: 0; right: 0;
        background: var(--bg-card);
        border-bottom: 1px solid var(--border);
        flex-direction: column;
        align-items: stretch;
        padding: 10px 16px 16px;
        gap: 2px;
        margin-left: 0;
        box-shadow: 0 8px 24px rgba(0,0,0,.6);
    }
    .navbar-menu.open { display: flex; }

    .nav-link {
        padding: 12px 14px;
        font-size: 14.5px;
        border-radius: var(--radius-sm);
    }
    .nav-divider { width: 100%; height: 1px; margin: 6px 0; }
    .nav-user { padding: 12px 14px; font-size: 13.5px; }

    .main-content { padding: calc(var(--navbar-h) + 18px) 14px 36px; }
    .form-card { padding: 24px 20px; }
    .login-card { padding: 32px 22px; }

    /* Tabelas em cards no mobile */
    .table-wrapper thead { display: none; }
    .table-wrapper tbody tr {
        display: block;
        border-bottom: 1px solid var(--border);
        padding: 4px 0;
    }
    .table-wrapper tbody tr:last-child { border-bottom: none; }
    .table-wrapper tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 9px 16px;
        border-bottom: 1px solid rgba(255,255,255,.04);
        font-size: 14px;
    }
    .table-wrapper tbody td::before {
        content: attr(data-label);
        font-size: 11px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: .5px;
        color: var(--text-muted);
        flex-shrink: 0;
        margin-right: 12px;
    }
    .table-wrapper tbody td:last-child { border-bottom: none; }
    .td-actions { justify-content: flex-end; }
    .td-actions::before { display: none; }

    .stats-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
    .page-title { font-size: 1.45em; }

    .filters-bar { gap: 8px; padding: 14px 16px; }
    .filters-bar .divider { display: none; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .page-actions { width: 100%; }
}

/* ===== SCROLLBAR (sensação de app) ===== */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 20px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-dark); }
html { scrollbar-color: var(--border) var(--bg); scrollbar-width: thin; }

/* ===== HERO / PÁGINA PÚBLICA (partilhado com index.html) =====
   Pensado para caber sempre num só ecrã, sem scroll vertical:
   usa 100dvh + clamp() para encolher consoante a altura disponível. */
html, body { height: 100%; }

.hero-page {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(6px, 2vh, 20px) 20px;
    text-align: center;
    box-sizing: border-box;
}
.hero-page .container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(6px, 1.6vh, 16px);
    max-height: 100%;
    min-height: 0;
}
.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(224,169,46,.12);
    border: 1px solid rgba(224,169,46,.35);
    color: var(--accent);
    font-size: clamp(10.5px, 1.7vh, 12.5px);
    font-weight: 700;
    letter-spacing: .5px;
    text-transform: uppercase;
    padding: clamp(4px, .9vh, 6px) 14px;
    border-radius: 20px;
    flex-shrink: 0;
}
.hero-poster {
    width: auto;
    max-width: 90%;
    height: auto;
    max-height: clamp(120px, 34vh, 420px);
    object-fit: contain;
    border-radius: 16px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    flex-shrink: 1;
    min-height: 0;
}
.hero-countdown {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: clamp(10px, 2vh, 22px) clamp(16px, 4vw, 26px);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    width: 100%;
    max-width: 480px;
    flex-shrink: 0;
}
.hero-countdown h2 {
    margin: 0 0 clamp(4px, 1.2vh, 16px);
    color: var(--accent);
    font-size: clamp(.85em, 2.1vh, 1.3em);
    font-weight: 600;
}
.hero-timer { display: flex; justify-content: center; gap: clamp(10px, 2.8vw, 22px); }
.hero-timer div { display: flex; flex-direction: column; align-items: center; }
.hero-timer .value {
    font-family: var(--font-display);
    font-size: clamp(1.15em, 3.6vh, 2.3em);
    font-weight: 600;
    color: var(--text);
    line-height: 1;
}
.hero-timer .label {
    font-size: clamp(.55em, 1.3vh, .7em);
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-muted);
    margin-top: 4px;
}
.hero-actions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: clamp(8px, 1.6vw, 14px);
    flex-shrink: 0;
}
.hero-footer {
    font-size: clamp(.62em, 1.3vh, .8em);
    color: var(--text-muted);
    flex-shrink: 0;
}
@media (max-height: 700px) {
    .install-hint { display: none; }
}
