/*
 * assets/css/admin-aprendizaje.css
 * Estilos del Constructor Visual de Objetos de Aprendizaje
 */

:root {
    --blue: #1B396A;
    --blue-light: #eef2f8;
    --border: #e2e8f0;
    --text: #1a202c;
    --muted: #64748b;
    --radius: 12px;
    --shadow: 0 4px 20px rgba(0,0,0,0.06);
    --transition: all 0.2s ease;
}

/* ── Cabecera de Sección ──────────────────────────── */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 12px;
}

.section-header h1 {
    font-size: 22px;
    font-weight: 800;
    color: var(--blue);
    margin: 0;
}

/* ── Tarjetas de Módulo (List view) ──────────────── */
.oa-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.oa-table thead th {
    background: var(--blue);
    color: white;
    padding: 14px 18px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: left;
}

.oa-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
}

.oa-table tbody tr:last-child { border-bottom: none; }

.oa-table tbody tr:hover { background: var(--blue-light); }

.oa-table td {
    padding: 14px 18px;
    font-size: 14px;
    color: var(--text);
    vertical-align: middle;
}

.oa-table .td-id {
    font-family: monospace;
    font-size: 12px;
    color: var(--muted);
}

.badge-cat {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    background: var(--blue-light);
    color: var(--blue);
}

/* ── Builder: Panel General ──────────────────────── */
.builder-card {
    background: white;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 28px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.builder-card h2 {
    font-size: 14px;
    font-weight: 800;
    color: var(--blue);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0 0 20px 0;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border);
}

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

@media (max-width: 640px) { .form-grid-2 { grid-template-columns: 1fr; } }

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input,
.form-group select,
.form-group textarea {
    border: 1.5px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 14px;
    font-family: 'Open Sans', sans-serif;
    color: var(--text);
    background: white;
    transition: var(--transition);
    outline: none;
    width: 100%;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(27,57,106,0.1);
}

.form-group textarea { resize: vertical; min-height: 100px; }

.form-group .hint {
    font-size: 11px;
    color: var(--muted);
}

/* ── Constructor de Pasos ────────────────────────── */
.steps-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.steps-header h2 {
    font-size: 14px;
    font-weight: 800;
    color: var(--blue);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0;
}

.step-card {
    background: white;
    border-radius: var(--radius);
    border: 1.5px solid var(--border);
    margin-bottom: 14px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    transition: border-color 0.2s;
}

.step-card:hover { border-color: #c3d0e5; }

.step-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: var(--blue-light);
    user-select: none;
}

.step-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    flex-shrink: 0;
}

.step-header-left:hover .step-type-badge {
    background: #d3e0f5;
}

.step-chevron {
    font-size: 11px;
    color: var(--blue);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.step-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    background: white;
    color: var(--blue);
    border: 1px solid #c3d0e5;
}

.step-title-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    outline: none;
    padding: 0;
    font-family: 'Open Sans', sans-serif;
}

.step-title-input::placeholder { color: #a0aec0; }

.step-controls {
    display: flex;
    gap: 6px;
    margin-left: auto;
}

.btn-step-ctrl {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: white;
    color: var(--muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: var(--transition);
    padding: 0;
}

.btn-step-ctrl:hover { background: var(--blue); color: white; border-color: var(--blue); }

.btn-step-ctrl.btn-delete:hover { background: #ef4444; border-color: #ef4444; }

.step-body {
    padding: 20px;
    border-top: 1px solid var(--border);
}

/* ── Formulario de Actividad (Quiz) ──────────────── */
.options-list { margin: 12px 0; }

.option-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.option-row input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--blue);
    flex-shrink: 0;
    cursor: pointer;
}

.option-row input[type="text"] {
    flex: 1;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 14px;
    outline: none;
    transition: var(--transition);
    font-family: 'Open Sans', sans-serif;
}

.option-row input[type="text"]:focus { border-color: var(--blue); }

.btn-rm-option {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid #fca5a5;
    background: #fef2f2;
    color: #ef4444;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    transition: var(--transition);
    flex-shrink: 0;
}

.btn-rm-option:hover { background: #ef4444; color: white; }

/* ── Menú de Añadir Paso ──────────────────────────── */
.add-step-wrapper { position: relative; display: inline-block; }

.add-step-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 10px 30px rgba(0,0,0,0.12);
    z-index: 100;
    min-width: 220px;
    overflow: hidden;
}

.add-step-menu.open { display: block; }

.add-step-menu button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: white;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
    font-family: 'Open Sans', sans-serif;
}

.add-step-menu button:hover { background: var(--blue-light); color: var(--blue); }

.add-step-menu button i { width: 20px; text-align: center; color: var(--blue); }

/* ── Botones de Acción ────────────────────────────── */
.btn-publish {
    background: var(--blue);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 14px 32px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-publish:hover { background: #152d56; transform: translateY(-1px); }
.btn-publish:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.btn-outline {
    background: white;
    color: var(--blue);
    border: 1.5px solid var(--blue);
    border-radius: 10px;
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn-outline:hover { background: var(--blue-light); }

.btn-danger-sm {
    background: #fef2f2;
    color: #ef4444;
    border: 1px solid #fca5a5;
    border-radius: 7px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.btn-danger-sm:hover { background: #ef4444; color: white; border-color: #ef4444; }

.btn-edit-sm {
    background: var(--blue-light);
    color: var(--blue);
    border: 1px solid #c3d0e5;
    border-radius: 7px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.btn-edit-sm:hover { background: var(--blue); color: white; border-color: var(--blue); }

/* ── Toast ────────────────────────────────────────── */
.oa-toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: #1e293b;
    color: white;
    padding: 14px 22px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    z-index: 9999;
    transform: translateY(80px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
    display: flex;
    align-items: center;
    gap: 10px;
}

.oa-toast.show { transform: translateY(0); opacity: 1; }
.oa-toast.success { background: #065f46; }
.oa-toast.error   { background: #991b1b; }

/* ── Empty State ──────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--muted);
    background: white;
    border-radius: var(--radius);
    border: 1px dashed var(--border);
}

.empty-state i { font-size: 48px; margin-bottom: 16px; opacity: 0.3; display: block; }
.empty-state p { font-size: 15px; margin: 0; }

/* ── Apoyos de cabecera y formularios (antes inline) ── */
.title-icon {
    margin-right: 10px;
}

.section-sub {
    font-size: 13px;
    color: var(--muted);
    margin: 4px 0 0;
}

#desc-counter {
    font-weight: 400;
    color: #94a3b8;
    float: right;
}

#oa-descripcion {
    min-height: 70px;
}

#oa-id {
    margin-top: 6px;
}

.col-btn-buscar {
    padding-left: 10px;
}

.btn-buscar-h {
    height: 45px;
}

.hint-spaced {
    margin-top: 10px;
}

/* ── Loader Skeleton ──────────────────────────────── */
.sk-card {
    background: white;
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
}

.sk-line-title { height: 20px; margin-bottom: 16px; }
.sk-line { height: 14px; margin-bottom: 10px; }
.sk-line-last { height: 14px; }
.sk-box { height: 100px; border-radius: var(--radius); }
.sk-box-lg { height: 300px; border-radius: var(--radius); margin-top: 20px; }

.w-40 { width: 40%; }
.w-60 { width: 60%; }
.w-70 { width: 70%; }
.w-80 { width: 80%; }

.sk {
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: sk-shimmer 1.4s infinite linear;
    border-radius: 6px;
}

@keyframes sk-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── Volver link ──────────────────────────────────── */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
    margin-bottom: 24px;
    padding: 6px 0;
    border: none;
    background: none;
    transition: color 0.2s;
}

.back-link:hover { color: var(--blue); }

/* ── Footer del Builder ───────────────────────────── */
.builder-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    margin-top: 8px;
    flex-wrap: wrap;
    gap: 12px;
}

/* ── Tabs ─────────────────────────────────────────── */
.oa-tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    margin-bottom: 28px;
    gap: 0;
}

.oa-tab {
    padding: 11px 22px;
    border: none;
    background: none;
    font-size: 14px;
    font-weight: 700;
    color: var(--muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
    font-family: 'Open Sans', sans-serif;
}

.oa-tab:hover { color: var(--blue); }

.oa-tab.active {
    color: var(--blue);
    border-bottom-color: var(--blue);
}

/* ── Búsqueda (patrón search-wrap del panel) ──────── */
.search-wrap { position: relative; }
.search-wrap .fa-search {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 14px;
    pointer-events: none;
}
.search-input {
    padding-left: 45px !important;
    height: 45px;
    border: 1.5px solid var(--border) !important;
    border-radius: 8px !important;
    font-size: 14px !important;
    font-family: 'Open Sans', sans-serif;
    letter-spacing: 0.5px;
}
.search-input:focus {
    border-color: var(--blue) !important;
    box-shadow: 0 0 0 3px rgba(27,57,106,0.1) !important;
}

/* ── Tabla analítica (header gris, como activity-table) ── */
.analytics-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: white;
    border-radius: var(--radius);
    overflow: hidden;
}
.analytics-table th {
    background: #f8fafc;
    padding: 13px 16px;
    font-size: 11px;
    font-weight: 700;
    color: var(--blue);
    border-bottom: 2px solid var(--border);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: left;
}
.analytics-table td {
    padding: 13px 16px;
    font-size: 13px;
    border-bottom: 1px solid #f1f5f9;
    color: #475569;
    vertical-align: middle;
}
.analytics-table tbody tr:last-child td { border-bottom: none; }
.analytics-table tbody tr:hover { background: var(--blue-light); }

/* ── Barra de progreso en tablas ──────────────────── */
.stats-bar-wrap {
    height: 6px;
    background: var(--blue-light);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 4px;
}

.stats-bar-fill {
    height: 100%;
    background: var(--blue);
    border-radius: 3px;
    transition: width 0.4s ease;
}

.stats-bar-label {
    font-size: 11px;
    color: var(--muted);
    font-weight: 600;
}

/* ── Badge de estado ──────────────────────────────── */
.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.badge-status.completed    { background: #ecfdf5; color: #065f46; }
.badge-status.in-progress  { background: var(--blue-light); color: var(--blue); }

/* ── Header de resultado de búsqueda ─────────────── */
.result-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}
.result-nc-badge {
    background: var(--blue);
    color: white;
    font-family: monospace;
    font-size: 14px;
    font-weight: 700;
    padding: 6px 14px;
    border-radius: 6px;
    letter-spacing: 1px;
}

/* ── Recursos picker (builder) ───────────────────── */
.recurso-check-label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    font-size: 13px;
}

.recurso-check-label:hover {
    background: #f0f5ff;
    border-color: var(--blue);
}

.recurso-check-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--blue);
    flex-shrink: 0;
}

.recurso-check-label:has(input:checked) {
    background: #eff4ff;
    border-color: var(--blue);
}

.step-recursos-section {
    border-top: 1.5px solid var(--border);
    margin-top: 20px;
    padding-top: 16px;
}

.step-recursos-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: var(--blue-light);
    border: 1.5px solid var(--border);
    border-radius: 8px;
    padding: 9px 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--blue);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    gap: 8px;
}

.step-recursos-toggle:hover {
    background: #dce8f8;
    border-color: var(--blue);
}

.toggle-chevron {
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.step-recursos-panel {
    padding-top: 12px;
}

.recursos-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--blue);
    color: #fff;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    margin-left: 6px;
    vertical-align: middle;
}
