/* ayuda.lol — Hoja de estilos principal */

:root {
    color-scheme: light;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --bg: #f1f5f9;
    --card: #ffffff;
    --text: #1e293b;
    --muted: #64748b;
    --border: #e2e8f0;
    --danger: #dc2626;
    --success: #16a34a;
    --warning: #d97706;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

/* ---------- Barra superior ---------- */
.topbar {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 24px;
    flex-wrap: wrap;
    gap: 10px;
}
.brand img { height: 38px; display: block; }
.brand { text-decoration: none; }
.brand-text { font-size: 1.2rem; font-weight: 700; color: var(--primary); }
.topbar nav { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.topbar nav a { color: var(--text); text-decoration: none; font-weight: 500; font-size: .95rem; }
.topbar nav a:hover { color: var(--primary); }
.user-chip {
    background: var(--bg);
    padding: 4px 12px;
    border-radius: 999px;
    font-size: .85rem;
    color: var(--muted);
}
.btn-logout { color: var(--danger) !important; }

/* ---------- Contenedores ---------- */
.container { max-width: 1080px; margin: 28px auto; padding: 0 20px; }
.container.bare { max-width: 440px; margin-top: 8vh; }

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
}
.card h1, .card h2 { margin-top: 0; }

/* ---------- Tarjetas de estadísticas ---------- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 18px 20px;
}
.stat-card .num { font-size: 1.9rem; font-weight: 700; color: var(--primary); }
.stat-card .label { color: var(--muted); font-size: .9rem; }

/* ---------- Formularios ---------- */
label { display: block; font-weight: 600; font-size: .88rem; margin: 12px 0 4px; }
input, select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: .95rem;
    background: #fff;
    color: var(--text);
}
input:focus, select:focus { outline: 2px solid var(--primary); border-color: transparent; }
.form-row { display: flex; gap: 14px; flex-wrap: wrap; }
.form-row > div { flex: 1; min-width: 200px; }
.hint { color: var(--muted); font-size: .8rem; margin-top: 3px; }

/* ---------- Botones ---------- */
.btn {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    border: 0;
    border-radius: 8px;
    padding: 10px 18px;
    font-size: .95rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}
.btn:hover { background: var(--primary-dark); }
.btn-sm { padding: 5px 10px; font-size: .8rem; }
.btn-secondary { background: var(--muted); }
.btn-danger { background: var(--danger); }
.btn-warning { background: var(--warning); }
.btn-ghost {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--border);
}

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
tr:hover td { background: #f8fafc; }
.short-code { font-family: ui-monospace, monospace; font-weight: 600; color: var(--primary); }
.long-url {
    max-width: 260px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-block;
    vertical-align: middle;
    color: var(--muted);
}
.actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- Insignias ---------- */
.badge { padding: 3px 10px; border-radius: 999px; font-size: .75rem; font-weight: 600; }
.badge-active { background: #dcfce7; color: #166534; }
.badge-suspended { background: #fee2e2; color: #991b1b; }
.badge-admin { background: #ede9fe; color: #5b21b6; }
.badge-student { background: #e0f2fe; color: #075985; }

/* ---------- Alertas ---------- */
.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 18px; font-size: .93rem; }
.alert-success { background: #dcfce7; color: #166534; }
.alert-error { background: #fee2e2; color: #991b1b; }

/* ---------- Modal QR ---------- */
.qr-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .55);
    align-items: center;
    justify-content: center;
    z-index: 50;
}
.qr-modal {
    background: #fff;
    border-radius: 14px;
    padding: 26px;
    text-align: center;
    max-width: 320px;
    width: 92%;
}
#qr-box { display: flex; justify-content: center; }
.qr-url { font-family: ui-monospace, monospace; font-size: .85rem; color: var(--muted); word-break: break-all; }
.qr-actions { display: flex; gap: 10px; justify-content: center; }

/* ---------- Estadísticas avanzadas ---------- */
.two-col {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}
.two-col .card { margin-bottom: 0; }
.pct-bar {
    background: var(--border);
    border-radius: 999px;
    height: 8px;
    overflow: hidden;
    min-width: 80px;
}
.pct-fill {
    background: var(--primary);
    height: 100%;
    border-radius: 999px;
}

/* ---------- Login ---------- */
.login-card { text-align: center; }
.login-card form { text-align: left; }
.login-logo { max-height: 60px; margin-bottom: 8px; }

@media (max-width: 640px) {
    .topbar { padding: 10px 14px; }
    .container { margin-top: 16px; }
}
