/**
 * Structured Lesson Styles
 * Interactive, hierarchical lesson display
 *
 * @package Lesson_Generator
 * @since 3.0.0
 */

/* ==========================================================================
   Sections - Collapsible with clear hierarchy
   ========================================================================== */

.lg-structured-lesson {
    max-width: 900px;
    margin: 0 auto;
}

.lg-section {
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 0;
}

.lg-section:last-child {
    border-bottom: none;
}

.lg-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    background: transparent;
    border-bottom: 1px solid #e2e8f0;
    cursor: pointer;
    user-select: none;
}

.lg-section-header:hover {
    background: #f8fafc;
}

.lg-section-header:focus {
    outline: 2px solid #667eea;
    outline-offset: -2px;
}

.lg-section-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #334155;
    display: flex;
    align-items: center;
    gap: 10px;
}

.lg-section-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-radius: 50%;
    font-size: 0.8rem;
    font-weight: 700;
}

.lg-section-toggle {
    font-size: 0.8rem;
    color: #94a3b8;
    transition: transform 0.3s ease;
}

/* Collapsed state */
.lg-section:not(.lg-section-expanded) .lg-section-body {
    display: none;
}

.lg-section:not(.lg-section-expanded) .lg-section-toggle {
    transform: rotate(-90deg);
}

.lg-section-body {
    padding: 16px 0;
}

/* ==========================================================================
   Paragraph Content
   ========================================================================== */

.lg-paragraph {
    font-size: 1.05rem;
    line-height: 1.7;
    color: #334155;
    margin-bottom: 16px;
}

.lg-paragraph p {
    margin: 0 0 0.75em 0;
}

.lg-paragraph p:last-child {
    margin-bottom: 0;
}

.lg-paragraph strong {
    color: #1e293b;
    font-weight: 600;
}

/* ==========================================================================
   Keywords - Interactive vocabulary pills
   ========================================================================== */

.lg-keywords-container {
    background: #fefce8;
    border-left: 3px solid #fbbf24;
    padding: 12px 16px;
    margin-bottom: 16px;
}

.lg-keywords-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #a16207;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 8px 0;
}

.lg-keywords-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.lg-keyword-pill {
    display: inline-block;
    padding: 4px 10px;
    background: #fff;
    border: 1px solid #fbbf24;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
    color: #92400e;
    cursor: pointer;
    transition: all 0.2s ease;
}

.lg-keyword-pill:hover,
.lg-keyword-pill:focus {
    background: #fef3c7;
    border-color: #f59e0b;
}

.lg-keyword-pill.lg-keyword-active {
    background: #fbbf24;
    color: #78350f;
    border-color: #f59e0b;
}

/* Keyword highlight in paragraph */
.lg-keyword-highlight {
    background: #fef3c7;
    border-radius: 2px;
    padding: 0 2px;
    transition: background 0.2s ease;
}

.lg-keyword-highlight.lg-highlight-active {
    background: #fbbf24;
}

/* ==========================================================================
   Questions - Numbered with show/hide answers
   ========================================================================== */

.lg-questions-container {
    border-top: 1px solid #e2e8f0;
    padding-top: 16px;
    margin-top: 8px;
}

.lg-questions-heading {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 12px 0;
}

.lg-question-group {
    margin-bottom: 16px;
}

.lg-question-group:last-child {
    margin-bottom: 0;
}

.lg-question-type-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
    margin: 0 0 8px 0;
    padding-bottom: 6px;
    border-bottom: 1px dashed #cbd5e1;
}

.lg-question-icon {
    font-size: 1rem;
}

.lg-question {
    background: #f8fafc;
    border-left: 3px solid #e2e8f0;
    padding: 10px 12px;
    margin-bottom: 8px;
}

.lg-question:last-child {
    margin-bottom: 0;
}

.lg-question-prompt {
    font-size: 0.95rem;
    line-height: 1.5;
    color: #334155;
}

.lg-question-number {
    font-weight: 700;
    color: #667eea;
    margin-right: 6px;
}

/* Answer reveal */
.lg-answer-reveal {
    margin-top: 8px;
}

.lg-show-answer-btn,
.lg-show-hint-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    background: #667eea;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.lg-show-answer-btn:hover,
.lg-show-hint-btn:hover {
    background: #5a6fd8;
}

.lg-show-answer-btn[aria-expanded="true"],
.lg-show-hint-btn[aria-expanded="true"] {
    background: #475569;
}

.lg-answer-content {
    margin-top: 8px;
    padding: 10px 12px;
    background: #ecfdf5;
    border-left: 3px solid #10b981;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.lg-answer-text {
    font-size: 0.95rem;
    font-weight: 600;
    color: #065f46;
    margin-bottom: 4px;
}

.lg-answer-content > .lg-answer-text:last-child {
    margin-bottom: 0;
}

.lg-scaffold-hint {
    font-size: 0.85rem;
    color: #047857;
    font-style: italic;
}

.lg-scaffold-hint strong {
    font-style: normal;
}

/* ==========================================================================
   Sources
   ========================================================================== */

.lg-sources-container {
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    padding: 16px 0;
    margin-top: 16px;
}

.lg-sources-heading {
    font-size: 0.9rem;
    font-weight: 700;
    color: #475569;
    margin: 0 0 8px 0;
}

.lg-sources-list {
    margin: 0;
    padding-left: 20px;
}

.lg-source-item {
    margin-bottom: 4px;
    font-size: 0.85rem;
}

.lg-source-item:last-child {
    margin-bottom: 0;
}

.lg-source-item a {
    color: #667eea;
    text-decoration: none;
}

.lg-source-item a:hover {
    text-decoration: underline;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 768px) {
    .lg-section-header {
        padding: 14px 16px;
    }

    .lg-section-title {
        font-size: 1rem;
    }

    .lg-section-number {
        width: 28px;
        height: 28px;
        font-size: 0.85rem;
    }

    .lg-section-body {
        padding: 16px;
    }

    .lg-paragraph {
        font-size: 1rem;
    }

    .lg-keywords-container {
        padding: 12px 16px;
    }

    .lg-question {
        padding: 12px;
    }

    .lg-sources-container {
        padding: 16px;
    }
}

/* ==========================================================================
   Lesson Context / Settings
   ========================================================================== */

.lg-context-container {
    background: #f1f5f9;
    border-top: 1px solid #e2e8f0;
    padding: 16px 0;
    margin-top: 16px;
}

.lg-context-heading {
    font-size: 0.9rem;
    font-weight: 700;
    color: #475569;
    margin: 0 0 12px 0;
}

.lg-context-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.lg-context-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.lg-context-item-wide {
    grid-column: 1 / -1;
}

.lg-context-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.lg-context-value {
    font-size: 0.85rem;
    color: #334155;
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .lg-structured-lesson {
        max-width: none;
    }

    .lg-section {
        border: 1px solid #ccc;
        box-shadow: none;
        page-break-inside: avoid;
    }

    .lg-section-header {
        background: #f5f5f5 !important;
    }

    .lg-section-toggle {
        display: none;
    }

    /* Expand all sections for print */
    .lg-section .lg-section-body {
        display: block !important;
    }

    /* Show all answers for print */
    .lg-answer-content {
        display: block !important;
    }

    .lg-show-answer-btn,
    .lg-show-hint-btn {
        display: none;
    }

    .lg-keyword-pill {
        border: 1px solid #999;
        background: #fff;
    }
}
