/* ALAPÉRTELMEZETT: SÖTÉT MÓD (Elegáns sötétkék/pala, nem koromfekete!) */
:root {
    --primary: #14b8a6;
    --primary-dark: #0d9488;
    --bg-body: #0f172a;
    /* Sötétkék (Tailwind slate-900) */
    --bg-content: #1e293b;
    /* Kicsit világosabb kék (slate-800) */
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --sidebar-bg: #0f172a;
    --border: #334155;
    --header-height: 70px;
}

::selection {
    background-color: #14b8a6;
    /* Kijelölés háttérszíne */
    color: #000000;
    /* Kijelölés szövegszíne */
}

/* VILÁGOS MÓD */
html.light-mode {
    --primary: #0f766e;
    --primary-dark: #115e59;
    --bg-body: #f8fafc;
    --bg-content: #ffffff;
    --text-main: #0f172a;
    --text-muted: #475569;
    --sidebar-bg: #f1f5f9;
    --border: #e2e8f0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: system-ui, -apple-system, sans-serif;
    color: var(--text-main);
    background: var(--bg-body);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: 100%;
    transition: background-color 0.3s, color 0.3s;
}

body.no-scroll {
    overflow: hidden;
}

/* 1. Eltünteti a mobilos kék/szürke villanást minden kattintható elemről */
* {
    -webkit-tap-highlight-color: transparent;
}

/* 2. Letiltjuk a szövegkijelölést a UI elemeken (Menük, Gombok, Képek, Logó) */
header,
.sidebar,
.btn,
img,
.logo,
.mobile-toggle,
.theme-toggle,
.footer-col h4,
.card-icon {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
}

/* 3. BIZTOSÍTÉK: A tartalmat (cikkek, kódok) továbbra is ki lehessen jelölni és másolni! */
.main-content p,
.main-content h1,
.main-content h2,
.main-content h3,
.main-content li,
pre,
code {
    user-select: text;
    -webkit-user-select: text;
    -moz-user-select: text;
}

a {
    text-decoration: none;
    color: var(--primary);
}

a:hover {
    text-decoration: underline;
}

.site-wrapper {
    max-width: 1440px;
    margin: 0 auto;
    background: var(--bg-content);
    min-height: 100vh;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    position: relative;
    display: flex;
    flex-direction: column;
    overflow-x: clip;
    width: 100%;
    transition: background-color 0.3s;
}

.menu-overlay {
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: 100%;
    height: calc(100vh - var(--header-height));
    background: rgba(0, 0, 0, 0.7);
    z-index: 850;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
}

.menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

.top-header {
    background: var(--bg-content);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1000;
    height: var(--header-height);
    width: 100%;
    transition: background-color 0.3s;
}

.header-inner {
    display: flex;
    align-items: center;
    height: 100%;
    padding: 0 2rem;
}

.header-home {
    justify-content: space-between;
}

.header-study {
    justify-content: space-between;
}

/* Logó Képek */
.logo {
    display: flex;
    align-items: center;
    height: 100%;
    overflow: hidden;
}

.logo a {
    display: flex;
    align-items: center;
    height: 100%;
}

/* Főoldali nagy logó */
.logo-img-home {
    max-width: 280px !important;
    height: auto !important;
    max-height: 40px !important;
    display: block !important;
    object-fit: contain !important;
    margin: 0;
}

/* Tanulmányi oldali asztali logó */
.logo-img-study-desktop {
    max-width: 220px !important;
    height: auto !important;
    max-height: 40px !important;
    display: block !important;
    object-fit: contain !important;
    margin: 0;
}

/* A mobilos kis logó elrejtése asztali nézetben */
.logo-img-study-mobile {
    display: none !important;
}

/* Mobilos logó alapból rejtve */
html.light-mode .logo-img-home,
html.light-mode .logo-img-study-desktop,
html.light-mode .logo-img-study-mobile {
    filter: invert(1) hue-rotate(180deg);
}

/* Asztali Navigáció */
.top-nav ul {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.top-nav a {
    color: var(--text-main);
    font-weight: 600;
}

.top-nav a:hover {
    color: var(--primary);
    text-decoration: none;
}

/* Téma Kapcsoló (SVG Ikonok) */
.theme-toggle-wrapper {
    display: flex;
    align-items: center;
}

.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border-radius: 4px;
    transition: background 0.2s;
}

.theme-toggle:hover {
    background: var(--border);
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
}

.theme-toggle-text {
    display: none;
    font-weight: 600;
}

/* Szöveg csak mobilon látszik */

/* Ikon váltás logika */
.sun-icon {
    display: block;
}

.moon-icon {
    display: none;
}

html.light-mode .sun-icon {
    display: none;
}

html.light-mode .moon-icon {
    display: block;
}

/* Mobil Gombok */
.mobile-toggle {
    display: none;
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 0.5rem 0;
    width: 90px;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    text-align: center;
    flex-shrink: 0;
}

.arrow {
    display: inline-block;
    transition: transform 0.3s ease;
}

.nav-toggle.active .arrow {
    transform: rotate(180deg);
}

/* Layout */
.container {
    display: flex;
    flex: 1;
    align-items: flex-start;
    width: 100%;
}

.sidebar {
    width: 280px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    padding: 2rem 1rem;
    flex-shrink: 0;
    position: sticky;
    top: var(--header-height);
    height: calc(100vh - var(--header-height));
    overflow-y: auto;
    transition: transform 0.3s ease, background-color 0.3s;
    z-index: 900;
}

.sidebar h3 {
    font-size: 0.9rem;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 1rem;
    letter-spacing: 1px;
}

.sidebar ul {
    list-style: none;
}

.sidebar a {
    color: var(--text-main);
    display: block;
    padding: 0.6rem;
    border-radius: 4px;
    transition: background 0.2s;
}

.sidebar a:hover,
.sidebar a.active {
    background: var(--border);
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.main-content {
    flex: 1;
    padding: 3rem 5rem;
    max-width: 1000px;
    width: 100%;
    min-width: 0;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    line-height: 1.2;
    color: var(--text-main);
}

h2 {
    font-size: 1.8rem;
    margin: 2.5rem 0 1rem;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0.5rem;
    color: var(--text-main);
}

h3 {
    font-size: 1.4rem;
    margin: 1.5rem 0 1rem;
    color: var(--text-main);
}

p {
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
}

ul.content-list {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}

ul.content-list li {
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.main-content img {
    max-width: 100%;
    height: auto !important;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    display: block;
    object-fit: contain;
    border: 1px solid var(--border);
}

.breadcrumbs {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.btn {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    padding: 0.8rem 1.5rem;
    border-radius: 6px;
    font-weight: bold;
    transition: background 0.3s;
    border: none;
    cursor: pointer;
}

.btn:hover {
    background: var(--primary-dark);
    text-decoration: none;
    color: #fff;
}

/* Kódblokk */
.code-wrapper {
    position: relative;
    margin-bottom: 2rem;
    border-radius: 8px;
    background: #020617;
    border: 1px solid var(--border);
}

.code-wrapper pre[class*="language-"] {
    margin-bottom: 0;
    padding-top: 2.5rem;
    overflow-x: auto;
    max-width: 100%;
    border-radius: 8px;
    background: transparent;
}

.copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #334155;
    color: #fff;
    border: 1px solid #475569;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.2s;
    z-index: 10;
}

.copy-btn:hover {
    background: #475569;
}

p code,
li code {
    background: var(--border);
    color: #ef4444;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.9em;
    font-family: monospace;
    word-break: break-word;
}

/* --- FŐOLDAL SPECIFIKUS CSS --- */
.hero {
    position: relative;
    background-image: linear-gradient(rgba(15, 23, 42, 0.7), rgba(15, 23, 42, 0.85)), url('../img/hero-bg.webp');
    background-size: cover;
    background-position: center;
    padding: 10rem 2rem;
    text-align: center;
    border-bottom: 1px solid var(--border);
}

.hero h1 {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    color: #ffffff;
    line-height: 1.1;
}

.hero p {
    font-size: 1.3rem;
    color: #cbd5e1;
    max-width: 750px;
    margin: 0 auto 2.5rem;
}

.section-title {
    text-align: center;
    margin-bottom: 4rem;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.section-title h2 {
    font-size: 2.5rem;
    border: none;
    margin-bottom: 1rem;
    color: var(--text-main);
}

.section-title p {
    color: var(--text-muted);
    font-size: 1.2rem;
}

/* --- TYPEWRITER KURZOR (Prémium, méretezett verzió) --- */
.typewriter {
    color: var(--primary);
    position: relative;
    display: inline-block;
}

/* A kurzort egy különálló elemként hozzuk létre a szöveg után */
.typewriter::after {
    content: '';
    display: inline-block;
    width: 4px;
    /* A kurzor vastagsága */
    height: 0.85em;
    background-color: var(--primary);
    margin-left: 5px;
    vertical-align: baseline;
    animation: blink-caret 1.2s step-end infinite;
}

/* Az átlátszóságot animáljuk a keret színe helyett */
@keyframes blink-caret {

    from,
    to {
        opacity: 0;
    }

    50% {
        opacity: 1;
    }
}

/* Szekciók térközeinek növelése */
.roadmap {
    padding: 8rem 2rem;
    max-width: 1200px;
    margin: auto;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2.5rem;
}

.card {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2.5rem;
    transition: transform 0.2s, box-shadow 0.2s;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    border-color: var(--primary);
}

.card-icon {
    font-size: 3rem;
    margin-bottom: 1.5rem;
}

.card h3 {
    font-size: 1.5rem;
    margin-top: 0;
    margin-bottom: 1rem;
    color: var(--text-main);
}

.card p {
    flex: 1;
    color: var(--text-muted);
}

.card .btn {
    margin-top: 1.5rem;
    text-align: center;
}

.info-section {
    padding: 8rem 2rem;
    background: var(--bg-body);
    border-top: 1px solid var(--border);
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 3rem;
    max-width: 1200px;
    margin: 0 auto;
}

.info-box {
    padding: 2.5rem;
    background: var(--bg-content);
    border-radius: 12px;
    border-left: 4px solid var(--primary);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.info-box h3 {
    margin-top: 0;
    color: var(--text-main);
    font-size: 1.4rem;
    margin-bottom: 1rem;
}

.cta-section {
    padding: 8rem 2rem;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    text-align: center;
    color: #fff;
}

.cta-section h2 {
    color: #fff;
    border: none;
    margin-top: 0;
    font-size: 2.5rem;
}

.cta-section .btn {
    background: #fff;
    color: var(--primary-dark);
    font-size: 1.2rem;
    padding: 1rem 3rem;
    margin-top: 2.5rem;
    border-radius: 50px;
}

.cta-section .btn:hover {
    background-color: #f8fafc !important;
    color: var(--primary-dark) !important;
    transform: scale(1.05);
}

/* Footer CSS */
.site-footer {
    background: #020617;
    color: #94a3b8;
    padding: 4rem 2rem 2rem;
    margin-top: auto;
    width: 100%;
    border-top: 1px solid var(--border);
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    border-bottom: 1px solid #1e293b;
    padding-bottom: 2rem;
}

.footer-col h4 {
    color: #f8fafc;
    margin-bottom: 1.5rem;
    font-size: 1.2rem;
}

.footer-col ul {
    list-style: none;
}

.footer-col ul li {
    margin-bottom: 0.8rem;
}

.footer-col a {
    color: #94a3b8;
    transition: color 0.2s;
}

.footer-col a:hover {
    color: var(--primary);
    text-decoration: none;
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    color: #64748b;
    font-size: 0.9rem;
}

/* 3. Az "Előző lecke" gomb Sötét Mód javítása 
   (Felülírjuk a PHP-ban lévő hardkódolt style="background: #e2e8f0" szabályt!) */
.main-content .btn[style*="background: #e2e8f0"] {
    background-color: var(--border) !important;
    color: var(--text-main) !important;
    border: 1px solid var(--border);
}

.main-content .btn[style*="background: #e2e8f0"]:hover {
    background-color: var(--text-muted) !important;
    color: #ffffff !important;
}

/* --- MOBIL RESZPONZIVITÁS --- */
.show-mobile-inline {
    display: none;
}

@media (max-width: 992px) {
    .main-content {
        padding: 2rem;
    }
}

@media (max-width: 768px) {
    .header-inner {
        padding: 0 1rem;
    }

    .mobile-toggle {
        display: block;
    }

    .header-home {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .logo-img-home {
        max-width: calc(100vw - 150px) !important;
    }

    .header-study {
        display: grid;
        grid-template-columns: 90px minmax(0, 1fr) 90px;
        align-items: center;
        gap: 10px;
    }

    .header-study .logo {
        justify-content: center;
    }

    /* Logó csere mobilon a tanulmányi oldalon */
    .header-study .logo-img-study-desktop {
        display: none !important;
    }

    .header-study .logo-img-study-mobile {
        display: block !important;
        width: 40px !important;
        height: 40px !important;
        object-fit: contain !important;
        margin: 0 auto !important;
    }

    /* Főmenü (Jobb oldalról nyílik le) */
    .top-nav {
        display: none;
        width: 100%;
        position: absolute;
        top: var(--header-height);
        left: 0;
        background: var(--bg-content);
        padding: 0;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
        z-index: 950;
        border-bottom: 1px solid var(--border);
    }

    .top-nav.active {
        display: block;
    }

    .top-nav ul {
        flex-direction: column;
        gap: 0;
        align-items: stretch;
    }

    .top-nav a {
        color: var(--text-main);
        display: block;
        padding: 1.2rem 2rem;
        border-bottom: 1px solid var(--border);
        text-align: right;
    }

    .top-nav a:hover {
        background: var(--sidebar-bg);
        text-decoration: none;
    }

    /* Téma kapcsoló mobilon (A menü alján) */
    .theme-toggle-wrapper {
        border-bottom: 1px solid var(--border);
    }

    .theme-toggle {
        width: 100%;
        justify-content: flex-end;
        padding: 1.2rem 2rem;
        border-radius: 0;
    }

    .theme-toggle-text {
        display: inline;
        margin-right: 10px;
    }

    .container {
        flex-direction: column;
    }

    .sidebar {
        position: fixed;
        top: var(--header-height);
        left: -100%;
        width: 280px;
        height: calc(100vh - var(--header-height));
        z-index: 900;
        box-shadow: 2px 0 5px rgba(0, 0, 0, 0.3);
        transition: left 0.3s ease;
    }

    .sidebar.active {
        left: 0;
    }

    .main-content {
        padding: 1.5rem;
        width: 100%;
        overflow-x: hidden;
    }

    .hero {
        padding: 6rem 1rem;
    }

    .hero h1 {
        font-size: 2.5rem;
    }

    .section-title h2 {
        font-size: 2rem;
    }

    .hide-mobile {
        display: none !important;
    }

    .show-mobile-inline {
        display: inline !important;
    }

    .pagination-container {
        display: flex !important;
        flex-direction: row !important;
        gap: 10px !important;
        justify-content: space-between !important;
    }

    .pagination-container .btn {
        flex: 1 1 0px !important;
        width: 50% !important;
        text-align: center !important;
        padding: 0.8rem 0.5rem !important;
        font-size: 0.9rem !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        margin: 0 !important;
    }
}