/* GymTracker Admin — estilos base (sin framework CSS) */

:root {
    --primary: #E8590C;
    --primary-dark: #A63A00;
    --primary-soft: #FFE8CC;
    --bg: #F5F5F4;
    --surface: #FFFFFF;
    --text: #1F1F1F;
    --muted: #6E6E6E;
    --border: #E4E4E4;
    --danger: #E03131;
    --success: #2F9E44;
    --radius: 10px;
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
    color: var(--text);
    background: var(--bg);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
h1 { font-size: 1.6rem; margin: 0 0 1rem; }
h1:focus { outline: none; }
h2 { font-size: 1.15rem; margin: 1.5rem 0 .75rem; }
a { color: var(--primary-dark); }

/* ---------- Layout ---------- */
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.sidebar { background: #1F1F1F; color: #fff; padding: 1.25rem .75rem; display: flex; flex-direction: column; gap: .25rem; }
.sidebar .brand { font-weight: 700; font-size: 1.2rem; padding: 0 .75rem 1.25rem; }
.sidebar .brand span { color: var(--primary); }
.sidebar a { color: #DDD; text-decoration: none; padding: .55rem .75rem; border-radius: 8px; }
.sidebar a:hover { background: #333; color: #fff; }
.sidebar a.active { background: var(--primary); color: #fff; }
.sidebar form { margin-top: auto; }
.sidebar .who { font-size: .8rem; color: #AAA; padding: 0 .75rem .5rem; word-break: break-all; }
.content { padding: 2rem; max-width: 1100px; width: 100%; }

@media (max-width: 760px) {
    .shell { grid-template-columns: 1fr; }
    .sidebar { flex-direction: row; flex-wrap: wrap; align-items: center; }
    .sidebar .brand { padding: 0 .75rem; }
    .sidebar form { margin: 0 0 0 auto; }
    .sidebar .who { display: none; }
    .content { padding: 1rem; }
}

/* ---------- Componentes ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1rem; }
.toolbar { display: flex; gap: .75rem; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 1rem; }
.toolbar h1 { margin: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; }
.stat b { display: block; font-size: 1.8rem; }
.stat span { color: var(--muted); font-size: .9rem; }
.muted { color: var(--muted); font-size: .9rem; }
.badge { display: inline-block; padding: .1rem .5rem; border-radius: 999px; background: var(--primary-soft); color: var(--primary-dark); font-size: .8rem; font-weight: 600; }
.empty { text-align: center; color: var(--muted); padding: 2rem; }
.alert { padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1rem; }
.alert-error { background: #FFE3E3; color: #A61E1E; }
.alert-ok { background: #D3F9D8; color: #1B6E2D; }

/* ---------- Tablas ---------- */
table { width: 100%; border-collapse: collapse; background: var(--surface); }
th, td { text-align: left; padding: .6rem .75rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: .8rem; text-transform: uppercase; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: none; }
.table-wrap { border: 1px solid var(--border); border-radius: var(--radius); overflow-x: auto; margin-bottom: 1rem; }
td.num, th.num { text-align: right; white-space: nowrap; }
td.actions { white-space: nowrap; text-align: right; }

/* ---------- Formularios ---------- */
label { display: block; font-weight: 600; font-size: .9rem; margin: .75rem 0 .3rem; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], select, textarea {
    width: 100%; padding: .55rem .7rem; border: 1px solid #CCC; border-radius: 8px; font: inherit; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary-soft); border-color: var(--primary); }
textarea { min-height: 80px; resize: vertical; }
input.small { width: 5rem; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 1rem; }
.form-actions { display: flex; gap: .75rem; margin-top: 1.25rem; flex-wrap: wrap; }

/* ---------- Botones ---------- */
.btn { display: inline-flex; align-items: center; gap: .35rem; padding: .55rem 1rem; border-radius: 8px; border: 1px solid transparent; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; background: var(--primary); color: #fff; }
.btn:hover { background: var(--primary-dark); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-secondary { background: var(--primary-soft); color: var(--primary-dark); }
.btn-secondary:hover { background: #FFD8A8; }
.btn-ghost { background: transparent; color: var(--muted); border-color: var(--border); }
.btn-ghost:hover { background: #EEE; }
.btn-danger { background: transparent; color: var(--danger); border-color: #F5C2C2; }
.btn-danger:hover { background: #FFE3E3; }
.btn-sm { padding: .3rem .6rem; font-size: .85rem; }
.btn-icon { padding: .3rem .55rem; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.login .card { width: 100%; max-width: 380px; }
.login h1 span { color: var(--primary); }

/* ---------- Sesiones ---------- */
details.session { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: .5rem; }
details.session summary { padding: .75rem 1rem; cursor: pointer; display: flex; gap: 1rem; flex-wrap: wrap; align-items: baseline; }
details.session .body { padding: 0 1rem 1rem; }
.sets { display: flex; flex-wrap: wrap; gap: .35rem; margin: .25rem 0 .75rem; }
.sets span { background: var(--bg); border-radius: 6px; padding: .15rem .5rem; font-size: .9rem; }

/* ---------- Plantilla ---------- */
.ex-row td input { margin: 0; }
video { max-width: 100%; border-radius: 8px; background: #000; }

/* ---------- Errores Blazor ---------- */
#blazor-error-ui { background: lightyellow; bottom: 0; box-shadow: 0 -1px 2px rgba(0,0,0,.2); display: none; left: 0; padding: .6rem 1.25rem .7rem; position: fixed; width: 100%; z-index: 1000; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }
.blazor-error-boundary { background: #b32121; padding: 1rem; color: white; }
.blazor-error-boundary::after { content: "Ha ocurrido un error."; }
.validation-message { color: var(--danger); font-size: .85rem; }
