/* ===================================================================
   LESSON CONTENT STYLES
   Comprehensive CSS for all interactive lesson content elements
   Used by LessonDetail.razor to render rich lesson HTML
   =================================================================== */

/* ===== BASE LESSON CONTAINER ===== */
.lesson-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    line-height: 1.7;
    color: #333;
}

.sanitized-content .lesson-container {
    padding: 0;
    max-width: 100%;
}

/* ===== CONTENT THEME VARIABLES =====
   Lesson content uses CSS variables that were defined in now-stripped <style> blocks.
   Define them here so content renders correctly on the light page background.
   Original dark-theme values mapped to light-theme equivalents. */
.sanitized-content,
.lesson-content-area {
    --primary: #f59e0b;
    --secondary: #1e3a5f;
    --dark: #1a1a2e;
    --light: #333;            /* Was #f8fafc (near-white) — now dark text for light bg */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg-dark: #f8f9fa;       /* Was #0f172a — now light bg */
    --bg-card: #ffffff;
    --text-primary: #333;
    --text-secondary: #666;
    --border: #e0e0e0;
    --accent: #f59e0b;
}

/* Force readable text on any remaining inline white color styles */
.sanitized-content [style*="color: white"],
.sanitized-content [style*="color:white"],
.sanitized-content [style*="color: #fff"],
.sanitized-content [style*="color:#fff"],
.sanitized-content [style*="color: #ffffff"],
.sanitized-content [style*="color:#ffffff"],
.sanitized-content [style*="color: #f8fafc"],
.sanitized-content [style*="color:#f8fafc"] {
    color: #333 !important;
}

/* Ensure learner-content divs (from dark-theme content) render properly */
.sanitized-content .learner-content,
.sanitized-content .lesson-content,
.sanitized-content .interactive-lesson {
    color: #333;
    background: transparent;
    line-height: 1.8;
}

.sanitized-content .learner-content h1,
.sanitized-content .learner-content h2,
.sanitized-content .learner-content h3,
.sanitized-content .learner-content h4,
.sanitized-content .learner-content h5,
.sanitized-content .learner-content h6,
.sanitized-content .interactive-lesson h1,
.sanitized-content .interactive-lesson h2,
.sanitized-content .interactive-lesson h3,
.sanitized-content .interactive-lesson h4 {
    color: #1a1a2e;
}

.sanitized-content .learner-content p,
.sanitized-content .learner-content li,
.sanitized-content .learner-content span,
.sanitized-content .learner-content td,
.sanitized-content .interactive-lesson p,
.sanitized-content .interactive-lesson li,
.sanitized-content .interactive-lesson span {
    color: #333;
}

/* ===== LESSON HEADER ===== */
.lesson-container .lesson-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 3px solid #2196F3;
}

.lesson-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #2196F3, #1976D2);
    color: white;
    font-size: 1.25rem;
    font-weight: bold;
    border-radius: 50%;
    flex-shrink: 0;
}

.lesson-container .lesson-title {
    font-size: 2rem;
    color: #1a1a2e;
    margin: 0;
}

/* ===== OBJECTIVES PANEL ===== */
.objectives-panel {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border-left: 5px solid #2196F3;
    padding: 1.5rem 2rem;
    margin: 2rem 0;
    border-radius: 0 8px 8px 0;
}

.objectives-panel h3 {
    color: #1565C0;
    margin-top: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.objectives-panel ul {
    margin-bottom: 0;
}

.objectives-panel li {
    margin: 0.5rem 0;
}

/* ===== IMAGE SECTIONS ===== */
.image-section {
    margin: 2rem 0;
    background: #f8f9fa;
    border-radius: 12px;
    padding: 1.5rem;
}

.image-section h3 {
    color: #1565C0;
    margin-top: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.lesson-image-container {
    text-align: center;
    margin: 1rem 0;
}

.lesson-image {
    max-width: 100%;
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.image-caption {
    margin-top: 0.75rem;
    font-size: 0.9rem;
    color: #666;
    font-style: italic;
}

/* ===== GENERAL IMAGES IN CONTENT ===== */
.sanitized-content img,
.lesson-container img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
    margin: 1.5rem auto;
    display: block;
}

/* ===== MODEL VIEWER SECTION ===== */
.model-viewer-section {
    margin: 2rem 0;
    background: #f8f9fa;
    border-radius: 12px;
    padding: 1.5rem;
}

.model-viewer-section h3 {
    color: #1565C0;
    margin-top: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.model-viewer-container {
    position: relative;
    width: 100%;
    height: 400px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    background-color: #f0f0f0;
}

model-viewer {
    width: 100%;
    height: 100%;
    background-color: #e8e8e8;
}

.model-controls {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    z-index: 10;
}

.btn-control {
    background: rgba(255,255,255,0.95);
    border: 1px solid #ddd;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.btn-control:hover {
    background: #2196F3;
    color: white;
    border-color: #2196F3;
}

/* ===== CONTENT SECTIONS ===== */
.content-section {
    margin: 2rem 0;
}

.content-section h2 {
    color: #1a1a2e;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

.content-section p {
    margin-bottom: 1rem;
}

/* ===== COMPONENT GRID ===== */
.components-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.component-card {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s;
}

.component-card:hover {
    border-color: #2196F3;
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.component-icon {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    font-size: 1.25rem;
    color: #1565C0;
}

.component-card h4 {
    margin: 0 0 0.5rem 0;
    color: #1a1a2e;
}

.component-card p {
    margin: 0 0 1rem 0;
    font-size: 0.9rem;
    color: #666;
}

.component-location {
    font-size: 0.8rem;
    color: #2196F3;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.component-location::before {
    content: '\1F4CD'; /* pin emoji */
}

/* ===== MAST TYPES ===== */
.mast-types {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin: 2rem 0;
}

@media (max-width: 768px) {
    .mast-types {
        grid-template-columns: 1fr;
    }
}

.mast-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 3px 15px rgba(0,0,0,0.1);
}

.mast-header {
    background: linear-gradient(135deg, #2196F3, #1976D2);
    color: white;
    padding: 1rem 1.5rem;
}

.mast-header h4 {
    margin: 0;
}

.mast-content {
    padding: 1.25rem 1.5rem;
}

.mast-content ul {
    margin: 0;
    padding-left: 1.25rem;
}

.mast-content li {
    margin: 0.4rem 0;
    font-size: 0.9rem;
}

/* ===== POWER GRID ===== */
.power-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin: 2rem 0;
}

@media (max-width: 768px) {
    .power-grid {
        grid-template-columns: 1fr;
    }
}

.power-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    border: 2px solid #e0e0e0;
    text-align: center;
}

.power-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 1.5rem;
}

.power-card.lpg .power-icon {
    background: #fff3e0;
    color: #f57c00;
}

.power-card.diesel .power-icon {
    background: #e8f5e9;
    color: #388e3c;
}

.power-card.electric .power-icon {
    background: #e3f2fd;
    color: #1976d2;
}

.power-card h4 {
    margin: 0 0 1rem 0;
}

.power-card ul {
    text-align: left;
    margin: 0;
    padding-left: 1.25rem;
}

.power-card li {
    margin: 0.4rem 0;
    font-size: 0.85rem;
}

/* ===== HYDRAULIC DIAGRAM ===== */
.hydraulic-diagram {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 1.5rem;
    margin: 2rem 0;
}

.hydraulic-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid #e0e0e0;
}

.hydraulic-item:last-child {
    border-bottom: none;
}

.hydraulic-icon {
    width: 45px;
    height: 45px;
    background: linear-gradient(135deg, #1976d2, #1565c0);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.hydraulic-content h5 {
    margin: 0 0 0.25rem 0;
    color: #1a1a2e;
}

.hydraulic-content p {
    margin: 0;
    font-size: 0.9rem;
    color: #666;
}

/* ===== INFO BOXES ===== */
.info-box {
    display: flex;
    gap: 1rem;
    padding: 1.5rem;
    margin: 2rem 0;
    border-radius: 8px;
    border-left: 5px solid;
}

.info-box.danger {
    background: #ffebee;
    border-color: #dc3545;
}

.info-box.warning {
    background: #fff3e0;
    border-color: #f57c00;
}

.info-box.info {
    background: #e3f2fd;
    border-color: #2196F3;
}

.info-box.success {
    background: #e8f5e9;
    border-color: #4caf50;
}

.info-icon {
    flex-shrink: 0;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.info-box.danger .info-icon {
    background: #dc3545;
    color: white;
}

.info-box.warning .info-icon {
    background: #f57c00;
    color: white;
}

.info-box.info .info-icon {
    background: #2196F3;
    color: white;
}

.info-box.success .info-icon {
    background: #4caf50;
    color: white;
}

.info-content h4 {
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.info-content ul {
    margin-bottom: 0;
    padding-left: 1.25rem;
}

/* ===== SUMMARY BOX ===== */
.summary-box {
    background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
    border: 2px solid #ddd;
    border-radius: 12px;
    padding: 1.5rem 2rem;
    margin: 2rem 0;
}

.summary-box h3 {
    color: #1565C0;
    margin-top: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.summary-box ul {
    margin-bottom: 0;
}

.summary-box li {
    margin: 0.5rem 0;
}

/* ===== FLIP CARDS ===== */
.flip-cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.flip-card {
    perspective: 1000px;
    height: 200px;
    cursor: pointer;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.flip-card:hover .flip-card-inner,
.flip-card.flipped .flip-card-inner {
    transform: rotateY(180deg);
}

.flip-card-front,
.flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    text-align: center;
}

.flip-card-front {
    background: linear-gradient(135deg, #2196F3, #1976D2);
    color: white;
}

.flip-card-back {
    background: white;
    border: 2px solid #2196F3;
    color: #333;
    transform: rotateY(180deg);
}

.flip-card-front h4 {
    margin: 0.5rem 0 0 0;
}

.flip-card-icon {
    font-size: 2.5rem;
}

/* ===== STEP LIST ===== */
.step-list {
    counter-reset: step-counter;
    list-style: none;
    padding: 0;
    margin: 2rem 0;
}

.step-list li {
    counter-increment: step-counter;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.5rem;
    margin-bottom: 1rem;
    background: white;
    border-radius: 8px;
    border-left: 4px solid #2196F3;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.step-list li::before {
    content: counter(step-counter);
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #2196F3, #1976D2);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1rem;
}

/* ===== KNOWLEDGE CHECK ===== */
.knowledge-check {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 2rem;
    margin: 2rem 0;
    border: 2px solid #e0e0e0;
}

.knowledge-check h3 {
    color: #1565C0;
    margin-top: 0;
}

.knowledge-check .question {
    font-weight: 600;
    margin-bottom: 1rem;
    color: #333;
}

.knowledge-check .options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.knowledge-check .option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.knowledge-check .option:hover {
    border-color: #2196F3;
    background: #e3f2fd;
}

.knowledge-check .option.correct {
    border-color: #4caf50;
    background: #e8f5e9;
}

.knowledge-check .option.incorrect {
    border-color: #f44336;
    background: #ffebee;
}

/* ===== PROCEDURE CARDS ===== */
.procedure-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.procedure-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 3px 15px rgba(0,0,0,0.1);
}

.procedure-header {
    background: linear-gradient(135deg, #2196F3, #1976D2);
    color: white;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.procedure-header h4 {
    margin: 0;
}

.procedure-content {
    padding: 1.5rem;
}

.procedure-content ol {
    margin: 0;
    padding-left: 1.5rem;
}

.procedure-content li {
    margin: 0.5rem 0;
}

/* ===== HAZARD GRID ===== */
.hazard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.hazard-card {
    background: white;
    border: 2px solid #f57c00;
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
}

.hazard-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.hazard-card h4 {
    color: #f57c00;
    margin: 0 0 0.5rem 0;
}

.hazard-card p {
    margin: 0;
    font-size: 0.9rem;
    color: #666;
}

/* ===== CHECKLIST ===== */
.checklist {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 1.5rem 2rem;
    margin: 2rem 0;
}

.checklist h3 {
    color: #1565C0;
    margin-top: 0;
}

.checklist ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.checklist li {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid #e0e0e0;
}

.checklist li:last-child {
    border-bottom: none;
}

.checklist li::before {
    content: '\2610'; /* checkbox emoji */
    font-size: 1.25rem;
    color: #2196F3;
}

/* ===== TABLES ===== */
.lesson-container table,
.sanitized-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.lesson-container th,
.sanitized-content th {
    background: linear-gradient(135deg, #2196F3, #1976D2);
    color: white;
    padding: 1rem;
    text-align: left;
    font-weight: 600;
}

.lesson-container td,
.sanitized-content td {
    padding: 1rem;
    border-bottom: 1px solid #e0e0e0;
}

.lesson-container tr:last-child td,
.sanitized-content tr:last-child td {
    border-bottom: none;
}

.lesson-container tr:nth-child(even),
.sanitized-content tr:nth-child(even) {
    background: #f8f9fa;
}

/* ===== LESSON NAVIGATION (in content) ===== */
.lesson-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 2px solid #e0e0e0;
}

.lesson-navigation .btn-nav {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.lesson-navigation .btn-prev {
    background: #f5f5f5;
    color: #666;
}

.lesson-navigation .btn-next {
    background: linear-gradient(135deg, #2196F3, #1976D2);
    color: white;
}

.lesson-navigation .btn-next:hover {
    transform: translateX(3px);
    box-shadow: 0 4px 15px rgba(33, 150, 243, 0.4);
}

/* ===== FONT AWESOME ICON REPLACEMENTS ===== */
/* Since we may not have Font Awesome, use emoji fallbacks */
.fa-bullseye::before { content: '\1F3AF'; } /* target */
.fa-image::before { content: '\1F5BC'; } /* frame */
.fa-cube::before { content: '\1F4E6'; } /* package */
.fa-weight-hanging::before { content: '\2696'; } /* scales */
.fa-car::before { content: '\1F697'; } /* car */
.fa-arrows-alt-v::before { content: '\2195'; } /* up-down arrows */
.fa-grip-horizontal::before { content: '\2630'; } /* trigram */
.fa-shield-alt::before { content: '\1F6E1'; } /* shield */
.fa-grip-lines::before { content: '\2550'; } /* lines */
.fa-hard-hat::before { content: '\1F6D1'; } /* stop sign */
.fa-circle::before { content: '\26AA'; } /* circle */
.fa-fire::before { content: '\1F525'; } /* fire */
.fa-gas-pump::before { content: '\26FD'; } /* fuel */
.fa-bolt::before { content: '\26A1'; } /* lightning */
.fa-oil-can::before { content: '\1F6E2'; } /* oil */
.fa-cog::before { content: '\2699'; } /* gear */
.fa-link::before { content: '\1F517'; } /* chain */
.fa-exclamation-triangle::before { content: '\26A0'; } /* warning */
.fa-clipboard-check::before { content: '\1F4CB'; } /* clipboard */
.fa-arrow-left::before { content: '\2190'; } /* left arrow */
.fa-arrow-right::before { content: '\2192'; } /* right arrow */
.fa-sync-alt::before { content: '\1F504'; } /* refresh */
.fa-arrow-down::before { content: '\2193'; } /* down arrow */
.fa-angle-double-down::before { content: '\21CA'; } /* double down */
.fa-check::before { content: '\2713'; } /* check */
.fa-times::before { content: '\2717'; } /* x */

/* Hide actual Font Awesome icons if not loaded */
.fas, .far, .fab {
    font-family: inherit;
    font-style: normal;
}

/* ===== DARK MODE SUPPORT ===== */
.dogging-dark-theme .lesson-container,
.dogging-dark-theme .sanitized-content {
    color: #e0e0e0;
}

.dogging-dark-theme .component-card,
.dogging-dark-theme .mast-card,
.dogging-dark-theme .power-card,
.dogging-dark-theme .procedure-card,
.dogging-dark-theme .knowledge-check {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

.dogging-dark-theme .component-card h4,
.dogging-dark-theme .content-section h2 {
    color: #e0e0e0;
}

.dogging-dark-theme .component-card p,
.dogging-dark-theme .hydraulic-content p {
    color: rgba(255, 255, 255, 0.7);
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    .lesson-container {
        padding: 1rem;
    }

    .components-grid,
    .flip-cards-container,
    .hazard-grid {
        grid-template-columns: 1fr;
    }

    .lesson-container .lesson-header {
        flex-direction: column;
        text-align: center;
    }

    .lesson-container .lesson-title {
        font-size: 1.5rem;
    }

    .lesson-navigation {
        flex-direction: column;
        gap: 1rem;
    }

    .lesson-navigation .btn-nav {
        width: 100%;
        justify-content: center;
    }
}
