:root {
    --primary-bg: #121212;
    --secondary-bg: #1e1e1e;
    --border-color: #333;
    --text-primary: #e0e0e0;
    --text-secondary: #ccc;
    --text-muted: #aaa;
    --accent-color: #2d76cc;
    --accent-hover: #1d5bb1;
    --accent-secondary: #28a746;
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    --header-height: 70px;
    --border-radius-soft: 8px;
    --transition-speed: 0.2s;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-primary);
    background: var(--primary-bg);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
    padding-top: var(--header-height);
    font-size: 14px;
}

/* HEADER */
header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--header-height);
    background: var(--secondary-bg);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
}

/* HEADER CONTENT */
.header__container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* HOME BUTTON */
.home-button {
    background: var(--accent-secondary);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: var(--border-radius-soft);
    cursor: pointer;
    font-weight: 500;
    transition: background-color var(--transition-speed) ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    position: absolute;
    left: 20px;
}

.home-button:hover {
    background: #219a3b;
}

/* LOGO & TITLE */
.header-content {
    text-align: center;
    flex: 1;
}

.main-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--accent-color);
    margin: 0;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 400;
    margin-top: 2px;
}

.spacer {
    width: 80px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: calc(100vh - var(--header-height));
    display: flex;
    flex-direction: column;
}

.navigation {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.nav-level {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.nav-level.active {
    display: block;
}

.nav-level h2 {
    color: var(--text-primary);
    font-size: 1.3rem;
    font-weight: 500;
    margin-bottom: 20px;
    text-align: center;
    padding: 0 16px;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    font-size: 13px;
    color: var(--text-secondary);
    padding: 12px 16px;
    background: var(--secondary-bg);
    border-radius: var(--border-radius-soft);
    border: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.breadcrumb-item {
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-weight: 400;
    white-space: nowrap;
}

.breadcrumb-item:hover {
    background: rgba(45, 118, 204, 0.1);
    color: var(--accent-color);
}

.breadcrumb-separator {
    color: var(--text-muted);
    margin: 0 2px;
}

.breadcrumb-item.active {
    color: var(--accent-color);
    font-weight: 500;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    flex: 1;
    align-items: stretch;
    padding: 0;
    margin: 2rem 0;
    list-style: none;
}

.card {
    background: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-soft);
    padding: 20px;
    cursor: pointer;
    transition: transform 0.3s ease, opacity 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 140px;
    max-height: 200px;
    opacity: 1;
    animation: fadeIn 0.5s ease forwards;
}

.card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 3px;
    background-color: var(--accent-color);
    transition: width 0.3s ease-out, left 0.3s ease-out;
}

.card:hover {
    transform: translateY(-3px);
    border-color: var(--accent-color);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.15);
}

.card:hover::after {
    width: 100%;
    left: 0;
}

.card:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--accent-color);
}

.card-title {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 8px;
    color: var(--text-primary);
    text-align: center;
    line-height: 1.3;
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px 0;
}

.card-subtitle {
    color: var(--text-secondary);
    font-size: 1.0rem;
    margin-bottom: 12px;
    text-align: center;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-top: auto;
}

.subject-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 0;
    min-height: 160px;
    max-height: 220px;
    transition: transform 0.3s ease, opacity 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    animation: fadeIn 0.5s ease forwards;
}

.subject-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 3px;
    background-color: var(--accent-color);
    transition: width 0.3s ease-out, left 0.3s ease-out;
}

.subject-card:hover {
    transform: translateY(-3px);
    border-color: var(--accent-color);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.15);
}

.subject-card:hover::after {
    width: 100%;
    left: 0;
}

.subject-card:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--accent-color);
}

.subject-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    padding-bottom: 16px;
    text-align: center;
}

.subject-info h3 {
    color: var(--text-primary);
    margin: 0 0 12px 0;
    font-size: 1.5rem;
    font-weight: bold;
    line-height: 1.3;
    text-align: center;
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px 0;
}

.subject-info p {
    color: var(--text-secondary);
    font-size: 1.0rem;
    line-height: 1.4;
    margin: 0;
    text-align: center;
}

.subject-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 12px 0 0 0;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.subject-stats {
    display: flex;
    gap: 12px;
    font-size: 0.75rem;
    color: var(--text-muted);
    justify-content: center;
    width: 100%;
}

.subject-stat {
    display: flex;
    align-items: center;
    gap: 3px;
}

.view-button {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: var(--border-radius-soft);
    cursor: pointer;
    font-weight: 500;
    font-size: 0.85rem;
    transition: background-color var(--transition-speed) ease;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    text-align: center;
    margin: 0;
    min-height: 36px;
    margin-top: auto;
}

.view-button:hover {
    background: var(--accent-hover);
}

.back-button {
    background: var(--secondary-bg);
    color: var(--accent-color);
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: var(--border-radius-soft);
    cursor: pointer;
    font-weight: 500;
    transition: all var(--transition-speed) ease;
    margin-bottom: 20px;
    display: inline-block;
    font-size: 13px;
}

.back-button:hover {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

/* NO RESULTS MESSAGE */
.no-results-message {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
    background: var(--secondary-bg);
    border-radius: var(--border-radius-soft);
    margin: 2rem auto;
    max-width: 500px;
    display: none;
    border: 1px solid var(--border-color);
}

.no-results-message.visible {
    display: block;
}

/* SEARCH HIGHLIGHT STYLING */
mark {
    background-color: rgba(45, 118, 204, 0.15);
    color: var(--text-primary);
    padding: 0 2px;
    border-radius: 2px;
}

/* MOBILE RESPONSIVENESS */
@media (max-width: 768px) {
    :root {
        --header-height: 60px;
    }

    .header__container {
        padding: 0 16px;
    }

    .main-title {
        font-size: 1.3rem;
    }

    .subtitle {
        font-size: 0.75rem;
    }

    .spacer {
        display: none;
    }

    .cards-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .card {
        padding: 16px;
        min-height: 140px;
        max-height: 200px;
    }

    .subject-card {
        min-height: 160px;
        max-height: 220px;
    }

    .container {
        padding: 1.5rem 3%;
    }

    .breadcrumb {
        padding: 10px 12px;
        gap: 6px;
    }

    .breadcrumb-item {
        padding: 4px 8px;
        font-size: 12px;
    }

    .nav-level h2 {
        font-size: 1.2rem;
        margin-bottom: 16px;
    }

    .card-title {
        font-size: 1.7rem;
    }

    .subject-info h3 {
        font-size: 1.7rem;
    }
}

@media (max-width: 480px) {
    .header__container {
        flex-direction: row;
        justify-content: space-between;
        padding: 0 12px;
    }

    .home-button {
        padding: 6px 12px;
        font-size: 12px;
    }

    .main-title {
        font-size: 1.1rem;
    }

    .subtitle {
        font-size: 0.7rem;
    }

    .container {
        padding: 12px;
    }

    .cards-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .card {
        padding: 14px;
        min-height: 140px;
        max-height: 200px;
    }

    .subject-card {
        min-height: 160px;
        max-height: 220px;
    }

    .card-title {
        font-size: 1.5rem;
    }

    .subject-info h3 {
        font-size: 1.5rem;
    }

    .card-subtitle {
        font-size: 1.0rem;
    }

    .subject-info p {
        font-size: 1.0rem;
    }

    .breadcrumb {
        padding: 8px 10px;
        font-size: 11px;
    }
}