/* =========================
   THEME VARIABLES
========================= */

:root {

    --bg: #f5f7fa;
    --bg-secondary: #f8fafc;
    --card: #ffffff;

    --text: #333333;
    --text-soft: #475569;

    --border: #e5e7eb;

    --primary: #3b82f6;
    --primary-hover: #2563eb;

    --link-bg: #e0f2fe;
    --link-hover: #bae6fd;

    --shadow: rgba(0,0,0,0.08);

    --header-bg: #1e293b;
    --footer-bg: #111827;
    --hover-bg: rgba(0, 0, 0, 0.15);

    --stats-bg: #66a8cb29;

    --exam-hover: rgba(72, 160, 238, 0.25);

    --dropdown-bg: #ffffff;

    --task-link: #0369a1;
    --task-link-hover: #075985;

    --input-bg: #ffffff;

    --disabled-bg: #f1f5f9;
    --disabled-text: #9ca3af;
}

body.dark-theme {

    --bg: #0f172a;
    --bg-secondary: #111827;
    --card: #1e293b;

    --text: #e5e7eb;
    --text-soft: #94a3b8;

    --border: #334155;

    --primary: #60a5fa;
    --primary-hover: #93c5fd;

    --link-bg: #1e3a5f;
    --link-hover: #2563eb;

    --shadow: rgba(0,0,0,0.35);

    --header-bg: #020617;
    --footer-bg: #020617;
    --hover-bg: rgba(0, 0, 0, 0.4);

    --stats-bg: rgba(96,165,250,0.12);

    --exam-hover: rgba(96,165,250,0.12);

    --dropdown-bg: #1e293b;

    --task-link: #93c5fd;
    --task-link-hover: #dbeafe;

    --input-bg: #0f172a;

    --disabled-bg: #334155;
    --disabled-text: #64748b;
}

/* =========================
   RESET + BASE
========================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-tap-highlight-color: transparent;
    transition:
        background 0.25s ease,
        color 0.25s ease;
}

/* =========================
   LAYOUT
========================= */

.container {
    width: 90%;
    max-width: 1100px;
    margin: auto;
}

/* =========================
   HEADER / NAV
========================= */

header {
    background: var(--header-bg);
    color: white;
}

.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
}

nav a {
    color: white;
    margin-left: 20px;
    text-decoration: none;
    transition: opacity 0.2s;
}

nav a:hover {
    opacity: 0.7;
}

.dropdown {
    position: relative;
    display: inline-block;
}

.dropbtn {
    background: none;
    border: none;
    color: inherit;
    font: inherit;
    cursor: pointer;
    padding: 10px 14px;
    font-weight: inherit;
}

.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 180px;
    background: var(--card-bg);
    background-color: rgba(0,0,0,0.65);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow:
        0 6px 16px
        rgba(0,0,0,.18);
    overflow: hidden;
    z-index: 1000;
}

.dropdown-content a {
    display: block;
    padding: 10px 14px;
    text-decoration: none;
    color: inherit;
    white-space: nowrap;
}

.dropdown-content a:hover {
    background: var(--hover-bg);
}

.dropdown:hover
.dropdown-content {
    display: block;
}

.dropbtn:hover {
    opacity: .85;
}

/* =========================
   HERO
========================= */

.hero {
    background: linear-gradient(135deg, #3b82f6, #06b6d4);
    color: white;
    text-align: center;
    padding: 80px 20px;
}

.hero.small {
    padding: 40px 20px;
}

.hero h2 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

/* =========================
   BUTTONS
========================= */

.btn {
    display: inline-block;
    margin-top: 20px;
    padding: 12px 25px;
    background: white;
    color: var(--primary);
    border-radius: 8px;
    text-decoration: none;
    font-weight: bold;
    transition: 
        transform 0.2s, 
        box-shadow 0.2s;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 10px rgba(0,0,0,0.1);
}

.toggle-buttons {
    margin-bottom: 15px;
    display: flex;
    gap: 10px;
}

.btn-outline {

    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid var(--primary);
    background: var(--card);
    color: var(--primary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-outline:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-1px);
}

.btn-outline:active {
    transform: translateY(0);
}

.btn-outline.secondary {
    border-color: #64748b;
    color: var(--text-soft);
}

.btn-outline.secondary:hover {
    background: #64748b;
    color: white;
}

/* =========================
   THEME TOGGLE
========================= */

.theme-toggle {
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--card);
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s ease;
    opacity: 0.88;
}

.theme-toggle:hover {
    background: var(--link-hover);
    opacity: 1;
    transform: scale(1.05);
}

.floating-theme-btn {
    position: fixed !important;
    top: 12px;
    left: 12px;
    z-index: 999999;
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--card);
    color: var(--text);
    display: flex !important;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.22);
    backdrop-filter: blur(10px);
    transition:
        transform 0.2s ease,
        background 0.2s ease,
        opacity 0.2s ease;
    opacity: 0.88;
    overflow: hidden !important;
}

.floating-theme-btn:hover {
    opacity: 1;
    transform: scale(1.06);
    background: var(--link-hover);
}

/* =========================
   SEARCH BAR
========================= */

.search-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg);
    padding: 5px;
    border-bottom: 1px solid var(--border);
    border-radius: 5px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 20px 0;
}

.search-bar.sticky-active {
    box-shadow: 0 4px 10px var(--shadow);
}

.search-bar input,
.search-bar select {
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.95rem;
    background: var(--input-bg);
    color: var(--text);
}

/* =========================
   STATS
========================= */

#stats {
    margin-bottom: 15px;
    font-size: 0.9rem;
    color: var(--text-soft);
    background-color: var(--stats-bg);
    border-radius: 5px;
    padding: 3px;
}

/* =========================
   CARDS
========================= */

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin: 40px auto;
}

.card {
    background: var(--card);
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    text-decoration: none;
    color: var(--text);
    text-align: center;
}

/* =========================
   HIGHLIGHT
========================= */

.highlight {
    background: var(--header-bg);
    color: white;
    text-align: center;
    padding: 50px 20px;
}

/* =========================
   EXAM LIST
========================= */

.exam-item {
    background: var(--card);
    padding: 14px;
    margin-bottom: 10px;
    border-radius: 8px;
    position: relative;
    z-index: 1;
    box-shadow: 0 2px 6px var(--shadow);
    transition: 
        transform 0.15s ease, 
        box-shadow 0.15s ease, 
        background 0.2s ease;
}

.exam-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 12px var(--shadow);
    background-color: var(--exam-hover);
    z-index: 50;
}

.year-block {
    margin-bottom: 30px;
    padding: 10px 15px;
    border-left: 5px solid var(--primary);
    background: var(--bg-secondary);
    border-radius: 6px;
}

.year-block h3 {
    margin-bottom: 10px;
    color: var(--text);
    padding-left: 5px;
    font-size: 1.4rem;
}

.year-title {
    cursor: pointer;
    transition: color 0.2s;
}

.year-title:hover {
    color: var(--primary);
}

.year-content {
    max-height: 0;
    display: block;
    overflow: visible;
    transition: max-height 0.3s ease;
}

.year-content.collapsed {
    max-height: 0;
    overflow: hidden;
}

/* =========================
   TASK CONTAINER
========================= */

.task-container {
    display: inline-flex;
    padding: 2px;
    border: 1px solid var(--border);
    border-radius: 5px;
    font-size: 0.75rem;
    font-weight: 600;
    overflow: hidden;
    white-space: nowrap;
    overflow-x: auto;
}

.task-list {
    display: inline-block;
    font-weight: 300;
}

.task-badge {
    display: inline-block;
    margin-left: 10px;
    padding: 1px 1px;
    color: var(--task-link);
    border-radius: 6px;
    font-size: 0.8rem;
    white-space: nowrap;
}

.task-hover {
    position: relative;
    display: inline-block;
    text-decoration: none;
    color: inherit;
    z-index: 100;
}

.task-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--dropdown-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 20px var(--shadow);
    padding: 8px;
    min-width: 220px;
    z-index: 9999;
}

.task-hover:hover .task-dropdown {
    display: inline-block;
}

.task-dropdown-item {
    padding: 5px 8px;
    font-size: 0.9rem;
    border-radius: 5px;
    cursor: pointer;
}

.task-dropdown-item:hover {
    background: var(--link-hover);
}

.task-link-plain {
    background: none !important;
    padding: 0 !important;
    margin-left: 8px !important;
    display: inline !important;
    color: var(--task-link) !important;
    text-decoration: none;
    font-size: 0.8rem !important;
    font-weight: 200 !important;
}

.task-link-plain:hover {
    text-decoration: underline;
    color: var(--task-link-hover) !important;
    background: none !important;
    transform: none !important;
}

/* =========================
   LINKS
========================= */

.links {
    margin-top: 8px;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
}

.links a {
    display: inline-block;
    margin: 4px 8px 4px 0;
    padding: 6px 10px;
    min-width: 7em;
    font-size: 0.85rem;
    font-weight: 500;
    background: var(--link-bg);
    color: var(--task-link);
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.links a:hover {
    background: var(--link-hover);
    color: var(--task-link-hover);
    transform: translateY(-1px);
}

.disabled-link {
    display: inline-block;
    margin: 4px 8px 4px 0;
    padding: 6px 10px;
    font-size: 0.85rem;
    background: var(--disabled-bg);
    color: var(--disabled-text);
    border-radius: 6px;
}

/* =========================
   LEVEL BADGES
========================= */

.badge {
    display: inline-block;
    padding: 2px 8px;
    margin: 0 4px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 6px;
}

.badge.kozep {
    background: #dcfce7;
    color: #166534;
}

.badge.emelt {
    background: #fee2e2;
    color: #991b1b;
}

/* =========================
   FOOTER
========================= */

footer {
    background: var(--footer-bg);
    color: #aaa;
    text-align: center;
    padding: 20px;
    margin-top: auto;
}

.active {
    background-color: var(--link-hover);
}

/* ========================= 
   FLIP-CARD
========================= */
.flip-card{
    perspective:1000px;
    padding:0;
    overflow:visible;
    background: var(--card);
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}

.flip-inner{
    position:relative;
    width:100%;
    height:100%;
    min-height:100px;
    transition:.65s;
    transform-style: preserve-3d;
}

.flip-card:hover .flip-inner{
    transform: rotateY(180deg);
}

.flip-front,
.flip-back{
    position:absolute;
    inset:0;
    border-radius:10px;
    backface-visibility: hidden;
    display:flex;
    flex-direction:column;
    justify-content:center;
    align-items:center;
    padding:24px;
    box-sizing:border-box;
    box-shadow: 0 4px 12px rgba(0,0,0,.12);
}

.flip-front{
    background:inherit;
}

.flip-back{
    background: linear-gradient( 135deg, var(--card-bg), var(--surface-bg));
    color: var(--text-color);
    transform: rotateY(180deg);
    flex-direction:row;
    padding:0;
    overflow:hidden;
}

.flip-side{
    flex:1;
    height:100%;
    display:flex;
    flex-direction:column;
    justify-content:center;
    align-items:center;
    gap:10px;
    text-decoration:none;
    color: var(--text-color);
    font-size:1rem;
    transition:.25s;
}

.flip-side:first-child{
    border-right: 1px solid rgba(255, 255, 255, 0.18);
}

.flip-side:hover{
    background: var(--hover-bg);
}

.flip-side div{
    font-size: 2rem;
}

.flip-side strong{
    font-size:1.05rem;
}

/* =========================
   RESPONSIVE
========================= */

@media (max-width: 768px) {

    .nav {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    nav a {
        margin: 0 10px;
        display: inline-block;
    }

    .hero h2 {
        font-size: 1.8rem;
    }

    .search-bar {
        flex-direction: column;
        gap: 8px;
    }

    .search-bar input,
    .search-bar select {
        width: 100%;
    }

    .toggle-buttons {
        flex-direction: column;
    }

    .btn-outline {
        width: 100%;
        text-align: center;
    }

    .year-block {
        padding: 10px;
    }

    .exam-item {
        padding: 12px;
        scroll-margin-bottom: 120px;
    }

    .links {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
    }

    #stats {
        text-align: center;
    }
}

@media (max-width: 480px) {

    body {
        font-size: 0.95rem;
    }

    .hero {
        padding: 30px 15px;
    }

    .hero h2 {
        font-size: 1.5rem;
    }

    .year-block h3 {
        font-size: 1.2rem;
    }

    .exam-item strong {
        display: block;
        margin-bottom: 6px;
        line-height: 1.4;
    }

    .links a,
    .disabled-link {
        flex: 1 1 100%;
        text-align: center;
    }

    #stats {
        text-align: center;
    }

    .year-block {
       scroll-margin-top: 80px;
    }

    .exam-item::after {
       content: "";
        display: block;
        clear: both;
    }

    .links {
        display: flex;
        flex-wrap: wrap;
        align-items: flex-start;
    }

    .task-container {
        display: inline-flex;
        flex-wrap: wrap;
        align-items: center;
        overflow: hidden;
    }

    .year-content {
        overflow: auto;
    }

    .links .task-hover {
        flex: 1 1 98%;
    }

    .links .task-hover a {
        display: block;
        width: 98%;
        text-align: center;
    }
}