/* =====================================================================
   Laboratorio Quiniela — estilos de la aplicación (sobre Bootstrap 5.3)
   Tema claro/oscuro vía data-bs-theme en <html>.
   ===================================================================== */

:root {
    --lq-sidebar-w: 248px;
    --lq-topbar-h: 60px;
    --lq-radius: .8rem;
    --lq-1: #198754;
    --lq-x: #6c757d;
    --lq-2: #dc3545;
    --lq-doble: #0d6efd;
    --lq-triple: #6f42c1;
    --lq-surface: #ffffff;
    --lq-bg: #f4f6fb;
    --lq-border: rgba(0, 0, 0, .07);
    --lq-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 16px rgba(16, 24, 40, .06);
    --lq-sidebar-bg: #0f172a;
    --lq-sidebar-fg: #cbd5e1;
    --lq-accent: #4f46e5;
    --bs-font-sans-serif: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

[data-bs-theme="dark"] {
    --lq-surface: #161b26;
    --lq-bg: #0d1117;
    --lq-border: rgba(255, 255, 255, .08);
    --lq-shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 24px rgba(0, 0, 0, .35);
    --lq-sidebar-bg: #0a0e15;
    --bs-body-bg: #0d1117;
    --bs-tertiary-bg: #1b2130;
}

body { background: var(--lq-bg); font-size: .925rem; }
a { text-decoration: none; }

/* ---------------------------------------------------------------- Layout */
.lq-sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--lq-sidebar-w); z-index: 1040;
    background: var(--lq-sidebar-bg); color: var(--lq-sidebar-fg);
    display: flex; flex-direction: column; transition: transform .25s ease;
}
.lq-brand { height: var(--lq-topbar-h); display: flex; align-items: center; gap: .6rem; padding: 0 1.25rem; color: #fff; font-weight: 700; letter-spacing: -.01em; border-bottom: 1px solid rgba(255,255,255,.06); }
.lq-brand .logo { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: linear-gradient(135deg, #6366f1, #22c55e); color: #fff; }
.lq-nav { padding: .75rem .6rem; overflow-y: auto; flex: 1; }
.lq-nav .nav-section { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: #64748b; padding: .9rem .75rem .35rem; }
.lq-nav a { display: flex; align-items: center; gap: .7rem; color: var(--lq-sidebar-fg); padding: .55rem .75rem; border-radius: .55rem; margin-bottom: 2px; font-weight: 500; }
.lq-nav a i { font-size: 1.05rem; opacity: .85; width: 1.2rem; text-align: center; }
.lq-nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.lq-nav a.active { background: linear-gradient(90deg, rgba(99,102,241,.35), rgba(99,102,241,.12)); color: #fff; }
.lq-nav .badge { margin-left: auto; }
.lq-sidebar-footer { padding: .9rem 1.25rem; font-size: .75rem; color: #64748b; border-top: 1px solid rgba(255,255,255,.06); }

.lq-main { margin-left: var(--lq-sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.lq-topbar {
    position: sticky; top: 0; z-index: 1030; height: var(--lq-topbar-h);
    background: color-mix(in srgb, var(--lq-surface) 88%, transparent); backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--lq-border); display: flex; align-items: center; gap: .75rem; padding: 0 1.25rem;
}
.lq-topbar .search { max-width: 420px; flex: 1; }
.lq-content { padding: 1.5rem; flex: 1; }
.lq-footer { padding: 1rem 1.5rem; font-size: .78rem; color: var(--bs-secondary-color); }

@media (max-width: 991.98px) {
    .lq-sidebar { transform: translateX(-100%); }
    body.sidebar-open .lq-sidebar { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.4); }
    .lq-main { margin-left: 0; }
    .lq-content { padding: 1rem; }
}
.lq-backdrop { display: none; }
@media (max-width: 991.98px) { body.sidebar-open .lq-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 1035; } }

/* ---------------------------------------------------------------- Cards y bloques */
.card { border: 1px solid var(--lq-border); border-radius: var(--lq-radius); box-shadow: var(--lq-shadow); background: var(--lq-surface); }
.card-header { background: transparent; border-bottom: 1px solid var(--lq-border); padding: .85rem 1.1rem; font-weight: 600; display: flex; align-items: center; gap: .5rem; }
.card-header .actions { margin-left: auto; display: flex; gap: .35rem; align-items: center; }
.page-header { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-bottom: 1.25rem; }
.page-header h1 { font-size: 1.45rem; font-weight: 700; margin: 0; letter-spacing: -.02em; }
.page-header .subtitle { color: var(--bs-secondary-color); font-size: .88rem; }
.page-header .actions { margin-left: auto; display: flex; flex-wrap: wrap; gap: .5rem; }

.kpi { padding: 1rem 1.1rem; }
.kpi .label { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--bs-secondary-color); }
.kpi .value { font-size: 1.6rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; }
.kpi .icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; font-size: 1.2rem; }

.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--bs-secondary-color); }
.empty-state i { font-size: 2.6rem; opacity: .5; display: block; margin-bottom: .5rem; }

/* ---------------------------------------------------------------- Signos 1/X/2 */
.sign { display: inline-flex; align-items: center; justify-content: center; min-width: 1.9rem; height: 1.6rem; padding: 0 .35rem; border-radius: .4rem; font-weight: 700; font-size: .82rem; color: #fff; letter-spacing: .02em; }
.sign-1 { background: var(--lq-1); }
.sign-x { background: var(--lq-x); }
.sign-2 { background: var(--lq-2); }
.sign-doble { background: var(--lq-doble); }
.sign-triple { background: var(--lq-triple); }
.sign-empty { background: transparent; color: var(--bs-secondary-color); border: 1px dashed var(--lq-border); }
.sign.hit { box-shadow: 0 0 0 2px #ffc107; }

/* Rejilla de selección del generador */
.pick-grid td, .pick-grid th { vertical-align: middle; }
.pick { width: 2.4rem; height: 2.1rem; border-radius: .45rem; border: 1.5px solid var(--lq-border); background: var(--bs-body-bg); font-weight: 700; color: var(--bs-body-color); transition: all .12s; position: relative; }
.pick:hover { border-color: var(--lq-accent); }
.pick.on[data-s="1"] { background: var(--lq-1); border-color: var(--lq-1); color: #fff; }
.pick.on[data-s="X"] { background: var(--lq-x); border-color: var(--lq-x); color: #fff; }
.pick.on[data-s="2"] { background: var(--lq-2); border-color: var(--lq-2); color: #fff; }
.pick .p { position: absolute; bottom: -1.05rem; left: 0; right: 0; font-size: .62rem; font-weight: 500; color: var(--bs-secondary-color); }
.pick.value-hint::after { content: ""; position: absolute; top: -4px; right: -4px; width: 9px; height: 9px; border-radius: 50%; background: #f59e0b; border: 2px solid var(--lq-surface); }
.pick-row td { padding-bottom: 1.25rem !important; }

/* Barras de probabilidad apiladas */
.probbar { display: flex; height: .55rem; border-radius: 1rem; overflow: hidden; background: var(--bs-tertiary-bg); min-width: 90px; }
.probbar > span { display: block; height: 100%; }
.probbar .b1 { background: var(--lq-1); } .probbar .bx { background: #adb5bd; } .probbar .b2 { background: var(--lq-2); }
.probbar.lae { height: .35rem; opacity: .75; margin-top: 3px; }
.probtext { font-size: .72rem; color: var(--bs-secondary-color); font-variant-numeric: tabular-nums; }

.conf { display: inline-block; min-width: 2.6rem; text-align: center; border-radius: .4rem; padding: .1rem .35rem; font-weight: 600; font-size: .78rem; }
.conf-high { background: rgba(25,135,84,.15); color: #198754; }
.conf-mid { background: rgba(255,193,7,.18); color: #b58100; }
.conf-low { background: rgba(220,53,69,.12); color: #dc3545; }
[data-bs-theme="dark"] .conf-mid { color: #ffc107; }

.value-chip { font-size: .72rem; padding: .12rem .45rem; border-radius: 1rem; background: rgba(245,158,11,.15); color: #b45309; font-weight: 600; white-space: nowrap; }
[data-bs-theme="dark"] .value-chip { color: #fbbf24; }

.table-lq { --bs-table-bg: transparent; margin: 0; }
.table-lq thead th { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--bs-secondary-color); font-weight: 600; border-bottom-width: 1px; white-space: nowrap; }
.table-lq td { vertical-align: middle; }
.table-lq tbody tr:hover { background: color-mix(in srgb, var(--lq-accent) 5%, transparent); }
.pos-badge { width: 1.7rem; height: 1.7rem; border-radius: 50%; display: inline-grid; place-items: center; font-weight: 700; font-size: .78rem; background: var(--bs-tertiary-bg); }
.pos-badge.pleno { background: #fde68a; color: #92400e; }

/* Celdas heatmap simples */
.heat { border-radius: .3rem; text-align: center; font-size: .72rem; font-weight: 600; padding: .25rem 0; }

/* Respuesta de la IA */
.ia-output { line-height: 1.6; }
.ia-output h3, .ia-output h4, .ia-output h5 { font-size: 1.02rem; font-weight: 700; margin-top: 1rem; }
.ia-output table { font-size: .85rem; }
.ia-output blockquote { border-left: 3px solid var(--lq-accent); padding-left: .75rem; color: var(--bs-secondary-color); }
.ia-output pre { background: var(--bs-tertiary-bg); padding: .75rem; border-radius: .5rem; font-size: .8rem; }
.ia-meta { font-size: .75rem; color: var(--bs-secondary-color); }

/* Chat */
.chat-wrap { height: calc(100vh - 260px); min-height: 380px; overflow-y: auto; padding: 1rem; }
.msg { max-width: 85%; padding: .7rem 1rem; border-radius: 1rem; margin-bottom: .75rem; line-height: 1.55; }
.msg.user { margin-left: auto; background: var(--lq-accent); color: #fff; border-bottom-right-radius: .3rem; }
.msg.assistant { background: var(--bs-tertiary-bg); border-bottom-left-radius: .3rem; }
.msg.system { background: rgba(220,53,69,.1); color: #dc3545; font-size: .85rem; margin: 0 auto .75rem; }
.msg p:last-child { margin-bottom: 0; }
.typing span { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .4; margin: 0 2px; animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; } .typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 50% { opacity: 1; } }

/* Utilidades */
.text-1 { color: var(--lq-1) !important; } .text-x { color: var(--lq-x) !important; } .text-2 { color: var(--lq-2) !important; }
.fw-600 { font-weight: 600; }
.small-muted { font-size: .78rem; color: var(--bs-secondary-color); }
.nowrap { white-space: nowrap; }
.tabular { font-variant-numeric: tabular-nums; }
.sticky-panel { position: sticky; top: calc(var(--lq-topbar-h) + 1rem); }
.saving-indicator { font-size: .78rem; color: var(--bs-secondary-color); }
.nav-pills-lq .nav-link { border-radius: .55rem; color: var(--bs-body-color); font-weight: 500; padding: .45rem .85rem; }
.nav-pills-lq .nav-link.active { background: var(--lq-accent); color: #fff; }
.form-control, .form-select { border-radius: .55rem; }
.btn { border-radius: .55rem; font-weight: 500; }
.btn-accent { background: var(--lq-accent); color: #fff; border-color: var(--lq-accent); }
.btn-accent:hover { background: #4338ca; color: #fff; }
.loading-overlay { position: absolute; inset: 0; background: color-mix(in srgb, var(--lq-surface) 70%, transparent); display: grid; place-items: center; z-index: 5; border-radius: var(--lq-radius); }
.toast-container { z-index: 1090; }
.widget-handle { cursor: grab; }
[x-cloak] { display: none !important; }
.auth-bg { min-height: 100vh; background: radial-gradient(1200px 600px at 10% -10%, rgba(99,102,241,.25), transparent), radial-gradient(900px 500px at 110% 110%, rgba(34,197,94,.18), transparent), var(--lq-bg); }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: .4rem; }
.calendar-grid .day { min-height: 92px; border: 1px solid var(--lq-border); border-radius: .5rem; padding: .35rem .45rem; background: var(--lq-surface); font-size: .78rem; }
.calendar-grid .day.other { opacity: .4; }
.calendar-grid .day.today { border-color: var(--lq-accent); box-shadow: inset 0 0 0 1px var(--lq-accent); }
.calendar-grid .head { text-align: center; font-size: .72rem; font-weight: 600; color: var(--bs-secondary-color); text-transform: uppercase; }
@media (max-width: 575.98px) { .calendar-grid .day { min-height: 60px; font-size: .68rem; } .hide-xs { display: none !important; } }
@media print { .lq-sidebar, .lq-topbar, .lq-footer, .no-print { display: none !important; } .lq-main { margin: 0; } }
