/**
 * Components CSS for EEPrep
 * Contains styles for reusable components like sidebar, buttons, cards, etc.
 */

/* ------------ Sidebar Component ------------ */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: var(--sidebar-width);
    max-width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    box-shadow: var(--shadow);
    transform: translateX(0);
    will-change: transform, width; /* Optimize for animations */
    transition: transform 0.3s var(--bounce),
                width 0.3s var(--bounce), 
                max-width 0.3s var(--bounce),
                min-width 0.3s var(--bounce);
    z-index: 100;
    overflow-y: hidden;
    overflow-x: hidden !important;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.sidebar-animating {
    /* Prevent content reflow during transitions */
    transition: all 0.3s var(--bounce) !important;
}

.content-animating {
    transition: margin-left 0.3s var(--bounce),
                width 0.3s var(--bounce) !important;
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-full);
}

/* Collapsed state */
body.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-width) !important;
    min-width: var(--sidebar-collapsed-width) !important;
    max-width: var(--sidebar-collapsed-width) !important;
    overflow-x: hidden !important;
    overflow-y: auto;
    position: fixed;
    z-index: 1000;
}

/* Inner sidebar container */
.sidebar-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-x: hidden !important;
    width: 100%;
}

/* Sidebar header */
.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    max-width: calc(100% - 40px);
    overflow: hidden;
}

.sidebar-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--sidebar-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    transition: opacity 0.3s ease;
}


/* Sidebar navigation */
.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
    width: 100%;
    box-sizing: border-box;
    max-width: 100%;
    overflow-x: hidden;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    width: 100%;
}

.sidebar-item {
    margin: 0.5rem;
    border-radius: var(--radius);
    overflow: hidden;
    width: calc(100% - 1rem);
    box-sizing: border-box;
    transition: all 0.3s ease;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--sidebar-text);
    text-decoration: none;
    padding: 0.75rem 1rem;
    transition: background-color 0.2s ease, padding 0.3s ease;
    border-radius: var(--radius);
    width: 100%;
    box-sizing: border-box;
    white-space: nowrap;
    position: relative;
}

.sidebar-link i {
    font-size: 1.125rem; /* Slightly larger icons */
    min-width: 1.5rem; /* Fixed width to prevent shifting */
    text-align: center;
    transition: transform 0.3s ease;
}

.sidebar-link .link-text {
    transition: opacity 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-link:hover {
    background-color: rgba(255,255,255,0.1);
}

.sidebar-item.active .sidebar-link {
    background-color: rgba(255,255,255,0.15);
    font-weight: 500;
}

/* Sidebar footer */
.sidebar-footer {
    padding: 1.25rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
    box-sizing: border-box;
    max-width: 100%;
    overflow-x: hidden;
}

.sidebar-info {
    color: rgba(255,255,255,0.6);
    font-size: 0.875rem;
    transition: opacity 0.2s ease;
}

.sidebar-close {
    background: transparent;
    color: var(--sidebar-text);
    border: none;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: background 0.2s ease;
}

.sidebar-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Collapsed sidebar styles */
body.sidebar-collapsed .sidebar-title,
body.sidebar-collapsed .sidebar-link span,
body.sidebar-collapsed .theme-toggle span,
body.sidebar-collapsed .sidebar-info,
body.sidebar-collapsed .sidebar-search {
    display: none;
}

body.sidebar-collapsed .sidebar-link {
    justify-content: center;
    padding: 0.75rem 0;
    width: 100%;
    text-align: center;
}

body.sidebar-collapsed .sidebar-item {
    margin: 0.25rem 0;
    width: 100%;
    display: flex;
    justify-content: center;
}

body.sidebar-collapsed .sidebar-link i {
    margin-right: 0;
    transform: scale(1.2); /* Slightly enlarge icons when collapsed */
}

body.sidebar-collapsed .link-text {
    opacity: 0;
    width: 0;
    visibility: hidden;
}

body.sidebar-collapsed .sidebar-title {
    opacity: 0;
    width: 0;
    visibility: hidden;
}

body.sidebar-collapsed .sidebar-info {
    opacity: 0;
    height: 0;
    margin: 0;
    visibility: hidden;
}

/* Sidebar toggle button styles */
.sidebar-collapse-toggle {
    position: fixed;
    top: 5rem;
    left: calc(var(--sidebar-width) - 16px);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1001;
    transition: all 0.3s var(--bounce);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.sidebar-collapse-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.sidebar-collapse-toggle i {
    font-size: 0.8rem;
    transition: transform 0.3s ease;
}

body.sidebar-collapsed .sidebar-collapse-toggle {
    left: calc(var(--sidebar-collapsed-width) - 16px);
}

/* Theme toggle */
.theme-toggle {
    background: rgba(255, 255, 255, 0.1);
    color: var(--sidebar-text);
    border: none;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.2s ease;
    width: 100%;
}

.theme-toggle i {
    min-width: 1.5rem; /* Fixed width to prevent shifting */
    text-align: center;
    transition: transform 0.3s var(--bounce);
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
}

.theme-toggle:hover i {
    transform: rotate(30deg);
}

body.sidebar-collapsed .theme-toggle {
    padding: 0.75rem;
    justify-content: center;
}

body.sidebar-collapsed .theme-toggle i {
    margin-right: 0;
}

/* Mobile sidebar */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
        transition: transform 0.3s var(--bounce);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    body.sidebar-collapsed .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar-collapse-toggle {
        display: none !important;
    }
}

/* Header Styles (when used) */
.site-header {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.8);
    position: sticky;
    top: 0;
    z-index: 99;
    border-bottom: 1px solid rgba(229, 231, 235, 0.7);
    height: 60px;
    display: flex;
    align-items: center;
}

[data-theme="dark"] .site-header {
    background: rgba(52, 53, 65, 0.8);
    border-bottom: 1px solid rgba(86, 88, 105, 0.7);
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* Mobile Navigation */
.mobile-nav-toggle {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1001;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    border: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: all 0.2s ease;
}

.mobile-nav-toggle:hover {
    transform: scale(1.05);
}

.mobile-nav-toggle:active {
    transform: scale(0.95);
}

@media (max-width: 1024px) {
    .mobile-nav-toggle {
        display: flex;
    }
    
    .hidden-desktop {
        display: block;
    }
    
    .hidden-mobile {
        display: none;
    }
}

@media (min-width: 1025px) {
    .hidden-desktop {
        display: none;
    }
    
    .hidden-mobile {
        display: block;
    }
}

/* Topic Grid Styles */
.topics-grid {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

.topic-group {
    margin-bottom: 1rem;
}

.topic-group-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    color: var(--primary-color);
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary-light);
    position: relative;
}

.topic-group-title::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 60px;
    height: 2px;
    background: var(--primary-color);
}

.topic-cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.topic-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    height: 100%;
}

.topic-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.topic-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1.25rem;
    transition: transform 0.3s var(--bounce);
}

.topic-card:hover .topic-icon {
    transform: scale(1.1);
    background: var(--primary-color);
    color: white;
}

.topic-card h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.topic-card p {
    margin-bottom: 1.5rem;
    color: var(--text);
    opacity: 0.8;
    flex-grow: 1;
    font-size: 0.95rem;
}

@media (max-width: 768px) {
    .topic-cards-container {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }
}

@media (max-width: 480px) {
    .topic-cards-container {
        grid-template-columns: 1fr;
    }
}

/* Topic Page Components */
.topics-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.topic-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    align-items: center;
    background: var(--card-bg);
    padding: 1rem 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-label {
    font-weight: 600;
    font-size: 0.9rem;
}

.filter-select {
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background-color: var(--bg);
    color: var(--text);
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(26, 54, 93, 0.2);
}

.search-box {
    flex-grow: 1;
    position: relative;
    max-width: 300px;
}

.search-box input {
    width: 100%;
    padding: 0.5rem 2.5rem 0.5rem 0.75rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background-color: var(--bg);
    color: var(--text);
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(26, 54, 93, 0.2);
}

.search-box i {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.category-section {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all 0.3s ease;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
    background: var(--card-bg);
}

.category-section:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    background-color: var(--card-bg);
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background-color 0.2s ease;
}

.category-header:hover {
    background-color: rgba(26, 54, 93, 0.05);
}

.category-header h2 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    color: var(--primary-color);
}

.category-header i {
    transition: transform 0.3s var(--bounce);
    color: var(--primary-color);
}

.category-header.collapsed i {
    transform: rotate(-90deg);
}

.category-content {
    max-height: 2000px;
    overflow: hidden;
    transition: max-height 0.5s ease;
}

.category-content.collapsed {
    max-height: 0;
}

.topic-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.25rem;
    padding: 1.5rem;
}

.topic-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    background-color: var(--card-bg);
    transition: transform 0.3s var(--bounce), box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.topic-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(to right, var(--primary-color), var(--accent-color));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.topic-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.topic-card:hover::before {
    opacity: 1;
}

.topic-card h3 {
    margin-top: 0;
    margin-bottom: 0.75rem;
    color: var(--primary-color);
    font-size: 1.25rem;
    font-weight: 600;
}

.topic-card p {
    margin-bottom: 1.25rem;
    color: var(--text);
    opacity: 0.9;
    flex-grow: 1;
    font-size: 0.95rem;
}

.topic-meta {
    font-size: 0.85rem;
    display: flex;
    justify-content: space-between;
    color: var(--text-muted);
    margin-bottom: 1rem;
    align-items: center;
}

.difficulty {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.difficulty.beginner, .difficulty.easy {
    background-color: rgba(2, 136, 209, 0.15);
    color: #0288d1;
}

.difficulty.intermediate, .difficulty.medium {
    background-color: rgba(56, 142, 60, 0.15);
    color: #388e3c;
}

.difficulty.advanced, .difficulty.hard {
    background-color: rgba(211, 47, 47, 0.15);
    color: #d32f2f;
}

.topic-actions {
    margin-top: auto;
    display: flex;
    justify-content: flex-end;
}

.topic-actions .btn {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.no-results {
    text-align: center;
    padding: 3rem 2rem;
    grid-column: 1 / -1;
    color: var(--text-muted);
    background: rgba(26, 54, 93, 0.05);
    border-radius: var(--radius);
    font-weight: 500;
}

/* Common Topic Content Components */
.topic-title {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent;
}

.topic-description {
    font-size: 1.125rem;
    margin-bottom: 1.5rem;
    color: var(--text);
    opacity: 0.9;
    max-width: 800px;
}

.topic-breadcrumbs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.topic-breadcrumbs a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

.topic-breadcrumbs a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.topic-overview {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 2.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.topic-overview h2 {
    margin-top: 0;
    margin-bottom: 1rem;
    color: var(--primary-color);
    font-size: 1.75rem;
    position: relative;
}

.topic-overview h2::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 50px;
    height: 3px;
    background: linear-gradient(to right, var(--primary-color), var(--accent-color));
    border-radius: var(--radius-full);
}

.concept-section {
    margin-bottom: 2.5rem;
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.concept-section:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.concept-section h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    color: var(--primary-color);
    font-size: 1.5rem;
}

.concept-section p {
    margin-bottom: 1.25rem;
    color: var(--text);
    line-height: 1.7;
}

.concept-section:last-child {
    margin-bottom: 0;
}

.concept-section ul {
    margin: 1rem 0;
    padding-left: 1.5rem;
}

.concept-section ul li {
    margin-bottom: 0.5rem;
    color: var(--text);
}

/* Code snippets styling */
.code-snippet {
    background: var(--bg);
    border-radius: var(--radius);
    padding: 0.25rem;
    margin: 1rem 0;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border);
    overflow-x: auto;
}

.code-snippet pre {
    padding: 1rem;
    margin: 0;
    overflow-x: auto;
}

.code-snippet code {
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 0.9rem;
}

/* Example styles */
.example-box {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.example-box:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.example-box h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    color: var(--primary-color);
    font-size: 1.25rem;
}

.example-problem {
    background: rgba(26, 54, 93, 0.05);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    border-left: 3px solid var(--primary-color);
}

.example-solution {
    background: rgba(56, 178, 172, 0.05);
    border-radius: var(--radius);
    padding: 1.25rem;
    border-left: 3px solid var(--accent-color);
}

.example-solution h4 {
    margin-top: 0;
    margin-bottom: 1rem;
    color: var(--accent-color);
    font-size: 1.1rem;
}

/* Contribution components */
.contribution-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.step-box {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
}

.step-box:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.step-box h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    color: var(--primary-color);
    font-size: 1.25rem;
    border-bottom: 2px solid var(--primary-light);
    padding-bottom: 0.5rem;
}

.step-box p {
    margin-bottom: 1rem;
    color: var(--text);
}

.step-box ul {
    margin: 1rem 0;
    padding-left: 1.5rem;
}

.step-box ul li {
    margin-bottom: 0.5rem;
    color: var(--text);
}

.github-info {
    background: var(--bg);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin: 1rem 0;
    border: 1px solid var(--border);
}

.github-info p {
    margin-bottom: 1rem;
}

.github-info p:last-child {
    margin-bottom: 0;
}

.github-info a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.github-info a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* Button and Link styles */
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-weight: 500;
    text-decoration: none;
    transition: background 0.2s ease, transform 0.2s ease;
    font-size: 0.95rem;
}

.button:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

.resources-list {
    list-style: none;
    padding: 0;
    margin: 1rem 0;
}

.resources-list li {
    padding: 1rem;
    margin-bottom: 1rem;
    background: rgba(26, 54, 93, 0.05);
    border-radius: var(--radius);
    border-left: 3px solid var(--primary-color);
}

.resources-list li:last-child {
    margin-bottom: 0;
}

.resources-list li strong {
    color: var(--primary-color);
    margin-right: 0.5rem;
}

.resources-list li a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.resources-list li a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* Practice section components */
.practice-list {
    list-style: none;
    padding: 0;
    margin: 1.5rem 0;
}

.practice-list li {
    margin-bottom: 1rem;
    transition: transform 0.2s ease;
}

.practice-list li:hover {
    transform: translateX(5px);
}

.practice-list li a {
    display: block;
    padding: 1rem 1.5rem;
    background: var(--card-bg);
    border-radius: var(--radius);
    color: var(--text);
    text-decoration: none;
    border: 1px solid var(--border);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.practice-list li a:hover {
    border-color: var(--primary-color);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.practice-header {
    padding: 2rem 0;
    text-align: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
    color: white;
    border-radius: 8px;
    margin-bottom: 2rem;
}

.practice-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background-color: var(--card-bg);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.practice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.problem-card {
    background-color: var(--card-bg);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}

.problem-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.problem-card h3 {
    margin-top: 0;
    color: var(--primary-color);
}

.problem-card p {
    flex-grow: 1;
}

.problem-details {
    display: flex;
    justify-content: space-between;
    margin-top: 1rem;
    font-size: 0.9rem;
}

.practice-session {
    background-color: var(--card-bg);
    border-radius: 8px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: none;
}

.practice-session.active {
    display: block;
}

.problem-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 2rem;
}

/* Answer components */
.answer-section {
    margin: 1.5rem 0;
    padding: 1.5rem;
    background-color: var(--bg-light);
    border-radius: 8px;
}

.answer-options {
    margin-top: 1rem;
}

.option {
    padding: 1rem;
    margin-bottom: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.option:hover {
    background-color: var(--primary-light);
}

.option.selected {
    background-color: var(--primary-light);
    border-color: var(--primary-color);
}

.answer-result {
    padding: 1rem;
    margin-top: 1rem;
    border-radius: 4px;
    display: none;
}

.answer-result.correct {
    background-color: #d4edda;
    color: #155724;
    display: block;
}

.answer-result.incorrect {
    background-color: #f8d7da;
    color: #721c24;
    display: block;
}

/* Solution components */
.solution-section {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background-color: var(--bg-light);
    border-radius: 8px;
    display: none;
}

.solution-section.visible {
    display: block;
}

.progress-section {
    padding: 2rem;
    background-color: var(--card-bg);
    border-radius: 8px;
    margin-top: 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.progress-bar {
    height: 12px;
    background-color: var(--bg-light);
    border-radius: 6px;
    margin: 1rem 0;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color) 0%, var(--accent-color) 100%);
    width: 0%;
    transition: width 0.3s ease;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    text-align: center;
}

.stat-card {
    padding: 1rem;
    background-color: var(--bg-light);
    border-radius: 8px;
}

.stat-card h4 {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.stat-card p {
    margin: 0.5rem 0 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary-color);
}

/* Utility components */
.card-grid .related-topic-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: transform 0.3s var(--bounce), box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.card-grid .related-topic-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.card-grid .related-topic-card h3 {
    margin-top: 0;
    margin-bottom: 0.75rem;
    color: var(--primary-color);
    font-size: 1.25rem;
}

.card-grid .related-topic-card p {
    margin-bottom: 1.5rem;
    flex-grow: 1;
}

.loading {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.loading i {
    color: var(--primary-color);
    font-size: 1.5rem;
}

.error-message {
    background: rgba(211, 47, 47, 0.1);
    color: #d32f2f;
    padding: 2rem;
    border-radius: var(--radius);
    text-align: center;
    border: 1px solid rgba(211, 47, 47, 0.3);
    margin: 2rem 0;
}

/* Sidebar link container for dropdown items */
.sidebar-link-container {
    display: flex;
    align-items: center;
    width: 100%;
    position: relative;
}

/* Main link in dropdown item takes most of the space */
.sidebar-link-container .sidebar-link {
    flex-grow: 1;
    padding-right: 40px; /* Make space for the dropdown button */
}

/* Dropdown toggle button - right aligned */
.dropdown-toggle-btn {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 36px;
    background: transparent;
    border: none;
    color: var(--sidebar-text);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-radius: 0 var(--radius) var(--radius) 0;
}

.dropdown-toggle-btn:hover {
    background-color: rgba(255,255,255,0.15);
}

/* Handle collapsed state for sidebar items with dropdowns */
body.sidebar-collapsed .dropdown-toggle-btn {
    position: static;
    width: 100%;
    padding: 0.75rem 0;
    border-radius: var(--radius);
}

body.sidebar-collapsed .sidebar-link-container {
    flex-direction: column;
}

body.sidebar-collapsed .sidebar-link-container .sidebar-link {
    padding-right: 0;
}

/* Updated dropdown styles for sidebar */
.sidebar-item.dropdown .dropdown-menu {
    position: static;
    width: 100%;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease;
    margin-top: 0;
    border-radius: 0 0 var(--radius) var(--radius);
    background: rgba(255, 255, 255, 0.05);
    padding: 0;
}

.sidebar-item.dropdown .dropdown-menu.active {
    max-height: 500px;
    opacity: 1;
    padding: 0.5rem 0;
    overflow-y: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-item.dropdown .dropdown-menu.closing {
    max-height: 0;
    opacity: 0;
    padding: 0;
}

.sidebar-item.dropdown .dropdown-group-header {
    padding: 0.5rem 0.5rem 0.25rem 3.25rem;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 600;
    margin-top: 0.25rem;
}

.sidebar-item.dropdown .dropdown-item {
    padding: 0;
    display: block;
    transition: background-color 0.2s ease;
    font-size: 0.9rem;
    opacity: 0;
    transform: translateY(-10px);
}

.sidebar-item.dropdown .dropdown-item.fade-in {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.sidebar-item.dropdown .dropdown-link {
    color: var(--sidebar-text);
    text-decoration: none;
    display: block;
    transition: all 0.2s ease;
    padding: 0.4rem 0.5rem 0.4rem 3.25rem;
    opacity: 0.85;
    font-size: 0.9rem;
}

.sidebar-item.dropdown .dropdown-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    opacity: 1;
    padding-left: 3.5rem;
}

.sidebar-item.dropdown .dropdown-item.loading,
.sidebar-item.dropdown .dropdown-item.error {
    padding: 0.5rem 0.5rem 0.5rem 3.25rem;
    opacity: 0.8;
}

.sidebar-item.dropdown .dropdown-item.loading i,
.sidebar-item.dropdown .dropdown-item.error i {
    margin-right: 0.5rem;
}

/* Collapsed sidebar adjustments for dropdowns */
body.sidebar-collapsed .sidebar-item.dropdown .dropdown-menu {
    position: absolute;
    left: var(--sidebar-collapsed-width);
    top: 0;
    width: 220px;
    max-width: 220px;
    background: var(--sidebar-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius);
    z-index: 1001;
}

body.sidebar-collapsed .sidebar-item.dropdown .dropdown-group-header {
    padding: 0.5rem 1rem 0.25rem 1rem;
}

body.sidebar-collapsed .sidebar-item.dropdown .dropdown-link {
    padding: 0.4rem 1rem;
}

body.sidebar-collapsed .sidebar-item.dropdown .dropdown-link:hover {
    padding-left: 1.25rem;
}

body.sidebar-collapsed .sidebar-item.dropdown .dropdown-item.loading,
body.sidebar-collapsed .sidebar-item.dropdown .dropdown-item.error {
    padding: 0.5rem 1rem;
}

/* Animation for dropdown items */
.sidebar-item.dropdown .dropdown-menu .fade-in {
    animation: fadeInItem 0.3s ease forwards;
}

@keyframes fadeInItem {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
