
/* 1. Reset everything to the left */
body {
    background: linear-gradient(to right, #eef2f3, #e0ecff);
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, sans-serif;
    font-size: 22px; 
    text-align: left; /* Forces text to start at the left */
    overflow-x: hidden;
}

/* --- REPLACED NAV & SEARCH SECTION ONLY --- */
.navbar {
    background-color: #00008b;
    display: flex !important;
    justify-content: space-between !important; 
    align-items: center;
    padding: 10px 50px;
    position: sticky;
    top: 0;
    z-index: 1000;
    overflow: visible !important;
}

.navbar a, .dropbtn {
    color: white;
    text-decoration: none;
    font-weight: bold;
    font-size: 22px;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    padding: 10px 15px;
    white-space: nowrap;
    transition: 0.3s;
}

.navbar a:hover, .dropbtn:hover {
    color: #add8e6;
    transform: scale(1.05);
}

.dropdown {
    position: relative;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: white;
    min-width: 250px;
    box-shadow: 0px 8px 16px rgba(0,0,0,0.2);
    top: 100%;
    left: 0;
    z-index: 9999;
}

.dropdown-content a {
    color: #333 !important;
    padding: 15px;
    display: block;
    font-size: 18px;
    border-bottom: 1px solid #eee;
}

.dropdown:hover .dropdown-content {
    display: block;
}

.dropdown-content a:hover {
    background-color: #add8e6 !important;
    color: #00008b !important;
}

.search-group {
    display: flex !important;
    align-items: center !important;
    gap: 30px !important;
    margin-left: 50px; 
    flex-shrink: 0; 
}

.search-wrapper {
    position: relative;
    width: 250px; 
    transition: width 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.search-wrapper:focus-within {
    width: 400px !important; 
}

#topicSearch {
    width: 100%;
    padding: 12px 18px;
    border: none;
    border-radius: 8px;
    outline: none;
    font-size: 16px;
    color: #00008b;
    box-sizing: border-box;
}

/* UPDATED SEARCH SUGGESTIONS TO MATCH NAV DROPDOWN COLORS */
.suggestions-dropdown {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    width: 100%;
    background: white;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    display: none;
    z-index: 9999 !important;
    border-radius: 0;
    overflow: hidden;
}

.suggestions-dropdown a {
    display: block !important; 
    padding: 15px;
    color: #333 !important;
    text-decoration: none !important;
    border-bottom: 1px solid #eee;
    font-size: 18px;
    text-align: left;
}

.suggestions-dropdown a:hover {
    background-color: #add8e6 !important;
    color: #00008b !important;
}

.modern-search-btn {
    background-color: white;
    color: #00008b;
    border: none;
    padding: 12px 25px;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.modern-search-btn:hover {
    background-color: #add8e6 !important;
    color: #00008b !important;
    transform: translateY(-2px);
}

/* --- YOUR ORIGINAL REMAINING STYLES --- */

.container {
    width: 90%;
    max-width: 1200px;
    margin: 40px auto;    
    padding-left: 60px;   
    padding-right: 40px;
    text-align: left;    
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);    
}

.example {
    background: #f8fafc;
    border-left: 5px solid #1e3a8a;
    border-radius: 10px;
    padding: 20px;
}

h1 {
    color: #00008b;
    font-size: 50px;
    width: fit-content;
}

h2 {
    color: #00008b;
    width: fit-content;
}

.question-list {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: bold;
}

#check-btn {
    background-color: #00008b;
    color: white;
    padding: 18px 35px;
    border: none;
    border-radius: 5px;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: block;
    margin: 30px 0;
}

#check-btn:hover {
    background-color: #0000cd;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

#answer-key {
    background-color: #e8f5e9;
    padding: 25px;
    border-radius: 8px;
    margin-top: 20px;
    border-left: 10px solid #2e7d32;
}

.note-box {
    background-color: #e8f5e9;
    border-left: 10px solid #2e7d32;
    padding: 20px;
    margin-top: 30px;
    border-radius: 5px;
}

.note-box h2 { color: #2e7d32; margin-top: 0; }

img {
    max-width: 100%;
    height: auto;
    display: block;
}

@media screen and (max-width: 768px) {
    .container {
        width: 95%;
        padding: 20px;
        margin: 10px auto;
    }
    .navbar {
        flex-direction: column;
        align-items: center;
        gap: 10px;
        padding: 10px 15px;
    }
    .search-group {
        width: 100%;
        justify-content: center;
        margin-left: 0;
    }
    .search-wrapper, .search-wrapper:focus-within {
        width: 100%;
        max-width: 300px;
    }
    h1 { font-size: 35px; }
    #check-btn { width: 100%; }

    /* ================= MOBILE MENU SHOW FIX ================= */
.mobile-menu.show {
    display: block !important;
}

}

/* ================= MOBILE NAV FIX ================= */

/* Hamburger icon */
.hamburger {
    display: none;
    font-size: 28px;
    color: white;
    cursor: pointer;
}

/* Mobile dropdown menu */
.mobile-menu {
    display: none;
    position: absolute;
    top: 60px;
    left: 10px;
    background: white;
    width: 200px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    border-radius: 6px;
    overflow: hidden;
    z-index: 9999;
}

.mobile-menu a {
    display: block;
    padding: 15px;
    color: #00008b;
    text-decoration: none;
    border-bottom: 1px solid #eee;
}

.mobile-menu a:hover {
    background-color: #add8e6;
}

/* MOBILE ONLY */
@media screen and (max-width: 768px) {

    /* Hide desktop links */
    .desktop-only {
        display: none !important;
    }

    /* Show hamburger */
    .hamburger {
        display: block;
    }

    /* Navbar layout */
    .navbar {
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        padding: 10px;
        gap: 10px;
    }

    /* Keep dropdown near hamburger */
    .dropdown {
        margin-left: 5px;
    }

    /* Push search to right */
    .search-group {
        margin-left: auto;
    }

    /* Smaller search */
    .search-wrapper {
        width: 140px;
    }

    .search-wrapper:focus-within {
        width: 180px !important;
    }

    /* Hide search button */
    .modern-search-btn {
        display: none !important;
    }

}
@media screen and (max-width: 768px) {

    /* 🔴 STOP ALL HORIZONTAL SCROLL */
    body {
        overflow-x: hidden;
    }

    /* 🔴 FIX NAVBAR WIDTH */
    .navbar {
        flex-wrap: nowrap;
        justify-content: flex-start;
        align-items: center;
        padding: 10px 10px;   /* 🔥 CRITICAL FIX (was 50px) */
        gap: 5px;
        width: 100%;
        box-sizing: border-box;
        overflow: hidden;
    }

    /* 🔴 HAMBURGER */
    .hamburger {
        display: block;
        margin-right: 5px;
    }

    /* 🔴 DROPDOWN CLOSE TO HAMBURGER */
    .dropdown {
        margin-left: 0;
    }

   .dropbtn {
    font-size: 18px;   /* match other nav items */
    padding: 10px 12px;
}

    /* 🔴 FORCE SEARCH TO FIT */
    .search-group {
        margin-left: auto;
        display: flex;
        align-items: center;
        max-width: 45%; /* 🔥 prevents pushing out */
    }

    /* 🔴 SEARCH INPUT FIX */
    .search-wrapper {
        width: 100%;
        max-width: 140px;
    }

    .search-wrapper:focus-within {
        width: 100% !important;
        max-width: 160px;
    }

    /* 🔴 REMOVE BUTTON */
    .modern-search-btn {
        display: none !important;
    }

    /* 🔴 HIDE DESKTOP LINKS */
    .desktop-only {
        display: none !important;
    }
}
    #topicSearch::placeholder {
        font-size: 13px;
    }

.navbar {
    transition: top 0.3s ease;
}
.mobile-menu a:active,
.mobile-menu a:focus,
.mobile-menu a:visited {
    color: #00008b !important;   /* keep dark blue */
    background-color: #add8e6 !important; /* light blue highlight */
}

/* Remove ugly mobile tap highlight */
.mobile-menu a {
    -webkit-tap-highlight-color: transparent;
}

  .suggestions-dropdown a {
        font-size: 14px;      /* smaller text */
        padding: 12px 10px;   /* better spacing */
        line-height: 1.4;     /* prevents cut text */
        white-space: normal;  /* allows wrapping */
    }
body {
    overflow-x: hidden;
}

* {
    box-sizing: border-box;
}
/* ================= MOBILE FONT FIX (FINAL) ================= */
@media screen and (max-width: 768px) {

    /* GENERAL TEXT */
    body {
        font-size: 16px !important;
    }

    p {
        font-size: 16px !important;
        line-height: 1.6;
    }

    /* HEADINGS */
    h1 {
        font-size: 32px !important;
    }

    h2 {
        font-size: 22px !important;
    }

    /* NAVBAR TEXT */
    .navbar a,
    .dropbtn {
        font-size: 15px !important;
    }

    /* SEARCH INPUT */
    #topicSearch {
        font-size: 14px !important;
    }

    /* SEARCH SUGGESTIONS */
    .suggestions-dropdown a {
        font-size: 14px !important;
    }

    /* TOPIC BOX TEXT */
    .topics ul li p {
        font-size: 14px !important;
        line-height: 1.3;
    }

    /* SLIGHTLY BIGGER BOXES FOR FIT */
    .topics ul li {
        height: 100px !important;
        padding: 5px !important;
    }
}

/* ==========================================
   DESKTOP / STANDARD FOOTER STYLES
   ========================================== */
.math-footer {
  background: #0d1b2a; 
  color: #e0e1dd;      
  font-family: 'Segoe UI', sans-serif;
  padding: 60px 40px 30px; 
  border-top: 4px solid #1b263b;
  /* FIXED: Safely stretches edge-to-edge on PC without breaking layout or causing scrollbar bugs */
  width: 100%;
  box-sizing: border-box;
  margin-top: 100px; 
}

.footer-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); 
  gap: 50px; 
  margin-bottom: 40px; 
}

.footer-column h3 {
  color: #ffffff; 
  margin-top: 0; 
  margin-bottom: 20px; 
  font-size: 1.5rem; 
  padding-bottom: 5px;
}

.footer-column p {
  font-size: 0.95rem;
  line-height: 1.6; 
}

.footer-column ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-column ul li {
  margin: 12px 0; 
}

/* Base link setup for PC */
.footer-column ul li a {
  color: #00c3ff;        
  text-decoration: none; 
  font-weight: 500;      
  display: inline-block; 
  transition: color 0.2s ease, transform 0.2s ease;
}

/* HOVER EFFECT: Turns bright teal-green and grows larger */
.footer-column ul li a:hover {
  color: #00ffcc;          
  transform: translateX(5px);  
  text-decoration: none;   
}

.footer-bottom {
  text-align: center;
  font-size: 1.5rem; /* Enlarged copyright text on PC */
  border-top: 1px solid #1b263b;
  padding-top: 25px; 
  color: #d1d5db; /* Brighter off-white/light gray instead of deep grey */
}

/* ==========================================
   RESPONSIVE ADJUSTMENTS FOR MOBILE DEVICES
   ========================================== */
@media (pointer: coarse), (max-width: 900px) {
  .math-footer {
    width: 100%;
    padding: 35px 15px; 
    box-sizing: border-box;
    margin-top: 60px; 
  }

  .footer-column p,
  .footer-column h3,
  .footer-column:nth-child(3) { 
    display: none !important;
  }

  .footer-container {
    display: flex;
    justify-content: center; 
    margin-bottom: 30px; 
    gap: 0;
  }

  .footer-column ul {
    display: grid;
    grid-template-columns: 1fr auto 1fr; 
    align-items: center;
    padding: 0;
    margin: 0;
    width: 100%; 
  }

  .footer-column ul li {
    margin: 0;
    display: flex;
    align-items: center;
    position: relative;
  }

  /* 1. HOME ADJUSTMENT (Left Column) */
  .footer-column ul li:nth-child(1) {
    display: flex;
    justify-content: flex-start; /* Aligns left edge */
    width: 100%;
    margin-left: -5px; /* INCREASE THIS to manually push Home further right */
  }

  /* 2. PRIVACY (Dead-centered Column - Adjustable Shift) */
  .footer-column ul li:nth-child(2) {
    justify-self: center; 
    /* MANUAL CONTROL FOR PRIVACY: */
    /* Use a negative number (-5px) to shift left. Use a positive number (5px) to shift right. */
    transform: translateX(-10px); 
  }


  /* 3. CONTACT US ADJUSTMENT (Right Column) */
  .footer-column ul li:nth-child(3) {
    display: flex;
    justify-content: flex-end; /* Aligns right edge */
    width: 100%;
    margin-right: 50px; /* INCREASE THIS to manually push Contact Us further left */
  }

  .footer-column ul li a {
    font-size: 1rem; 
    color: #00c3ff !important; 
    text-decoration: none !important;
    font-weight: 500; 
    transform: none !important; 
    transition: color 0.1s ease; 
    white-space: nowrap; /* Prevents "Contact Us" from breaking onto two lines when pushed */
  }

  /* GREEN FEEDBACK WHEN PRESSED (MOBILE) */
  .footer-column ul li a:active {
    color: #00ffcc !important; 
  }

  .footer-bottom {
    border-top: 1px solid #1b263b;
    padding-top: 20px;
    display: flex;
    flex-direction: column; 
    gap: 8px;
    font-size: 0.9rem; 
    color: #8d99ae; 
  }

  .footer-bottom p {
    margin: 0;
  }
}
/* =================================================
   DARK THEME BASE
================================================= */

:root[data-theme="dark"]{
    color-scheme: dark;
}

/* PAGE */

:root[data-theme="dark"] body{
    background:#060b1d;
    color:#f1f5f9;
}

/* MAIN CONTAINER */

:root[data-theme="dark"] .container{
    background:#18263b;
    color:#f1f5f9;
    border:1px solid #2c3f5f;
    border-radius:14px;
    box-shadow:0 12px 35px rgba(0,0,0,.45);
}
/* HEADINGS */

:root[data-theme="dark"] h1 {
    color: #2fbdff;
}
:root[data-theme="dark"] h2 {
    color: #2fbdff;
}
/* BOLD TEXT */

:root[data-theme="dark"] b,
:root[data-theme="dark"] strong {
    color: #2fbdff;
}
/* EXAMPLE BLOCK */

:root[data-theme="dark"] .example {
    background-color: #000000 !important;
    background: #000000 !important;
    border: 2px solid #3b82f6 !important;
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.4) !important;
    border-radius: 12px !important;
    padding: 20px !important;
}

/* Base text color inside examples */
:root[data-theme="dark"] .example,
:root[data-theme="dark"] .example * {
    color: #c8e4fc !important;
}

/* Bold elements inside examples */
:root[data-theme="dark"] .example b,h2
:root[data-theme="dark"] .example strong {
    color: #53c6fc !important;
}
/* SAMPLE QUESTIONS */
:root[data-theme="dark"] .question-list,
:root[data-theme="dark"] #answer-key {
    background-color: #010120 !important; /* Dark Purple */
    background: #01013d !important;
    border: 2px solid rgba(85, 223, 247, 0.4) !important; /* Shiny Purple Border */
    box-shadow: 0 0 15px rgba(85, 223, 247, 0.4) !important; /* Glowing effect */
    margin: 15px 0 !important;
    border-radius: 8px;
    padding: 15px;
}

/* Forces all nested text inside the container to white and NOT BOLD */
:root[data-theme="dark"] .question-list,
:root[data-theme="dark"] .question-list *,
:root[data-theme="dark"] #answer-key,
:root[data-theme="dark"] #answer-key * {
    color: #c8e4fc !important;
    font-weight: normal !important;
}
/* SAMPLE ANSWERS ONLY */
:root[data-theme="dark"] #answer-key {
    background-color: #010108 !important;
    background: #02010e !important;
    border: 2px solid rgba(85, 223, 247, 0.4) !important;
    box-shadow: 0 0 15px rgba(85, 223, 247, 0.4) !important;
    margin: 15px 0 !important;
    border-radius: 8px;
    padding: 15px;
}

/* Forces all nested text inside the answer key to be light blue and BOLD */
:root[data-theme="dark"] #answer-key,
:root[data-theme="dark"] #answer-key * {
    color: #5ac5f7 !important;
    font-weight: bold !important;
}
/* NOTE BOX */

:root[data-theme="dark"] .note-box {
    background-color: #140722 !important; /* Dark Purple */
    background: #140722 !important;
    
    /* Restores the left vertical line with a shiny purple color */
    border-left: 6px solid #8006f3 !important; 
    border-top: none !important;
    border-right: none !important;
    border-bottom: none !important;
    
    /* Adds the glowing effect focused on that left edge */
    box-shadow: -5px 0 15px rgba(125, 10, 233, 0.5) !important; 
    
    border-radius: 0 8px 8px 0 !important; /* Rounds only the right corners */
    padding: 15px !important;
}

/* Forces all nested text elements inside the notebox to light green */
:root[data-theme="dark"] .note-box,
:root[data-theme="dark"] .note-box h2,
:root[data-theme="dark"] .note-box p,
:root[data-theme="dark"] .note-box li,
:root[data-theme="dark"] .note-box * {
    color: #acd2f3 !important;
}
/* CHECK ANSWER BUTTON TEXT COLOR ONLY */

:root[data-theme="dark"] #check-btn {
    color: #d2e4f3 !important;
}
/* FOOTER HEADINGS COLOR */

:root[data-theme="dark"] .math-footer h1,
:root[data-theme="dark"] .math-footer h2,
:root[data-theme="dark"] .math-footer h3,
:root[data-theme="dark"] .math-footer h4,
:root[data-theme="dark"] .math-footer h5,
:root[data-theme="dark"] .math-footer h6 {
    color: #d8e8f5 !important;
}

/* =================================================
   NAVBAR, DROPDOWNS & SEARCH BAR
================================================= */

/* NAVBAR BACKGROUND */
:root[data-theme="dark"] .navbar {
    background-color: #000000 !important;
    background: #000000 !important;
    opacity: 1.0 !important;
}

/* NAVBAR LINKS */
:root[data-theme="dark"] .navbar a,
:root[data-theme="dark"] .navbar span,
:root[data-theme="dark"] .navbar-brand,
:root[data-theme="dark"] .nav-link {
    color: #d8e8f5 !important;
}

/* SEARCH INPUT FIELD */
:root[data-theme="dark"] .navbar input[type="text"],
:root[data-theme="dark"] .navbar input[type="search"] {
    background-color: transparent !important;
    color: #d8e8f5 !important;
    border: 1px solid #c8e4fc !important;
}

/* SEARCH PLACEHOLDER */
:root[data-theme="dark"] .navbar input::placeholder {
    color: #d8e8f5 !important;
    opacity: 1 !important;
}

/* SEARCH BUTTON */
:root[data-theme="dark"] .navbar button,
:root[data-theme="dark"] #search-btn,
:root[data-theme="dark"] .search-btn {
    background-color: #000000 !important;
    background: #000000 !important;
    color: #d8e8f5 !important;
    border: 1px solid #c8e4fc !important;
}

/* DROPDOWN & SUGGESTION BOXES */
:root[data-theme="dark"] .dropdown-menu,
:root[data-theme="dark"] .search-suggestions,
:root[data-theme="dark"] [class*="suggestion"],
:root[data-theme="dark"] [class*="dropdown"],
:root[data-theme="dark"] .navbar ul,
:root[data-theme="dark"] .navbar div {
    background-color: #000000 !important;
    background: #000000 !important;
}

/* DROPDOWN LINKS (DEFAULT STATE) */
:root[data-theme="dark"] .dropdown-menu a,
:root[data-theme="dark"] .dropdown-menu li,
:root[data-theme="dark"] [class*="suggestion"] a,
:root[data-theme="dark"] [class*="suggestion"] li,
:root[data-theme="dark"] [class*="dropdown"] a,
:root[data-theme="dark"] [class*="dropdown"] li {
    color: #c8e4fc !important;
    background-color: transparent !important;
    background: transparent !important;
}

/* DROPDOWN HOVER & TOUCH STATES */
:root[data-theme="dark"] .dropdown-menu a:hover,
:root[data-theme="dark"] .dropdown-menu a:active,
:root[data-theme="dark"] [class*="suggestion"] a:hover,
:root[data-theme="dark"] [class*="suggestion"] li:hover,
:root[data-theme="dark"] [class*="dropdown"] a:hover {
    background-color: #5ecbff !important;
    background: #5ecbff !important;
    color: #000000 !important;
}
/* =================================================
   TOP-RIGHT CORNER TOGGLE BUTTON (NO CONTENT SHIFT)
================================================= */

/* 1. Sets the anchor on the main container box */
:root .container {
    position: relative !important;
}

/* 2. Locks the button in the top-right empty space */
.theme-toggle {
    position: absolute !important;
    top: 25px !important;      /* Distance from the top inside edge */
    right: 25px !important;    /* Distance from the right inside edge */
    z-index: 100 !important;   /* Keeps it clickable above everything else */
    
    /* Clean button styling */
    padding: 6px 14px;
    border: 2px solid #1e293b;
    border-radius: 30px;
    background: #c8e4fc;
    color: #1e293b;
    font-weight: bold;
    font-size: 11px;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.theme-toggle:hover {
    background: #1e293b;
    color: #c8e4fc;
}

/* Dark Mode states */
:root[data-theme="dark"] .theme-toggle {
    background: #101b2c;
    color: #5ecbff;
    border: 2px solid #3b82f6;
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.3);
}

:root[data-theme="dark"] .theme-toggle:hover {
    background: #3b82f6;
    color: #000000;
    box-shadow: 0 0 18px rgba(59, 130, 246, 0.6);
}

/* 3. Mobile screen handling (Maintains right side alignment, prevents shifting) */
@media (max-width: 768px) {
    .theme-toggle {
        top: 15px !important;   /* Pulls it slightly closer to the top on mobile */
        right: 15px !important; /* Pulls it slightly closer to the right on mobile */
        padding: 4px 10px;       /* Shrinks button size slightly for mobile spacing */
        font-size: 10px;
    }
}
/* =================================================
   MATH OPERATORS OVERRIDE (WHITE DIVISION & MULTIPLICATION)
================================================= */

/* 1. Targets text characters like times (×), asterisks (*), and hyphens/dashes (-) */
:root[data-theme="dark"] .example,
:root[data-theme="dark"] .example *,
:root[data-theme="dark"] .container * {
    /* If your symbols are wrapped in generic math tags, spans, or utility classes */
    --operator-color: #c8e4fc !important;
}

/* 2. Forces text multiplication (×, x) and division signs to white */
:root[data-theme="dark"] span[class*="multiply"],
:root[data-theme="dark"] span[class*="divide"],
:root[data-theme="dark"] .multiplication-sign,
:root[data-theme="dark"] .division-sign {
    color: #c8e4fc !important;
}

/* 3. Fixes horizontal fraction/division lines built with borders or HR tags */
:root[data-theme="dark"] .fraction,
:root[data-theme="dark"] div[style*="border"],
:root[data-theme="dark"] span[style*="border"],
:root[data-theme="dark"] .numerator,
:root[data-theme="dark"] .denominator {
    border-color: #c8e4fc !important; /* Forces the horizontal fraction line to be white */
    border-bottom-color: #c8e4fc !important;
    border-top-color: #c8e4fc !important;
}

/* 4. Support for MathJax/KaTeX if you use them on your 100+ pages */
:root[data-theme="dark"] .mjx-mo, 
:root[data-theme="dark"] .katex .mbin,
:root[data-theme="dark"] .katex .mrel {
    color: #c8e4fc !important;
}
/* =================================================
   TARGET ONLY SPECIFIC INVISIBLE GREY TEXT ELEMENTS
================================================= */

/* Targets the main body text paragraphs and unstyled span wrappers inside the container */
:root[data-theme="dark"] .container p,
:root[data-theme="dark"] .container p > span,
:root[data-theme="dark"] .container div > span {
    color: #c8e4fc !important;
}
/* =================================================
   INVERT MATH DIAGRAMS WITH SOFTER LIGHT BLUE TEXT
================================================= */

/* Targets formula images inside the container during dark mode */
:root[data-theme="dark"] .container img,
:root[data-theme="dark"] img[src*="quadratic"],
:root[data-theme="dark"] .formula-img {
    /* Inverts to black/white, then tints it to the soft blue #c8e4fc */
    filter: invert(1) sepia(20%) saturate(1000%) hue-rotate(185deg) brightness(105%) !important;
}
/* =================================================
   FIX FOR STRAGGLER MATH BOXES (EXCLUDING NOTE BOX)
================================================= */

/* Targets stray background blocks, but strictly IGNORES the note box */
:root[data-theme="dark"] .container div[style*="background"]:not(.note-box),
:root[data-theme="dark"] .container span[style*="background"],
:root[data-theme="dark"] .container pre,
:root[data-theme="dark"] .container code,
:root[data-theme="dark"] .container table,
:root[data-theme="dark"] .container td,
:root[data-theme="dark"] .container [class*="math"],
:root[data-theme="dark"] .container [class*="calc"],
:root[data-theme="dark"] .container [class*="box"]:not(.note-box) {
    background-color: #000000 !important; 
    background: #000000 !important;
    border: 1px solid #3b82f6 !important;  
}

/* Forces inner text to soft blue, but strictly IGNORES the note box contents */
:root[data-theme="dark"] .container pre *,
:root[data-theme="dark"] .container table *,
:root[data-theme="dark"] .container [class*="math"] *,
:root[data-theme="dark"] .container [class*="calc"] *,
:root[data-theme="dark"] .container [class*="box"]:not(.note-box) *,
:root[data-theme="dark"] .container div[style*="background"]:not(.note-box) * {
    color: #c8e4fc !important;
}
/* =================================================
   LIGHT MODE SAMPLE QUESTIONS OVERRIDE (NOT BOLD)
================================================= */

/* Targets light mode by selecting when data-theme is NOT dark, or when no theme is set */
:root:not([data-theme="dark"]) .question-list,
:root:not([data-theme="dark"]) .question-list * {
    font-weight: normal !important;
}
/* Base container wrapper */
.donation-card-container {
    width: 100%;
    max-width: 1100px; /* Aligns with your main body text block */
    margin: 0 auto;
    padding: 10px 20px 45px 20px; /* Pads nicely right above the footer */
    box-sizing: border-box;
}

/* Light Mode Card Design */
.donation-card {
    background-color: #ffffff; /* Clean pure white background */
    border: 2px solid #e2e8f0; /* Sharp, visible light border boundary */
    border-radius: 10px;
    padding: 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05); /* Premium, modern lift effect */
}

/* High-Visibility Typography */
.donation-content h3 {
    color: #1e3a8a; /* Deep, authoritative dark blue headline */
    font-family: sans-serif;
    font-size: 1.4rem; /* Prominent size for clarity */
    font-weight: 700;
    margin-top: 0;
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.donation-content p {
    color: #334155; /* Ultra-clear, dark slate gray for maximum text readability */
    font-family: sans-serif;
    font-size: 1rem; /* Standard comfortable reading size */
    line-height: 1.6; /* Breathing room for easy reading */
    margin: 0;
    max-width: 750px; /* Prevents text lines from stretching too long */
}

/* Eye-Catching Button Design */
.coffee-btn {
    display: inline-block;
    background-color: #f59e0b; /* Bright golden amber to stand out instantly */
    color: #000000; /* High-contrast black text on gold */
    text-decoration: none;
    font-family: sans-serif;
    font-weight: 700;
    font-size: 1rem;
    padding: 14px 28px;
    border-radius: 6px;
    white-space: nowrap;
    text-align: center;
    box-shadow: 0 2px 4px rgba(245, 158, 11, 0.2);
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.coffee-btn:hover {
    background-color: #d97706; /* Richer gold tone on cursor hover */
    transform: translateY(-1px); /* Subtle premium interaction effect */
}

/* Flawless responsive layout layout for mobile screens */
@media (max-width: 768px) {
    .donation-card {
        flex-direction: column; /* Stacks text and button vertically on phones */
        text-align: center;
        padding: 24px;
        gap: 20px;
    }
    
    .donation-content p {
        font-size: 0.95rem; /* Micro-adjustment for mobile readability */
    }
    
    .coffee-btn {
        width: 100%; /* Stretches button wide for easy thumb tapping */
        box-sizing: border-box;
    }
}
/* =================================================
   DARK THEME DONATION CARD
================================================= */

/* Container adaptation */
:root[data-theme="dark"] .donation-card {
    background-color: #0b1329 !important; /* Deep dark slate to blend with the footer */
    border: 2px solid #1e293b !important; /* Muted dark border line */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6) !important; /* Stronger shadow for dark background depth */
}

/* Heading color */
:root[data-theme="dark"] .donation-content h3 {
    color: #2fbdff !important; /* Uses your signature neon blue heading color */
}

/* Paragraph text color */
:root[data-theme="dark"] .donation-content p {
    color: #94a3b8 !important; /* Soft, accessible gray to reduce eye strain */
}

/* Golden Amber Button Tweaks */
:root[data-theme="dark"] .coffee-btn {
    background-color: #f59e0b !important; /* Keeps the high-visibility gold */
    color: #000000 !important; /* Keeps the deep black text contrast */
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3) !important; /* Gives the gold button a faint glowing lift */
}

:root[data-theme="dark"] .coffee-btn:hover {
    background-color: #fbbf24 !important; /* Slightly brighter gold on hover for responsive dark feedback */
}
/* =================================================
   ANTI-HORIZONTAL SCROLL SAFETY SHIELD
================================================= */
html, body {
    max-width: 100% !important;
    overflow-x: hidden !important;
}
/* =================================================
   TABLET & IPAD VIEWPORT NAV BAR FIX (769px - 1024px)
================================================= */
@media screen and (min-width: 769px) and (max-width: 1024px) {

    /* 🔴 STOP ALL HORIZONTAL SCROLL */
    body {
        overflow-x: hidden !important;
    }

    /* 🔴 FIX NAVBAR SCROLLING & BOUNDARIES */
    .navbar {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        justify-content: flex-start !important;
        align-items: center !important;
        padding: 10px 10px !important;   
        gap: 5px !important;
        width: 100% !important;
        box-sizing: border-box !important;
        overflow: visible !important; 
        position: relative !important; 
    }

    /* 🔴 HAMBURGER */
    .hamburger {
        display: block !important;
        margin-right: 5px !important;
        cursor: pointer !important;
    }

    /* 🔴 DROPDOWN CLOSE TO HAMBURGER */
    .dropdown {
        margin-left: 0 !important;
    }

    .dropbtn {
        font-size: 18px !important;   
        padding: 10px 12px !important;
    }

    /* 🔴 FORCE SEARCH TO FIT */
    .search-group {
        margin-left: auto !important;
        display: flex !important;
        align-items: center !important;
        max-width: 45% !important; 
    }

    /* 🔴 SEARCH INPUT FIX */
    .search-wrapper {
        width: 100% !important;
        max-width: 160px !important; 
        position: relative !important;
    }

    .search-wrapper:focus-within {
        width: 100% !important;
        max-width: 190px !important;
    }

    /* 🔴 REMOVE BUTTON */
    .modern-search-btn {
        display: none !important;
    }

    /* 🔴 HIDE DESKTOP LINKS */
    .desktop-only {
        display: none !important;
    }

    /* NAVBAR TEXT SIZES */
    .navbar a,
    .dropbtn {
        font-size: 15px !important;
    }

    /* SEARCH INPUT TEXT */
    #topicSearch {
        font-size: 14px !important;
    }

    /* SEARCH SUGGESTIONS TEXT */
    .suggestions-dropdown a {
        font-size: 14px !important;
    }

    /* =================================================
       🔥 FIXED: HAMBURGER DROP-DOWN MENU (LIGHT & DARK THEMES)
    ================================================= */
    .mobile-menu {
        display: none !important; 
        position: absolute !important;
        top: 100% !important; 
        left: 10px !important;          
        width: 250px !important;        
        flex-direction: column !important;
        padding: 5px 0 !important;
        z-index: 999999 !important; 
        border-radius: 8px !important;
        
        /* Default: Clean Light Mode Look */
        background-color: #ffffff !important; 
        border: 1px solid #ccd6f6 !important;
        box-shadow: 0 10px 25px rgba(0,0,0,0.15) !important;
    }

    .mobile-menu.show {
        display: flex !important;
    }

    /* Default Light Mode Link Colors */
    .mobile-menu a {
        display: block !important;
        width: 100% !important;
        padding: 12px 20px !important;
        box-sizing: border-box !important;
        text-decoration: none !important;
        text-align: left !important;
        font-size: 15px !important;
        font-weight: bold !important;
        color: #0b192c !important; /* Dark text for crisp light visibility */
        border-bottom: 1px solid #f0f4f8 !important;
    }
    
    .mobile-menu a:hover {
        background-color: #f0f4f8 !important;
    }

    /* 🌓 Dark Mode Overrides for Hamburger Dropdown */
    :root[data-theme="dark"] .mobile-menu {
        background-color: #010120 !important; 
        border: 2px solid rgba(85, 223, 247, 0.4) !important;
        box-shadow: 0 5px 15px rgba(0,0,0,0.5) !important;
    }

    :root[data-theme="dark"] .mobile-menu a {
        color: #c8e4fc !important;
        border-bottom: 1px solid rgba(255,255,255,0.05) !important;
    }
    
    :root[data-theme="dark"] .mobile-menu a:hover {
        background-color: rgba(85, 223, 247, 0.1) !important;
    }

    /* =================================================
       🔥 FIXED: THEME TOGGLE BUTTON CLEAR PLACEMENT & COLORS
    ================================================= */
    .theme-toggle {
        position: absolute !important;
        right: 8px !important;        
        top: -37px !important; /* Safely clears the title header spacing zone completely */
        z-index: 99999 !important;
        display: inline-block !important;
        visibility: visible !important;
        opacity: 1 !important;
        
        /* Crisp High-Visibility Styling for Light Mode */
        padding: 8px 18px !important;
        min-width: 110px !important;
        text-align: center !important;
        border: 2px solid #00008b !important;
        border-radius: 40px !important;
        background: #00008b !important;
        color: #ffffff !important;
        font-weight: 800 !important;
        font-size: 11px !important;
        letter-spacing: 0.8px !important;
        text-transform: uppercase !important;
        box-shadow: 0 4px 12px rgba(0, 0, 139, 0.3) !important;
    }

    /* High-Visibility Styling for Dark Mode */
    :root[data-theme="dark"] .theme-toggle {
        background: linear-gradient(135deg, #00b8ff, #0077ff) !important;
        border: none !important;
        color: #000000 !important;
        font-weight: 900 !important;
        box-shadow: 0 0 15px rgba(0, 184, 255, 0.5) !important;
    }
}
    /* =================================================
       🔥 HIDE TOGGLE BUTTON ONLY WHEN SEARCHING
    ================================================= */
    /* When the search input is focused, hide the theme button so it never overlaps the dropdown suggestions */
    :root:has(#topicSearch:focus) .theme-toggle {
        display: none !important;
        opacity: 0 !important;
        visibility: hidden !important;
    }
