/**
 * Lesson Display Styles
 * Styling for LG_HTML_Generator output
 *
 * Design Philosophy: Clean, uncluttered, professional
 * Hierarchy through spacing and subtle typography only
 */

/* ==========================================================================
   Global Styles
   ========================================================================== */

.lg-lesson-content {
    background-color: #ffffff;
    font-family: 'Poppins', sans-serif;
}

/* ==========================================================================
   Section Layout
   ========================================================================== */

.lesson-section {
    margin-bottom: 32px;
    padding-bottom: 0;
    border-bottom: none;
}

.lesson-section:last-child {
    margin-bottom: 0;
}

/* Section Headers - subtle, not prominent */
.lesson-section .section-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    margin: 0 0 16px 0 !important;
    padding-bottom: 0;
    border-bottom: none;
    width: fit-content;
    text-align: left !important;
    max-width: none !important;
}

.section-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: #4f46e5; /* Indigo-600 to match brand */
    color: white;
    border-radius: 50%;
    font-weight: 600;
    font-size: 20px;
    flex-shrink: 0;
}

.section-label {
    color: #666;
    font-size: 24px;
    font-weight: 400;
}

/* ==========================================================================
   Side-by-Side Image Layout (CSS Grid for proper column alignment)
   ========================================================================== */

.lesson-section.has-image {
    display: grid;
    grid-template-columns: 1fr 400px;
    grid-template-rows: auto 1fr;
    gap: 0 32px;
}

/* Section header spans full width */
.lesson-section.has-image .section-header {
    grid-column: 1 / -1;
    grid-row: 1;
}

/* Content wrapper contains paragraph, keywords, and questions */
.lesson-section.has-image .section-content-wrapper {
    grid-column: 1;
    grid-row: 2;
}

/* Image/placeholder stays in right column, aligned to top */
.lesson-section.has-image .lg-section-image,
.lesson-section.has-image .lg-image-placeholder {
    grid-column: 2;
    grid-row: 2;
    align-self: start;
}

/* Fallback for sections without content wrapper (legacy HTML) */
.lesson-section.has-image .lesson-paragraph,
.lesson-section.has-image .lesson-keywords,
.lesson-section.has-image .lesson-questions {
    grid-column: 1;
}

/* Section Images */
.lg-section-image {
    max-width: 100%;
    position: relative;
}

.lg-section-image .lg-lesson-image {
    width: 100%;
    height: auto;
    border-radius: 4px;
    display: block;
}

.lg-image-attribution {
    font-size: 11px;
    color: #999;
    margin: 4px 0 0 0;
    line-height: 1.3;
}

.lg-image-attribution a {
    color: #888;
}

/* Image action buttons (show on hover, overlay on image) */
.lg-image-replace-actions {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    padding: 8px 12px;
    border-radius: 6px;
    z-index: 10;
}

.lg-lesson-content.editing .lg-section-image:hover .lg-image-replace-actions {
    display: flex !important;
    gap: 8px;
}

.lg-image-replace-actions .button {
    font-size: 12px;
    padding: 4px 10px;
    background: #fff;
    border-color: #fff;
    color: #333;
}

.lg-image-replace-actions .button:hover {
    background: #f0f0f0;
    border-color: #f0f0f0;
}

/* Responsive: Stack on mobile */
@media (max-width: 768px) {
    .lesson-section.has-image {
        display: block;
    }

    .lesson-section.has-image .lg-section-image,
    .lesson-section.has-image .lg-image-placeholder {
        width: 100%;
        margin: 16px 0;
    }
}

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

.lesson-paragraph {
    line-height: 1.75;
    font-size: 16px;
    font-family: 'Poppins', sans-serif;
    margin-bottom: 16px;
}

.lesson-paragraph p,
.lg-lesson-content p {
    margin: 0 0 16px 0;
    font-family: 'Poppins', sans-serif;
    font-size: 16px;
}

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

/* Remove bold from keywords in body text */
.lesson-paragraph strong,
.lesson-paragraph b {
    font-weight: 400;
}

/* ==========================================================================
   Keywords
   ========================================================================== */

.lesson-keywords {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 16px 0 20px 0;
}

.keywords-label {
    font-weight: 500;
    color: #333;
    font-size: 15px;
    margin-right: 4px;
}

.keywords-label::after {
    content: ":";
}

.keyword-pill {
    display: inline-block;
    padding: 6px 14px;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    font-size: 14px;
    color: #333;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.15s ease;
}

.keyword-pill:hover {
    background: #e8e8e8;
    border-color: #ccc;
}

.keyword-pill.keyword-active {
    background: #fff59d;
    border-color: #fdd835;
}

.keyword-pill::after {
    content: none;
}

/* Keyword highlighting when clicked */
.keyword-highlight {
    background-color: #fff59d;
    padding: 1px 2px;
    border-radius: 2px;
}

/* ==========================================================================
   Questions
   ========================================================================== */

.lesson-questions {
    margin-top: 20px;
    padding-left: 20px; /* Indent questions under keywords */
}

.question {
    margin: 0 0 16px 0;
    padding: 0;
    background: transparent;
    border-radius: 0;
}

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

.question-label {
    font-size: 16px;
    font-family: 'Poppins', sans-serif;
    text-transform: none;
    color: #333;
    margin: 20px 0 8px 0;
    font-weight: 600;
    letter-spacing: 0;
    background: transparent;
    padding: 0;
    border-radius: 0;
    display: block;
}

.question:first-child .question-label {
    margin-top: 0;
}

.question-number {
    display: inline;
    font-weight: 400;
    color: inherit;
    font-size: 16px;
    font-family: 'Poppins', sans-serif;
    user-select: none;
    pointer-events: none;
}

.question-number::after {
    content: ": ";
}

.question-prompt {
    display: inline;
    margin: 0;
    padding-left: 0;
    font-size: 16px;
    font-family: 'Poppins', sans-serif;
    line-height: 1.6;
    font-weight: 400;
}

/* Inline answer display */
.question-answer {
    display: inline;
    color: rgba(0, 0, 0, 0.7);
    font-style: normal;
}

.question-answer::before {
    content: " ";
}

/* Expected completions - inline, lighter color */
.question-completions {
    display: block;
    margin-top: 8px;
    font-size: 16px;
    color: rgba(0, 0, 0, 0.6);
    font-weight: 400;
}

/* ==========================================================================
   Answer Reveal (keeping for backwards compatibility)
   ========================================================================== */

.answer-reveal {
    margin-top: 8px;
    margin-left: 20px; /* Indent answer accordions */
}

.answer-reveal summary {
    cursor: pointer;
    color: rgba(0, 0, 0, 0.6);
    font-size: 16px; /* Match main content font size */
    font-family: 'Poppins', sans-serif;
    padding: 4px 0;
    user-select: none;
    list-style: none;
    text-decoration: underline;
}

.answer-reveal summary::-webkit-details-marker {
    display: none;
}

.answer-reveal summary::before {
    content: none;
}

.answer-reveal[open] summary::before {
    content: none;
}

.answer-reveal summary:hover {
    color: #333;
}

.answer-reveal[open] summary {
    margin-bottom: 4px;
}

.answer-text {
    background: transparent;
    padding: 0;
    padding-left: 16px;
    border-left: none;
    margin: 0;
    font-style: italic;
    color: rgba(0, 0, 0, 0.7);
    font-size: 16px; /* Match main content font size */
    font-family: 'Poppins', sans-serif;
}

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

.lesson-sources {
    margin-top: 32px;
    padding-top: 0;
    border-top: none;
}

.lesson-sources h3 {
    font-size: 16px;
    font-weight: 400;
    margin: 0 0 12px 0;
    color: #333;
}

.lesson-sources ol {
    margin: 0;
    padding-left: 0;
    list-style: none;
}

.lesson-sources li {
    margin-bottom: 6px;
    font-size: 16px;
    padding-left: 0;
    position: relative;
    color: rgba(0, 0, 0, 0.7);
    font-family: 'Poppins', sans-serif;
}

.lesson-sources li::before {
    content: none;
}

.lesson-sources a {
    color: #0073aa;
    text-decoration: underline;
}

.lesson-sources a:hover {
    color: #005177;
}

/* ==========================================================================
   Lesson Footer (Branding)
   ========================================================================== */

.lesson-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 32px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
    gap: 20px;
}

.lesson-footer-brand {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

.lesson-footer-logo {
    height: 36px;
    width: auto;
}

.lesson-footer-brand-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.lesson-footer-tagline {
    font-size: 13px;
    color: #666;
    font-style: italic;
}

.lesson-footer-url {
    font-size: 13px;
    color: #0073aa;
    text-decoration: none;
}

.lesson-footer-url:hover {
    text-decoration: underline;
}

.lesson-footer-meta {
    text-align: right;
}

.lesson-footer-created {
    font-size: 14px;
    color: #333;
}

/* Responsive: Stack on mobile */
@media (max-width: 768px) {
    .lesson-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .lesson-footer-brand {
        flex-wrap: wrap;
    }

    .lesson-footer-meta {
        text-align: left;
    }
}

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

@media print {
    .question-number {
        color: #000; /* Force black for print clarity */
        font-weight: 700; /* Slightly bolder for legibility */
    }
}
