/* =========================================
   ACADEMY MODULE-PAGE ELEMENTS — SA design system (BRAND.md --sa-* tokens).
   Loaded ONLY on course/module pages (when $course_id is set), so these rules —
   including .card-body / .card-footer overrides and the residual-navy rebrands at
   the foot of this file — never leak onto the academy root pages.
   Tokens come from academy/components/style.css :root (loaded before this file).
   ========================================= */
    .content-section {
        background: var(--sa-card);
        border-radius: 8px;
        padding: 2rem;
        margin-bottom: 2rem;
        box-shadow: 0 2px 4px rgba(16,24,40,0.05);
        border: 1px solid var(--sa-border);
    }
    .content-section h2 {
        color: var(--sa-heading);
        font-family: var(--font-heading);
        font-weight: 700;
        border-bottom: 2px solid var(--sa-border);
        padding-bottom: 0.5rem;
        margin-bottom: 1.5rem;
    }
    .content-section h3 {
        color: var(--sa-heading);
        font-family: var(--font-heading);
        font-weight: 600;
        margin-top: 1.5rem;
        margin-bottom: 1rem;
    }
    .content-section p {
        line-height: 1.8;
        color: var(--sa-text-2);
        margin-bottom: 1.5rem;
        text-align: justify;
    }
    .img-placeholder {
        background-color: var(--sa-panel);
        border: 2px dashed var(--sa-border-strong);
        color: var(--sa-muted);
        height: 300px;
        display: flex;
        align-items: center;
        justify-content: center;
        margin: 2rem 0;
        border-radius: 8px;
    }

    /* Sticky Sidebar Card */
    .sticky-progress {
        position: -webkit-sticky;
        position: sticky;
        top: 90px; /* Adjust based on navbar height */
        z-index: 100;
    }

    /* Glossary Cards */
    .glossary-card {
        background: var(--sa-panel);
        border-left: 4px solid var(--sa-cyb);
        padding: 1rem 1.5rem;
        margin-bottom: 1rem;
        transition: transform 0.2s;
    }
    .glossary-card:hover {
        transform: translateX(5px);
        background: var(--sa-card);
        box-shadow: 0 2px 4px rgba(16,24,40,0.05);
    }
    .glossary-term {
        font-weight: 700;
        color: var(--sa-heading);
        font-family: var(--font-heading);
        display: block;
        margin-bottom: 0.25rem;
    }

    /* Sidebar Styling */
    .sidebar-card {
        background: var(--sa-card);
        border: 1px solid var(--sa-border);
        border-radius: 8px;
        margin-bottom: 1.5rem;
        overflow: hidden;
    }
    .sidebar-header {
        background: var(--sa-panel);
        padding: 1rem;
        font-weight: 700;
        color: var(--sa-heading);
        border-bottom: 1px solid var(--sa-border);
    }
    .artifact-link {
        display: flex;
        align-items: center;
        padding: 0.75rem 1rem;
        color: var(--sa-text-2);
        text-decoration: none;
        transition: all 0.2s;
        border-bottom: 1px solid var(--sa-border);
    }
    .artifact-link:last-child { border-bottom: none; }
    .artifact-link:hover {
        background-color: var(--sa-panel);
        color: var(--sa-action);
        padding-left: 1.25rem;
    }
    .artifact-icon {
        width: 30px;
        text-align: center;
        margin-right: 10px;
    }
    /* Flip Card CSS */
    .flashcard-container {
        perspective: 1000px;
        width: 100%;
        height: 300px;
        cursor: pointer;
    }
    .flashcard-inner {
        position: relative;
        width: 100%;
        height: 100%;
        text-align: center;
        transition: transform 0.6s;
        transform-style: preserve-3d;
    }
    .flashcard-container.flipped .flashcard-inner {
        transform: rotateY(180deg);
    }
    .flashcard-front, .flashcard-back {
        position: absolute;
        width: 100%;
        height: 100%;
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
        border-radius: 15px;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 20px;
        box-shadow: 0 4px 15px rgba(16,24,40,0.1);
    }
    .flashcard-front {
        background-color: var(--sa-navy);
        color: #fff;
    }
    .flashcard-front h1, .flashcard-front h2, .flashcard-front h3, .flashcard-front h4, .flashcard-front h5, .flashcard-front h6 { color: #fff; }
    /* Flashcard modal title sits on the dark header — beat the global h1-h6 heading color (bolt icon stays amber). */
    #flashcardModal .modal-title,
    #videoModal .modal-title,
    #audioModal .modal-title,
    #infographicModal .modal-title { color: #fff; }
    /* Audio modal is dark (bg-dark text-white) — make ALL its body headings white too (the <h3> course
       name otherwise inherits the global dark h1-h6 color → dark-on-dark). */
    #audioModal h1, #audioModal h2, #audioModal h3,
    #audioModal h4, #audioModal h5, #audioModal h6 { color: #fff; }
    .flashcard-back {
        background-color: var(--sa-card);
        color: var(--sa-heading);
        transform: rotateY(180deg);
        border: 2px solid var(--sa-cyb);
    }

    /* Threat-actor grid — neutrals to tokens; the .border-* taxonomy colors are PRESERVED */
  .threat-actor-container {
    font-family: var(--font-body);
    background-color: var(--sa-panel);
    padding: 40px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    color: var(--sa-text);
  }

  .threat-card {
    background: var(--sa-card);
    border-radius: 12px;
    padding: 0;
    box-shadow: 0 4px 6px rgba(16,24,40,0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border-top: 5px solid var(--sa-border-strong); /* Default color (taxonomy overrides below) */
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .threat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px rgba(16,24,40,0.1);
  }

  .card-body {
    padding: 25px;
    flex-grow: 1;
  }

  .threat-title {
    margin: 0 0 10px 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--sa-heading);
  }

  .motivation-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 15px;
    background-color: var(--sa-panel);
    color: var(--sa-muted);
  }

  .threat-desc {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--sa-text-2);
    margin: 0;
  }

  .card-footer {
    background-color: var(--sa-panel);
    border-top: 1px solid var(--sa-border);
    padding: 20px 25px;
  }

  .footer-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--sa-muted);
    margin-bottom: 5px;
  }

  .footer-content {
    font-size: 0.9rem;
    color: var(--sa-text);
    margin: 0;
  }

  /* Semantic threat-actor taxonomy colors — PRESERVED (content meaning, not chrome) */
  .border-amateur { border-color: #38b2ac; } /* Teal */
  .border-hacktivist { border-color: #805ad5; } /* Purple */
  .border-criminal { border-color: #dd6b20; } /* Orange */
  .border-insider { border-color: #3182ce; } /* Blue */
  .border-nation { border-color: #e53e3e; } /* Red */
    .border-hacker { border-color: #2d3748; } /* Dark Grey */

    .hat-list {
      list-style: none;
      padding: 0;
      margin: 15px 0 0 0;
      font-size: 0.85rem;
    }
    .hat-list li {
      margin-bottom: 8px;
      padding-left: 12px;
      border-left: 2px solid var(--sa-border-strong);
    }
    .hat-list strong {
      color: var(--sa-heading);
    }

  /* Concept callouts — CYB accent family */
  .core-principle-box {
    background-color: var(--sa-cyb-surface);
    border: 1px solid var(--sa-border);
    border-radius: 6px;
    padding: 20px;
    display: flex;
    gap: 15px;
    align-items: flex-start;
  }
  .principle-label {
    font-weight: 700;
    color: var(--sa-cyb-ink);
    text-transform: uppercase;
    font-size: 0.8rem;
    white-space: nowrap;
    margin-top: 3px;
  }
  .principle-content {
    margin: 0;
    font-size: 0.95rem;
    font-style: italic;
    color: var(--sa-text-2);
  }
  .formula-panel {
    background-color: var(--sa-cyb-surface);
    border-left: 6px solid var(--sa-cyb);
    border-right: 6px solid var(--sa-cyb);
    border-radius: 12px;
    padding: 2rem 4rem;
    margin: 20px;
    box-shadow: 0 10px 25px rgba(16,24,40,0.05);
    font-size: 1.75rem;
    color: var(--sa-text);
    text-align: center;
  }
  /* "Section Takeaways" callouts */
  .concept-panel {
    background-color: var(--sa-cyb-surface);
    border-left: 6px solid var(--sa-cyb);
    border-radius: 8px;
    padding: 15px;
    margin: 10px;
    font-family: var(--font-body);
    color: var(--sa-text-2);
    box-shadow: 0 10px 25px rgba(16,24,40,0.05);
  }
  .concept-title {
    font-weight: 800;
    color: var(--sa-cyb-ink);
  }

  /* ---- support classes for the module markup (Change B) ---- */
  /* Learning Outcomes panel — emerald action accent */
  .sa-outcomes {
    border-left: 5px solid var(--sa-action);
    box-shadow: 0 4px 6px rgba(16,24,40,0.05);
  }
  /* Module Summary block — navy surface, light text (replaces legacy bg-academy-dark) */
  .sa-module-summary {
    background: var(--sa-navy);
    border-color: var(--sa-navy);
    color: #fff;
  }
  .sa-module-summary h2, .sa-module-summary h3 {
    color: #fff;
    border-bottom-color: rgba(255,255,255,0.2);
  }
  .sa-module-summary p, .sa-module-summary li { color: rgba(255,255,255,0.9); }
  /* In-progress status pill (CYB-tinted; completed reuses .sa-pill-live) */
  .sa-pill-progress {
    display: inline-flex; align-items: center;
    font-size: .8rem; font-weight: 600;
    color: var(--sa-cyb-ink); background: var(--sa-cyb-surface);
    border: 1px solid var(--sa-cyb); padding: .35rem .8rem; border-radius: 50px;
  }
  .sa-pill-live { padding: .35rem .8rem; font-size: .8rem; }

  /* ---- residual legacy-navy rebrand (scoped to module/course pages via this file) ----
     text-primary / bg-primary / bg-academy-primary alias to the old --academy-primary navy
     in style.css; rebrand them to brand tokens here WITHOUT touching those aliases or the
     7 files' inline utility classes. Program accent (CYB) for accents; --sa-navy for surfaces. */
  .text-primary { color: var(--sa-cyb) !important; }
  .bg-primary { background-color: var(--sa-cyb) !important; }
  .progress-bar.bg-primary { background-color: var(--sa-cyb) !important; }
  .bg-academy-primary { background-color: var(--sa-navy) !important; }
