@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700&display=swap');

:root {
    --primary-color: #007bff;
    --secondary-color: #f8f9fa;
    --text-color: #333;
    --background-color: #fff;
    --border-color: #ddd;
    --box_shadow: 0 4px 12px rgba(0, 0, 0, .1);
    --success-color: #28a745;
    --error-color: #dc3545;
    --regenerate-color: #007bff;
    --approve-color: #28a745;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--secondary-color);
    color: var(--text-color);
    line-height: 1.6;
    margin: 0;
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

.container {
    max-width: 800px;
    width: 100%;
    background-color: var(--background-color);
    padding: 2rem;
    border-radius: 10px;
    box-shadow: var(--box_shadow);
    margin-bottom: 2rem;
}

h1 { color: var(--primary-color); text-align: center; margin-bottom: .5rem; }
.subtitle { text-align: center; margin-bottom: 2rem; color: #666; }

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.form-group { margin-bottom: 1rem; }
.full-width { grid-column: 1 / -1; }

label { display: block; font-weight: 500; margin-bottom: .5rem; }

input, select {
    width: 100%;
    padding: .8rem;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 1rem;
    box-sizing: border-box;
    background-color: #fff;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, .25);
}

button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    width: 100%;
    padding: 1rem;
    color: #fff;
    border: none;
    border-radius: 5px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color .2s ease-in-out, transform .1s ease;
}

button:active:not(:disabled) { transform: scale(.99); }
button:disabled { background-color: #999 !important; cursor: not-allowed; opacity: 0.7; }
#generate-btn { background-color: var(--primary-color); }

.loader { text-align: center; margin-top: 2rem; display: none; }
.spinner {
    border: 4px solid rgba(0, 0, 0, .1);
    width: 36px; height: 36px;
    border-radius: 50%;
    border-left-color: var(--primary-color);
    animation: spin 1s ease infinite;
    margin: 1rem auto;
}
@keyframes spin { 100% { transform: rotate(360deg); } }

.blog-post { margin-top: 2rem; border-top: 1px solid var(--border-color); padding-top: 2rem; }
.blog-post h1, .blog-post h2, .blog-post h3, .blog-post p { page-break-inside: avoid; }
.blog-post h1, .blog-post h2 { color: #222; }
.blog-post em { color: #555; }
.blog-post img {
    max-width: 90%;
    height: auto;
    border-radius: 8px;
    margin: 1.5rem auto 0.5rem auto;
    display: block;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: opacity 0.3s ease;
    page-break-inside: avoid;
}

.image-description {
    font-size: 0.9rem;
    color: #666;
    font-style: italic;
    text-align: center;
    margin: 0.5rem 0 1.5rem 0;
    padding: 0 1rem;
    line-height: 1.4;
}

.image-container { page-break-inside: avoid; margin-bottom: 1.5rem; break-inside: avoid; }

.image-interaction-area {
    margin-top: 0.5rem;
    padding: 0.75rem;
    background-color: #f8f9fa;
    border-radius: 5px;
    border: 1px solid #e9ecef;
}
.image-interaction-area label { font-size: 0.9rem; font-weight: 500; margin-bottom: 0.4rem; }
.image-prompt-input { margin-bottom: 0.75rem; }
.image-controls { display: flex; justify-content: center; gap: .5rem; }
.image-control-btn { padding: 0.4rem 0.8rem; font-size: 0.85rem; width: auto; flex-grow: 0; font-weight: 500; }
.image-control-btn.regenerate { background-color: var(--regenerate-color); }
.image-control-btn.approve { background-color: var(--approve-color); }

#export-controls { display: flex; gap: 1rem; margin-top: 2rem; flex-wrap: wrap; }

.status-message {
    padding: 10px 15px;
    border-radius: 5px;
    text-align: center;
    margin-top: 1rem;
    display: none;
    animation: fadeIn 0.5s;
    width: 100%;
}
.success { background-color: var(--success-color); color: white; }
.error { background-color: var(--error-color); color: white; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

footer { margin-top: auto; text-align: center; font-size: .85em; color: #777; padding: 1rem; }
.control-buttons { display: flex; gap: 1rem; width: 100%; }
.control-buttons button { flex: 1; width: 100%; }

#copy-html-btn { background-color: #343a40; color: white; }

.api-key-container { display: flex; gap: 0.5rem; align-items: center; margin-bottom: 1rem; }
.api-key-container input { flex: 1; }
.api-key-container button {
    width: auto;
    padding: 0.8rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    background-color: #28a745;
    white-space: nowrap;
}
.api-key-container button:hover { background-color: #218838; }

/* =============================================
   CUESTIONARIO DE SELECCIÓN MÚLTIPLE
   ============================================= */
.quiz-section {
    margin-top: 3rem;
    padding: 2rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(102, 126, 234, 0.4);
    color: white;
    position: relative;
    overflow: hidden;
}

.quiz-section::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 300px;
    height: 300px;
    background: rgba(255,255,255,0.05);
    border-radius: 50%;
}

.quiz-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.quiz-header h3 {
    font-size: 1.4rem;
    margin: 0 0 0.5rem 0;
    color: white;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.quiz-header p {
    font-size: 0.9rem;
    opacity: 0.85;
    margin: 0;
}

.quiz-progress {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.quiz-progress-bar {
    flex: 1;
    height: 8px;
    background: rgba(255,255,255,0.2);
    border-radius: 4px;
    overflow: hidden;
}

.quiz-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #f9ca24, #f0932b);
    border-radius: 4px;
    transition: width 0.5s ease;
    width: 0%;
}

.quiz-progress-text {
    font-size: 0.85rem;
    opacity: 0.9;
    white-space: nowrap;
}

.quiz-question-card {
    background: rgba(255,255,255,0.12);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    border: 1px solid rgba(255,255,255,0.2);
    animation: slideIn 0.4s ease;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.quiz-question-text {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.quiz-question-number {
    display: inline-block;
    background: rgba(255,255,255,0.25);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    line-height: 28px;
    text-align: center;
    font-size: 0.85rem;
    font-weight: 700;
    margin-right: 0.5rem;
    flex-shrink: 0;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.quiz-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: rgba(255,255,255,0.1);
    border: 2px solid rgba(255,255,255,0.15);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.95rem;
    color: white;
    text-align: left;
    width: 100%;
    font-weight: 400;
    font-family: 'Inter', sans-serif;
}

.quiz-option:hover:not(.answered) {
    background: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.4);
    transform: translateX(4px);
}

.quiz-option.correct {
    background: rgba(40, 167, 69, 0.4);
    border-color: #28a745;
    animation: pulse-green 0.5s ease;
}

.quiz-option.incorrect {
    background: rgba(220, 53, 69, 0.4);
    border-color: #dc3545;
    animation: shake 0.4s ease;
}

.quiz-option.reveal-correct {
    background: rgba(40, 167, 69, 0.25);
    border-color: rgba(40, 167, 69, 0.6);
}

@keyframes pulse-green {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}

.quiz-option-letter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    font-weight: 700;
    font-size: 0.8rem;
    flex-shrink: 0;
    transition: background 0.2s;
}

.quiz-option.correct .quiz-option-letter { background: #28a745; }
.quiz-option.incorrect .quiz-option-letter { background: #dc3545; }
.quiz-option.reveal-correct .quiz-option-letter { background: rgba(40,167,69,0.6); }

.quiz-feedback {
    margin-top: 0.75rem;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    display: none;
    animation: fadeIn 0.3s ease;
}

.quiz-feedback.show { display: block; }
.quiz-feedback.correct-fb { background: rgba(40,167,69,0.3); border-left: 4px solid #28a745; }
.quiz-feedback.incorrect-fb { background: rgba(220,53,69,0.3); border-left: 4px solid #dc3545; }

.quiz-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
    gap: 1rem;
}

.quiz-btn {
    padding: 0.7rem 1.5rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    width: auto;
    flex-grow: 0;
}

.quiz-btn-next {
    background: linear-gradient(135deg, #f9ca24, #f0932b);
    color: #333;
}

.quiz-btn-next:hover:not(:disabled) { filter: brightness(1.1); transform: translateY(-1px); }
.quiz-btn-next:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.quiz-btn-restart {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 2px solid rgba(255,255,255,0.4);
}

.quiz-btn-restart:hover { background: rgba(255,255,255,0.3); }

.quiz-score-panel {
    text-align: center;
    padding: 1.5rem;
    background: rgba(255,255,255,0.12);
    border-radius: 12px;
    display: none;
    animation: slideIn 0.5s ease;
}

.quiz-score-panel.show { display: block; }

.quiz-score-emoji { font-size: 3rem; margin-bottom: 0.5rem; }
.quiz-score-number { font-size: 2.5rem; font-weight: 700; color: #f9ca24; }
.quiz-score-label { font-size: 1rem; opacity: 0.9; margin-top: 0.25rem; }
.quiz-score-message { margin-top: 1rem; font-size: 1rem; opacity: 0.9; }

.quiz-loading {
    text-align: center;
    padding: 2rem;
    opacity: 0.8;
}

.quiz-loading .spinner {
    border-left-color: white;
    margin: 0 auto 1rem auto;
}

@media (max-width: 600px) {
    .form-grid { grid-template-columns: 1fr; }
    .control-buttons { flex-direction: column; }
    .quiz-nav { flex-direction: column; }
    .quiz-btn { width: 100%; }
}

/* =============================================
   CAJAS DESTACADAS (INFO BOXES)
   ============================================= */

/* Base compartida */
.info-box {
    margin: 1.8rem 0;
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    position: relative;
    page-break-inside: avoid;
    break-inside: avoid;
}

.info-box-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 0 0.6rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.info-box-body {
    font-size: 0.97rem;
    line-height: 1.65;
    margin: 0;
}

/* --- Tipo 1: Dato Clave (azul, borde doble estilo imagen) --- */
.info-box-key {
    background: #eaf4fb;
    border: 2px solid #5aabdd;
    outline: 4px solid #c2e0f4;
    outline-offset: -6px;
}

.info-box-key .info-box-title {
    color: #1a6fa8;
    border-bottom: 2px solid #5aabdd;
    padding-bottom: 0.5rem;
    margin-bottom: 0.75rem;
}

.info-box-key .info-box-body {
    color: #1a6fa8;
}

/* --- Tipo 2: Nota Importante (amarillo/ámbar) --- */
.info-box-note {
    background: #fffbea;
    border-left: 5px solid #f0b429;
    box-shadow: 0 2px 8px rgba(240, 180, 41, 0.15);
}

.info-box-note .info-box-title {
    color: #b7791f;
}

.info-box-note .info-box-body {
    color: #744210;
}

/* --- Tipo 3: Dato Curioso (verde esmeralda) --- */
.info-box-curious {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border: 1px solid #86efac;
    border-radius: 12px;
    box-shadow: inset 4px 0 0 #22c55e;
}

.info-box-curious .info-box-title {
    color: #15803d;
}

.info-box-curious .info-box-body {
    color: #166534;
}

/* --- Tipo 4: Cita / Reflexión (morado, estilo quote) --- */
.info-box-quote {
    background: #faf5ff;
    border: none;
    border-radius: 12px;
    padding: 1.5rem 1.75rem 1.5rem 2.5rem;
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.12);
}

.info-box-quote::before {
    content: '\201C';
    position: absolute;
    top: 0.2rem;
    left: 0.75rem;
    font-size: 4rem;
    color: #a78bfa;
    line-height: 1;
    font-family: Georgia, serif;
}

.info-box-quote .info-box-title {
    color: #6d28d9;
}

.info-box-quote .info-box-body {
    color: #4c1d95;
    font-style: italic;
    font-size: 1rem;
}

/* --- Tipo 5: Alerta / Advertencia (rojo coral) --- */
.info-box-alert {
    background: #fff5f5;
    border: 1px solid #feb2b2;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(229, 62, 62, 0.1);
}

.info-box-alert::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, #fc8181, #e53e3e);
    border-radius: 12px 12px 0 0;
}

.info-box-alert .info-box-title {
    color: #c53030;
    margin-top: 0.25rem;
}

.info-box-alert .info-box-body {
    color: #742a2a;
}

/* Botón descargar HTML */
#download-html-btn {
    background-color: #6f42c1;
    color: white;
}
