/* 1. VARIABLES Y BASE */
:root { 
    --p-color: #6366f1;
    --p-hover: #4f46e5;
    --s-color: #10b981;
    --err-color: #ef4444;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-color: #1e293b;
    --text-light: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

* { box-sizing: border-box; }

body { 
    font-family: 'Inter', system-ui, sans-serif; 
    background-color: var(--bg-color); 
    color: var(--text-color);
    margin: 0;
    display: flex;
    justify-content: center;
    padding: 20px 10px;
}

.container { 
    background: var(--card-bg); 
    padding: 25px; 
    border-radius: 16px; 
    box-shadow: var(--shadow); 
    width: 100%;
    max-width: 800px;
}

/* --- ESTILO LOGIN COMPACTO --- */
#section-login {
    max-width: 400px; /* Centramos y estrechamos el login para que no se vea gigante */
    margin: 0 auto;
}

.login-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 8px;
}

.login-row input {
    margin: 0 !important;
    flex-grow: 1; /* El cuadro de contraseña ocupa el espacio sobrante */
}

#btn-login {
    width: auto !important; /* Anula el width 100% general */
    min-width: 100px;
    margin: 0 !important;
    padding: 10px 20px;
    white-space: nowrap;
}



/* 2. ELEMENTOS DE FORMULARIO */
input, textarea { 
    width: 100%; 
    padding: 10px; 
    border: 1px solid var(--border-color); 
    border-radius: 8px; 
    font-size: 15px; 
}

button { 
    padding: 10px 15px; 
    border: none; 
    border-radius: 8px; 
    cursor: pointer; 
    font-weight: 600; 
    transition: all 0.2s; 
}

.btn-primary { background: var(--p-color); color: white; width: 100%; }
.btn-tab { background: transparent; color: var(--text-light); flex: 1; border-bottom: 2px solid transparent; border-radius: 0; }
.btn-tab.active { color: var(--p-color); border-bottom: 2px solid var(--p-color); }
.logout { background: var(--err-color); color: white; flex: none; }

/* 3. FORMULARIO NUEVO CUESTIONARIO */
.form-quiz-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f1f5f9;
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.q-controls-row { display: flex; align-items: center; gap: 10px; }
.q-input-titulo { margin: 0 !important; }
.q-input-curso { width: 80px; text-align: center; margin: 0 !important; }
.q-label-habilitado { display: flex; align-items: center; gap: 5px; font-size: 13px; white-space: nowrap; }
.q-label-habilitado input { width: auto !important; margin: 0 !important; }
#btn-guardar-quiz { background: #546e7a; color: white; margin: 0 !important; }

/* 4. EDITOR DE PREGUNTAS (Ajuste de alineación) */
.pregunta-edit {
    background: #fff;
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 15px;
    border: 1px solid var(--border-color);
}

.editor-header-fila {
    display: flex;
    align-items: flex-start; /* Alineado arriba para soportar enunciados largos multilínea */
    gap: 10px;
    margin-bottom: 12px;
}

.editor-num {
    font-weight: bold;
    color: var(--p-color);
    font-size: 1.1rem;
    min-width: 25px;
    margin-top: 7px; /* Alinear exactamente con la primera línea del textarea */
}

.editor-enunciado-input {
    flex-grow: 1;
    margin: 0 !important;
}

.btn-borrar-compact {
    background: #fee2e2;
    color: var(--err-color);
    padding: 8px;
    border-radius: 8px;
    font-size: 1.2rem;
    line-height: 1;
}

/* 5. OPCIONES (Los "Bolos") */
.opcion-fila {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 6px 0 6px 35px; /* Sangría para que no choquen con el número */
}

.opcion-fila input[type="radio"] {
    width: auto !important;
    margin: 0;
    transform: scale(1.2);
}

.opcion-fila input[type="text"] {
    margin: 0 !important;
    flex-grow: 1;
}

/* 6. TABLAS */
.tabla-container { margin-top: 15px; overflow-x: auto; border-radius: 8px; border: 1px solid var(--border-color); background: white; }
table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 450px; }
th, td { padding: 12px; border-bottom: 1px solid var(--border-color); text-align: left; white-space: nowrap; }
.btn-accion { padding: 6px 10px; font-size: 1.1rem; width: auto; display: inline-flex; align-items: center; justify-content: center; }
.btn-edit { background: #ffb100; color: white; }
.btn-borrar { background: var(--err-color); color: white; }

.hidden { display: none !important; }

/* 7. MEDIA QUERIES (MÓVIL) */
@media (max-width: 600px) {
    .container { padding: 15px; border-radius: 0; }
    
    .q-controls-row { justify-content: space-between; }
    .q-input-curso { width: 65px !important; }
    #btn-guardar-quiz { flex: 1; padding: 10px 5px; }

    /* Ajuste tabla móvil */
    table { min-width: 600px !important; }

    /* Ajuste editor móvil */
    .opcion-fila { margin-left: 0; } /* Quitamos sangría en móvil para ganar espacio */
    
    .editor-header-fila { gap: 5px; }
    .editor-num { font-size: 1rem; min-width: 20px; }

    /* Ajuste para móvil: si el móvil es muy estrecho, reducimos el botón */
@media (max-width: 600px) {
    #btn-login {
        min-width: 80px;
        padding: 10px 15px;
        font-size: 14px;
    }
}
}
