/* ================================================================
   AGENDA — Dark Mode Premium CSS
   Cores: #000 fundo | #1A1A1A cards | #D4AF37 dourado | #FFF texto
   ================================================================ */

:root {
    --bg:       #000000;
    --surface:  #1A1A1A;
    --gold:     #D4AF37;
    --gold-dim: #a88c28;
    --text:     #FFFFFF;
    --text-muted: #888888;
    --border:   #2A2A2A;
    --danger:   #E53935;
    --success:  #43A047;
    --warning:  #FB8C00;
    --radius:   12px;
    --radius-sm: 8px;
    --shadow:   0 4px 24px rgba(0,0,0,.6);
    --transition: .2s ease;
    --touch: 48px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ── Typography ── */
h1 { font-size: clamp(1.5rem, 5vw, 2rem); font-weight: 700; }
h2 { font-size: clamp(1.2rem, 4vw, 1.5rem); font-weight: 600; }
h3 { font-size: 1.1rem; font-weight: 600; }
p  { color: var(--text-muted); font-size: .95rem; }

/* ── Logo ── */
.logo {
    font-size: 2rem;
    font-weight: 900;
    letter-spacing: .15em;
    color: var(--gold);
    text-transform: uppercase;
    text-align: center;
    padding: 1.5rem 0 .5rem;
    user-select: none;
}
.logo span { color: var(--text); }

/* ── Layout ── */
.app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-width: 480px;
    margin: 0 auto;
}

.page {
    flex: 1;
    padding: 1rem;
    display: none;
    flex-direction: column;
    gap: 1rem;
    animation: fadeIn .25s ease;
}
.page.active { display: flex; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Cards ── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
}

/* ── Inputs ── */
.field {
    display: flex;
    flex-direction: column;
    gap: .4rem;
}
.field label {
    font-size: .8rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: .05em;
    text-transform: uppercase;
}
.field input,
.field select,
.field textarea {
    background: #0D0D0D;
    color: var(--text);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0 1rem;
    height: var(--touch);
    font-size: 1rem;
    transition: border-color var(--transition);
    outline: none;
    width: 100%;
    -webkit-appearance: none;
}
.field textarea {
    height: auto;
    padding: .75rem 1rem;
    resize: vertical;
    min-height: 80px;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
    border-color: var(--gold);
}
.field input::placeholder { color: #555; }
.field select option { background: #111; }

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    min-height: var(--touch);
    padding: 0 1.5rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: filter var(--transition), transform var(--transition);
    letter-spacing: .04em;
    text-decoration: none;
    white-space: nowrap;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; pointer-events: none; }

.btn-primary  { background: var(--gold);    color: #000; }
.btn-outline  { background: transparent;    color: var(--gold); border: 2px solid var(--gold); }
.btn-danger   { background: var(--danger);  color: #fff; }
.btn-ghost    { background: transparent;    color: var(--text-muted); }
.btn-full     { width: 100%; }
.btn-sm       { min-height: 36px; padding: 0 1rem; font-size: .875rem; }

.btn-primary:hover  { filter: brightness(1.12); }
.btn-outline:hover  { background: var(--gold); color: #000; }

/* ── Bottom Nav ── */
.bottom-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    display: none;
    justify-content: space-around;
    padding: .5rem 0 env(safe-area-inset-bottom, .5rem);
    z-index: 100;
    max-width: 480px;
    margin: 0 auto;
}
.bottom-nav.visible { display: flex; }
.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: .4rem .8rem;
    min-width: var(--touch);
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-muted);
    font-size: .7rem;
    font-weight: 600;
    letter-spacing: .03em;
    transition: color var(--transition);
    background: none;
    border: none;
    -webkit-tap-highlight-color: transparent;
}
.nav-item .icon { font-size: 1.4rem; }
.nav-item.active { color: var(--gold); }

/* ── Section header ── */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: .5rem;
}

/* ── Service card ── */
.service-list { display: flex; flex-direction: column; gap: .75rem; }
.service-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition);
}
.service-card:hover, .service-card.selected {
    border-color: var(--gold);
    background: #1f1f00;
}
.service-card .info { flex: 1; }
.service-card .info h3 { font-size: 1rem; margin-bottom: 2px; }
.service-card .info p  { font-size: .82rem; }
.service-card .price {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gold);
    white-space: nowrap;
}

/* ── Barber card ── */
.barber-list { display: flex; flex-direction: column; gap: .75rem; }
.barber-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    transition: border-color var(--transition);
}
.barber-card:hover, .barber-card.selected { border-color: var(--gold); }
.barber-avatar {
    width: 52px; height: 52px;
    border-radius: 50%;
    background: var(--border);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
    overflow: hidden;
}
.barber-avatar img { width: 100%; height: 100%; object-fit: cover; }
.barber-card .info h3 { font-size: .95rem; }
.barber-card .info p  { font-size: .82rem; }

/* ── Calendar ── */
.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: .75rem;
}
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}
.cal-day-name {
    text-align: center;
    font-size: .7rem;
    font-weight: 700;
    color: var(--text-muted);
    padding: .25rem 0;
    letter-spacing: .06em;
}
.cal-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: .875rem;
    cursor: pointer;
    color: var(--text-muted);
    transition: background var(--transition), color var(--transition);
    min-height: 36px;
    -webkit-tap-highlight-color: transparent;
}
.cal-day:hover       { background: var(--border); color: var(--text); }
.cal-day.today       { color: var(--gold); font-weight: 700; }
.cal-day.selected    { background: var(--gold); color: #000; font-weight: 700; }
.cal-day.disabled    { opacity: .25; pointer-events: none; }
.cal-day.empty       { pointer-events: none; }

/* ── Time slots ── */
.slots-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .5rem;
}
.slot {
    padding: .6rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    text-align: center;
    cursor: pointer;
    font-size: .9rem;
    font-weight: 600;
    transition: border-color var(--transition), background var(--transition);
    min-height: var(--touch);
    display: flex;
    align-items: center;
    justify-content: center;
}
.slot:hover  { border-color: var(--gold); }
.slot.selected { background: var(--gold); border-color: var(--gold); color: #000; }

/* ── Status badge ── */
.badge {
    display: inline-block;
    padding: .2em .7em;
    border-radius: 50px;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
}
.badge-pendente   { background: #2a2000; color: var(--warning); }
.badge-confirmado { background: #002a0a; color: var(--success); }
.badge-cancelado  { background: #2a0000; color: var(--danger);  }
.badge-concluido  { background: #1a1a2a; color: #7986CB; }

/* ── Appointment card ── */
.appt-list { display: flex; flex-direction: column; gap: .75rem; }
.appt-card { display: flex; flex-direction: column; gap: .5rem; }
.appt-card .row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
}
.appt-card .datetime {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
}
.appt-card .service-name { color: var(--text-muted); font-size: .88rem; }

/* ── Admin cards ── */
.admin-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: .75rem;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    text-align: center;
}
.stat-card .number {
    font-size: 2rem;
    font-weight: 900;
    color: var(--gold);
    display: block;
}
.stat-card .label {
    font-size: .75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .06em;
}

/* ── Client search (admin) ── */
.search-bar {
    position: relative;
    display: flex;
    align-items: center;
}
.search-bar input {
    background: #0D0D0D;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: .95rem;
    height: var(--touch);
    padding: 0 1rem 0 2.75rem;
    width: 100%;
    outline: none;
    transition: border-color var(--transition);
}
.search-bar input:focus  { border-color: var(--gold); }
.search-bar .search-icon {
    position: absolute;
    left: .9rem;
    font-size: 1.1rem;
    color: var(--text-muted);
    pointer-events: none;
}

/* ── Modal ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.8);
    z-index: 200;
    display: none;
    align-items: flex-end;
    justify-content: center;
}
.modal-overlay.open { display: flex; animation: fadeIn .2s ease; }
.modal {
    background: var(--surface);
    border-radius: var(--radius) var(--radius) 0 0;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 1.5rem 1.25rem;
    padding-bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.modal-handle {
    width: 40px; height: 4px;
    background: var(--border);
    border-radius: 2px;
    align-self: center;
    margin-bottom: .5rem;
}
.modal-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
}

/* ── Toast notifications ── */
#toast-container {
    position: fixed;
    top: 1rem; right: 1rem; left: 1rem;
    z-index: 999;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    pointer-events: none;
    max-width: 400px;
    margin: 0 auto;
}
.toast {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--gold);
    border-radius: var(--radius-sm);
    padding: .75rem 1rem;
    font-size: .9rem;
    font-weight: 500;
    animation: slideIn .25s ease, fadeOut .4s ease 2.8s forwards;
    pointer-events: auto;
}
.toast.error  { border-left-color: var(--danger); }
.toast.success { border-left-color: var(--success); }

@keyframes slideIn {
    from { transform: translateY(-12px); opacity: 0; }
    to   { transform: translateY(0);     opacity: 1; }
}
@keyframes fadeOut {
    to { opacity: 0; transform: translateY(-6px); }
}

/* ── Loader ── */
.loader {
    display: flex; align-items: center; justify-content: center;
    padding: 2rem;
}
.spinner {
    width: 28px; height: 28px;
    border: 3px solid var(--border);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Empty state ── */
.empty {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--text-muted);
}
.empty .icon { font-size: 2.5rem; margin-bottom: .75rem; display: block; }

/* ── Divider ── */
.divider {
    height: 1px;
    background: var(--border);
    margin: .5rem 0;
}

/* ── Step indicator ── */
.steps {
    display: flex;
    gap: .4rem;
    padding: .5rem 0;
}
.step {
    flex: 1;
    height: 3px;
    background: var(--border);
    border-radius: 2px;
    transition: background var(--transition);
}
.step.done, .step.active { background: var(--gold); }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ── Safe area bottom padding for pages with nav ── */
.has-nav { padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }

/* ── Desktop adjustment ── */
@media (min-width: 481px) {
    .app-shell { border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
    .bottom-nav { left: 50%; transform: translateX(-50%); }
}
