/* =========================================
   SCM Course Global Stylesheet
   Version: 5.4 (Module Headers & Modal Fixes)
   Author: Denise (AI UX Specialist)
   Standard: SCORM 1.2 / WCAG 2.1 AA
   ========================================= */

/* -----------------------------------------
   1. Variables & Design Tokens
   ----------------------------------------- */
:root {
  /* Brand Palette */
  --primary-color: #2c3e50;       /* Deep Navy - Headers, Primary Actions */
  --primary-accent: #3498db;      /* Bright Blue - Links, Focus */
  --secondary-bg: #f4f6f8;        /* Light Gray - Page Background */
  --surface-white: #ffffff;       /* Card Backgrounds */
  
  /* Accent Colors for Asset Types */
  --color-assessment: #16a085;    /* Teal - Skills & Case Studies */
  --color-quiz: #8e44ad;          /* Purple - Quizzes & Plans */
  --color-diagram: #d35400;       /* Orange - Diagrams */
  --color-reading: #3f51b5;       /* Indigo - Readings */

  /* Text Colors */
  --text-main: #333333;           
  --text-muted: #666666;          
  --border-color: #e1e4e8;        

  /* Status Colors */
  --success-color: #27ae60;       
  --warning-color: #f39c12;       
  --danger-color: #c0392b; 

  /* Feedback Backgrounds (Light) */
  --success-bg: #d4edda;
  --success-text: #155724;
  --error-bg: #f8d7da;
  --error-text: #721c24;       

  /* Layout Constants */
  --container-width: 900px; 
  --header-height: 60px;
  --border-radius: 8px;
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.2);
}

* {
  box-sizing: border-box;
}

/* -----------------------------------------
   2. Resets & Typography
   ----------------------------------------- */
body {
  font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
  color: var(--text-main);
  background-color: var(--secondary-bg);
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  font-size: 1.125rem; 
}

h1, h2, h3, h4, h5, h6 {
  color: var(--primary-color);
  margin-top: 0;
  margin-bottom: 1rem;
  font-weight: 700;
}

p {
  margin-bottom: 1.5rem;
}

a {
  color: var(--primary-accent);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  text-decoration: underline;
  color: #1d6fa5;
}

/* --- Glossary Term Styling --- */
.glossary-trigger {
  color: var(--primary-color);
  border-bottom: 2px dotted var(--primary-accent); 
  cursor: help; 
  transition: all 0.2s ease;
}

.glossary-trigger:hover {
  color: var(--primary-accent);
  border-bottom-style: solid;
  background-color: rgba(52, 152, 219, 0.1); 
}

ul, ol {
  margin-bottom: 1.5rem;
  padding-left: 2rem;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* -----------------------------------------
   3. Main Layout & Structure
   ----------------------------------------- */
.container {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Page Header (Breadcrumbs) */
.page-header {
  background-color: var(--surface-white);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 0;
}

.breadcrumb-container {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.breadcrumb-pill {
  background-color: #eef1f5;
  padding: 0.25rem 0.75rem;
  border-radius: 100px;
  color: var(--primary-color);
  font-weight: 500;
  font-size: 0.85rem;
  text-decoration: none;
  transition: background-color 0.2s, color 0.2s;
}

.breadcrumb-pill:hover {
  background-color: #dbe2ef;
  color: var(--primary-color);
  text-decoration: none;
}

.breadcrumb-pill--current {
  background-color: var(--primary-color);
  color: #ffffff;
}

/* Hero Title Banner */
.page-title-banner {
  background-color: var(--primary-color);
  color: #ffffff;
  padding: 3rem 0;
  margin-bottom: 2rem;
  text-align: center;
}

.page-title-banner h1 {
  color: #ffffff;
  margin: 0;
  font-size: 2.2rem;
}

/* Footer */
.page-footer {
  margin-top: 4rem;
  padding: 3rem 0;
  background-color: var(--surface-white);
  border-top: 1px solid var(--border-color);
  text-align: center;
  color: var(--text-muted);
}

/* -----------------------------------------
   4. Component: Module Blocks (FINAL)
   ----------------------------------------- */

/* The Card Container */
.module-block {
    background-color: var(--surface-white);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 3rem;
    overflow: hidden; /* Clips the header corners to match the border radius */
    display: flex;
    flex-direction: column;
}

/* The Header Section */
.section-module-block-start {
    background-color: var(--primary-color);
    color: #ffffff;
    padding: 1.5rem 2rem;
    margin: 0; 
    border-bottom: 1px solid rgba(0,0,0,0.1);
}

/* Typography for the Module Title */
.section-module-block-start p {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0.02em;
}

/* The Narrative Content Section(s) */
/* We target the specific class from your snippet */
.module-block .section-narrative-continue {
    padding: 2.5rem; /* Adds the breathing room inside the white box */
    background-color: transparent; /* Ensures it uses the parent's white bg */
}

/* If you have other content sections inside the module, ensure they also have padding */
.module-block .content-section {
    padding-left: 2.5rem;
    padding-right: 2.5rem;
}

/* -----------------------------------------
   5. Component: Callout Cards (Unified System)
   ----------------------------------------- */
/* Base Callout Structure */
.callout-box {
  background-color: var(--surface-white);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  margin: 1.5rem 0;
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
}

/* --- INTERACTIVE LAUNCH CARDS --- */
.callout-box.module-callout,
.callout-box.intro-callout,
.callout-box.sa-callout,
.callout-box.csa-callout,
.callout-box.summative-callout,
.callout-box.assessment-plan-callout,
.callout-box.quiz-callout,
.callout-box.diagram-callout, 
.callout-box.reading-callout {
  align-items: center; 
  justify-content: space-between;
  border-left: 6px solid var(--primary-color);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  cursor: pointer;
}

/* Hover State */
.callout-box.module-callout:hover,
.callout-box.intro-callout:hover,
.callout-box.sa-callout:hover,
.callout-box.csa-callout:hover,
.callout-box.summative-callout:hover,
.callout-box.assessment-plan-callout:hover,
.callout-box.quiz-callout:hover,
.callout-box.diagram-callout:hover,
.callout-box.reading-callout:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-left-color: var(--primary-accent);
}

/* --- Color Variations --- */

/* Assessments (Teal) */
.callout-box.sa-callout,
.callout-box.csa-callout {
    border-left-color: var(--color-assessment);
}
.callout-box.sa-callout:hover,
.callout-box.csa-callout:hover {
    border-left-color: #1abc9c;
}

/* Quizzes & Plans (Purple) */
.callout-box.summative-callout,
.callout-box.assessment-plan-callout,
.callout-box.quiz-callout {
    border-left-color: var(--color-quiz);
}
.callout-box.summative-callout:hover,
.callout-box.assessment-plan-callout:hover,
.callout-box.quiz-callout:hover {
    border-left-color: #9b59b6;
}

/* Diagrams (Orange) */
.callout-box.diagram-callout {
    border-left-color: var(--color-diagram);
}
.callout-box.diagram-callout:hover {
    border-left-color: #e67e22;
}

/* Readings (Indigo) */
.callout-box.reading-callout {
    border-left-color: var(--color-reading);
}
.callout-box.reading-callout:hover {
    border-left-color: #5c6bc0;
}


/* --- Inner Elements: Icons --- */
.callout-icon {
  flex: 0 0 50px;
  height: 50px;
  background-color: var(--secondary-bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-color);
  transition: background 0.2s, color 0.2s;
}

.callout-box:hover .callout-icon {
  background-color: var(--primary-accent);
  color: #fff;
}

.callout-icon svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

/* --- Inner Elements: Text Content --- */
.callout-main, .callout-content {
  flex: 1;
}

.callout-title {
  margin: 0 0 0.5rem 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary-color);
}

.callout-box p {
  margin: 0;
  color: #555;
}

/* --- Inner Elements: Action Buttons --- */
.callout-box .callout-action,
.callout-box .callout-action-link {
  display: inline-block;
  white-space: nowrap;
  padding: 0.6rem 1.2rem;
  border-radius: 4px;
  font-weight: 600;
  text-decoration: none;
  background-color: transparent;
  border: 2px solid transparent; 
  transition: all 0.2s ease;
  cursor: pointer;
}

/* Button Colors: Modules/Intro (Blue) */
.callout-box.module-callout .callout-action,
.callout-box.module-callout .callout-action-link,
.callout-box.intro-callout .callout-action,
.callout-box.intro-callout .callout-action-link {
    color: var(--primary-color);
    border-color: var(--primary-color);
}
.callout-box.module-callout:hover .callout-action,
.callout-box.module-callout:hover .callout-action-link,
.callout-box.intro-callout:hover .callout-action,
.callout-box.intro-callout:hover .callout-action-link {
    background-color: var(--primary-color);
    color: #ffffff;
}

/* Button Colors: Assessments (Teal) */
.callout-box.sa-callout .callout-action,
.callout-box.sa-callout .callout-action-link,
.callout-box.csa-callout .callout-action,
.callout-box.csa-callout .callout-action-link {
    color: var(--color-assessment);
    border-color: var(--color-assessment);
}
.callout-box.sa-callout:hover .callout-action,
.callout-box.sa-callout:hover .callout-action-link,
.callout-box.csa-callout:hover .callout-action,
.callout-box.csa-callout:hover .callout-action-link {
    background-color: var(--color-assessment);
    color: #ffffff;
}

/* Button Colors: Quizzes (Purple) */
.callout-box.summative-callout .callout-action,
.callout-box.summative-callout .callout-action-link,
.callout-box.assessment-plan-callout .callout-action,
.callout-box.assessment-plan-callout .callout-action-link,
.callout-box.quiz-callout .callout-action,
.callout-box.quiz-callout .callout-action-link {
    color: var(--color-quiz);
    border-color: var(--color-quiz);
}
.callout-box.summative-callout:hover .callout-action,
.callout-box.summative-callout:hover .callout-action-link,
.callout-box.assessment-plan-callout:hover .callout-action,
.callout-box.assessment-plan-callout:hover .callout-action-link,
.callout-box.quiz-callout:hover .callout-action,
.callout-box.quiz-callout:hover .callout-action-link {
    background-color: var(--color-quiz);
    color: #ffffff;
}

/* Button Colors: Diagrams (Orange) */
.callout-box.diagram-callout .callout-action,
.callout-box.diagram-callout .callout-action-link {
    color: var(--color-diagram);
    border-color: var(--color-diagram);
}
.callout-box.diagram-callout:hover .callout-action,
.callout-box.diagram-callout:hover .callout-action-link {
    background-color: var(--color-diagram);
    color: #ffffff;
}

/* Button Colors: Readings (Indigo) */
.callout-box.reading-callout .callout-action,
.callout-box.reading-callout .callout-action-link {
    color: var(--color-reading);
    border-color: var(--color-reading);
}
.callout-box.reading-callout:hover .callout-action,
.callout-box.reading-callout:hover .callout-action-link {
    background-color: var(--color-reading);
    color: #ffffff;
}

/* --- Informational Callout Variants --- */
.callout-box.callout--note, 
.callout-box.callout--tip {
    background-color: #f8fbff;
    border-left: 4px solid var(--primary-accent);
}
.callout-box.callout--insight,
.callout-box.callout--key-idea { 
    background-color: #f0fbf5;
    border-left: 4px solid var(--success-color);
}
.callout-box.callout--warning {
    background-color: #fffcf4;
    border-left: 4px solid var(--warning-color);
}

/* -----------------------------------------
   6. Component: Data Tables
   ----------------------------------------- */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.95rem;
    background-color: #ffffff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

table th, table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #e1e4e8;
}

table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: var(--primary-color);
    border-bottom: 2px solid #d1d5db;
}

table tr:hover {
    background-color: #f1f8ff;
}

.assessment-plan-table th {
    background-color: var(--primary-color);
    color: #ffffff;
}

.assessment-plan-table tr:last-child td {
    border-bottom: none;
}

/* -----------------------------------------
   7. Component: Modals & Overlays
   ----------------------------------------- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    display: none; 
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.is-visible {
    display: flex;
    opacity: 1;
}

.modal-content {
    background-color: var(--surface-white);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 8px;
    padding: 2.5rem;
    position: relative;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease-out;
}

.modal-content--wide {
    max-width: 950px;
}

.modal-title {
    margin-top: 0;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
    padding-right: 2rem;
}

/* Top Close X (Icon Only) */
.modal-close-btn:not(.button) {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    color: #999;
    transition: color 0.2s;
}

.modal-close-btn:not(.button):hover {
    color: var(--danger-color);
}

/* Bottom Close Button Container */
.modal-footer {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
  text-align: right;
}

/* Specific styling for the Bottom Close Button to prevent visibility issues */
.modal-footer .modal-close-btn {
    position: static;
    background-color: var(--surface-white);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-footer .modal-close-btn:hover {
    background-color: var(--primary-color);
    color: #ffffff;
    border-color: var(--primary-color);
    text-decoration: none;
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* -----------------------------------------
   8. Component: Quiz Styling
   ----------------------------------------- */
.grade-modal-score {
    text-align: center;
    margin: 2rem 0;
    padding: 2rem;
    background-color: var(--secondary-bg);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.grade-modal-score strong {
    display: block;
    font-size: 3.5rem;
    line-height: 1;
    margin-top: 0.5rem;
    color: var(--primary-color);
}

/* New Quiz Layout */
.quiz-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.question-text {
  font-weight: 600;
  margin-bottom: 1rem;
}

.option-item {
  margin-bottom: 0.5rem;
  padding: 0.5rem;
  border-radius: 4px;
  transition: background 0.2s;
}

.option-item:hover {
  background-color: #f0f0f0;
}

/* Feedback Messages */
.feedback-message {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 4px;
  font-weight: 500;
}

.feedback-message.is-correct {
  background-color: var(--success-bg);
  color: var(--success-text);
  border: 1px solid #c3e6cb;
}

.feedback-message.is-incorrect {
  background-color: var(--error-bg);
  color: var(--error-text);
  border: 1px solid #f5c6cb;
}

/* -----------------------------------------
   9. Component: Hybrid Reveal Sections
   ----------------------------------------- */
.section-expert, 
.section-self-assessment {
    background-color: var(--surface-white);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 2rem;
    margin-top: 3rem;
    position: relative;
}

.section-expert h2, 
.section-self-assessment h2 {
    border-bottom: 2px solid var(--secondary-bg);
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
}

/* Locked State Logic */
.section-expert.is-locked > *:not(h2):not(.reveal-widget),
.section-self-assessment.is-locked > *:not(h2):not(.reveal-widget) {
    display: none;
}

.reveal-widget {
    display: none; 
    margin-top: 1rem;
    text-align: center;
    padding: 3rem;
    background-color: #fbfbfb;
    border: 2px dashed #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.section-expert.is-locked .reveal-widget,
.section-self-assessment.is-locked .reveal-widget {
    display: block;
}

.reveal-widget:hover {
    background-color: #f0f4f8;
    border-color: var(--primary-accent);
}

.reveal-widget strong {
    display: block;
    color: var(--primary-color);
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.reveal-widget span {
    color: var(--text-muted);
}

/* -----------------------------------------
   10. Utilities & Media
   ----------------------------------------- */
.hero-image {
    margin: 2rem auto;
    text-align: center;
}
.hero-image img {
    border-radius: var(--border-radius);
    max-width: 80%; 
    width: auto;
    margin: 0 auto;
    box-shadow: var(--shadow-md);
}

figure.instructional-image {
  margin: 2rem auto;
  text-align: center;
  max-width: 50%;
  cursor: pointer;
  transition: transform 0.2s ease;
}

figure.instructional-image:hover {
  transform: scale(1.02);
}

figure.instructional-image img {
  width: 100%;
  height: auto;
  border: 1px solid var(--border-color);
  border-radius: 4px;
}

figure.instructional-image figcaption {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  font-style: italic;
}

.instructional-image-modal {
  width: 100%;
  height: auto;
  display: block;
}

/* Learning Coach */
.learning-coach {
    background-color: #fff8e1; 
    border-left: 5px solid #f1c40f;
    padding: 1.5rem 1.5rem 1.5rem 4rem; 
    margin: 2rem 0;
    color: #5d4037;
    font-style: italic;
    border-radius: 0 4px 4px 0;
    position: relative;
    font-size: 1.15rem; 
}

/* SVG Icon for Learning Coach */
.learning-coach::before {
  content: '';
  position: absolute;
  left: 1rem;
  top: 1.5rem;
  width: 2rem;
  height: 2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23f1c40f'%3E%3Cpath d='M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 3c1.66 0 3 1.34 3 3s-1.34 3-3 3-3-1.34-3-3 1.34-3 3-3zm0 14.2c-2.5 0-4.71-1.28-6-3.22.03-1.99 4-3.08 6-3.08 1.99 0 5.97 1.09 6 3.08-1.29 1.94-3.5 3.22-6 3.22z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: contain;
}

/* General Button Styles */
.button {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border-radius: 4px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-align: center;
  background-color: var(--primary-color);
  color: white;
  transition: all 0.2s ease;
}
.button:hover {
  background-color: var(--primary-accent); /* Fixed missing variable */
}

/* Primary Button (e.g. Submit) */
.button--primary {
    background-color: var(--primary-accent);
    color: white;
}
.button--primary:hover {
    background-color: #2980b9;
    color: white;
    text-decoration: none;
}

/* Secondary Button (e.g. Check Answer) */
.button--secondary {
    background-color: #ffffff;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}
.button--secondary:hover {
    background-color: var(--primary-color);
    color: #ffffff; 
    text-decoration: none;
}

/* -----------------------------------------
   11. Responsiveness
   ----------------------------------------- */
@media (max-width: 768px) {
    .callout-box {
        flex-direction: column;
    }
    
    .callout-box.module-callout,
    .callout-box.intro-callout,
    .callout-box.sa-callout,
    .callout-box.csa-callout,
    .callout-box.summative-callout,
    .callout-box.assessment-plan-callout,
    .callout-box.quiz-callout,
    .callout-box.diagram-callout,
    .callout-box.reading-callout {
        align-items: stretch;
        text-align: center;
    }

    .callout-icon {
        margin: 0 auto 1rem auto;
    }

    .callout-action, 
    .callout-action-link {
        width: 100%;
        text-align: center;
        display: block;
        margin-top: 1rem;
    }

    .module-block header,
    .module-block .module-content, 
    .assessment-section {
        padding: 1.5rem;
    }
    
    .page-title-banner h1 {
        font-size: 1.75rem;
    }
}