/* ============================================================
   ProfesorLegal Quiz — Estilos
   Paleta: azul guatemalteco + verde progreso + blanco
   ============================================================ */

#pfl-app {
    max-width: 680px;
    margin: 0 auto;
    font-family: 'Segoe UI', system-ui, sans-serif;
    color: #1a1a2e;
}

/* HEADER -------------------------------------------------------- */
.pfl-header {
    display: flex;
    align-items: center;
    gap: 14px;
    background: linear-gradient(135deg, #1a3a6b, #2563b0);
    color: #fff;
    border-radius: 16px;
    padding: 20px 24px;
    margin-bottom: 16px;
}
.pfl-header-icon { font-size: 2.4rem; }
.pfl-header h2   { margin: 0; font-size: 1.3rem; }
.pfl-header p    { margin: 4px 0 0; font-size: 0.85rem; opacity: 0.85; }

/* SUMMARY BAR --------------------------------------------------- */
.pfl-summary {
    background: #f0f4ff;
    border-radius: 12px;
    padding: 12px 18px;
    margin-bottom: 24px;
}
.pfl-summary-bar {
    height: 10px;
    background: #d0d8f0;
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 6px;
}
.pfl-summary-fill {
    height: 100%;
    background: linear-gradient(90deg, #22c55e, #16a34a);
    border-radius: 5px;
    transition: width 0.6s ease;
}
.pfl-summary-label { font-size: 0.82rem; color: #444; }

/* MAP ----------------------------------------------------------- */
.pfl-map { position: relative; padding-bottom: 20px; }

.pfl-chapter-row {
    display: flex;
    margin-bottom: 12px;
    position: relative;
}
.pfl-left  { justify-content: flex-start; }
.pfl-right { justify-content: flex-end; }

.pfl-connector {
    position: absolute;
    left: 50%;
    top: -12px;
    width: 2px;
    height: 12px;
    background: #c8d5f0;
}
.pfl-chapter-row:first-child .pfl-connector { display: none; }

/* Chapter Card */
.pfl-chapter-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    width: 88%;
    background: #fff;
    border: 2px solid #dde5f8;
    border-radius: 14px;
    padding: 14px 16px;
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
    position: relative;
}

.pfl-clickable { cursor: pointer; }
.pfl-clickable:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37,99,176,0.15);
    border-color: #2563b0;
}

/* States */
.pfl-state-done      { border-color: #22c55e; background: #f0fdf4; }
.pfl-state-progress  { border-color: #f59e0b; background: #fffbeb; }
.pfl-state-available { border-color: #2563b0; background: #fff; }
.pfl-state-locked    { border-color: #e2e8f0; background: #f8fafc; opacity: 0.65; }

/* Icon bubble */
.pfl-icon-bubble {
    width: 52px;
    height: 52px;
    min-width: 52px;
    border-radius: 50%;
    background: #eef2ff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    border: 2px solid #c7d7ff;
}
.pfl-state-done .pfl-icon-bubble    { background: #dcfce7; border-color: #86efac; }
.pfl-state-progress .pfl-icon-bubble{ background: #fef9c3; border-color: #fde68a; }
.pfl-state-locked .pfl-icon-bubble  { background: #f1f5f9; border-color: #cbd5e1; }

/* Card info */
.pfl-chapter-info { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.pfl-chapter-num  { font-size: 0.72rem; color: #6b7280; text-transform: uppercase; letter-spacing: 0.5px; }
.pfl-chapter-title{ font-size: 0.95rem; font-weight: 600; color: #1a1a2e; line-height: 1.3; }
.pfl-chapter-meta { font-size: 0.78rem; color: #2563b0; }
.pfl-no-q         { color: #9ca3af; }

/* Score bar */
.pfl-score-bar {
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    overflow: hidden;
    margin-top: 4px;
    width: 100%;
}
.pfl-score-fill      { height: 100%; border-radius: 3px; transition: width 0.5s; }
.pfl-score-done      { background: linear-gradient(90deg, #22c55e, #16a34a); }
.pfl-score-progress  { background: linear-gradient(90deg, #f59e0b, #d97706); }
.pfl-best-score      { font-size: 0.72rem; color: #6b7280; }

/* MODAL --------------------------------------------------------- */
.pfl-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pfl-fadein 0.2s;
}
@keyframes pfl-fadein { from { opacity: 0 } to { opacity: 1 } }

.pfl-modal-box {
    background: #fff;
    border-radius: 20px;
    width: 94%;
    max-width: 580px;
    max-height: 92vh;
    overflow-y: auto;
    padding: 0;
    box-shadow: 0 24px 60px rgba(0,0,0,0.25);
    animation: pfl-slidein 0.25s ease;
}
@keyframes pfl-slidein { from { transform: translateY(30px); opacity: 0 } to { transform: translateY(0); opacity: 1 } }

/* Modal Header */
.pfl-modal-header {
    background: linear-gradient(135deg, #1a3a6b, #2563b0);
    color: #fff;
    border-radius: 20px 20px 0 0;
    padding: 18px 20px 14px;
    position: relative;
}
.pfl-close-btn {
    position: absolute;
    right: 16px;
    top: 14px;
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.pfl-close-btn:hover { background: rgba(255,255,255,0.35); }
.pfl-modal-title { font-size: 1rem; font-weight: 700; padding-right: 40px; line-height: 1.3; }

/* Progress dots */
.pfl-progress-dots {
    display: flex;
    gap: 5px;
    margin-top: 10px;
    flex-wrap: wrap;
}
.pfl-dot {
    height: 8px;
    border-radius: 4px;
    background: rgba(255,255,255,0.3);
    flex: 1;
    min-width: 8px;
    max-width: 32px;
    transition: background 0.3s;
}
.pfl-dot.correct  { background: #22c55e; }
.pfl-dot.wrong    { background: #ef4444; }
.pfl-dot.current  { background: rgba(255,255,255,0.9); }

/* Question area */
#pfl-question-screen { padding: 24px 24px 20px; }

.pfl-question-counter {
    font-size: 0.78rem;
    color: #6b7280;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.pfl-question-text {
    font-size: 1.05rem;
    font-weight: 600;
    color: #1a1a2e;
    line-height: 1.5;
    margin-bottom: 22px;
}

/* Options */
.pfl-options { display: flex; flex-direction: column; gap: 10px; }

.pfl-option-btn {
    background: #f8fafc;
    border: 2px solid #dde5f8;
    border-radius: 12px;
    padding: 13px 16px;
    text-align: left;
    font-size: 0.93rem;
    color: #1a1a2e;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    line-height: 1.4;
}
.pfl-option-btn:hover:not(:disabled) {
    border-color: #2563b0;
    background: #eef2ff;
    transform: translateX(3px);
}
.pfl-option-btn .pfl-opt-letter {
    width: 28px;
    height: 28px;
    min-width: 28px;
    border-radius: 50%;
    background: #dde5f8;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    color: #2563b0;
}
.pfl-option-btn.correct {
    background: #dcfce7;
    border-color: #22c55e;
    color: #166534;
}
.pfl-option-btn.correct .pfl-opt-letter { background: #22c55e; color: #fff; }
.pfl-option-btn.wrong {
    background: #fef2f2;
    border-color: #ef4444;
    color: #991b1b;
}
.pfl-option-btn.wrong .pfl-opt-letter { background: #ef4444; color: #fff; }

/* Feedback */
.pfl-feedback {
    margin-top: 20px;
    padding: 16px;
    border-radius: 14px;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    animation: pfl-fadein 0.2s;
}
.pfl-feedback-icon { font-size: 2rem; margin-bottom: 6px; }
.pfl-feedback-msg  { font-weight: 700; font-size: 1rem; margin-bottom: 6px; }
.pfl-feedback.pfl-correct { background: #f0fdf4; border-color: #86efac; }
.pfl-feedback.pfl-correct .pfl-feedback-msg { color: #166534; }
.pfl-feedback.pfl-wrong   { background: #fef2f2; border-color: #fca5a5; }
.pfl-feedback.pfl-wrong .pfl-feedback-msg { color: #991b1b; }
.pfl-explanation {
    font-size: 0.87rem;
    color: #374151;
    line-height: 1.5;
    margin-bottom: 14px;
}
.pfl-next-btn {
    background: linear-gradient(135deg, #1a3a6b, #2563b0);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 10px 24px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s;
}
.pfl-next-btn:hover { opacity: 0.88; }

/* Results */
#pfl-results-screen { padding: 40px 24px; text-align: center; }
.pfl-results-icon   { font-size: 4rem; margin-bottom: 12px; }
.pfl-results-title  { font-size: 1.4rem; font-weight: 800; margin-bottom: 8px; }
.pfl-results-score  { font-size: 3rem; font-weight: 900; color: #2563b0; margin: 10px 0; }
.pfl-results-msg    { color: #6b7280; margin-bottom: 28px; font-size: 0.95rem; }

.pfl-retry-btn, .pfl-back-btn {
    border: none;
    border-radius: 12px;
    padding: 13px 28px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    margin: 6px;
    transition: opacity 0.15s;
}
.pfl-retry-btn { background: linear-gradient(135deg, #1a3a6b, #2563b0); color: #fff; }
.pfl-back-btn  { background: #f1f5f9; color: #374151; border: 2px solid #e2e8f0; }
.pfl-retry-btn:hover, .pfl-back-btn:hover { opacity: 0.85; }

/* Loading */
.pfl-loading { padding: 60px 24px; text-align: center; color: #6b7280; }
.pfl-spinner {
    width: 40px; height: 40px;
    border: 4px solid #dde5f8;
    border-top-color: #2563b0;
    border-radius: 50%;
    animation: pfl-spin 0.8s linear infinite;
    margin: 0 auto 16px;
}
@keyframes pfl-spin { to { transform: rotate(360deg) } }

/* Responsive */
@media (max-width: 500px) {
    .pfl-chapter-card { width: 95%; }
    .pfl-modal-box    { border-radius: 16px 16px 0 0; position: fixed; bottom: 0; max-height: 90vh; width: 100%; border-radius: 20px 20px 0 0; }
    .pfl-modal        { align-items: flex-end; }
    #pfl-question-screen { padding: 18px 16px; }
    .pfl-question-text   { font-size: 0.95rem; }
}
