/* --- List of transformations --- */
.transformation-list {    
    margin-top: 0.5rem;
    margin-bottom: 1rem;
    margin-left: 4rem;
}

.transformation-list {
    line-height: 2rem;
}

/* Base styling for transformation-content */
.transformation-content {
    border-width: 0 0 0 10px;
    border-style: solid;
    border-color: #212121;
    padding: 0.5rem 1rem;
    margin-bottom: 1rem;
    box-shadow: -3px 0 0 rgba(47, 47, 47, 0.4);
    background-image: linear-gradient(to right, #212121, transparent);
}

/* Color-specific border classes */
.transformation-content-lightgreen {
    border-color: lightgreen;
}
.transformation-content-yellow {
    border-color: yellow;
}
.transformation-content-darkgoldenrod {
    border-color: darkgoldenrod;
}
.transformation-content-pink {
    border-color: pink;
}

/* --- MCQ choices container --- */
.mcq-choices {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, auto)); /* Allow columns to size by content */
    grid-template-rows: repeat(2, auto);
    grid-auto-flow: row;
    gap: 10px;
    margin: 20px auto;
    justify-content: center;
    align-items: start;
    box-sizing: border-box;
    max-width: 100%; /* Prevent overflow */
}

.mcq-choice {
    display: flex;
    flex-direction: column; /* Stack label above math */
    align-items: flex-start; /* Left-align content */
    gap: 4px;
    padding: 14px;
    min-width: 0; /* Allow content-driven sizing */
    min-height: 0; /* Allow height to expand with content */
    box-sizing: border-box;
    background-color: #fff;
    border-radius: 6px;
}

/* Explicit grid placement for 2x2 layout */
.mcq-choice[data-index="0"] {
    grid-row: 1;
    grid-column: 1;
}
.mcq-choice[data-index="1"] {
    grid-row: 1;
    grid-column: 2;
}
.mcq-choice[data-index="2"] {
    grid-row: 2;
    grid-column: 1;
}
.mcq-choice[data-index="3"] {
    grid-row: 2;
    grid-column: 2;
}

.choice-label {
    font-weight: bold;
    line-height: 1.4;
    text-align: left;
}

.choice-math {
    display: block; /* Block to allow full width */
    max-width: 100%; /* Prevent overflow */
    white-space: normal; /* Allow wrapping */
}

/* Target MathJax container */
.mcq-choices .choice-math mjx-container {
    display: block !important; /* Ensure block for proper stacking */
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1.4 !important;
    min-height: 0 !important; /* Allow natural height */
    max-width: 100% !important;
    overflow-wrap: anywhere !important; /* Break long expressions */
}

/* Responsive layout for small screens */
@media (max-width: 600px) {
    .mcq-choices {
        display: flex;
        flex-direction: column;
        gap: 12px;
        max-width: 100%;
        margin: 10px auto;
    }

    .mcq-choice {
        flex-direction: column;
        align-items: flex-start;
        padding: 10px;
        min-width: 0;
        min-height: 0;
        background-color: #fff;
        border-radius: 6px;
    }

    .mcq-choice[data-index="0"],
    .mcq-choice[data-index="1"],
    .mcq-choice[data-index="2"],
    .mcq-choice[data-index="3"] {
        grid-row: auto;
        grid-column: auto;
    }

    .choice-label {
        text-align: left;
        font-weight: bold;
        line-height: 1.4;
    }

    .choice-math {
        max-width: 100%;
        white-space: normal;
    }

    .mcq-choices .choice-math mjx-container {
        display: block !important;
        margin: 0 !important;
        padding: 0 !important;
        line-height: 1.4 !important;
        min-height: 0 !important;
        max-width: 100% !important;
        overflow-wrap: anywhere !important;
    }
}

/* Labels for the columns display */
/*👉.columns-labels {
    font-weight: 700;
    text-align: center;
    padding: 4px 8px;
    border-bottom: 2px solid #787272;
    font-size: large;
    font-style: italic;
}👈*/

/* JSXGraph container styling */
.jxg-mount {
    display: flex;
    justify-self: center;
    background-color: aliceblue;
    margin-top: 2rem;
    margin-bottom: 2rem;
    border-radius: 10px;
}

.test-point-label {
    border: 1px solid black;
    padding: 2px 4px; /* Adjust padding to fit text */
    background: transparent;
}

.jxg-mount-hints {
    background-color: beige;
    border: 3px solid black;
    border-radius: 10px;
}

/* Graph container styling */
.graph-container {
        border: 2px solid #ccc;
        box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.1);
        border-radius: 12px;      
}   

/* 2-col grid table base */
.solution-content .solution-matches-table.solution-grid-2col {
  border-collapse: collapse;
  width: 100%;
  max-width: 900px;
  margin: 20px auto;
  background: #fff;
  box-shadow: 0 2px 4px rgba(0,0,0,.08);
  font-size: 14px;
  line-height: 1.35;
}

.solution-content .solution-matches-table.solution-grid-2col th,
.solution-content .solution-matches-table.solution-grid-2col td {
  border: 1px solid #e5e7eb;
  padding: 12px;
  vertical-align: top;
}

.solution-content .solution-matches-table.solution-grid-2col thead th {
  background: #f3f4f6 !important;
  color: #111827 !important;
  font-weight: 600;
  text-align: center;
}

.solution-content .solution-matches-table.solution-grid-2col td {
  color: #111827 !important;
}

/* Graph host sizing (responsive-ish) */
.solution-content .solution-matches-table.solution-grid-2col .graph-container {
  width: min(320px, 40vw);
  height: calc(min(320px, 40vw) * 2/3); /* keep ~3:2 ratio */
  margin: 0 auto 10px;
}

/* Ensure JSXGraph board background is aliceblue */
.solution-content .solution-matches-table.solution-grid-2col .graph-container .JXGboard {
  background-color: #ffffff !important;
}

/* Notes under each cell (Option A) */
.solution-content .solution-matches-table.solution-grid-2col .graph-notes p {
  margin: 6px 0 0;
}

/* Notes row (Option B) */
.solution-content .solution-matches-table.solution-grid-2col .grid-notes-row {
  background: #fafafa;
}

.solution-content .solution-matches-table.solution-grid-2col .notes-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.solution-content .solution-matches-table.solution-grid-2col .notes-hdr {
  font-weight: 600;
  margin-bottom: 6px;
  color: #374151;
}

/* Mobile tweaks */
@media (max-width: 640px) {
  .solution-content .solution-matches-table.solution-grid-2col .notes-2col {
    grid-template-columns: 1fr;
  }
}

.explanation {
    /* 1. Enable Flexbox for the container */
    display: flex;
    
    /* Optional: Add some padding/margin between items */
    /* margin-bottom: 5px;  */
    padding: 0.5rem 1rem;    
    border-left: 3px solid #007bff;
    border-radius: 4px;
    line-height: 1.6;
}

.explanation strong {
    /* 2. Fix the width of the label column (e.g., A:, B:, etc.) */
    /* This ensures the label takes up a consistent space */
    width: 25px; /* Adjust this value based on label width (e.g., 20px - 30px) */
    
    /* 3. Ensure the label doesn't shrink */
    flex-shrink: 0;
    
    /* Optional: Align the label to the start of the line */
    text-align: left;
    margin-right: 5px; /* Space between label and start of explanation */
}

.explanation-text {
    /* 4. Allow the explanation text to take up the remaining space and wrap */
    flex-grow: 1;
}

/* ———————————————————————— Array header in T1-S6 ———————————————————————— */
.solution-commentary mjx-mtr:first-child > mjx-mtd {
  /* text-align: center !important; */
}

/* ——————————————— FIXED: Math Transformation Table (No Overflow) ——————————————— */
.math-transformation-table {
    display: table;                    /* or inline-table if you want auto-width */
    width: 100%;                       /* fill container but respect max-width */
    max-width: 960px;                  /* prevent it from getting too wide */
    margin: 32px auto;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;               /* ← crucial: forces column widths to respect % */
    font-family: 'Latin Modern Math', 'STIX Two Math', 'Times New Roman', serif;
    font-size: 1.05em;
    background: transparent;
    color: white;
    border: none;
}

/* Allow wrapping only where it makes sense */
.math-transformation-table th,
.math-transformation-table td {
    padding: 14px 16px;
    background: transparent;
    color: white;
    border-left: 1px solid rgba(255, 255, 255, 0.25);
    border-right: 1px solid rgba(255, 255, 255, 0.25);
    overflow: hidden;
    text-overflow: ellipsis;
}

/* IMPORTANT: Only the function column stays nowrap (math looks bad when wrapped) */
.trans-func {
    white-space: nowrap;
    text-align: center;
    font-size: 1.15em;
    font-weight: 500;
}

/* All text columns: allow wrapping */
.trans-desc,
.trans-how,
.math-transformation-table th {
    white-space: normal;              /* ← allow line breaks */
    word-wrap: break-word;            /* old spec, but still helps */
    overflow-wrap: anywhere;          /* modern, breaks even long words if needed */
}

/* Header */
.math-transformation-table thead th {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(6px);
    font-weight: 600;
    border-bottom: 2px solid rgba(255, 255, 255, 0.4);
}

/* Grid lines – inner only */
.math-transformation-table tr > *:first-child { border-left: none; }
.math-transformation-table tr > *:last-child  { border-right: none; }
.math-transformation-table tbody tr {
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    transition: background 0.22s;
}
.math-transformation-table tbody tr:last-child { border-bottom: none; }
.math-transformation-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Column proportions – now respected because of table-layout: fixed */
.trans-step   { width: 70px; text-align: center; font-weight: 700; }
.trans-desc   { width: 34%; }
.trans-how    { width: 32%; font-size: 0.96em; opacity: 0.94; }
.trans-func   { width: 30%; }

/* Responsive */
@media (max-width: 820px) {
    .math-transformation-table {
        font-size: 0.95em;
    }
    .math-transformation-table th,
    .math-transformation-table td {
        padding: 11px 10px;
    }
}


