/* ===== Study Page — Two-Panel NOK Layout ===== */
.study-layout {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

/* --- Left panel: Question card --- */
.study-question-panel {
    flex: 1;
    background: white;
    border-radius: 10px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.07);
    overflow: hidden;
    min-width: 0;
}

.study-q-header {
    background: #1565c0;
    color: white;
    padding: 14px 22px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
/* phase2 uses same style as phase1 */
.study-q-num { font-weight: 700; font-size: 15px; }
.study-q-block { font-size: 13px; opacity: 0.85; }

.study-q-text {
    padding: 24px 22px 16px;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.7;
    color: #222;
}

/* --- Answer options: 2-column grid --- */
.study-answers {
    padding: 0 22px 8px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.study-answer-option {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    text-align: left;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 13px 14px;
    background: white;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s;
    line-height: 1.5;
    font-family: inherit;
    width: 100%;
}
.study-answer-option:hover:not(:disabled) { border-color: #90caf9; background: #f0f7ff; }
.study-answer-option.selected { border-color: #1565c0; background: #e3f2fd; }
.study-answer-option.correct { border-color: #4caf50; background: #e8f5e9; }
.study-answer-option.wrong-sel { border-color: #f44336; background: #ffebee; }
.study-answer-option:disabled { cursor: default; }
.study-answer-option:disabled:not(.correct):not(.wrong-sel):not(.selected) { opacity: 0.6; }

.study-answer-letter {
    font-weight: 700;
    color: #1565c0;
    flex-shrink: 0;
    min-width: 20px;
}

/* --- Feedback area --- */
.study-feedback {
    padding: 0 22px 16px;
}
.study-feedback-box {
    padding: 14px 18px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.5;
}
.study-feedback-box.correct {
    background: #e8f5e9;
    border: 1px solid #a5d6a7;
    color: #2e7d32;
}
.study-feedback-box.wrong {
    background: #ffebee;
    border: 1px solid #ef9a9a;
    color: #c62828;
}
.study-feedback-box.info {
    background: #e3f2fd;
    border: 1px solid #90caf9;
    color: #1565c0;
}
.study-feedback-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-weight: 600;
    margin-bottom: 4px;
}
.study-streak-dots {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 12px;
}
.study-streak-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    transition: all 0.3s;
}
.study-explanation {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(0,0,0,0.1);
    font-size: 13px;
    opacity: 0.9;
}

/* --- Action buttons --- */
.study-actions {
    padding: 12px 22px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}
.study-actions-right {
    display: flex;
    gap: 10px;
    align-items: center;
}
.study-btn-back {
    padding: 10px 20px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    font-size: 14px;
    color: #666;
    text-decoration: none;
    transition: all 0.15s;
}
.study-btn-back:hover { border-color: #bbb; color: #333; }

.study-btn-confirm {
    padding: 10px 24px;
    background: #1565c0;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.15s;
    font-family: inherit;
}
.study-btn-confirm:hover:not(:disabled) { background: #0d47a1; }
.study-btn-confirm:disabled { opacity: 0.4; cursor: not-allowed; }

.study-btn-check {
    padding: 10px 24px;
    background: white;
    color: #1565c0;
    border: 2px solid #1565c0;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.15s;
    font-family: inherit;
}
.study-btn-check:hover:not(:disabled) { background: #e3f2fd; }
.study-btn-check:disabled { opacity: 0.4; cursor: not-allowed; }

.study-btn-next {
    padding: 10px 28px;
    background: #1565c0;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.15s;
    font-family: inherit;
}
.study-btn-next:hover { background: #0d47a1; }

/* --- Right panel: Navigation --- */
.study-nav-panel {
    width: 240px;
    flex-shrink: 0;
    background: white;
    border-radius: 10px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.07);
    padding: 18px;
    position: sticky;
    top: 20px;
}
.study-nav-title {
    font-size: 13px;
    font-weight: 700;
    color: #1565c0;
    margin-bottom: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.study-nav-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
}
.study-nav-cell {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.15s;
}
.study-nav-cell.not-visited { background: #f5f5f5; color: #999; border: 1px solid #ddd; }
.study-nav-cell.in-progress { background: #fff3e0; color: #e65100; border: 1px solid #ffcc80; }
.study-nav-cell.mastered { background: #c8e6c9; color: #2e7d32; }
.study-nav-cell.failed { background: #ffcdd2; color: #c62828; }
.study-nav-cell.current { background: #1565c0; color: white; outline: 2px solid #1565c0; outline-offset: 1px; }

/* Legend */
.study-nav-legend {
    margin-top: 14px;
    font-size: 11px;
    color: #888;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.study-legend-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    vertical-align: middle;
    margin-right: 3px;
}
.study-legend-dot.mastered { background: #c8e6c9; }
.study-legend-dot.failed { background: #ffcdd2; }
.study-legend-dot.current { background: #1565c0; }
.study-legend-dot.in-progress { background: #fff3e0; border: 1px solid #ffcc80; }

/* Progress bar */
.study-nav-progress {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid #eee;
}
.study-nav-progress-label { font-size: 12px; color: #888; margin-bottom: 6px; }
.study-nav-progress-bar {
    background: #e2e8f0;
    border-radius: 4px;
    height: 8px;
    overflow: hidden;
}
.study-nav-progress-fill {
    background: #4caf50;
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}
.study-nav-progress-text { font-size: 12px; color: #666; margin-top: 4px; }

/* Phase info badge */
.study-phase-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 12px;
}

/* --- Inline hint box --- */
.study-hint-box {
    margin: 0 22px 12px;
    padding: 16px 18px 16px 18px;
    background: #e3f2fd;
    border: 1px solid #90caf9;
    border-radius: 8px;
    position: relative;
}
.study-hint-close {
    position: absolute;
    top: 12px;
    right: 14px;
    background: none;
    border: none;
    cursor: pointer;
    color: #1565c0;
    font-size: 13px;
    font-weight: 600;
    text-decoration: underline;
    padding: 0;
}
.study-hint-close:hover { color: #0d47a1; }

/* --- Block done / Phase transition overlays --- */
.study-done-card, .study-transition-card {
    max-width: 500px;
    margin: 60px auto;
    padding: 48px;
    text-align: center;
    background: white;
    border-radius: 10px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.07);
}
.study-done-card { border: 2px solid #a5d6a7; }
.study-transition-card { border: 2px solid #ffcc80; }
.study-done-icon, .study-transition-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}
.study-done-icon { background: #dcfce7; }
.study-transition-icon { background: #fff3e0; }

/* --- Loading --- */
.study-loading {
    max-width: 500px;
    margin: 60px auto;
    padding: 48px;
    text-align: center;
}

/* --- Mobile responsive --- */
@media (max-width: 800px) {
    .study-layout { flex-direction: column; }
    /* Навигация НИЖЕ блока вопроса */
    .study-nav-panel { width: 100%; position: static; order: 1; }
    .study-question-panel { order: 0; overflow: visible; }
    .study-answers { grid-template-columns: 1fr; }
    .study-q-header { flex-direction: column; gap: 4px; text-align: center; }
    .study-actions { flex-wrap: wrap; justify-content: center; gap: 8px; }
    .study-actions-right { width: 100%; justify-content: center; flex-wrap: wrap; }
    /* Центрирование текста вопроса */
    .study-q-text { text-align: center; }
    /* Кнопки — удобнее для касания */
    .study-btn-check,
    .study-btn-confirm,
    .study-btn-next,
    .study-btn-back {
        padding: 12px 20px;
        font-size: 15px;
        min-height: 44px;
    }
}

/* --- Small mobile (<=480px) --- */
@media (max-width: 480px) {
    .study-q-text { padding: 16px 14px 12px; font-size: 14px; }
    .study-answers { padding: 0 14px 8px; }
    .study-answer-option { padding: 12px 10px; font-size: 13px; }
    .study-actions { padding: 10px 14px 16px; }
    .study-feedback { padding: 0 14px 12px; }
    .study-hint-box { margin: 0 14px 12px; }
    .study-nav-panel { padding: 14px; }
    .study-nav-grid { grid-template-columns: repeat(7, 1fr); gap: 4px; }
    .study-nav-cell { font-size: 11px; }
    /* Кнопки на всю ширину на маленьком экране */
    .study-btn-check,
    .study-btn-confirm,
    .study-btn-next {
        flex: 1;
        text-align: center;
    }
    .study-btn-back { width: 100%; text-align: center; }
    .study-actions-right { gap: 8px; }
}
/* Demo hint */
.demo-hint-pulse {
    animation: demoHintPulse 1.5s ease-in-out infinite !important;
    border-color: #1565c0 !important;
}
@keyframes demoHintPulse {
    0% { box-shadow: 0 0 0 0 rgba(21, 101, 192, 0.5); }
    70% { box-shadow: 0 0 0 10px rgba(21, 101, 192, 0); }
    100% { box-shadow: 0 0 0 0 rgba(21, 101, 192, 0); }
}
.demo-hint-banner {
    text-align: center; padding: 10px 16px; margin: 8px 22px 0;
    background: #e3f2fd; color: #1565c0; border-radius: 8px;
    font-size: 14px; font-weight: 600;
    animation: demoHintFade 1.5s ease-in-out infinite;
}
@keyframes demoHintFade {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.75; }
}
.demo-hint-tooltip {
    position: absolute; top: -36px; left: 50%;
    transform: translateX(-50%);
    background: #1565c0; color: #fff; padding: 6px 16px;
    border-radius: 8px; font-size: 13px; font-weight: 600;
    white-space: nowrap; z-index: 10;
    animation: demoHintBounce 1.5s ease-in-out infinite;
}
.demo-hint-arrow {
    position: absolute; bottom: -6px; left: 50%; transform: translateX(-50%);
    width: 0; height: 0;
    border-left: 6px solid transparent; border-right: 6px solid transparent;
    border-top: 6px solid #1565c0;
}
@keyframes demoHintBounce {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(-4px); }
}
.demo-hint-pulse-btn {
    animation: demoHintPulseBtn 1.5s ease-in-out infinite !important;
}
@keyframes demoHintPulseBtn {
    0% { box-shadow: 0 0 0 0 rgba(21, 101, 192, 0.5); }
    70% { box-shadow: 0 0 0 10px rgba(21, 101, 192, 0); }
    100% { box-shadow: 0 0 0 0 rgba(21, 101, 192, 0); }
}
