/* ============================================================
   ESCUELA B2B - Estilos principales
   Plataforma LMS B2B segura
   ============================================================ */

/* === VARIABLES === */
:root {
    --primary: #00d4aa;
    --primary-dark: #00b894;
    --primary-light: #e8fcf6;
    --bg-dark: #1a1a2e;
    --bg-darker: #16162a;
    --bg-sidebar: #1e1e3a;
    --text: #333;
    --text-light: #666;
    --text-muted: #999;
    --border: #e2e8f0;
    --bg-page: #f7f8fc;
    --white: #fff;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.12);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* === RESET === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); font-size: 14px; line-height: 1.6; color: var(--text); background: var(--bg-page); }
a { color: var(--primary-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
ul { list-style: none; }
pre { background: #f1f5f9; padding: 12px 16px; border-radius: var(--radius); font-size: 12px; overflow-x: auto; }
code { background: #f1f5f9; padding: 2px 6px; border-radius: 4px; font-size: 13px; }

.course-notice-dialog {
    width: min(620px, calc(100% - 32px));
    max-height: calc(100vh - 32px);
    margin: auto;
    padding: 0;
    overflow: auto;
    color: var(--text);
    background: var(--white);
    border: 0;
    border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.course-notice-dialog::backdrop {
    background: rgba(22, 22, 42, 0.76);
}

.course-notice-content {
    position: relative;
    padding: 28px;
}

.course-notice-close-form {
    position: absolute;
    top: 10px;
    right: 10px;
}

.course-notice-close {
    display: grid;
    width: 36px;
    height: 36px;
    padding: 0;
    place-items: center;
    color: var(--text-light);
    background: transparent;
    border: 0;
    border-radius: 50%;
    font: inherit;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}

.course-notice-close:hover,
.course-notice-close:focus-visible {
    color: var(--text);
    background: var(--bg-page);
}

.course-notice-content h2 {
    margin-bottom: 18px;
    font-size: 24px;
}

.course-notice-content ul {
    display: grid;
    gap: 14px;
    margin: 0 0 24px 20px;
    list-style: disc;
}

.course-notice-content li {
    padding-left: 4px;
}

.course-notice-content a {
    overflow-wrap: anywhere;
    font-weight: 600;
}

.course-notice-content > form:last-child {
    display: flex;
    justify-content: flex-end;
}

@media (max-width: 520px) {
    .course-notice-content {
        padding: 22px 20px;
    }

    .course-notice-content h2 {
        font-size: 21px;
    }

    .course-notice-content form .btn {
        width: 100%;
    }
}

/* === LAYOUT AUTH === */
.layout-auth {
    background: var(--bg-dark);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.auth-card {
    background: var(--white);
    border-radius: 12px;
    padding: 40px;
    box-shadow: var(--shadow-lg);
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-header h1 {
    font-size: 28px;
    color: var(--bg-dark);
    margin-bottom: 4px;
}

.auth-header p {
    color: var(--text-muted);
}

.auth-footer {
    text-align: center;
    color: rgba(255,255,255,0.4);
    font-size: 12px;
    margin-top: 20px;
}

.auth-links {
    text-align: center;
    margin-top: 16px;
    font-size: 13px;
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}
.auth-links a {
    color: var(--text-muted, #64748b);
    text-decoration: none;
    transition: color .2s;
}
.auth-links a:hover {
    color: var(--primary, #00d4aa);
    text-decoration: underline;
}

.welcome-message {
    background: var(--primary-light);
    padding: 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
}

.welcome-message p { margin-bottom: 4px; color: var(--text); }

/* === LAYOUT ADMIN (sidebar) === */
.layout-admin {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 250px;
    background: var(--bg-sidebar);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    overflow-y: auto;
}

.sidebar-header {
    padding: 24px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-header h2 {
    font-size: 18px;
    margin-bottom: 6px;
}

.sidebar-nav {
    padding: 12px 0;
    flex: 1;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: rgba(255,255,255,0.7);
    font-size: 14px;
    transition: all 0.15s;
    text-decoration: none;
}

.sidebar-nav .nav-link:hover {
    color: #fff;
    background: rgba(255,255,255,0.05);
    text-decoration: none;
}

.sidebar-nav .nav-link.active {
    color: var(--primary);
    background: rgba(0,212,170,0.1);
    border-right: 3px solid var(--primary);
}

.nav-icon { font-size: 16px; width: 24px; text-align: center; }

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-footer .user-info {
    color: rgba(255,255,255,0.6);
    font-size: 13px;
    margin-bottom: 8px;
}

.layout-admin .main-content {
    margin-left: 250px;
    padding: 30px;
    flex: 1;
    min-width: 0;
}

/* === LAYOUT STUDENT/VIEWER (top bar) === */
.top-bar {
    background: var(--bg-dark);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    height: 60px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.top-bar-left { display: flex; align-items: center; gap: 12px; }
.top-bar-left h2 { font-size: 18px; }
.top-bar-center .nav-link { color: rgba(255,255,255,0.7); padding: 8px 16px; }
.top-bar-center .nav-link:hover { color: #fff; text-decoration: none; }
.top-bar-center .nav-link.active { color: var(--primary); }
.top-bar-right { display: flex; align-items: center; gap: 12px; }
.user-name { color: rgba(255,255,255,0.7); font-size: 13px; }

.main-content-full {
    padding: 30px;
    max-width: 1200px;
    margin: 0 auto;
}

/* === COMPONENTES: Cards === */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 { font-size: 16px; margin: 0; }
.card-body { padding: 20px; }

/* === COMPONENTES: Tables === */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    text-align: left;
    padding: 10px 14px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
}

.table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.table tbody tr:hover { background: #f9fafb; }
.table-compact th, .table-compact td { padding: 8px 12px; }
.table-scroll { overflow-x: auto; }
.users-table { min-width: 1050px; }
.users-table th:last-child,
.users-table td:last-child {
    position: sticky;
    right: 0;
    background: var(--white);
    box-shadow: -4px 0 8px rgba(15, 23, 42, 0.08);
    z-index: 1;
}
.users-table th:last-child { z-index: 2; }
.users-table tbody tr:hover td:last-child { background: #f9fafb; }

/* === COMPONENTES: Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    line-height: 1.4;
}

.btn:hover { text-decoration: none; opacity: 0.9; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary { background: var(--primary); color: var(--bg-dark); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: #e2e8f0; color: var(--text); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--text-muted); }
.sidebar .btn-outline,
.top-bar .btn-outline { color: #fff; border-color: rgba(255,255,255,0.3); }
.sidebar .btn-outline:hover,
.top-bar .btn-outline:hover { border-color: rgba(255,255,255,0.6); background: rgba(255,255,255,0.1); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-group { display: flex; gap: 6px; flex-wrap: wrap; }

/* === COMPONENTES: Forms === */
.form-group { margin-bottom: 18px; }
.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 13px;
    color: var(--text);
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    font-family: var(--font);
    transition: border-color 0.15s;
    background: var(--white);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0,212,170,0.15);
}

.form-help { display: block; margin-top: 4px; font-size: 12px; color: var(--text-muted); }

.form-inline {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.form-inline .form-input { flex: 1; min-width: 200px; }

.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: normal;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

/* === COMPONENTES: Alerts === */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 14px;
    line-height: 1.5;
}

.alert ul { margin-top: 8px; padding-left: 20px; list-style: disc; }
.alert-success { background: #ecfdf5; color: #065f46; border-left: 4px solid var(--success); }
.alert-error { background: #fef2f2; color: #991b1b; border-left: 4px solid var(--danger); }
.alert-warning { background: #fffbeb; color: #92400e; border-left: 4px solid var(--warning); }
.alert-info { background: #eff6ff; color: #1e40af; border-left: 4px solid var(--info); }

/* === COMPONENTES: Badges === */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-muted { background: #f1f5f9; color: #64748b; }
.badge-admin { background: var(--primary); color: var(--bg-dark); font-size: 10px; }
.badge-viewer { background: var(--info); color: #fff; font-size: 10px; }

/* === COMPONENTES: Stats === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    text-align: center;
}

.stat-number { font-size: 36px; font-weight: 700; color: var(--bg-dark); }
.stat-label { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.stat-success .stat-number { color: var(--success); }
.stat-info .stat-number { color: var(--info); }
.stat-muted .stat-number { color: var(--text-muted); }

/* === COMPONENTES: Progress Bar === */
.progress-bar-container {
    background: #f1f5f9;
    border-radius: 10px;
    height: 8px;
    overflow: hidden;
    margin-bottom: 4px;
}

.progress-bar-lg { height: 12px; }

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-dark));
    border-radius: 10px;
    transition: width 0.5s ease;
    min-width: 0;
}

/* === PAGE ELEMENTS === */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.page-header h1 { font-size: 24px; color: var(--bg-dark); }

.link-back {
    display: inline-block;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

.text-muted { color: var(--text-muted); }
.mb-4 { margin-bottom: 24px; }
.mb-6 { margin-bottom: 36px; }
.mt-2 { margin-top: 12px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }

.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    color: var(--text-muted);
}

.empty-state h2 { margin-bottom: 8px; color: var(--text); }

.quick-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* === CURSOS GRID (student) === */
.courses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

.course-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.2s;
}

.course-card:hover { box-shadow: var(--shadow-lg); }

.course-thumbnail {
    height: 170px;
    background-size: cover;
    background-position: center;
    background-color: var(--bg-dark);
    overflow: hidden;
}

.course-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.course-thumbnail-default {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 64px;
}

.course-card-body { padding: 20px; flex: 1; }
.course-card-body h3 { font-size: 18px; margin-bottom: 8px; }
.course-progress { margin-top: 16px; }
.progress-text { font-size: 12px; color: var(--text-muted); }
.course-card-footer { padding: 0 20px 20px; }

/* === CURSO DETALLE (student) === */
.course-detail { max-width: 900px; }

.course-progress-summary {
    text-align: center;
}

.progress-circle {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 6px;
}

.progress-number { font-size: 20px; font-weight: 700; color: var(--primary-dark); }
.progress-label { font-size: 12px; color: var(--text-muted); }

/* === MODULES / LESSONS === */
.module-block {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    overflow: hidden;
}

.module-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
}

.module-header h2 { font-size: 16px; }
.module-count { font-size: 13px; color: var(--text-muted); font-weight: 500; }

.lessons-list { padding: 0; }

.lesson-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    transition: background 0.1s;
}

.lesson-item:last-child { border-bottom: none; }
.lesson-item:hover { background: #fafafa; }
.lesson-locked { opacity: 0.5; }
.lesson-completed { background: #f0fdf4; }

.lesson-status-icon { font-size: 18px; width: 28px; text-align: center; flex-shrink: 0; }
.lesson-info { flex: 1; min-width: 0; }
.lesson-info h4 { font-size: 14px; margin-bottom: 2px; }
.lesson-duration { font-size: 12px; color: var(--text-muted); }
.lesson-action { flex-shrink: 0; }

/* === LESSON VIEW === */
.lesson-view {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 24px;
    max-width: 1200px;
}

.lesson-main { min-width: 0; }

.lesson-header {
    margin-bottom: 20px;
}

.lesson-header h1 { font-size: 22px; margin-bottom: 4px; }
.lesson-module-name { font-size: 13px; color: var(--text-muted); }

.video-container {
    background: #000;
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 20px;
    aspect-ratio: 16/9;
}

.video-container iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.iframe-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
}

.iframe-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.extra-video-player {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.lesson-no-video {
    margin-bottom: 20px;
}

.no-video-card {
    background: var(--white);
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
}

.no-video-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 12px;
}

.no-video-card p {
    margin: 4px 0;
    font-size: 15px;
}

.lesson-description {
    background: var(--white);
    padding: 20px;
    border-radius: var(--radius);
    margin-bottom: 20px;
}

.lesson-description h3 { margin-bottom: 10px; }

.lesson-download {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.lesson-actions {
    background: var(--white);
    padding: 20px;
    border-radius: var(--radius);
    text-align: center;
}

#complete-hint { margin-top: 8px; font-size: 13px; }

/* === LESSON SIDEBAR === */
.lesson-sidebar {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    height: fit-content;
    position: sticky;
    top: 80px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}

.lesson-sidebar h3 {
    margin-bottom: 16px;
    font-size: 16px;
}

.sidebar-module { margin-bottom: 16px; }
.sidebar-module h4 { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }

.sidebar-lessons li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    font-size: 13px;
    border-radius: 4px;
}

.sidebar-lessons li.current {
    background: var(--primary-light);
    color: var(--primary-dark);
}

.sidebar-lessons li.completed { color: var(--text-muted); }
.sidebar-icon { font-size: 14px; width: 20px; text-align: center; flex-shrink: 0; }

/* === MODULE CARD (admin) === */
.module-card { overflow: visible; }
.add-lesson-form {
    padding-top: 16px;
    border-top: 1px solid var(--border);
}
.add-lesson-form h4 { margin-bottom: 12px; font-size: 14px; color: var(--text-muted); }

.csv-example { background: #f8fafc; padding: 16px; border-radius: var(--radius); }
.csv-example h4 { margin-bottom: 8px; }

/* === REPORT TABS === */
.report-tabs {
    display: flex;
    gap: 0;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.report-tab {
    flex: 1;
    text-align: center;
    padding: 14px 20px;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.15s;
    border-bottom: 3px solid transparent;
}

.report-tab:hover {
    color: var(--text);
    background: #f8fafc;
    text-decoration: none;
}

.report-tab.active {
    color: var(--primary-dark);
    border-bottom-color: var(--primary);
    background: var(--primary-light);
}

/* === DISTRIBUTION BARS (insights) === */
.dist-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.dist-label {
    width: 100px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    flex-shrink: 0;
}

.dist-bar-container {
    flex: 1;
    height: 24px;
    background: #f1f5f9;
    border-radius: 6px;
    overflow: hidden;
}

.dist-bar {
    height: 100%;
    border-radius: 6px;
    transition: width 0.5s ease;
    min-width: 0;
}

.dist-count {
    width: 30px;
    text-align: right;
    font-weight: 700;
    font-size: 14px;
    color: var(--text);
    flex-shrink: 0;
}

/* === ACTIVITY FEED === */
.activity-feed {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

.activity-item:last-child { border-bottom: none; }

.activity-icon {
    font-size: 16px;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.activity-content {
    flex: 1;
    min-width: 0;
}

.activity-content em {
    font-style: normal;
    color: var(--primary-dark);
}

.activity-time {
    flex-shrink: 0;
    font-size: 12px;
    white-space: nowrap;
}

/* === RESPONSIVE === */
/* ========== TEST SECTION IN LESSON ========== */
.lesson-test-section { margin-top: 2rem; }
.test-card { background: #fff; border: 2px solid var(--border); border-radius: 12px; overflow: hidden; }
.test-card-header { padding: 1.25rem 1.5rem; background: linear-gradient(135deg, #667eea, #764ba2); color: #fff; }
.test-card-header h3 { margin: 0 0 .25rem; font-size: 1.2rem; }
.test-card-header .text-muted { color: rgba(255,255,255,.8); margin: 0; font-size: .9rem; }
.test-card-body { padding: 1.5rem; }
.test-info-grid { display: flex; gap: 1.5rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.test-info-item { text-align: center; }
.test-info-item .label { display: block; font-size: .75rem; color: var(--text-light); text-transform: uppercase; }
.test-info-item .value { display: block; font-size: 1.3rem; font-weight: 700; color: var(--primary); }
.test-best-result { display: flex; align-items: center; gap: 1rem; padding: 1rem; border-radius: 8px; margin-bottom: 1.25rem; }
.test-best-result.passed { background: #d4edda; border: 1px solid #c3e6cb; }
.test-best-result.failed { background: #f8d7da; border: 1px solid #f5c6cb; }
.test-best-result .result-icon { font-size: 2rem; }
.test-best-result strong { display: block; }
.test-best-result span { font-size: .85rem; color: var(--text-light); }

/* ========== TEST TAKING ========== */
.test-taking { max-width: 800px; margin: 0 auto; padding: 2rem 1rem; }
.test-taking-header { text-align: center; margin-bottom: 2rem; }
.test-taking-header h1 { margin-bottom: .5rem; }
.test-meta { display: flex; gap: 1.5rem; justify-content: center; flex-wrap: wrap; margin-top: 1rem; color: var(--text-light); }
.test-previous-attempts { margin-bottom: 2rem; }
.test-previous-attempts h3 { margin-bottom: .75rem; }

.question-card { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 1.5rem; margin-bottom: 1.5rem; }
.question-header { display: flex; gap: 1rem; align-items: flex-start; margin-bottom: 1rem; }
.question-number { background: var(--primary); color: #fff; width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .9rem; flex-shrink: 0; }
.question-text p { margin: 0; font-size: 1.05rem; }
.question-points { font-size: .8rem; color: var(--text-light); }
.question-options { display: flex; flex-direction: column; gap: .5rem; }
.option-label { display: flex; align-items: center; gap: .75rem; padding: .75rem 1rem; border: 2px solid var(--border); border-radius: 8px; cursor: pointer; transition: all .2s; }
.option-label:hover { border-color: var(--primary); background: rgba(79,70,229,.04); }
.option-label input:checked ~ .option-text { font-weight: 600; }
.option-label input:checked ~ .option-text { color: var(--primary); }
.option-label input[type="radio"]:checked + .option-text,
.option-label input[type="checkbox"]:checked + .option-text { color: var(--primary); }

.test-submit { text-align: center; margin-top: 2rem; padding-top: 2rem; border-top: 2px solid var(--border); }

/* Timer */
.test-timer { display: inline-block; background: var(--primary); color: #fff; padding: .5rem 1.25rem; border-radius: 20px; font-size: 1.1rem; font-weight: 700; margin-top: 1rem; }
.test-timer.timer-warning { background: #e74c3c; animation: pulse 1s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .6; } }

/* ========== TEST RESULT ========== */
.test-result-view { max-width: 800px; margin: 0 auto; padding: 2rem 1rem; }
.test-result-header { text-align: center; margin-bottom: 2rem; }
.result-summary { display: flex; align-items: center; gap: 1.5rem; justify-content: center; padding: 2rem; border-radius: 12px; margin-bottom: 2rem; text-align: center; flex-direction: column; }
.result-passed { background: linear-gradient(135deg, #d4edda, #b8e0c8); }
.result-failed { background: linear-gradient(135deg, #f8d7da, #f1b5bb); }
.result-icon { font-size: 3rem; }
.result-score { font-size: 2.5rem; margin: 0; }
.result-status { font-size: 1.2rem; margin: .25rem 0; }
.result-meta { display: flex; gap: 1.5rem; justify-content: center; flex-wrap: wrap; font-size: .9rem; color: var(--text-light); }

.result-answers { margin-bottom: 2rem; }
.result-answers h3 { margin-bottom: 1rem; }
.answer-card { background: #fff; border: 2px solid var(--border); border-radius: 10px; padding: 1.25rem; margin-bottom: 1rem; }
.answer-card.answer-correct { border-left: 4px solid #28a745; }
.answer-card.answer-wrong { border-left: 4px solid #dc3545; }
.answer-header { display: flex; align-items: center; gap: .75rem; margin-bottom: .75rem; }
.answer-icon { font-size: 1.2rem; }
.answer-number { font-weight: 600; }
.answer-points { margin-left: auto; font-size: .85rem; color: var(--text-light); }
.answer-question-text { margin: 0 0 .75rem; }
.answer-options { display: flex; flex-direction: column; gap: .3rem; }
.answer-option { display: flex; align-items: center; gap: .5rem; padding: .5rem .75rem; border-radius: 6px; font-size: .95rem; }
.opt-correct-selected { background: #d4edda; }
.opt-wrong-selected { background: #f8d7da; }
.opt-correct-missed { background: #fff3cd; }
.answer-explanation { margin-top: .75rem; padding: .75rem; background: #e8f4fd; border-radius: 6px; font-size: .9rem; }
.result-actions { display: flex; gap: 1rem; justify-content: center; margin-top: 2rem; }
.result-no-detail { text-align: center; padding: 2rem; color: var(--text-light); }

@media (max-width: 1024px) {
    .lesson-view { grid-template-columns: 1fr; }
    .lesson-sidebar { position: static; max-height: none; }
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        transform: translateX(-100%);
        transition: transform 0.3s;
    }
    .sidebar.open { transform: translateX(0); }
    .layout-admin .main-content { margin-left: 0; }
    .grid-2 { grid-template-columns: 1fr; }
    .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
    .courses-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================
   CERTIFICADOS
   ============================================================ */

/* Utilidades */
.mb-4 { margin-bottom: 1.5rem; }
.mb-6 { margin-bottom: 2rem; }

/* --- Placeholders help --- */
.cert-placeholders-help {
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 10px 14px;
    margin-bottom: 20px;
    font-size: 13px;
    line-height: 1.8;
}
.cert-placeholders-help code {
    background: var(--gray-200);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
}

/* --- Vista previa del fondo --- */
.cert-bg-preview {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius);
    padding: 8px;
    background: var(--gray-100);
    text-align: center;
}
.cert-bg-preview img {
    max-width: 100%;
    max-height: 320px;
    border-radius: 4px;
}

/* --- Campo dinámico card --- */
.cert-field-card {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    background: var(--white);
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.cert-field-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--gray-100);
}

.cert-field-position-grid {
    display: grid;
    grid-template-columns: auto repeat(4, 1fr) auto;
    gap: 10px;
    margin-top: 4px;
}

.form-input-color {
    height: 38px;
    padding: 3px;
    cursor: pointer;
}

/* btn-group para acciones inline */
.btn-group {
    display: flex;
    gap: 6px;
    align-items: center;
}

/* --- Student: Certificate Banner --- */
.certificate-banner {
    margin-bottom: 2rem;
}

.cert-banner-content {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem 2rem;
    background: linear-gradient(135deg, #1a7f37 0%, #2da44e 100%);
    color: #fff;
    border-radius: var(--radius);
}

.cert-banner-ready {
    background: linear-gradient(135deg, #0969da 0%, #218bff 100%);
}

.cert-banner-icon {
    font-size: 2.5rem;
    flex-shrink: 0;
}

.cert-banner-text h3 {
    margin: 0 0 0.25rem 0;
    font-size: 1.2rem;
    color: #fff;
}

.cert-banner-text p {
    margin: 0;
    opacity: 0.9;
    font-size: 0.9rem;
}

.cert-banner-content .btn {
    flex-shrink: 0;
    margin-left: auto;
    background: rgba(255,255,255,0.2);
    border: 2px solid #fff;
    color: #fff;
    font-weight: 600;
}

.cert-banner-content .btn:hover {
    background: #fff;
    color: #1a7f37;
}

.cert-banner-ready .btn:hover {
    color: #0969da;
}

@media (max-width: 768px) {
    .cert-field-position-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .cert-banner-content {
        flex-direction: column;
        text-align: center;
    }
    .cert-banner-content .btn {
        margin-left: 0;
    }
}

/* ============================================================
   GAMIFICACIÓN - Badges & Rankings
   ============================================================ */

/* --- Mini bar en dashboard alumno --- */
.gamification-summary-bar { display: flex; align-items: center; gap: 10px; }
.gamification-mini {
    display: flex; gap: 12px; align-items: center;
    background: linear-gradient(135deg, #eff6ff, #f0fdf4);
    padding: 8px 16px; border-radius: 20px;
    text-decoration: none; font-size: 13px; font-weight: 600;
    border: 1px solid #dbeafe;
    transition: all 0.2s;
}
.gamification-mini:hover { box-shadow: 0 2px 8px rgba(37,99,235,0.15); transform: translateY(-1px); }
.gm-points { color: #2563eb; }
.gm-badges { color: #16a34a; }
.gm-total-points { text-align: center; }
.gm-pts-number { font-size: 32px; font-weight: 800; color: #2563eb; display: block; }
.gm-pts-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }

/* --- Últimas insignias strip --- */
.badges-recent-strip {
    background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 16px 20px;
}
.badges-recent-header {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px;
}
.badges-recent-header h3 { margin: 0; font-size: 16px; }
.badges-mini-grid { display: flex; gap: 10px; flex-wrap: wrap; }
.badge-mini-card {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 14px; border-radius: 10px;
    border: 2px solid #e5e7eb; background: #fff;
    transition: all 0.2s;
}
.badge-mini-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.badge-mini-icon { font-size: 1.4rem; }
.badge-mini-name { font-size: 13px; font-weight: 600; color: var(--text); }
.badge-mini-pts { font-size: 11px; color: var(--text-muted); background: #f1f5f9; padding: 2px 6px; border-radius: 8px; }

/* Tier borders */
.tier-bronze { border-color: #CD7F32 !important; }
.tier-silver { border-color: #C0C0C0 !important; }
.tier-gold { border-color: #FFD700 !important; }
.tier-platinum { border-color: #b8b8e0 !important; background: linear-gradient(135deg, #fafafa, #f0f0ff) !important; }

/* Tier text */
.tier-text-bronze { color: #CD7F32; }
.tier-text-silver { color: #808080; }
.tier-text-gold { color: #b8860b; }
.tier-text-platinum { color: #7c7cb0; }

/* --- Badges grid (página completa) --- */
.badges-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}
.badge-card {
    display: flex; align-items: center; gap: 14px;
    padding: 18px; border-radius: 12px;
    border: 2px solid #e5e7eb; background: #fff;
    transition: all 0.25s;
    position: relative;
}
.badge-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.badge-earned { background: #fefce8; }
.badge-locked { opacity: 0.55; filter: grayscale(0.4); }
.badge-card-icon { font-size: 2.2rem; flex-shrink: 0; width: 48px; text-align: center; }
.badge-card-info { flex: 1; min-width: 0; }
.badge-card-info h4 { margin: 0 0 4px; font-size: 14px; }
.badge-card-info p { margin: 0; font-size: 12px; color: var(--text-muted); line-height: 1.4; }
.badge-card-meta { display: flex; gap: 8px; align-items: center; margin-top: 6px; }
.badge-tier { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.badge-pts { font-size: 11px; color: var(--text-muted); background: #f1f5f9; padding: 2px 8px; border-radius: 8px; }
.badge-earned-date { color: #16a34a; display: block; margin-top: 4px; }
.badge-check {
    position: absolute; top: 8px; right: 8px;
    background: #16a34a; color: #fff; width: 22px; height: 22px;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700;
}
.badge-lock-icon {
    position: absolute; top: 8px; right: 8px; font-size: 14px; opacity: 0.4;
}
.badge-tier-pill {
    display: inline-block; padding: 2px 10px; border-radius: 10px;
    font-size: 11px; font-weight: 700; text-transform: uppercase;
    background: #f1f5f9;
}

/* --- Leaderboard highlight --- */
.leaderboard-me { background: #eff6ff !important; }
.leaderboard-me td { font-weight: 600; }

/* --- Progress bar animated & colors --- */
.progress-animated .progress-bar { transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1); }
.progress-complete { background: linear-gradient(90deg, #16a34a, #22c55e) !important; }
.progress-half { background: linear-gradient(90deg, #2563eb, #60a5fa) !important; }
.progress-details { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; }
.progress-pct-badge {
    font-size: 11px; font-weight: 700; padding: 2px 8px;
    border-radius: 8px; background: #f1f5f9; color: var(--text);
}
.progress-pct-badge.progress-complete { background: #dcfce7; color: #166534; }
.progress-pct-badge.progress-half { background: #dbeafe; color: #1e40af; }

/* --- Podio (viewer ranking) --- */
.podium { padding: 20px; }
.podium-grid {
    display: flex; align-items: flex-end; justify-content: center; gap: 16px;
}
.podium-item {
    text-align: center; padding: 20px 24px; background: var(--white);
    border-radius: 12px; box-shadow: var(--shadow); position: relative;
    min-width: 140px;
}
.podium-medal { font-size: 2.5rem; margin-bottom: 8px; }
.podium-name { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.podium-points { font-size: 20px; font-weight: 800; color: #2563eb; }
.podium-badges { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.podium-bar {
    position: absolute; bottom: 0; left: 0; right: 0;
    border-radius: 0 0 12px 12px; opacity: 0.15;
}
.podium-gold .podium-bar { background: #FFD700; }
.podium-silver .podium-bar { background: #C0C0C0; }
.podium-bronze .podium-bar { background: #CD7F32; }
.podium-gold { border-bottom: 4px solid #FFD700; order: 2; }
.podium-silver { border-bottom: 4px solid #C0C0C0; order: 1; }
.podium-bronze { border-bottom: 4px solid #CD7F32; order: 3; }

@media (max-width: 768px) {
    .badges-grid { grid-template-columns: 1fr; }
    .podium-grid { flex-direction: column; align-items: center; }
    .podium-gold, .podium-silver, .podium-bronze { order: unset; }
    .badges-mini-grid { flex-direction: column; }
    .grid-2 { grid-template-columns: 1fr; }
    .certificates-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   CERTIFICADOS ALUMNO
   ============================================================ */
.certificates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}
.cert-card { transition: all 0.25s; }
.cert-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,0.1); }
.cert-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.cert-card-icon { font-size: 1.5rem; }
.cert-card-title { font-size: 1.1rem; font-weight: 700; margin: 0 0 1rem; line-height: 1.3; }
.cert-card-details { display: flex; flex-direction: column; gap: 8px; }
.cert-detail { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.cert-detail-label { color: var(--text-muted); }
.cert-detail-value { font-weight: 600; font-family: 'SF Mono', 'Fira Code', monospace; font-size: 12px; }
.cert-valid { border-left: 4px solid #16a34a; }
.cert-expired { border-left: 4px solid #dc2626; opacity: 0.7; }
.text-danger { color: #dc2626; }
.btn-block { display: block; width: 100%; text-align: center; }

/* ============================================================
   MARCA BLANCA / WHITE LABEL
   ============================================================ */

/* Logo en cabecera */
.brand-logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
}
.brand-header-logo {
    max-height: 40px;
    max-width: 180px;
    object-fit: contain;
}
.sidebar-header .brand-header-logo {
    max-height: 36px;
    max-width: 160px;
    filter: brightness(0) invert(1); /* logo blanco en sidebar oscuro */
}
.sidebar-header .brand-logo-link + .badge {
    margin-top: 6px;
}

/* Logo en login */
.auth-logo {
    max-height: 60px;
    max-width: 220px;
    object-fit: contain;
    margin-bottom: 12px;
}

/* Admin branding page */
.branding-form-grid {
    display: grid;
    gap: 20px;
    grid-template-columns: 1fr;
    max-width: 600px;
}
.branding-form-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}
.branding-form-row .form-group {
    min-width: 180px;
}
.flex-1 { flex: 1; }

/* Logo preview */
.logo-preview {
    margin-bottom: 12px;
    padding: 12px;
    background: var(--bg-page);
    border-radius: var(--radius);
    display: inline-block;
}
.brand-logo-preview {
    max-height: 50px;
    max-width: 200px;
    object-fit: contain;
    display: block;
    margin-bottom: 8px;
}
.logo-preview-sm {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}
.brand-logo-thumb {
    max-height: 36px;
    max-width: 120px;
    object-fit: contain;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 4px;
    background: #fff;
}

/* Company brand cards */
.company-brand-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
    background: var(--white);
}
.company-brand-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}
.company-brand-header h4 {
    margin: 0;
    font-size: 1rem;
}
.company-brand-form {
    border-top: 1px solid var(--border);
    padding-top: 12px;
}

/* Color input */
.color-input-group {
    display: flex;
    align-items: center;
    gap: 10px;
}
.form-color-input {
    width: 44px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    padding: 2px;
}
.form-input-sm {
    padding: 6px 10px;
    font-size: 0.85rem;
}

/* Brand preview bar */
.brand-preview-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: var(--bg-dark);
    border-radius: var(--radius);
    color: #fff;
}
.brand-preview-icon {
    font-size: 1.5rem;
}
.brand-preview-name {
    font-size: 1.1rem;
    font-weight: 600;
}
.brand-preview-logo {
    max-height: 36px;
    max-width: 150px;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

/* Inline preview / form actions */
.form-actions-inline {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
}
.brand-preview-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-light);
}
.brand-inline-logo {
    max-height: 24px;
    max-width: 80px;
    object-fit: contain;
}

/* Badge styles for muted */
.badge-muted {
    background: #e2e8f0;
    color: #6b7280;
}
.badge-success {
    background: #d1fae5;
    color: #065f46;
}

/* Checkbox inline */
.checkbox-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--danger);
    cursor: pointer;
}
.checkbox-inline input[type="checkbox"] {
    cursor: pointer;
}

/* Form help */
.form-help {
    display: block;
    margin-top: 4px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Spacing */
.mb-md { margin-bottom: 16px; }
.mb-lg { margin-bottom: 24px; }
.mb-4 { margin-bottom: 16px; }

/* Custom brand color accent (via CSS variable) */
.layout-student .top-bar {
    border-bottom-color: var(--brand-color, var(--primary));
}

@media (max-width: 768px) {
    .branding-form-row { flex-direction: column; }
    .brand-preview-bar { flex-direction: column; text-align: center; }
}

/* ============================================================
   PÁGINAS DE AYUDA PÚBLICA
   ============================================================ */
.help-page {
    width: 100%;
    max-width: 860px;
    margin: 0 auto;
    padding: 30px 20px 60px;
}

.help-hero {
    text-align: center;
    padding: 60px 20px 40px;
}

.help-hero h1 { font-size: 28px; color: #fff; }
.help-hero h2 { font-size: 24px; color: var(--primary); margin-top: 8px; }
.help-hero p { color: rgba(255,255,255,0.7); margin-top: 8px; font-size: 15px; }

/* Cards de selección de rol */
.help-cards-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-top: 20px;
}

.help-role-card {
    background: var(--white);
    border-radius: 12px;
    padding: 36px 28px;
    text-align: center;
    box-shadow: var(--shadow-lg);
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
    color: var(--text);
    display: block;
}

.help-role-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    text-decoration: none;
}

.help-role-icon { font-size: 48px; margin-bottom: 16px; display: block; }
.help-role-card h3 { font-size: 20px; margin-bottom: 10px; color: var(--bg-dark); }
.help-role-card p { color: var(--text-light); font-size: 14px; line-height: 1.6; }
.help-role-cta { display: inline-block; margin-top: 16px; color: var(--primary-dark); font-weight: 600; font-size: 14px; }

/* Cabecera de guía */
.help-header {
    padding: 40px 0 20px;
}

.help-header h1 { font-size: 28px; color: #fff; margin-top: 8px; }
.help-header .text-muted { color: rgba(255,255,255,0.6); }
.help-header .link-back { color: #fff; font-size: 14px; }

/* Índice (TOC) */
.help-toc {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius);
    padding: 20px 24px;
    margin-bottom: 32px;
}

.help-toc h3 { color: #fff; font-size: 16px; margin-bottom: 12px; }
.help-toc ol { padding-left: 20px; list-style: decimal; }
.help-toc ol li { margin-bottom: 6px; }
.help-toc ol li a { color: var(--primary); font-size: 14px; }
.help-toc ol li a:hover { color: #fff; }

/* Secciones */
.help-section {
    background: var(--white);
    border-radius: 12px;
    padding: 32px;
    margin-bottom: 24px;
    position: relative;
    box-shadow: var(--shadow);
}

.help-step-number {
    position: absolute;
    top: -14px;
    left: 24px;
    background: var(--primary-dark);
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 15px;
    box-shadow: 0 2px 8px rgba(0,180,148,0.3);
}

.help-section h2 {
    font-size: 20px;
    color: var(--bg-dark);
    margin-bottom: 16px;
    padding-left: 4px;
}

.help-content p { margin-bottom: 12px; line-height: 1.7; }

/* Pasos dentro de una sección */
.help-steps-list { display: flex; flex-direction: column; gap: 14px; margin: 16px 0; }

.help-step {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 16px;
    background: var(--bg-page);
    border-radius: var(--radius);
    border-left: 3px solid var(--primary);
}

.step-icon { font-size: 22px; flex-shrink: 0; margin-top: 1px; }
.help-step div { font-size: 14px; line-height: 1.6; }
.help-step strong { color: var(--bg-dark); }

/* Notas/avisos */
.help-note {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-top: 16px;
    font-size: 13px;
    line-height: 1.6;
}

/* Grid de features */
.help-feature-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin: 16px 0;
}

.help-feature {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    background: var(--bg-page);
    border-radius: var(--radius);
}

.feature-icon { font-size: 24px; flex-shrink: 0; }
.help-feature strong { display: block; margin-bottom: 4px; color: var(--bg-dark); font-size: 14px; }
.help-feature p { font-size: 13px; color: var(--text-light); line-height: 1.5; margin: 0; }

/* Lista con iconos */
.help-list {
    padding-left: 0;
    list-style: none;
}

.help-list li {
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    line-height: 1.6;
}

.help-list li:last-child { border-bottom: none; }

/* FAQ */
.help-faq { display: flex; flex-direction: column; gap: 8px; }

.faq-item {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.faq-item summary {
    padding: 14px 16px;
    cursor: pointer;
    font-size: 14px;
    background: var(--bg-page);
    transition: background 0.15s;
}

.faq-item summary:hover { background: #eef0f4; }

.faq-item[open] summary {
    border-bottom: 1px solid var(--border);
    background: #eef0f4;
}

.faq-item p {
    padding: 14px 16px;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-light);
    margin: 0;
}

/* Footer de ayuda */
.help-footer {
    text-align: center;
    padding: 32px 0;
    display: flex;
    gap: 12px;
    justify-content: center;
}
.help-footer .btn-outline {
    color: #fff;
    border-color: rgba(255, 255, 255, .25);
    border-radius: 999px;
    padding: 10px 24px;
    font-weight: 600;
    font-size: .875rem;
}
.help-footer .btn-outline:hover {
    border-color: rgba(255, 255, 255, .5);
    background: rgba(255, 255, 255, .08);
}

/* Responsive móvil */
@media (max-width: 640px) {
    .help-cards-container { grid-template-columns: 1fr; }
    .help-feature-grid { grid-template-columns: 1fr; }
    .help-section { padding: 24px 18px; }
    .help-hero { padding: 40px 16px 30px; }
}

/* ==================== CATÁLOGO ADMIN ==================== */

/* Grid de tarjetas del catálogo */
.catalog-admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 20px;
}

.catalog-admin-card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow .2s;
}

.catalog-admin-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.catalog-admin-card.catalog-hidden {
    opacity: 0.55;
}

.catalog-admin-thumb {
    position: relative;
    height: 180px;
    background: #f1f5f9;
    overflow: hidden;
}

.catalog-admin-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.catalog-admin-no-img {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    font-size: 2.5rem;
    color: #94a3b8;
    flex-direction: column;
}

.catalog-badge-hidden {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0,0,0,0.7);
    color: #fff;
    font-size: 0.7rem;
    padding: 3px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.catalog-admin-info {
    padding: 16px;
    flex: 1;
}

.catalog-admin-info h3 {
    margin: 0 0 6px;
    font-size: 1rem;
    font-weight: 600;
    color: #1e293b;
}

.catalog-admin-desc {
    font-size: 0.85rem;
    margin: 6px 0 0;
    line-height: 1.4;
}

.catalog-admin-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.catalog-admin-price {
    font-weight: 600;
    color: var(--primary, #00d4aa);
    font-size: 0.95rem;
}

.catalog-admin-price s {
    font-weight: 400;
    font-size: 0.8rem;
    margin-right: 4px;
}

.catalog-admin-tags {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.tag-pill {
    background: #e2e8f0;
    color: #475569;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 99px;
    white-space: nowrap;
}

.catalog-admin-actions {
    padding: 12px 16px;
    border-top: 1px solid #f1f5f9;
    text-align: right;
}

/* Layout del formulario de edición */
.catalog-edit-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 24px;
    align-items: start;
}

.catalog-edit-sidebar .card {
    margin-bottom: 16px;
}

.catalog-image-preview {
    background: #f1f5f9;
    border-radius: 6px;
    overflow: hidden;
    min-height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.catalog-image-preview img {
    width: 100%;
    height: auto;
    display: block;
}

.catalog-sidebar-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.85rem;
    color: #475569;
}

.catalog-sidebar-info strong {
    color: #1e293b;
}

/* Editor WYSIWYG simple */
.editor-toolbar {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 6px 8px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-bottom: none;
    border-radius: 6px 6px 0 0;
}

.editor-btn {
    background: none;
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    padding: 4px 8px;
    font-size: 0.85rem;
    color: #475569;
    line-height: 1;
}

.editor-btn:hover {
    background: #e2e8f0;
}

.editor-btn.active {
    background: #cbd5e1;
    border-color: #94a3b8;
}

.editor-sep {
    width: 1px;
    height: 18px;
    background: #e2e8f0;
    margin: 0 4px;
}

.editor-visual {
    border: 1px solid #e2e8f0;
    border-radius: 0 0 6px 6px;
    padding: 14px;
    min-height: 250px;
    font-size: 0.9rem;
    line-height: 1.6;
    color: #1e293b;
    outline: none;
    overflow-y: auto;
    max-height: 500px;
}

.editor-visual:focus {
    border-color: var(--primary, #00d4aa);
    box-shadow: 0 0 0 3px rgba(0, 212, 170, 0.1);
}

.editor-visual h3 { font-size: 1.1rem; margin: 12px 0 6px; }
.editor-visual p { margin-bottom: 8px; }
.editor-visual ul, .editor-visual ol { margin: 8px 0; padding-left: 24px; }
.editor-visual li { margin-bottom: 4px; }

.editor-source {
    border: 1px solid #e2e8f0;
    border-radius: 0 0 6px 6px;
    padding: 14px;
    font-family: 'Fira Code', monospace;
    font-size: 0.82rem;
    line-height: 1.5;
    color: #1e293b;
    width: 100%;
    resize: vertical;
}

.form-hint {
    display: block;
    margin-top: 4px;
    font-size: 0.78rem;
    color: #94a3b8;
}

/* Responsive catálogo admin */
@media (max-width: 900px) {
    .catalog-edit-layout {
        grid-template-columns: 1fr;
    }
    .catalog-admin-grid {
        grid-template-columns: 1fr;
    }
}

/* Editor: imágenes embebidas y drop zone */
.editor-visual img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    margin: 8px 0;
    display: block;
}

.editor-img-uploading {
    display: inline-block;
    background: #f1f5f9;
    color: #64748b;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.85rem;
    margin: 4px 0;
    animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.editor-dropzone {
    position: absolute;
    inset: 0;
    background: rgba(0, 212, 170, 0.08);
    border: 2px dashed var(--primary, #00d4aa);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary, #00d4aa);
    z-index: 10;
    pointer-events: auto;
}

/* Wrapper para posicionar el drop zone sobre el editor */
.form-group:has(.editor-visual) {
    position: relative;
}
