/* ============================================================
   H-GYM - estilos generales (admin + cliente)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800&display=swap');

:root {
    --primary: #7C3AED;
    --primary-dark: #5B21B6;
    --primary-light: #A78BFA;
    --pink: #EC4899;
    --orange: #F97316;
    --green: #22C55E;
    --red: #EF4444;
    --yellow: #F59E0B;

    --bg: #F6F4FF;
    --card-bg: #FFFFFF;
    --text: #211B3D;
    --text-muted: #6B6485;
    --border: #E9E4FB;

    --gradient-brand: linear-gradient(135deg, #7C3AED 0%, #C026D3 55%, #F97316 100%);
    --gradient-soft: linear-gradient(135deg, #F5F3FF 0%, #FDF2FA 100%);

    --radius: 18px;
    --radius-sm: 12px;
    --shadow: 0 10px 30px -12px rgba(124, 58, 237, 0.25);
    --shadow-sm: 0 4px 14px -6px rgba(124, 58, 237, 0.2);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
    margin: 0;
    padding: 0;
    font-family: 'Poppins', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-tap-highlight-color: transparent;
}

a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; }
ul { list-style: none; margin: 0; padding: 0; }

.page-title {
    font-size: 22px;
    font-weight: 700;
    margin: 4px 0 16px;
}

/* ---------------- Botones ---------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: none;
    border-radius: 999px;
    padding: 13px 22px;
    font-weight: 600;
    font-size: 15px;
    transition: transform .15s ease-in-out, box-shadow .18s ease-in-out,
                opacity .15s ease-in-out, background-color .18s ease-in-out,
                color .18s ease-in-out, border-color .18s ease-in-out;
}
.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.btn--primary {
    background: var(--gradient-brand);
    color: #fff;
    box-shadow: var(--shadow-sm);
}
.btn--primary:hover:not(:disabled) { box-shadow: var(--shadow); }

.btn--ghost {
    background: #fff;
    color: var(--primary);
    border: 1.5px solid var(--border);
}

.btn--danger {
    background: #FFF1F2;
    color: var(--red);
    border: 1.5px solid #FFD9DC;
}

.btn--block { width: 100%; }
.btn--sm { padding: 8px 14px; font-size: 13px; }

.btn-remove {
    border: none;
    background: #FFF1F2;
    color: var(--red);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color .18s ease-in-out, transform .15s ease-in-out;
}
.btn-remove:active { transform: scale(0.9); }

/* ---------------- Formularios ---------------- */
label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 14px;
}
input[type=text], input[type=number], input[type=password],
input[type=time], input[type=date], select {
    display: block;
    width: 100%;
    margin-top: 6px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border);
    font-size: 15px;
    font-family: inherit;
    background: #fff;
    color: var(--text);
    transition: border-color .18s ease-in-out, box-shadow .18s ease-in-out;
}
input:focus, select:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 4px rgba(124, 58, 237, .12);
}

.form-row { display: flex; gap: 14px; }
.form-row label { flex: 1; }
.form-actions { display: flex; gap: 10px; margin-top: 6px; }

/* ---------------- Tarjetas / alertas / chips ---------------- */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
}

.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 16px;
}
.alert--error { background: #FFF1F2; color: #B91C1C; }
.alert--ok { background: #ECFDF5; color: #047857; }

.chip {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 999px;
    background: #F3EEFF;
    color: var(--primary-dark);
    font-size: 12px;
    font-weight: 600;
    margin: 3px 4px 0 0;
}
.chip--time { background: #FFF0E6; color: #C2410C; }
.chip--warn { background: #FEF3C7; color: #92400E; margin-left: 8px; }

.badge {
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}
.badge--on { background: #ECFDF5; color: #047857; }
.badge--off { background: #FFF1F2; color: #B91C1C; }

.empty-msg { color: var(--text-muted); font-size: 14px; padding: 10px 0; }
.empty-msg--sm { font-size: 13px; padding: 4px 0; }

/* ============================================================
   ADMIN
   ============================================================ */
.admin-body { min-height: 100vh; }

.admin-topbar {
    background: var(--gradient-brand);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    flex-wrap: wrap;
    gap: 10px;
}
.admin-topbar__brand { font-weight: 800; font-size: 20px; letter-spacing: .5px; }
.admin-topbar__brand span { font-weight: 400; opacity: .85; font-size: 14px; }
.admin-topbar__nav { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.admin-topbar__nav a {
    padding: 8px 16px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 14px;
    background: rgba(255,255,255,.12);
}
.admin-topbar__nav a.active { background: #fff; color: var(--primary-dark); }
.admin-topbar__logout { background: rgba(0,0,0,.18) !important; }

.admin-main { max-width: 980px; margin: 0 auto; padding: 24px 20px 60px; }

.page-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; margin-bottom: 26px; }
.stat-card { background: #fff; border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm); text-align: center; }
.stat-card__value { font-size: 28px; font-weight: 800; color: var(--primary); }
.stat-card__label { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

.menu-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.menu-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: transform .15s ease, box-shadow .15s ease;
}
.menu-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.menu-card__icon { font-size: 28px; }
.menu-card__title { font-weight: 700; font-size: 16px; }
.menu-card__desc { font-size: 13px; color: var(--text-muted); }

/* login */
.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-brand);
    background-size: 200% 200%;
    animation: gradientMove 10s ease infinite;
    padding: 20px;
}
@keyframes gradientMove {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}
.login-card {
    background: #fff;
    border-radius: 24px;
    padding: 36px 30px;
    width: 100%;
    max-width: 340px;
    box-shadow: 0 20px 50px -14px rgba(0,0,0,.35);
    text-align: center;
}
.login-card__logo { font-size: 26px; font-weight: 800; color: var(--primary); }
.login-card__sub { color: var(--text-muted); font-size: 13px; margin: 4px 0 20px; }
.login-card input { margin-bottom: 16px; }

/* clases */
.dias-selector { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.dia-chip { margin: 0; }
.dia-chip input { display: none; }
.dia-chip span {
    display: inline-block;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    background: #F3EEFF;
    color: var(--primary-dark);
    font-size: 13px;
    font-weight: 600;
    border: 1.5px solid transparent;
}
.dia-chip input:checked + span { background: var(--gradient-brand); color: #fff; }

.horario-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.horario-row input { margin: 0; }
.horario-row span { color: var(--text-muted); font-size: 13px; }

.form-clase { max-width: 560px; }

.clase-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.clase-card { background: #fff; border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm); }
.clase-card--inactiva { opacity: .55; }
.clase-card__head { display: flex; justify-content: space-between; align-items: center; }
.clase-card__head h3 { margin: 0; font-size: 17px; }
.clase-card__meta { display: flex; gap: 16px; font-size: 13px; color: var(--text-muted); margin: 8px 0; }
.clase-card__dias, .clase-card__horarios { margin-bottom: 6px; }
.clase-card__actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }

/* cuentas */
.limpieza-form { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.limpieza-form label { margin: 0; display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text); }
.limpieza-form select { width: auto; margin: 0; }

.table-wrap { overflow-x: auto; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table th { color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
.table tr:last-child td { border-bottom: none; }

/* ocupacion */
.fecha-form { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.fecha-form label { margin: 0; display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text); }
.fecha-form input { width: auto; margin: 0; }
.fecha-form__dia { font-weight: 700; color: var(--primary); }

.ocup-clase { margin-bottom: 22px; }
.ocup-clase h2 { font-size: 17px; margin-bottom: 10px; }
.ocup-horario { background: #fff; border-radius: var(--radius-sm); padding: 14px 16px; box-shadow: var(--shadow-sm); margin-bottom: 10px; }
.ocup-horario__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.ocup-lista li { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; font-size: 14px; border-top: 1px dashed var(--border); }
.ocup-lista li:first-child { border-top: none; }

/* ============================================================
   CLIENTE (PWA)
   ============================================================ */
.cliente-body {
    min-height: 100vh;
    background: var(--bg);
    max-width: 480px;
    margin: 0 auto;
    position: relative;
}

.screen { min-height: 100vh; }
.screen--center { display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--gradient-brand); background-size: 200% 200%; animation: gradientMove 10s ease infinite; }

.registro-card {
    background: #fff;
    border-radius: 24px;
    padding: 34px 26px;
    width: 100%;
    max-width: 340px;
    box-shadow: 0 20px 50px -14px rgba(0,0,0,.35);
    text-align: center;
}
.registro-card__logo { font-size: 30px; font-weight: 800; background: var(--gradient-brand); -webkit-background-clip: text; background-clip: text; color: transparent; }
.registro-card__sub { color: var(--text-muted); font-size: 13px; margin: 6px 0 24px; }
.registro-card input { margin-bottom: 4px; }
.registro-card label { text-align: left; }

.app-topbar {
    background: var(--gradient-brand);
    color: #fff;
    padding: 18px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 5;
}
.app-topbar__logo { font-weight: 800; font-size: 18px; }
.app-topbar__user { font-size: 13px; opacity: .9; }

.app-main { padding: 20px 18px 100px; }

.reservas-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 18px; }
.reserva-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--shadow-sm);
    border-left: 5px solid var(--primary);
}
.reserva-card__dia {
    font-size: 11px;
    font-weight: 800;
    color: var(--pink);
    writing-mode: vertical-rl;
    text-orientation: mixed;
}
.reserva-card__info { flex: 1; display: flex; flex-direction: column; }
.reserva-card__info b { font-size: 15px; }
.reserva-card__info span { font-size: 13px; color: var(--text-muted); }

.dia-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.dia-tab {
    flex: 1;
    padding: 11px;
    border: none;
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--text-muted);
    font-weight: 700;
    box-shadow: var(--shadow-sm);
}
.dia-tab.active { background: var(--gradient-brand); color: #fff; }

.clase-disp { background: #fff; border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-sm); margin-bottom: 14px; }
.clase-disp h3 { margin: 0 0 10px; font-size: 16px; }
.clase-disp__aviso { background: #FEF3C7; color: #92400E; font-size: 12.5px; font-weight: 600; padding: 8px 12px; border-radius: var(--radius-sm); margin-bottom: 12px; }

.horario-disp {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-top: 1px dashed var(--border);
}
.horario-disp:first-child { border-top: none; }
.horario-disp__hora { flex: 1; font-weight: 600; font-size: 14px; }
.horario-disp__cupo { font-size: 13px; color: var(--text-muted); font-weight: 600; min-width: 42px; text-align: center; }
.horario-disp--lleno .horario-disp__cupo { color: var(--red); }
.horario-disp--mia { background: #F5F3FF; margin: 0 -16px; padding: 10px 16px; border-radius: var(--radius-sm); }

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    background: #fff;
    display: flex;
    box-shadow: 0 -6px 24px -10px rgba(124,58,237,.3);
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    z-index: 10;
}
.bottom-nav__item {
    flex: 1;
    border: none;
    background: none;
    padding: 8px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}
.bottom-nav__item span { font-size: 20px; }
.bottom-nav__item.active { color: var(--primary); background: #F3EEFF; }

.toast {
    position: fixed;
    left: 50%;
    bottom: 90px;
    transform: translateX(-50%) translateY(20px);
    background: #211B3D;
    color: #fff;
    padding: 12px 20px;
    border-radius: 999px;
    font-size: 13.5px;
    font-weight: 600;
    box-shadow: 0 10px 26px -8px rgba(0,0,0,.4);
    z-index: 50;
    opacity: 0;
    transition: opacity .25s ease, transform .25s ease;
    max-width: 90%;
    text-align: center;
}
.toast--show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast--error { background: var(--red); }

.install-btn {
    position: fixed;
    bottom: 100px;
    right: 18px;
    left: 18px;
    max-width: 444px;
    margin: 0 auto;
    background: var(--gradient-brand);
    color: #fff;
    border: none;
    padding: 14px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 14px;
    box-shadow: var(--shadow);
    z-index: 20;
    animation: floatUp .35s ease;
}
@keyframes floatUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@media (min-width: 480px) {
    .cliente-body { box-shadow: 0 0 60px rgba(124,58,237,.15); }
}
