
/* ============================================================
   1. ALAPOK ÉS GLOBÁLIS BEÁLLÍTÁSOK
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700;800&display=swap');

* { box-sizing: border-box; } /* Padding/Border fix */

body { 
    font-family: 'Inter', sans-serif; 
    transition: background-color 0.3s, color 0.3s; 
    line-height: 1.6;
}

html, body {
    max-width: 100%;
    overflow-x: hidden;
    position: relative;
}

/* Szövegtörés fix (ne lógjanak ki a képletek) */
p, h1, h2, h3, h4, span {
    overflow-wrap: break-word;
    word-wrap: break-word;
    hyphens: auto;
}

/* Egyedi görgetősáv */
.custom-scrollbar::-webkit-scrollbar { width: 4px; }
.custom-scrollbar::-webkit-scrollbar-track { background: transparent; }
.custom-scrollbar::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }

/* ============================================================
   2. KOMPONENSEK (Navigáció, Gombok, Modálok)
   ============================================================ */
.nav-item { display: flex; flex-direction: column; width: 100%; text-align: left; padding: 1rem; border-radius: 0.75rem; border: 2px solid transparent; transition: all 0.2s; }
.nav-item.active { border-color: #6366f1; background-color: #f5f3ff; color: #4338ca; }
.nav-item:hover:not(.active) { background-color: #f1f5f9; }

.fixed-btn-container { position: fixed !important; z-index: 1500 !important; }
#beadoModal { z-index: 3000 !important; }
#assistant-window { z-index: 2000 !important; }

/* ============================================================
   3. FOGALOMTÁR ÉS TOOLTIP
   ============================================================ */
.glossary-term {
    color: inherit !important;
    background-color: rgba(79, 70, 229, 0.1);
    border-bottom: 2px dotted #818cf8;
    border-radius: 4px;
    padding: 0 4px;
    cursor: help;
    font-weight: 600;
    display: inline;
}

#global-glossary-tooltip {
    position: fixed !important;
    display: none;
    z-index: 100000;
    background: #0f172a !important;
    color: #ffffff !important;
    padding: 16px;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255,255,255,0.2);
    width: 280px; 
    max-width: 90vw;
}

/* ============================================================
   4. CUSTOM ELEMENTS (A tiszta HTML-hez)
   ============================================================ */

/* SZEKCIÓ FEJLÉC KOMPONENS */
math-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 3rem;
    margin-bottom: 1.5rem;
}

math-header .num-badge {
    flex: none;
    background-color: var(--badge-color, #2563eb);
    color: white;
    font-weight: 900;
    padding: 0.25rem 0.75rem;
    border-radius: 0.5rem;
}

/* DINAMIKUS SZEKCIÓ FEJLÉC */
math-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b; /* Slate-800 */
    text-decoration: underline;
    /* Itt a trükk: a PHP változót használjuk az aláhúzás színéhez is */
    text-decoration-color: var(--underline-color, rgba(37, 99, 235, 0.3));
    text-decoration-thickness: 4px;
    text-underline-offset: 8px;
}

math-def, math-theorem, math-proof, math-example, math-lab, math-quiz {
    display: block;
    margin-bottom: 2.5rem;
    border-radius: 1.25rem;
    transition: all 0.3s ease;
    width: 100%;
}

/* DEFINÍCIÓ */
math-def {
    padding: 1.5rem;
    background: #f0fdf4; /* Emerald-50 */
    border: 1px solid #dcfce7; /* Emerald-100 */
    border-left: 6px solid #10b981; /* Emerald-500 */
    color: #334155;
}

math-def::before {
    content: "DEFINÍCIÓ";
    display: inline-block;
    background: #dcfce7;
    color: #065f46; /* Emerald-800 */
    font-size: 0.6rem;
    font-weight: 900;
    padding: 0.2rem 0.6rem;
    border-radius: 0.4rem;
    margin-bottom: 1rem;
    letter-spacing: 0.05em;
}

math-trivia {
    display: block;
    margin: 4rem 0;
    padding: 2rem;
    background: linear-gradient(to bottom right, rgba(248, 250, 252, 0.8), rgba(241, 245, 249, 0.8));
    border-radius: 3rem;
    border: 2px dashed #e2e8f0;
}

/* TÉTEL */
math-theorem {
    padding: 1.5rem;
    background: #fffbeb;
    border: 1px solid #fef3c7;
    border-left: 6px solid #f59e0b;
}
math-theorem::before {
    content: "TÉTEL";
    display: inline-block;
    background: #fef3c7;
    color: #92400e;
    font-size: 0.6rem;
    font-weight: 900;
    padding: 0.2rem 0.6rem;
    border-radius: 0.4rem;
    margin-bottom: 1rem;
    letter-spacing: 0.05em;
}

/* BIZONYÍTÁS (Visszafogottabb stílus) */
math-proof {
    padding: 1.5rem;
    background: #fef2f2; /* Red-50 */
    border: 1px solid #fee2e2; /* Red-100 */
    border-left: 6px solid #ef4444; /* Red-500 */
    color: #475569;
}

math-proof::before {
    content: "BIZONYÍTÁS";
    display: inline-block;
    background: #fee2e2;
    color: #991b1b; /* Red-800 */
    font-size: 0.6rem;
    font-weight: 900;
    padding: 0.2rem 0.6rem;
    border-radius: 0.4rem;
    margin-bottom: 1rem;
    letter-spacing: 0.05em;
}

/* PÉLDAFELADAT */
math-example {
    padding: 1.5rem;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
}
math-example::before {
    content: "PÉLDAFELADAT";
    display: inline-block;
    background: #e2e8f0;
    color: #475569;
    font-size: 0.6rem;
    font-weight: 900;
    padding: 0.2rem 0.6rem;
    border-radius: 0.4rem;
    margin-bottom: 1rem;
}
/* INTERAKTÍV LABOR STÍLUSA */
math-lab {
    display: block;
    margin: 3rem 0;
    padding: 2rem;
    background-color: #0f172a; /* Slate-900: mélysötét kék */
    color: #f1f5f9; /* Slate-100: majdnem fehér */
    border-radius: 1.5rem;
    border: 1px solid #1e293b;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

.trivia-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.trivia-card {
    background: white;
    padding: 1.5rem;
    border-radius: 2rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.trivia-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

/* ============================================================
   5. ÉJSZAKAI MÓD OVERRIDES
   ============================================================ */
html.dark body, html.dark aside, html.dark main { background-color: #0f172a !important; color: #f1f5f9 !important; }
html.dark p, html.dark span, html.dark li, html.dark h1, html.dark h2, html.dark h3 { color: #f1f5f9 !important; }
html.dark .mjx-chtml { filter: invert(1) hue-rotate(180deg) brightness(1.5) !important; }

/* Dark mode navigáció overrides */
html.dark .nav-item.active {
    background-color: rgba(99, 102, 241, 0.2) !important;
    border-color: #6366f1 !important;
}
html.dark .nav-item:hover:not(.active) {
    background-color: rgba(255, 255, 255, 0.05) !important;
}
html.dark .nav-item:not(.active) span {
    color: #94a3b8 !important;
}
html.dark .nav-item:not(.active):hover span {
    color: #f1f5f9 !important;
}

/* Dark mode az egyedi elemekhez */
html.dark math-def { background: rgba(16, 185, 129, 0.05); border-color: #065f46; color: #f1f5f9; }
html.dark math-header h2 { color: white; }
html.dark .trivia-card { background: rgba(30, 41, 59, 0.6); box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2); }
html.dark math-trivia { background: linear-gradient(to bottom right, rgba(30, 41, 59, 0.4), rgba(15, 23, 42, 0.4)); border-color: rgba(71, 85, 105, 0.3); }
html.dark math-theorem { background: rgba(245, 158, 11, 0.05); border-color: #78350f; }
html.dark math-proof { background: rgba(239, 68, 68, 0.05); border-color: #991b1b; color: #f1f5f9; }
html.dark math-example { background: rgba(255,255,255,0.02); border-color: #334155; }

/* ============================================================
   6. MOBIL ÉS RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    #sidebar { transition: transform 0.3s; }
    #sidebar.closed { transform: translateX(-100%); }
    #sidebar.open { transform: translateX(0); }
    main { padding-top: 80px !important; }
}

/* Floating description box inside sidebar (desktop view) */
#sidebar-floating-desc {
    border-left: 4px solid var(--theme-color) !important;
}
#sidebar-floating-desc p,
#sidebar-floating-desc h3 {
    font-size: 0.825rem !important;
    line-height: 1.5 !important;
    margin: 0 !important;
    padding: 0 !important;
    color: inherit !important;
}
#sidebar-floating-desc b,
#sidebar-floating-desc strong {
    font-weight: 800 !important;
}
html.dark .custom-scrollbar::-webkit-scrollbar-thumb {
    background: #475569;
}

/* Remove separate scrollbar from sidebar on desktop view */
@media (min-width: 768px) {
    #sidebar {
        overflow-y: visible !important;
    }
}


