/* ============================================================
   Villa Bowling — Admin Design System
   Lilás/rosa degradê, glass, sombras suaves — visual "impactante"
   ============================================================ */

:root {
    --primary: #8039ea;
    --primary-dark: #5f21b8;
    --primary-light: #a466f0;
    --accent: #fe0070;
    --accent-light: #ff4d9a;
    --bg: #f4f2fb;
    --surface: #ffffff;
    --surface-soft: #faf8ff;
    --border: #ece7fa;
    --text: #241a35;
    --text-muted: #8a80a3;
    --ok: #16b378;
    --warn: #ff9f1c;
    --danger: #ef3b5c;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow-soft: 0 10px 30px rgba(128, 57, 234, 0.10);
    --shadow-strong: 0 20px 50px rgba(128, 57, 234, 0.18);
    --grad-brand: linear-gradient(135deg, #8039ea 0%, #a24af0 45%, #fe0070 100%);
    --grad-soft: linear-gradient(135deg, #f3ecff 0%, #fdeef6 100%);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    font-family: "Onest", "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }
input, select, textarea, button {
    font-family: "Onest", "Segoe UI", sans-serif;
}

/* ---------- Login ---------- */
.login-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--grad-brand);
    position: relative;
    overflow: hidden;
    padding: 20px;
}
.login-shell::before, .login-shell::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(10px);
    opacity: .5;
}
.login-shell::before { width: 500px; height: 500px; background: rgba(255,255,255,.12); top: -180px; left: -160px; }
.login-shell::after { width: 400px; height: 400px; background: rgba(255,255,255,.10); bottom: -160px; right: -140px; }

.login-card {
    position: relative;
    width: 100%;
    max-width: 400px;
    background: rgba(255,255,255,0.97);
    border-radius: 22px;
    padding: 40px 32px 32px;
    box-shadow: var(--shadow-strong);
    backdrop-filter: blur(6px);
}
.login-logo {
    text-align: center;
    margin-bottom: 22px;
}
.login-logo .brand-logo-img {
    width: 130px;
    height: 130px;
    object-fit: contain;
    border-radius: 20px;
    display: block;
    margin: 0 auto;
    box-shadow: 0 10px 24px rgba(128,57,234,.25);
}
.login-logo h1 { font-size: 18px; margin: 0; font-weight: 600; letter-spacing: .3px; }
.login-logo p { margin: 0; font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; font-weight: 600; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .6px; color: var(--text-muted); margin-bottom: 6px; }
.field input {
    width: 100%;
    padding: 13px 14px;
    border-radius: 10px;
    border: 2px solid var(--border);
    background: var(--surface-soft);
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    outline: none;
    transition: .2s;
}
.field input:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 4px rgba(128,57,234,.10); }

.btn-primary {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 12px;
    background: var(--grad-brand);
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: .6px;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(128,57,234,.30);
    transition: transform .15s, box-shadow .15s;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(128,57,234,.4); }

.alert { padding: 12px 14px; border-radius: 10px; font-size: 13px; font-weight: 600; margin-bottom: 16px; }
.alert-error { background: #fff0f5; color: var(--danger); border-left: 4px solid var(--danger); }
.alert-ok { background: #eafff6; color: var(--ok); border-left: 4px solid var(--ok); }

/* ---------- App shell ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 240px;
    flex-shrink: 0;
    background: linear-gradient(180deg, #2a1650 0%, #4a1f8f 55%, #7a2fce 100%);
    color: #fff;
    padding: 22px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 200;
    transition: transform .25s ease;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 22px; }
.sidebar-logo-img { width: 42px; height: 42px; object-fit: contain; border-radius: 10px; background: rgba(255,255,255,.95); padding: 3px; }
.sidebar-brand strong { font-size: 14px; display: block; }
.sidebar-brand span { font-size: 10px; opacity: .7; text-transform: uppercase; letter-spacing: .5px; }
.sidebar-close-mobile { display: none; }

.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 12px;
    border-radius: 10px;
    font-size: 13px; font-weight: 600;
    color: rgba(255,255,255,.75);
    transition: .15s;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { background: rgba(255,255,255,.16); color: #fff; box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); }

.sidebar-footer { margin-top: auto; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.12); }
.sidebar-user { font-size: 12px; opacity: .85; padding: 8px 12px; }
.sidebar-user strong { display: block; font-size: 13px; }

.main {
    flex: 1;
    min-width: 0;
    padding: 26px 32px 60px;
    margin-left: 240px;
    width: calc(100% - 240px);
}

.topbar {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 24px;
    gap: 12px;
    flex-wrap: wrap;
}
.topbar h1 { font-size: 22px; margin: 0; font-weight: 600; }
.topbar p { margin: 2px 0 0; font-size: 13px; color: var(--text-muted); font-weight: 600; }
.hamburger-btn {
    display: none;
    width: 40px; height: 40px; border-radius: 10px; border: none;
    background: var(--surface); box-shadow: var(--shadow-soft);
    align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0;
}
.hamburger-btn svg { width: 20px; height: 20px; color: var(--primary); }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(20,10,35,.5); z-index: 190; }
.sidebar-overlay.show { display: block; }

/* ---------- Responsivo ---------- */
@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); box-shadow: 0 0 40px rgba(0,0,0,.3); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-close-mobile {
        display: flex; align-items: center; justify-content: center;
        position: absolute; top: 18px; right: 14px;
        width: 30px; height: 30px; border-radius: 8px; border: none;
        background: rgba(255,255,255,.15); color: #fff; font-size: 18px; cursor: pointer;
    }
    .main { margin-left: 0; width: 100%; padding: 18px 16px 50px; }
    .hamburger-btn { display: flex; }
    .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr !important; }
    table.data-table { display: block; overflow-x: auto; white-space: nowrap; }
    .form-grid-2 { grid-template-columns: 1fr !important; }
    .cal-grid { grid-template-columns: repeat(7, minmax(34px, 1fr)); gap: 4px; }
    .cal-daycell { min-height: 60px; padding: 5px; font-size: 11px; }
    .cal-daycell .day-count { font-size: 9px; }
    .unit-tabs { flex-wrap: wrap; }
}
@media (max-width: 560px) {
    .cal-daycell { min-height: 44px; }
    .cal-daycell .occ-bar, .cal-daycell .day-count { display: none; }
    .modal-box { max-width: 100%; }
    .topbar h1 { font-size: 18px; }
}

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.pill-pendente { background: #fff4e0; color: var(--warn); }
.pill-confirmado { background: #e6fbf3; color: var(--ok); }
.pill-cancelado { background: #ffe9ee; color: var(--danger); }
.pill-finalizado { background: #eee9fb; color: var(--primary); }

/* ---------- Cards / grid ---------- */
.grid { display: grid; gap: 18px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2,1fr); } .grid-3 { grid-template-columns: repeat(2,1fr);} }

.card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border);
}

.stat-card { position: relative; overflow: hidden; }
.stat-card .icon-wrap {
    width: 42px; height: 42px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    background: var(--grad-soft); color: var(--primary); margin-bottom: 14px;
}
.stat-card .icon-wrap svg { width: 20px; height: 20px; }
.stat-card .stat-value { font-size: 28px; font-weight: 600; letter-spacing: -0.5px; }
.stat-card .stat-label { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .4px; margin-top: 2px; }
.stat-card.brand { background: var(--grad-brand); color: #fff; border: none; }
.stat-card.brand .icon-wrap { background: rgba(255,255,255,.18); color: #fff; }
.stat-card.brand .stat-label { color: rgba(255,255,255,.8); }

.section-title { font-size: 15px; font-weight: 600; margin: 0 0 14px; display: flex; align-items: center; gap: 8px; }

/* ---------- Tables ---------- */
table.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--text-muted); font-weight: 600; padding: 10px 12px; border-bottom: 2px solid var(--border); }
table.data-table td { padding: 12px; border-bottom: 1px solid var(--border); font-weight: 600; }
table.data-table tr:hover td { background: var(--surface-soft); }

.btn-sm { padding: 7px 12px; border-radius: 8px; border: none; font-size: 12px; font-weight: 600; cursor: pointer; }
.btn-ok { background: #e6fbf3; color: var(--ok); }
.btn-ok:hover { background: var(--ok); color: #fff; }
.btn-danger { background: #ffe9ee; color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-outline { background: #fff; border: 2px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }

/* ---------- Calendar ---------- */
.cal-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; gap: 12px; }
.unit-switch { display: flex; gap: 8px; background: var(--surface-soft); padding: 6px; border-radius: 12px; border: 1px solid var(--border); }
.unit-switch button { border: none; background: transparent; padding: 8px 16px; border-radius: 8px; font-weight: 600; font-size: 12px; color: var(--text-muted); cursor: pointer; }
.unit-switch button.active { background: var(--grad-brand); color: #fff; box-shadow: 0 6px 16px rgba(128,57,234,.3); }

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.cal-daycell {
    background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
    min-height: 108px; padding: 8px; cursor: pointer; transition: .15s;
    display: flex; flex-direction: column; gap: 6px;
}
.cal-daycell:hover { border-color: var(--primary-light); box-shadow: var(--shadow-soft); }
.cal-daycell.empty { background: transparent; border: none; cursor: default; }
.cal-daycell .daynum { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.cal-daycell.today .daynum { color: var(--primary); }
.cal-daycell .occ-bar { height: 6px; border-radius: 4px; background: var(--border); overflow: hidden; }
.cal-daycell .occ-bar span { display: block; height: 100%; background: var(--grad-brand); }
.cal-daycell .day-count { font-size: 11px; font-weight: 600; color: var(--text-muted); }
.day-badges { display: flex; flex-direction: column; gap: 2px; }
.badge-mini { font-size: 9px; font-weight: 600; padding: 2px 5px; border-radius: 5px; line-height: 1.5; white-space: nowrap; }
.badge-confirmado { background: #e6fbf3; color: var(--ok); }
.badge-pendente { background: #fff4e0; color: var(--warn); }
.badge-cancelado { background: #ffe9ee; color: var(--danger); }
.badge-disp { background: var(--grad-soft); color: var(--primary); font-weight: 700; }
@media (max-width: 900px) {
    .badge-mini { font-size: 7px; padding: 1px 3px; }
}
@media (max-width: 560px) {
    .day-badges { display: none; }
}
.cal-weekday { font-size: 11px; font-weight: 600; text-transform: uppercase; color: var(--text-muted); text-align: center; padding-bottom: 4px; }

/* ---------- Modal ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(36,26,53,.55); backdrop-filter: blur(3px); display: none; align-items: center; justify-content: center; z-index: 999; padding: 20px; }
.modal-overlay.show { display: flex; }
.modal-box { background: #fff; border-radius: 18px; width: 100%; max-width: 480px; max-height: 88vh; overflow-y: auto; box-shadow: var(--shadow-strong); }
.modal-header { padding: 20px 24px; background: var(--grad-brand); color: #fff; border-radius: 18px 18px 0 0; display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { margin: 0; font-size: 15px; font-weight: 600; }
.modal-unit-tag { display: inline-block; margin-top: 4px; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; background: rgba(255,255,255,.2); padding: 3px 9px; border-radius: 999px; }
.modal-header button { background: rgba(255,255,255,.2); border: none; color: #fff; width: 28px; height: 28px; border-radius: 8px; cursor: pointer; font-size: 15px; }
.modal-body { padding: 22px 24px; }
.modal-footer { padding: 16px 24px 22px; display: flex; gap: 10px; }

.detail-row { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px dashed var(--border); font-size: 13px; }
.detail-row span:first-child { color: var(--text-muted); font-weight: 600; }
.detail-row span:last-child { font-weight: 600; text-align: right; }

.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 11px; font-weight: 600; text-transform: uppercase; color: var(--text-muted); margin-bottom: 6px; letter-spacing: .4px; }
.pistas-hero {
    background: var(--grad-soft); border: 2px solid var(--primary-light); border-radius: 14px;
    padding: 16px 18px; margin-bottom: 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.pistas-hero-label { display: flex; flex-direction: column; gap: 2px; }
.pistas-hero-label strong { font-size: 14px; font-weight: 600; color: var(--text); }
.pistas-hero-label span { font-size: 11px; font-weight: 600; color: var(--primary); }
.pistas-hero-stepper { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
.pistas-btn {
    width: 40px; height: 40px; border-radius: 10px; border: none; background: var(--grad-brand); color: #fff;
    font-size: 20px; font-weight: 600; cursor: pointer; display: flex; align-items: center; justify-content: center;
    box-shadow: 0 6px 14px rgba(128,57,234,.3); transition: .15s;
}
.pistas-btn:hover { transform: translateY(-1px); }
.pistas-btn:disabled { opacity: .35; cursor: not-allowed; transform: none; box-shadow: none; }
.pistas-val { font-size: 22px; font-weight: 600; min-width: 26px; text-align: center; color: var(--text); }

.form-row input, .form-row select, .form-row textarea {
    width: 100%; padding: 11px 12px; border-radius: 9px; border: 2px solid var(--border);
    font-size: 13px; font-weight: 600; font-family: inherit; outline: none; background: var(--surface-soft);
}
.form-row input:focus, .form-row select:focus, .form-row textarea:focus { border-color: var(--primary); background: #fff; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.checkbox-list { background: var(--surface-soft); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.form-row label.checkbox-item {
    display: flex; align-items: center; gap: 8px;
    text-transform: none; letter-spacing: normal;
    font-size: 13px; font-weight: 600; color: var(--text);
    margin-bottom: 8px; cursor: pointer;
}
.form-row label.checkbox-item:last-child { margin-bottom: 0; }
.form-row label.checkbox-item input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }

.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.empty-state svg { width: 40px; height: 40px; margin-bottom: 10px; opacity: .4; }

/* ---------- Tabs (unidades) — mesmo visual "pill" das outras telas ---------- */
.unit-tabs { display: flex; gap: 8px; margin-bottom: 20px; background: var(--surface); padding: 6px; border-radius: 12px; box-shadow: var(--shadow-soft); border: 1px solid var(--border); flex-wrap: wrap; }
.unit-tab-btn {
    border: none; background: transparent; padding: 10px 18px; border-radius: 8px;
    font-weight: 600; font-size: 12px; color: var(--text-muted); cursor: pointer; transition: .15s;
}
.unit-tab-btn:hover { color: var(--primary); }
.unit-tab-btn.active { background: var(--grad-brand); color: #fff; box-shadow: 0 6px 16px rgba(128,57,234,.3); }
.unit-tab-btn.add-tab { color: var(--ok); }
.unit-tab-btn.add-tab.active { background: linear-gradient(135deg, #16b378 0%, #0e9c68 100%); box-shadow: 0 6px 16px rgba(22,179,120,.3); }
.unit-tab-pane { display: none; }
.unit-tab-pane.active { display: block; }

/* ---------- Filtro de período (dashboard) ---------- */
.period-filter { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; background: var(--surface); padding: 8px; border-radius: 12px; box-shadow: var(--shadow-soft); border: 1px solid var(--border); }
.period-filter button { border: none; background: transparent; padding: 8px 14px; border-radius: 8px; font-weight: 600; font-size: 12px; color: var(--text-muted); cursor: pointer; }
.period-filter button.active { background: var(--grad-brand); color: #fff; }
.period-filter input[type="date"] { padding: 7px 10px; border-radius: 8px; border: 2px solid var(--border); font-size: 12px; font-weight: 600; font-family: inherit; }

/* ---------- Ações inline em tabela ---------- */
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.icon-btn { width: 30px; height: 30px; border-radius: 8px; border: none; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; transition: .15s; }
.icon-btn svg { width: 15px; height: 15px; }
.icon-btn.edit { background: var(--grad-soft); color: var(--primary); }
.icon-btn.edit:hover { background: var(--primary); color: #fff; }
.icon-btn.danger { background: #ffe9ee; color: var(--danger); }
.icon-btn.danger:hover { background: var(--danger); color: #fff; }
