/* ============================================
   ESTILOS - FÁBRICA DE CONTENIDOS
   ============================================ */

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0f1117;
    color: #e1e4e8;
    line-height: 1.6;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 30px 20px;
}

h1 { color: #58a6ff; margin-bottom: 5px; }
h2 { color: #c9d1d9; margin-bottom: 15px; font-size: 1.3em; }
h3 { color: #58a6ff; font-size: 1.1em; }
h4 { color: #8b949e; font-size: 0.95em; margin: 15px 0 10px; }

.subtitulo { color: #8b949e; margin-bottom: 20px; }

.volver {
    color: #58a6ff;
    text-decoration: none;
    display: inline-block;
    margin-bottom: 15px;
}
.volver:hover { text-decoration: underline; }

/* Cards */
.card {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

/* Formularios */
.campo { margin-bottom: 15px; }
.campo label {
    display: block;
    color: #8b949e;
    margin-bottom: 5px;
    font-size: 0.9em;
}
.campo input,
.campo textarea,
.campo select {
    width: 100%;
    padding: 10px 12px;
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 6px;
    color: #e1e4e8;
    font-size: 0.95em;
}
.campo input:focus,
.campo textarea:focus {
    border-color: #58a6ff;
    outline: none;
}

/* Botones */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: 1px solid #30363d;
    border-radius: 6px;
    background: #21262d;
    color: #c9d1d9;
    cursor: pointer;
    font-size: 0.9em;
    text-decoration: none;
}
.btn:hover { background: #30363d; }
.btn-primary {
    background: #238636;
    border-color: #2ea043;
    color: #fff;
}
.btn-primary:hover { background: #2ea043; }
.btn-sm { padding: 6px 12px; font-size: 0.85em; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Tabla */
.tabla {
    width: 100%;
    border-collapse: collapse;
}
.tabla th, .tabla td {
    padding: 10px 12px;
    border-bottom: 1px solid #21262d;
    text-align: left;
}
.tabla th {
    color: #8b949e;
    font-size: 0.85em;
    text-transform: uppercase;
}

/* Estados */
.estado {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.8em;
}
.estado-borrador { background: #30363d; color: #8b949e; }
.estado-modulos_generados { background: #1f3a5f; color: #58a6ff; }
.estado-pendiente { background: #30363d; color: #8b949e; }
.estado-contenidos_generados { background: #1a3a2a; color: #3fb950; }
.estado-en_proceso { background: #3d2f00; color: #d29922; }
.estado-completado { background: #1a3a2a; color: #3fb950; }

/* Módulos */
.modulo-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.form-modulo { margin-bottom: 10px; }
.acciones-modulo {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

/* Contenidos */
.contenidos-lista { margin-top: 15px; border-top: 1px solid #30363d; padding-top: 15px; }
.contenido-item {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 10px;
    padding: 8px 12px;
    margin-bottom: 6px;
    border-radius: 6px;
    background: #0d1117;
}
.contenido-orden {
    background: #30363d;
    color: #8b949e;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8em;
    flex-shrink: 0;
}
.contenido-tipo { color: #8b949e; font-size: 0.85em; min-width: 110px; }
.contenido-titulo { color: #e1e4e8; font-weight: 500; }
.contenido-desc { width: 100%; color: #8b949e; font-size: 0.85em; margin-top: 2px; padding-left: 34px; }
.tipo-video { border-left: 3px solid #58a6ff; }
.tipo-presentacion { border-left: 3px solid #d29922; }

/* Loading */
.loading {
    color: #d29922;
    padding: 10px;
    font-style: italic;
}

/* Alertas */
.alerta {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
}
.alerta.error { background: #3d1f1f; border: 1px solid #f85149; color: #f85149; }
.alerta.ok { background: #1a3a2a; border: 1px solid #3fb950; color: #3fb950; }


/* Header con botón config */
.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

/* Ayuda bajo campos */
.campo-ayuda {
    display: block;
    color: #6e7681;
    font-size: 0.8em;
    margin-top: 4px;
}

/* Select estilo */
.campo select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238b949e' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}


/* Meta info */
.meta-info { color: #6e7681; font-size: 0.9em; margin-bottom: 20px; }

/* Grid diapositivas */
.diap-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 12px;
}
@media (max-width: 700px) {
    .diap-grid { grid-template-columns: 1fr; }
}
.diap-col { }
.diap-preview {
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 6px;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    overflow: hidden;
}
.diap-preview img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 6px;
}
.diap-preview audio { width: 100%; padding: 10px; }
.placeholder { color: #484f58; font-style: italic; padding: 30px; }

/* Diapositiva card */
.diapositiva-card { border-left: 3px solid #58a6ff; }

/* Campo inline */
.campo-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}
.campo-inline label { margin: 0; }

/* Botón warning */
.btn-warning {
    background: #3d2f00;
    border-color: #d29922;
    color: #d29922;
}
.btn-warning:hover { background: #4a3800; }

/* Barra de progreso */
.progress-bar {
    background: #21262d;
    border-radius: 8px;
    height: 24px;
    overflow: hidden;
    margin: 10px 0;
}
.progress-fill {
    background: #238636;
    height: 100%;
    border-radius: 8px;
    transition: width 0.3s;
}


/* Saldo / estado API */
.saldo-resultado {
    display: inline-block;
    margin-left: 10px;
    font-size: 0.85em;
    padding: 4px 10px;
    border-radius: 6px;
    vertical-align: middle;
}
.saldo-loading { color: #d29922; }
.saldo-ok { color: #3fb950; background: #1a3a2a; }
.saldo-error { color: #f85149; background: #3d1f1f; }
.saldo-link {
    color: #58a6ff;
    text-decoration: none;
    margin-left: 6px;
}
.saldo-link:hover { text-decoration: underline; }
