/*
|--------------------------------------------------------------------------
| Hoja de estilos principal
|--------------------------------------------------------------------------
| CSS define la apariencia. Se usan variables para cambiar colores y espacios
| desde un solo lugar.
*/

:root {
    --bg: #f6f7fb;
    --surface: #ffffff;
    --ink: #17202a;
    --muted: #667085;
    --line: #d8dee9;
    --primary: #0f766e;
    --primary-dark: #115e59;
    --accent: #b45309;
    --danger: #b42318;
    --success: #027a48;
    --shadow: 0 18px 45px rgba(20, 27, 38, 0.10);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.5;
    padding-bottom: 86px;
}

a {
    color: inherit;
    text-decoration: none;
}

.edu-banner {
    position: sticky;
    top: 0;
    z-index: 20;
    padding: 0.55rem 0.8rem;
    background: #fff4d6;
    color: #5f370e;
    border-bottom: 1px solid #f3c76a;
    font-weight: 700;
    font-size: 0.82rem;
    text-align: center;
}

.site-header {
    position: sticky;
    top: 35px;
    z-index: 19;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 64px;
    padding: 0.65rem 1rem;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    font-weight: 800;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    background: var(--primary);
    color: white;
    border-radius: 8px;
    font-size: 0.85rem;
}

.main-nav {
    position: fixed;
    left: 0.75rem;
    right: 0.75rem;
    bottom: 0.75rem;
    z-index: 60;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(58px, 1fr));
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.2);
    backdrop-filter: blur(12px);
}

.main-nav a {
    display: grid;
    place-items: center;
    min-height: 48px;
    padding: 0.35rem 0.2rem;
    border-radius: 7px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
    text-align: center;
}

.main-nav a:hover,
.main-nav a.is-active {
    background: #e6fffb;
    color: var(--primary-dark);
}

.teacher-link {
    border: 1px dashed var(--line);
}

.hero {
    min-height: 560px;
    display: grid;
    align-items: end;
    padding: 2rem 1rem;
    color: white;
    background:
        linear-gradient(90deg, rgba(13, 33, 37, 0.88), rgba(13, 33, 37, 0.45)),
        url("../img/aula-laboratorio.svg");
    background-size: cover;
    background-position: center;
}

.hero-content {
    max-width: 720px;
}

.eyebrow {
    margin: 0 0 0.6rem;
    color: var(--accent);
    font-size: 0.82rem;
    font-weight: 800;
    text-transform: uppercase;
}

.hero .eyebrow {
    color: #facc15;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    font-size: clamp(2.35rem, 12vw, 4.5rem);
    line-height: 1;
}

h2 {
    font-size: clamp(1.35rem, 7vw, 2.15rem);
}

.hero-copy {
    max-width: 620px;
    color: #e6f4f1;
    font-size: 1.2rem;
}

.hero-actions,
.dashboard-header,
.dashboard-grid,
.stats-grid,
.plans-grid,
.referral-grid,
.risk-grid {
    display: grid;
    gap: 1rem;
}

.hero-actions {
    grid-template-columns: 1fr;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0.8rem 1rem;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 800;
}

.btn.primary {
    background: var(--primary);
    color: white;
}

.btn.secondary {
    background: white;
    color: var(--primary-dark);
}

.btn.full {
    width: 100%;
}

.stats-section,
.plans-section,
.story-section,
.mission-section,
.classroom-section,
.script-section,
.warning-section,
.dashboard,
.risk-page {
    padding: 1.4rem 1rem;
}

.section-heading {
    max-width: 760px;
    margin-bottom: 1.5rem;
}

.stats-grid,
.plans-grid,
.story-grid,
.mission-grid,
.script-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.stat-card,
.plan-card,
.story-card,
.mission-card,
.script-card,
.metric-panel,
.panel-section,
.referral-card,
.risk-grid article,
.form-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.stat-card,
.plan-card,
.story-card,
.mission-card,
.script-card,
.metric-panel,
.panel-section,
.referral-card,
.risk-grid article,
.form-card,
.warning-section {
    padding: 1.4rem;
}

.visual-panel {
    margin-bottom: 1rem;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.visual-panel img {
    display: block;
    width: 100%;
    height: auto;
}

.scenario-list {
    display: grid;
    gap: 0.55rem;
    margin: 1rem 0;
}

.scenario-list span {
    padding: 0.7rem;
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--muted);
    font-weight: 700;
}

.stat-card strong,
.metric-panel strong,
.price {
    display: block;
    margin-bottom: 0.4rem;
    color: var(--primary-dark);
    font-size: 2rem;
    font-weight: 900;
}

.warning-section {
    margin: 0 clamp(1rem, 5vw, 5rem) 3rem;
    background: #fff7ed;
    border-left: 6px solid var(--accent);
}

.auth-layout {
    min-height: 68vh;
    display: grid;
    place-items: center;
    padding: 1.4rem 1rem;
}

.form-card {
    width: min(100%, 460px);
}

label {
    display: block;
    margin: 1rem 0 0.35rem;
    color: var(--muted);
    font-weight: 800;
}

input,
select {
    width: 100%;
    min-height: 46px;
    padding: 0.75rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    font: inherit;
}

.input-error {
    border-color: var(--danger);
}

.form-error,
.flash-error {
    color: var(--danger);
    font-weight: 700;
}

.flash,
.balance-note {
    margin: 1rem auto;
    width: min(92%, 900px);
    padding: 1rem;
    border-radius: 8px;
    background: var(--surface);
    border: 1px solid var(--line);
}

.flash-success {
    color: var(--success);
}

.small-text,
.metric-panel p,
.referral-card p,
.site-footer {
    color: var(--muted);
}

.dashboard-header {
    grid-template-columns: 1fr;
    align-items: center;
    margin-bottom: 1rem;
}

.dashboard-grid {
    grid-template-columns: 1fr;
    margin-bottom: 1rem;
}

.panel-tabs {
    position: sticky;
    top: 100px;
    z-index: 10;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.35rem;
    padding: 0.35rem;
    margin-bottom: 1rem;
    background: #eef6ff;
    border: 1px solid #bcd7ff;
    border-radius: 8px;
}

.panel-tab {
    min-height: 48px;
    padding: 0.65rem 0.55rem;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--primary-dark);
    cursor: pointer;
    font: inherit;
    font-weight: 800;
}

.panel-tab.is-active {
    background: var(--surface);
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
}

.panel-view[hidden] {
    display: none;
}

.team-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1rem;
}

.user-pill,
.status {
    display: inline-flex;
    padding: 0.4rem 0.7rem;
    background: #eef6ff;
    border: 1px solid #bcd7ff;
    border-radius: 999px;
    color: #175cd3;
    font-weight: 800;
}

.panel-section {
    margin-top: 1rem;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 0.7rem;
    border-bottom: 1px solid var(--line);
    text-align: left;
}

th {
    color: var(--muted);
    font-size: 0.82rem;
    text-transform: uppercase;
}

.referral-grid,
.risk-grid {
    grid-template-columns: 1fr;
}

.site-footer {
    padding: 2rem 1rem 6rem;
    text-align: center;
    background: var(--surface);
    border-top: 1px solid var(--line);
}

textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    resize: vertical;
    font: inherit;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: grid;
    place-items: end center;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.62);
}

.modal-backdrop[hidden] {
    display: none;
}

.modal {
    width: min(100%, 520px);
    padding: 1.2rem;
    background: var(--surface);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1rem;
}

.inline-admin-form {
    display: grid;
    grid-template-columns: 120px 140px 150px auto;
    gap: 0.5rem;
    min-width: 620px;
}

.inline-admin-form input,
.inline-admin-form select {
    min-height: 40px;
}

@media (max-width: 820px) {
    .modal-actions {
        flex-direction: column;
    }

    .team-header {
        align-items: stretch;
        flex-direction: column;
    }

    .inline-admin-form {
        grid-template-columns: 1fr;
        min-width: 280px;
    }
}

@media (min-width: 821px) {
    body {
        padding-bottom: 96px;
    }

    .site-header {
        top: 37px;
        padding-inline: clamp(1rem, 4vw, 4rem);
    }

    .main-nav {
        left: 50%;
        right: auto;
        width: min(720px, calc(100% - 2rem));
        transform: translateX(-50%);
    }

    .hero {
        padding: clamp(3rem, 8vw, 7rem) clamp(1rem, 5vw, 5rem);
    }

    .hero-actions,
    .stats-grid,
    .plans-grid,
    .story-grid,
    .mission-grid,
    .script-grid,
    .dashboard-grid,
    .referral-grid,
    .risk-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .hero-actions {
        grid-template-columns: repeat(2, max-content);
    }

    .dashboard-header {
        grid-template-columns: 1fr auto;
    }

    .dashboard-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .panel-tabs {
        width: min(100%, 620px);
    }

    .modal-backdrop {
        place-items: center;
    }
}
