/* =====================================================
   Panel - Barbería El Negro
   Dorado #c9a227 · negro #0d0d0d
   ===================================================== */
:root {
    --sidebar-w: 250px;
    --gold: #c9a227;
    --gold-dark: #a6851f;
    --ink: #111;
    --bg: #f2f2ef;
    --card: #fff;
    --line: #e6e4de;
    --muted: #6f6f6f;
    --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
    --radius: 14px;
}

body.admin {
    font-family: 'Outfit', sans-serif;
    background: var(--bg);
    color: var(--ink);
}

/* ---------- Menú lateral ---------- */
.sidebar {
    --bs-offcanvas-width: 280px;
    --bs-offcanvas-bg: #0d0d0d;
    /* !important: en computadora Bootstrap le pone fondo transparente a .offcanvas-lg */
    background-color: #0d0d0d !important;
    color: #fff;
}
.sidebar-inner {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    height: 100%;
    padding: 1.25rem 1rem calc(1rem + env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
}
.sidebar .brand {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.6rem;
    letter-spacing: 2px;
    color: var(--gold);
}
.sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: rgba(255, 255, 255, 0.68);
    border-radius: 10px;
    padding: 0.65rem 0.9rem;
    margin-bottom: 2px;
    font-weight: 500;
    transition: background-color 150ms ease, color 150ms ease;
}
.sidebar .nav-link i { width: 20px; font-size: 1.05rem; }
.sidebar .nav-link.active {
    background: rgba(201, 162, 39, 0.16);
    color: var(--gold);
}
@media (hover: hover) and (pointer: fine) {
    .sidebar .nav-link:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
    .sidebar .nav-link.active:hover { background: rgba(201, 162, 39, 0.2); color: var(--gold); }
}

@media (min-width: 992px) {
    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: var(--sidebar-w);
        z-index: 100;
    }
    .main { margin-left: var(--sidebar-w); }
}

.main {
    padding: 1.5rem;
    max-width: 1400px;
}
@media (max-width: 991.98px) {
    .main { padding: 1rem 1rem calc(2rem + env(safe-area-inset-bottom, 0px)); }
    .page-head:not(:has(> :not(h4))) { display: none !important; }
}

/* ---------- Barra superior (celular) ---------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: calc(0.5rem + env(safe-area-inset-top, 0px)) 0.75rem 0.5rem;
    background: rgba(13, 13, 13, 0.95);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    color: #fff;
}
.topbar-title {
    flex: 1;
    font-weight: 600;
    font-size: 1.05rem;
    text-align: center;
}
.topbar-btn {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-size: 1.4rem;
    text-decoration: none;
}
.topbar-btn-gold { background: var(--gold); color: var(--ink); }

/* ---------- Tarjetas ---------- */
.table-card, .panel-card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 0 0 1px rgba(0, 0, 0, 0.03);
}
.panel-card-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.9rem;
    font-weight: 700;
    font-size: 1rem;
}
.panel-card-title a { font-size: 0.85rem; font-weight: 500; text-decoration: none; color: var(--gold-dark); }

/* Estadísticas */
.stat {
    background: var(--card);
    border-radius: var(--radius);
    padding: 1rem 1.1rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 0 0 1px rgba(0, 0, 0, 0.03);
    height: 100%;
    display: block;
    color: inherit;
    text-decoration: none;
    transition: transform 200ms var(--ease-out);
}
a.stat:active { transform: scale(0.98); }
.stat-label { color: var(--muted); font-size: 0.82rem; display: flex; align-items: center; gap: 0.35rem; }
.stat-value { font-size: 1.65rem; font-weight: 700; line-height: 1.2; margin-top: 0.15rem; font-variant-numeric: tabular-nums; }
.stat-sub { color: var(--muted); font-size: 0.8rem; }
.stat-gold { background: #0d0d0d; color: #fff; }
.stat-gold .stat-label, .stat-gold .stat-sub { color: rgba(255, 255, 255, 0.6); }
.stat-gold .stat-value { color: var(--gold); }
.stat-alerta { box-shadow: inset 0 0 0 2px #f0ad4e; }

/* ---------- Agenda (lista de turnos como tarjetas) ---------- */
.agenda { display: flex; flex-direction: column; gap: 0.5rem; }
.turno {
    display: grid;
    grid-template-columns: 64px 1fr auto;
    gap: 0.75rem;
    align-items: center;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    transition: border-color 150ms ease, opacity 200ms ease;
}
.turno-hora { font-weight: 700; font-size: 1.15rem; font-variant-numeric: tabular-nums; line-height: 1.1; }
.turno-hora small { display: block; font-weight: 400; font-size: 0.75rem; color: var(--muted); }
.turno-cliente { font-weight: 600; }
.turno-meta { font-size: 0.85rem; color: var(--muted); }
.turno-acciones { display: flex; gap: 0.35rem; flex-wrap: wrap; justify-content: flex-end; }
.turno-acciones form { margin: 0; }
.turno-acciones .btn { min-width: 38px; min-height: 38px; display: inline-flex; align-items: center; justify-content: center; gap: 0.3rem; }
.turno.es-ahora {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.18);
}
.turno.es-ahora .turno-hora { color: var(--gold-dark); }
.turno.finalizado { opacity: 0.6; }
.turno.finalizado:hover { opacity: 1; }
.etiqueta-ahora {
    display: inline-block;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    background: var(--gold);
    color: var(--ink);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    vertical-align: middle;
}
.hueco {
    font-size: 0.8rem;
    color: var(--muted);
    padding: 0.1rem 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.hueco::before, .hueco::after { content: ''; flex: 1; border-top: 1px dashed var(--line); }

@media (max-width: 575.98px) {
    .turno { grid-template-columns: 56px 1fr; }
    .turno-acciones { grid-column: 1 / -1; justify-content: stretch; }
    .turno-acciones > * { flex: 1; }
    .turno-acciones .btn { width: 100%; }
}

.min-w-0 { min-width: 0; }
.fecha-grupo {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gold-dark);
    margin: 1rem 0 0.25rem;
}
.fecha-grupo:first-child { margin-top: 0; }

/* Botón WhatsApp */
.btn-wa { --bs-btn-bg: #25d366; --bs-btn-border-color: #25d366; --bs-btn-color: #fff;
          --bs-btn-hover-bg: #1da851; --bs-btn-hover-border-color: #1da851; --bs-btn-hover-color: #fff;
          --bs-btn-active-bg: #178a43; --bs-btn-active-color: #fff; }
.btn-outline-wa { --bs-btn-color: #1a9c4b; --bs-btn-border-color: #25d366;
                  --bs-btn-hover-bg: #25d366; --bs-btn-hover-border-color: #25d366; --bs-btn-hover-color: #fff;
                  --bs-btn-active-bg: #1da851; --bs-btn-active-color: #fff; }

/* Semana: tira de 7 días con cantidad de turnos */
.semana { display: grid; grid-template-columns: repeat(7, 1fr); gap: 0.4rem; }
.semana-dia {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.55rem 0.25rem;
    border-radius: 12px;
    border: 1px solid var(--line);
    color: inherit;
    text-decoration: none;
    background: #fff;
    transition: border-color 150ms ease, transform 160ms var(--ease-out);
}
.semana-dia:active { transform: scale(0.96); }
.semana-dia .d { font-size: 0.72rem; color: var(--muted); text-transform: capitalize; }
.semana-dia .n { font-weight: 700; font-size: 1.05rem; }
.semana-dia .c { font-size: 0.72rem; margin-top: 0.1rem; color: var(--muted); }
.semana-dia .barra { width: 70%; height: 4px; border-radius: 4px; background: #eee; margin-top: 0.35rem; overflow: hidden; }
.semana-dia .barra span { display: block; height: 100%; background: var(--gold); border-radius: inherit; }
.semana-dia.hoy { border-color: var(--gold); }
.semana-dia.cerrado { opacity: 0.45; }
@media (hover: hover) and (pointer: fine) {
    .semana-dia:hover { border-color: var(--gold); }
}

/* Navegador de días en Turnos */
.dia-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.dia-nav .dia-actual { font-weight: 700; font-size: 1.1rem; min-width: 0; }
.vista-tabs .btn { border-radius: 999px; }

/* Compartir con QR */
.compartir-card { border: 0; border-radius: 18px; }
.qr-marco {
    width: 260px;
    padding: 18px 18px 12px;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 0 0 1px var(--line), 0 10px 30px rgba(0, 0, 0, 0.08);
}
#qr-codigo { width: 220px; height: 220px; margin: 0 auto; }
#qr-codigo img, #qr-codigo canvas { width: 220px !important; height: 220px !important; }
.qr-pie {
    margin-top: 10px;
    font-family: 'Bebas Neue', sans-serif;
    letter-spacing: 2px;
    font-size: 1.15rem;
    color: var(--gold-dark);
}
.sidebar button.nav-link { cursor: pointer; }

/* Estado vacío */
.vacio {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--muted);
}
.vacio > i { font-size: 2rem; color: var(--gold); display: block; margin-bottom: 0.5rem; }

.estado-badge { font-weight: 600; letter-spacing: 0.01em; }

/* ---------- Colores del panel ---------- */
.btn-primary {
    --bs-btn-bg: #c9a227; --bs-btn-border-color: #c9a227; --bs-btn-color: #111;
    --bs-btn-hover-bg: #a6851f; --bs-btn-hover-border-color: #a6851f; --bs-btn-hover-color: #111;
    --bs-btn-active-bg: #8f7219; --bs-btn-active-border-color: #8f7219; --bs-btn-active-color: #111;
    --bs-btn-disabled-bg: #c9a227; --bs-btn-disabled-border-color: #c9a227; --bs-btn-disabled-color: #111;
    font-weight: 600;
}
.form-control:focus, .form-select:focus, .form-check-input:focus {
    border-color: #c9a227;
    box-shadow: 0 0 0 .2rem rgba(201, 162, 39, .25);
}
.form-check-input:checked { background-color: #c9a227; border-color: #c9a227; }

/* Campos para completar: bien visibles */
.main .form-control,
.main .form-select {
    background-color: #fff;
    border: 1.5px solid #b5b5b5;
    color: #111;
    min-height: 40px;
    font-size: .95rem;
}
@media (max-width: 991.98px) {
    /* 16px: evita que el iPhone haga zoom al tocar un campo */
    .main .form-control, .main .form-select { font-size: 16px; }
}
.main .form-control:hover,
.main .form-select:hover { border-color: #6b6b6b; }
.main .form-control::placeholder { color: #9a9a9a; font-style: italic; }
.main .form-control:focus,
.main .form-select:focus {
    border-color: #c9a227;
    box-shadow: 0 0 0 .25rem rgba(201, 162, 39, .25);
}
.main .form-label { font-weight: 600; color: #333; }
.main .form-check-input { border: 1.5px solid #9a9a9a; width: 1.15em; height: 1.15em; }
.login-card .form-control::placeholder { color: #777; }

/* Tablas: un poco más de aire */
.main .table > :not(caption) > * > * { padding-top: 0.6rem; padding-bottom: 0.6rem; }
.main .table thead th { font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }

/* Tablas que en el celular se ven como tarjetas */
@media (max-width: 767.98px) {
    .tabla-cards thead { display: none; }
    .tabla-cards, .tabla-cards tbody, .tabla-cards tr, .tabla-cards td { display: block; width: 100%; }
    .tabla-cards tr {
        border: 1px solid var(--line);
        border-radius: 12px;
        padding: 0.6rem 0.8rem;
        margin-bottom: 0.6rem;
        background: #fff;
    }
    .tabla-cards td { border: 0 !important; padding: 0.2rem 0 !important; }
    .tabla-cards td[data-label]::before {
        content: attr(data-label);
        display: inline-block;
        min-width: 90px;
        color: var(--muted);
        font-size: 0.8rem;
    }
    .tabla-cards td.td-acciones { padding-top: 0.5rem !important; }
}

/* Toque en celular: sin destello y con respuesta al apretar */
html { -webkit-tap-highlight-color: transparent; }
.btn, .chip, .semana-dia, .topbar-btn { touch-action: manipulation; -webkit-user-select: none; user-select: none; }
.btn { transition: transform 160ms var(--ease-out), background-color 150ms ease, border-color 150ms ease, color 150ms ease; }
.btn:active, .chip:active, .topbar-btn:active { transform: scale(0.97); }

/* Entrada suave del contenido */
@keyframes subir {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: none; }
}
.main > * { animation: subir 320ms var(--ease-out) both; }
.main > *:nth-child(2) { animation-delay: 30ms; }
.main > *:nth-child(3) { animation-delay: 60ms; }
.main > *:nth-child(4) { animation-delay: 90ms; }
.main > *:nth-child(n+5) { animation-delay: 120ms; }

@media (prefers-reduced-motion: reduce) {
    .main > * { animation: none; }
    .btn:active, .chip:active, .topbar-btn:active, a.stat:active, .semana-dia:active { transform: none; }
}
