/* ==========================================================================
   BIMMers Academy — estilos compartidos por academia.html, curso.html y
   verificar.html.

   Mismas variables de tema que el resto de la plataforma (data-theme en <html>),
   para que la Academia no se vea como un producto ajeno.
   ========================================================================== */

:root {
    --logo-blue: #3AAFE9;
    --logo-blue-dark: #2B8BBF;
}

[data-theme="light"] {
    --bg-primary: #F0F4F8;
    --bg-secondary: #FFFFFF;
    --bg-tertiary: #F8FAFC;
    --bg-card: #FFFFFF;
    --border-subtle: #E2E8F0;
    --border-light: #CBD5E1;
    --accent: #3AAFE9;
    --accent-dark: #2B8BBF;
    --accent-glow: rgba(58, 175, 233, .25);
    --text-primary: #0F172A;
    --text-secondary: #334155;
    --text-muted: #64748B;
    --text-dimmed: #94A3B8;
    --success: #10B981;
    --success-bg: rgba(16, 185, 129, .1);
    --warning: #F59E0B;
    --warning-bg: rgba(245, 158, 11, .1);
    --error: #EF4444;
    --error-bg: rgba(239, 68, 68, .1);
    --header-bg: #FFFFFF;
    --shadow: 0 1px 3px rgba(15, 23, 42, .08);
}

[data-theme="dark"] {
    --bg-primary: #0B1622;
    --bg-secondary: #111D2E;
    --bg-tertiary: #162233;
    --bg-card: #111D2E;
    --border-subtle: rgba(255, 255, 255, .08);
    --border-light: rgba(255, 255, 255, .12);
    --accent: #3AAFE9;
    --accent-dark: #2B8BBF;
    --accent-glow: rgba(58, 175, 233, .3);
    --text-primary: #F1F5F9;
    --text-secondary: #E2E8F0;
    --text-muted: #94A3B8;
    --text-dimmed: #64748B;
    --success: #10B981;
    --success-bg: rgba(16, 185, 129, .15);
    --warning: #F59E0B;
    --warning-bg: rgba(245, 158, 11, .15);
    --error: #EF4444;
    --error-bg: rgba(239, 68, 68, .15);
    --header-bg: #111D2E;
    --shadow: 0 1px 3px rgba(0, 0, 0, .3);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: 'Outfit', sans-serif; margin: 0; }

a { color: inherit; }

/* ── Cabecera ─────────────────────────────────────────────────────────── */
.ac-header {
    position: sticky; top: 0; z-index: 50;
    background: var(--header-bg);
    border-bottom: 1px solid var(--border-subtle);
}

.ac-header-content {
    max-width: 1400px; margin: 0 auto; padding: 12px 24px;
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
}

.ac-header-left { display: flex; align-items: center; gap: 18px; min-width: 0; }

.ac-logo { display: flex; align-items: center; gap: 9px; text-decoration: none; }
.ac-logo img { height: 30px; }
.ac-logo-text { font-family: 'Outfit', sans-serif; font-weight: 800; font-size: 17px; }
.ac-logo-text span { color: var(--accent); }

.ac-back {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 13px; border-radius: 8px;
    border: 1px solid var(--border-subtle); background: var(--bg-tertiary);
    color: var(--text-secondary); text-decoration: none; font-size: 13px; font-weight: 500;
    transition: .15s;
}
.ac-back:hover { border-color: var(--accent); color: var(--accent); }
.ac-back svg { width: 15px; height: 15px; }

.ac-header-actions { display: flex; align-items: center; gap: 12px; }

.ac-theme { display: flex; gap: 2px; padding: 3px; border-radius: 9px; background: var(--bg-tertiary); border: 1px solid var(--border-subtle); }
.ac-theme button {
    width: 30px; height: 28px; border: 0; border-radius: 7px; cursor: pointer;
    background: transparent; color: var(--text-muted); display: grid; place-items: center;
}
.ac-theme button.active { background: var(--bg-card); color: var(--accent); box-shadow: var(--shadow); }

.ac-user { display: flex; align-items: center; gap: 9px; }
.ac-avatar {
    width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: #fff; font-weight: 700; font-size: 13px;
}
.ac-user-name { font-size: 13px; font-weight: 600; }

/* ── Layout ───────────────────────────────────────────────────────────── */
.ac-main { max-width: 1400px; margin: 0 auto; padding: 28px 24px 64px; }

.ac-page-head { margin-bottom: 26px; }
.ac-page-title { font-size: 27px; font-weight: 800; display: flex; align-items: center; gap: 11px; }
.ac-page-sub { color: var(--text-muted); font-size: 14px; margin-top: 6px; }

/* ── Pestañas ─────────────────────────────────────────────────────────── */
.ac-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border-subtle); margin-bottom: 24px; flex-wrap: wrap; }
.ac-tab {
    padding: 10px 17px; border: 0; background: transparent; cursor: pointer;
    color: var(--text-muted); font-size: 14px; font-weight: 600; font-family: inherit;
    border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.ac-tab:hover { color: var(--text-secondary); }
.ac-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ── Tarjetas de curso ────────────────────────────────────────────────── */
.ac-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(288px, 1fr)); gap: 20px; }

.ac-card {
    background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: 14px;
    overflow: hidden; display: flex; flex-direction: column;
    transition: transform .15s, border-color .15s, box-shadow .15s;
    text-decoration: none; color: inherit;
}
.ac-card:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: 0 10px 26px var(--accent-glow); }

.ac-card-cover {
    height: 150px; background: linear-gradient(135deg, var(--accent-dark), var(--accent));
    display: grid; place-items: center; position: relative; overflow: hidden;
}
.ac-card-cover img { width: 100%; height: 100%; object-fit: cover; }
.ac-card-cover .ac-cover-icon { font-size: 44px; opacity: .85; }

.ac-badge {
    position: absolute; top: 10px; right: 10px;
    padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 700;
    background: rgba(0, 0, 0, .55); color: #fff; backdrop-filter: blur(4px);
}
.ac-badge.borrador { background: rgba(100, 116, 139, .9); }
.ac-badge.en_revision { background: rgba(245, 158, 11, .92); }
.ac-badge.publicado { background: rgba(16, 185, 129, .92); }
.ac-badge.archivado { background: rgba(71, 85, 105, .92); }

.ac-card-body { padding: 15px 16px 17px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.ac-card-title { font-size: 15.5px; font-weight: 700; line-height: 1.32; }
.ac-card-sub { font-size: 12.5px; color: var(--text-muted); line-height: 1.45; flex: 1; }
.ac-card-meta { display: flex; gap: 13px; font-size: 11.5px; color: var(--text-dimmed); flex-wrap: wrap; }

/* ── Barra de progreso ────────────────────────────────────────────────── */
.ac-progress { height: 6px; border-radius: 4px; background: var(--bg-tertiary); overflow: hidden; }
.ac-progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--success)); transition: width .3s; }
.ac-progress-label { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }

/* ── Botones ──────────────────────────────────────────────────────────── */
.ac-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 9px 17px; border-radius: 9px; border: 1px solid transparent;
    font-size: 13.5px; font-weight: 600; font-family: inherit; cursor: pointer;
    text-decoration: none; transition: .15s; white-space: nowrap;
}
.ac-btn-primary { background: var(--accent); color: #fff; }
.ac-btn-primary:hover { background: var(--accent-dark); }
.ac-btn-ghost { background: var(--bg-tertiary); border-color: var(--border-subtle); color: var(--text-secondary); }
.ac-btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.ac-btn-danger { background: var(--error-bg); color: var(--error); border-color: transparent; }
.ac-btn-danger:hover { background: var(--error); color: #fff; }
.ac-btn-sm { padding: 6px 11px; font-size: 12.5px; }
.ac-btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Formularios ──────────────────────────────────────────────────────── */
.ac-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.ac-field label { font-size: 12.5px; font-weight: 600; color: var(--text-secondary); }
.ac-field input[type=text], .ac-field input[type=number], .ac-field textarea, .ac-field select {
    padding: 9px 12px; border-radius: 8px; font-size: 13.5px; font-family: inherit;
    border: 1px solid var(--border-subtle); background: var(--bg-tertiary); color: var(--text-primary);
}
.ac-field input:focus, .ac-field textarea:focus, .ac-field select:focus {
    outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow);
}
.ac-field textarea { resize: vertical; min-height: 74px; }
.ac-field-hint { font-size: 11.5px; color: var(--text-dimmed); }
.ac-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ── Alternativas del editor de preguntas ─────────────────────────────── */
.ac-opt-row { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.ac-opt-row .op-txt {
    flex: 1; min-width: 0; padding: 8px 11px; border-radius: 8px;
    font-size: 13.5px; font-family: inherit;
    border: 1px solid var(--border-subtle); background: var(--bg-tertiary); color: var(--text-primary);
}
.ac-opt-row .op-txt:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.ac-opt-check {
    display: grid; place-items: center; width: 34px; height: 34px; flex-shrink: 0;
    border-radius: 8px; border: 1px solid var(--border-subtle); background: var(--bg-tertiary);
    cursor: pointer;
}
/* La casilla marcada se tiñe de verde: de un vistazo se ve cuál es la correcta. */
.ac-opt-check:has(input:checked) { background: var(--success-bg); border-color: var(--success); }
.ac-opt-check input { cursor: pointer; }

/* ── Modal ────────────────────────────────────────────────────────────── */
.ac-modal { position: fixed; inset: 0; z-index: 200; display: none; }
.ac-modal.open { display: block; }
.ac-modal-bg { position: absolute; inset: 0; background: rgba(0, 0, 0, .6); backdrop-filter: blur(3px); }
.ac-modal-box {
    position: relative; margin: 5vh auto; max-width: 640px; width: calc(100% - 32px);
    max-height: 90vh; overflow-y: auto;
    background: var(--bg-card); border: 1px solid var(--border-subtle);
    border-radius: 15px; box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
}
.ac-modal-head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 17px 21px; border-bottom: 1px solid var(--border-subtle);
    position: sticky; top: 0; background: var(--bg-card); border-radius: 15px 15px 0 0;
}
.ac-modal-head h3 { font-size: 16.5px; font-weight: 700; }
.ac-modal-close { border: 0; background: transparent; color: var(--text-muted); font-size: 25px; cursor: pointer; line-height: 1; }
.ac-modal-body { padding: 21px; }
.ac-modal-foot { padding: 15px 21px; border-top: 1px solid var(--border-subtle); display: flex; justify-content: flex-end; gap: 9px; }

/* ── Estados ──────────────────────────────────────────────────────────── */
.ac-empty { text-align: center; padding: 62px 22px; color: var(--text-muted); }
.ac-empty-icon { font-size: 46px; margin-bottom: 13px; opacity: .55; }
.ac-empty h3 { font-size: 17px; margin-bottom: 7px; color: var(--text-secondary); }
.ac-empty p { font-size: 13.5px; max-width: 430px; margin: 0 auto; line-height: 1.6; }

.ac-loading { text-align: center; padding: 56px; color: var(--text-muted); font-size: 14px; }

.ac-toast {
    position: fixed; bottom: 24px; right: 24px; z-index: 400;
    padding: 13px 19px; border-radius: 10px; font-size: 13.5px; font-weight: 500;
    background: var(--bg-card); border: 1px solid var(--border-subtle);
    box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
    transform: translateY(90px); opacity: 0; transition: .25s;
}
.ac-toast.show { transform: translateY(0); opacity: 1; }
.ac-toast.success { border-left: 3px solid var(--success); }
.ac-toast.error { border-left: 3px solid var(--error); }
.ac-toast.info { border-left: 3px solid var(--accent); }

.ac-pill {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 700;
}
.ac-pill.ok { background: var(--success-bg); color: var(--success); }
.ac-pill.warn { background: var(--warning-bg); color: var(--warning); }
.ac-pill.info { background: var(--accent-glow); color: var(--accent); }

@media (max-width: 720px) {
    .ac-row { grid-template-columns: 1fr; }
    .ac-header-content { padding: 10px 14px; }
    .ac-main { padding: 20px 14px 48px; }
    .ac-back span { display: none; }
}
