/* ═══════════════════════════════════════════════════════════════════
   CorpoGlow — Citas · Control de Peso · Belleza
   Tema de marca: carbón oscuro + morado + dorado (según logo).
   Estructura de navegación tomada de SystemOne.CC (dropdowns por grupo
   + buscador rápido), adaptada a SSR con CSS puro y un JS mínimo.
   ═══════════════════════════════════════════════════════════════════ */

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

:root {
    /* Fondo carbón con matiz morado */
    --bg-dark:     #16131c;
    --bg-mid:      #1e1a27;
    --bg-panel:    rgba(30, 26, 39, 0.88);

    /* Marca */
    --gold:        #d4af37;
    --gold-bright: #f0d98c;
    --gold-deep:   #a8862a;
    --rose:        #e0b490;
    --purple:      #9b72d0;
    --purple-deep: #5d3a8e;

    --text-pri:    #f2eef6;
    --text-muted:  #a89bb8;

    --card-border: rgba(212, 175, 55, 0.18);
    --line-soft:   rgba(255, 255, 255, 0.06);

    --ok-green:    #3ecf7a;
    --err-red:     #ff8a7a;
    --warn-amber:  #f0a060;

    --radius:      12px;
    --radius-sm:   7px;
    --font:        'Segoe UI', 'Inter', system-ui, -apple-system, sans-serif;
}

html, body {
    margin: 0;
    min-height: 100%;
    font-family: var(--font);
    color: var(--text-pri);
    background:
        radial-gradient(1100px 500px at 85% -10%, rgba(93, 58, 142, 0.28), transparent 60%),
        radial-gradient(900px 420px at -10% 110%, rgba(212, 175, 55, 0.10), transparent 55%),
        linear-gradient(160deg, var(--bg-dark) 0%, var(--bg-mid) 100%);
    background-attachment: fixed;
}

.app { min-height: 100vh; display: flex; flex-direction: column; }

/* ── Top bar ─────────────────────────────────────────────────────── */
.topbar {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 24px;
    background: rgba(16, 13, 22, 0.92);
    border-bottom: 1px solid var(--card-border);
    box-shadow: 0 2px 18px rgba(0, 0, 0, 0.35);
    position: sticky;
    top: 0;
    z-index: 100;
}

.brand {
    font-size: 1.12rem;
    font-weight: 800;
    letter-spacing: 2.5px;
    text-decoration: none;
    text-transform: uppercase;
    background: linear-gradient(110deg, var(--rose) 0%, var(--gold-bright) 45%, var(--gold) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    white-space: nowrap;
}
.brand::after { content: " ✦"; color: var(--gold-bright); -webkit-text-fill-color: var(--gold-bright); font-size: .8em; }

.nav { display: flex; align-items: center; gap: 4px; flex: 1; }
.nav > a {
    color: var(--text-pri);
    text-decoration: none;
    font-size: .9rem;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    transition: background-color .15s ease, color .15s ease;
    white-space: nowrap;
}
.nav > a:hover { background: rgba(255, 255, 255, 0.09); color: var(--gold-bright); }
.nav .user {
    color: var(--text-muted);
    font-size: .8rem;
    margin-left: auto;
    padding-left: 12px;
}
.inline { display: inline; margin: 0; }
.link {
    background: none; border: none; cursor: pointer; font: inherit;
    color: var(--err-red); font-size: .85rem; padding: 6px 10px;
    border: 1px solid rgba(192, 57, 43, 0.35); border-radius: var(--radius-sm);
    transition: background-color .15s ease;
}
.link:hover { background: rgba(192, 57, 43, 0.15); }

/* ── Navbar por grupos (dropdown por hover, CSS puro — apto SSR) ── */
.cg-nav-group { position: relative; }
.cg-nav-group-btn {
    display: flex; align-items: center; gap: 6px;
    background: transparent; border: none; color: var(--text-pri);
    font: inherit; font-size: .9rem; padding: 8px 12px;
    border-radius: var(--radius-sm); cursor: pointer; white-space: nowrap;
    transition: background-color .15s ease, color .15s ease;
}
.cg-caret { font-size: .6rem; opacity: .65; transition: transform .15s ease; color: var(--gold); }
.cg-nav-group:hover .cg-nav-group-btn { background: rgba(255, 255, 255, 0.09); color: var(--gold-bright); }
.cg-nav-group:hover .cg-caret { transform: rotate(180deg); }

.cg-dropdown {
    display: none;
    position: absolute; top: 100%; left: 0;
    min-width: 230px;
    background: #241f30;
    border: 1px solid var(--card-border);
    border-radius: 10px;
    box-shadow: 0 14px 38px rgba(0, 0, 0, 0.55);
    padding: 6px;
    z-index: 200;
}
/* Puente invisible para no perder el hover entre botón y menú */
.cg-dropdown::before { content: ""; position: absolute; top: -8px; left: 0; right: 0; height: 8px; }
.cg-nav-group:hover .cg-dropdown { display: block; }

.cg-dropdown a {
    display: block; padding: 9px 12px; border-radius: 6px;
    font-size: .87rem; color: var(--text-pri); text-decoration: none;
    white-space: nowrap; transition: background-color .12s ease, color .12s ease;
}
.cg-dropdown a:hover { background: rgba(155, 114, 208, 0.18); color: var(--gold-bright); }

/* ── Buscador rápido (Ctrl+K) ────────────────────────────────────── */
.cg-search-trigger {
    display: flex; align-items: center; gap: 8px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: var(--text-muted); border-radius: var(--radius-sm);
    padding: 6px 12px; cursor: pointer; font: inherit; font-size: .82rem;
    transition: background-color .15s ease;
}
.cg-search-trigger:hover { background: rgba(255, 255, 255, 0.12); color: var(--text-pri); }
.cg-search-hint {
    font-size: .68rem; border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px; padding: 1px 5px; opacity: .7;
}

.cg-search-overlay {
    position: fixed; inset: 0; background: rgba(8, 5, 14, 0.66);
    z-index: 1000; display: flex; align-items: flex-start; justify-content: center;
    padding-top: 12vh; backdrop-filter: blur(3px);
}
.cg-search-overlay[hidden] { display: none; }
.cg-search-box {
    width: 560px; max-width: 92vw;
    background: #262032; border: 1px solid var(--card-border);
    border-radius: 12px; overflow: hidden;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6);
}
.cg-search-input-row {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 16px; border-bottom: 1px solid var(--line-soft);
}
.cg-search-input {
    flex: 1; border: none; outline: none; background: transparent;
    font: inherit; font-size: 1rem; color: var(--text-pri);
}
.cg-search-esc {
    font-size: .68rem; color: var(--text-muted);
    border: 1px solid rgba(255, 255, 255, 0.18); border-radius: 4px; padding: 2px 6px;
}
.cg-search-results { max-height: 340px; overflow-y: auto; padding: 6px; }
.cg-search-results a {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: 6px;
    color: var(--text-pri); text-decoration: none; font-size: .9rem;
}
.cg-search-results a:hover,
.cg-search-results a.selected { background: rgba(155, 114, 208, 0.18); color: var(--gold-bright); }
.cg-search-results a[hidden] { display: none; }
.cg-search-group {
    font-size: .68rem; color: var(--text-muted);
    background: rgba(255, 255, 255, 0.06); border-radius: 4px;
    padding: 2px 7px; white-space: nowrap;
}
.cg-search-empty { padding: 20px; text-align: center; color: var(--text-muted); font-size: .86rem; }
.cg-search-empty[hidden] { display: none; }

/* ── Contenido ───────────────────────────────────────────────────── */
.content { max-width: 1080px; width: 100%; margin: 1.25rem auto 3rem; padding: 0 1.5rem; }

h1 {
    font-size: 1.45rem; font-weight: 650; margin: 0 0 .5rem;
    color: var(--text-pri); letter-spacing: .4px;
}
h1::after {
    content: ""; display: block; width: 64px; height: 2px; margin-top: 10px;
    background: linear-gradient(90deg, var(--gold), transparent);
}
h2 {
    font-size: .82rem; font-weight: 700; letter-spacing: 2px; text-transform: uppercase;
    color: var(--gold); margin: 2.2rem 0 .9rem;
}
h3 { color: var(--text-pri); }

a { color: var(--purple); }
.content a { color: var(--gold-bright); text-decoration: none; border-bottom: 1px solid rgba(212, 175, 55, 0.35); }
.content a:hover { color: #fff; border-bottom-color: var(--gold-bright); }

/* ── Tarjeta (login / portal) ────────────────────────────────────── */
.card {
    max-width: 400px;
    margin: 0 auto 2rem;
    padding: 1.5rem 2rem 1.5rem;
    background: var(--bg-panel);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}
.card h1 { font-size: 1.15rem; text-align: center; margin-bottom: .35rem; }
.card h1::after { margin: 8px auto 0; }
.card label { margin-bottom: .7rem; }
.card .hint { margin-bottom: .8rem; }
/* Recorte del logo: la imagen original trae mucho margen alrededor */
.card-logo {
    display: block; width: 100%; height: 120px;
    object-fit: cover; object-position: center;
    border-radius: 10px; margin-bottom: .9rem;
}

/* ── Formularios ─────────────────────────────────────────────────── */
form { max-width: 640px; }

label {
    display: block; margin-bottom: 1rem;
    font-size: .72rem; font-weight: 600;
    letter-spacing: 1.2px; text-transform: uppercase;
    color: var(--text-muted);
}

input, select, textarea {
    display: block; width: 100%; margin-top: .35rem;
    padding: .55rem .75rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: var(--radius-sm);
    color: var(--text-pri);
    font: inherit; font-size: .95rem;
    outline: none;
    transition: border-color .2s ease, box-shadow .2s ease;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.15);
}
select option { background: #241f30; color: var(--text-pri); }
input::placeholder { color: rgba(168, 155, 184, 0.55); }

/* Fix para el ícono del calendario en tema oscuro */
input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(0.8); }

label.check {
    display: flex; align-items: center; gap: .6rem;
    color: var(--text-pri); font-size: .85rem;
    text-transform: none; letter-spacing: normal; font-weight: 500;
}
label.check input { width: auto; margin: 0; accent-color: var(--gold); }

button[type="submit"] {
    padding: .6rem 1.6rem;
    background: linear-gradient(135deg, var(--gold-deep), var(--gold) 55%, var(--gold-bright));
    color: #221a08;
    border: none; border-radius: var(--radius-sm);
    font: inherit; font-size: .92rem; font-weight: 700;
    letter-spacing: .5px; cursor: pointer;
    box-shadow: 0 4px 16px rgba(212, 175, 55, 0.25);
    transition: filter .2s ease, transform .15s ease;
}
button[type="submit"]:hover { filter: brightness(1.12); transform: translateY(-1px); }
button:disabled { opacity: .4; cursor: not-allowed; }

/* ── Tablas ──────────────────────────────────────────────────────── */
.grid {
    width: 100%; border-collapse: collapse;
    margin-bottom: 1.5rem;
    background: var(--bg-panel);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    overflow: hidden;
    font-size: .86rem;
    box-shadow: 0 8px 26px rgba(0, 0, 0, 0.25);
}
.grid thead tr {
    background: rgba(93, 58, 142, 0.22);
    border-bottom: 1px solid rgba(155, 114, 208, 0.3);
}
.grid th {
    text-align: left; padding: .65rem .85rem;
    font-size: .68rem; font-weight: 700;
    letter-spacing: 1.5px; text-transform: uppercase;
    color: var(--text-muted); white-space: nowrap;
}
.grid td { padding: .6rem .85rem; border-bottom: 1px solid var(--line-soft); }
.grid tbody tr:last-child td { border-bottom: none; }
.grid tbody tr { transition: background-color .12s ease; }
.grid tbody tr:hover { background: rgba(212, 175, 55, 0.05); }

/* ── Pestañas selectoras (agenda: citas del día / disponibilidad) ── */
.cg-tabs {
    display: inline-flex;
    background: var(--bg-panel);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    padding: 4px;
    gap: 4px;
    margin-bottom: 1.1rem;
}
.cg-tabs a {
    padding: .5rem 1.3rem;
    border-radius: 5px;
    font-size: .88rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    border-bottom: none !important;
    transition: background-color .15s ease, color .15s ease;
}
.cg-tabs a:hover { color: var(--gold-bright); }
.cg-tabs a.active {
    background: linear-gradient(135deg, var(--purple-deep), var(--purple));
    color: #fff;
    box-shadow: 0 2px 10px rgba(93, 58, 142, 0.4);
}

/* ── Filtros (agenda, panel, ventas) ─────────────────────────────── */
.filtros {
    display: flex; gap: 1rem; align-items: flex-end; flex-wrap: wrap;
    background: var(--bg-panel);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1.6rem;
    max-width: none;
}
.filtros label { margin-bottom: 0; min-width: 180px; }
.filtros button {
    padding: .55rem 1.4rem;
    background: linear-gradient(135deg, var(--purple-deep), var(--purple));
    color: #fff; border: none; border-radius: var(--radius-sm);
    font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer;
    box-shadow: 0 4px 14px rgba(93, 58, 142, 0.35);
    transition: filter .2s ease, transform .15s ease;
}
.filtros button:hover { filter: brightness(1.15); transform: translateY(-1px); }

/* ── Paquetes ────────────────────────────────────────────────────── */
.paquete {
    background: var(--bg-panel);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 1.1rem 1.35rem;
    margin-bottom: 1rem;
    box-shadow: 0 8px 26px rgba(0, 0, 0, 0.25);
}
.paquete h3 { margin: 0 0 .3rem; display: flex; justify-content: space-between; align-items: baseline; }
.paquete .precio { color: var(--gold-bright); font-size: 1.05rem; font-weight: 700; }
.paquete ul { margin: .5rem 0 0; padding-left: 1.2rem; color: var(--text-muted); }

/* ── Vista semanal de la agenda ──────────────────────────────────── */
.cg-semana {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
    margin-bottom: 1.5rem;
}
.cg-dia {
    background: var(--bg-panel);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-sm);
    padding: 10px;
    min-height: 120px;
}
.cg-dia.hoy { border-color: var(--gold); box-shadow: 0 0 0 1px rgba(212, 175, 55, 0.25); }
.cg-dia h4 { margin: 0 0 8px; font-size: .78rem; text-transform: uppercase; letter-spacing: 1px; }
.cg-dia h4 a { color: var(--gold); text-decoration: none; border-bottom: none; }
.cg-dia h4 a:hover { color: var(--gold-bright); }
.cg-cita {
    font-size: .74rem;
    line-height: 1.35;
    padding: 6px 8px;
    border-radius: 5px;
    margin-bottom: 6px;
    background: rgba(155, 114, 208, 0.14);
    border-left: 3px solid var(--purple);
}
.cg-cita span { color: var(--text-muted); }
.cg-cita.completada { border-left-color: var(--ok-green); background: rgba(62, 207, 122, 0.10); }
.cg-cita.cancelada { border-left-color: var(--text-muted); opacity: .55; }
.cg-cita.noshow { border-left-color: var(--err-red); background: rgba(192, 57, 43, 0.12); }

@media (max-width: 900px) {
    .cg-semana { grid-template-columns: repeat(2, 1fr); }
}

/* ── Galería de fotos del expediente ─────────────────────────────── */
.cg-galeria {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 1.5rem;
}
.cg-galeria figure {
    margin: 0;
    background: var(--bg-panel);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.cg-galeria img {
    display: block; width: 100%; height: 170px;
    object-fit: cover;
    transition: transform .2s ease;
}
.cg-galeria a:hover img { transform: scale(1.04); }
.cg-galeria figcaption {
    padding: 6px 8px;
    font-size: .72rem;
    color: var(--text-muted);
}

/* ── Mensajes ────────────────────────────────────────────────────── */
.error {
    color: var(--err-red); font-size: .88rem;
    background: rgba(192, 57, 43, 0.14);
    border: 1px solid rgba(192, 57, 43, 0.35);
    border-radius: var(--radius-sm);
    padding: .55rem .8rem;
}
.validation-message { color: var(--err-red); font-size: .8rem; margin-top: .25rem; }
.validation-errors { margin: 0 0 1rem; padding-left: 1.1rem; }
.hint { color: var(--text-muted); font-size: .88rem; line-height: 1.55; margin-bottom: 1.25rem; }
.hint strong { color: var(--ok-green); }

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 900px) {
    .topbar { flex-wrap: wrap; padding: 10px 14px; }
    .nav { flex-wrap: wrap; }
    .content { padding: 0 1rem; }
    .grid { display: block; overflow-x: auto; }
}

/* ── Pestañas / filtro por botones ───────────────────────────────── */
/* Reemplaza pantallas con muchas secciones apiladas: cada sección va
   detrás de un botón y solo se renderiza la seleccionada, para no
   tener que recorrer toda la página buscando la última opción.
   Los selectores van calificados con .tabs (en vez de solo .tab-btn)
   para tener más especificidad que ".content a" (línea ~216), que si
   no queda pisando el color/subrayado de estos botones. */
.tabs {
    display: flex; flex-wrap: wrap; gap: .9rem;
    margin-bottom: 1.8rem;
}
.tabs .tab-btn {
    display: inline-block;
    padding: .6rem 1.3rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--card-border);
    border-radius: 999px;
    color: var(--text-muted);
    font-size: .85rem; font-weight: 600; letter-spacing: .3px;
    text-decoration: none;
    cursor: pointer;
    transition: background .15s ease, color .15s ease, border-color .15s ease, transform .15s ease;
}
.tabs .tab-btn:hover {
    color: var(--text-pri);
    border-color: rgba(212, 175, 55, 0.4);
    transform: translateY(-1px);
}
.tabs .tab-btn.active {
    background: linear-gradient(135deg, var(--purple-deep), var(--purple) 65%);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 4px 16px rgba(93, 58, 142, 0.35);
}
.tabs .tab-btn.active:hover { transform: none; }
