/* Enhanced Dashboard Styles */

/* Fix overlapping issues and z-index management */
body {
    padding-top: 0; /* Remove any default padding that might conflict */
    margin: 0;
    overflow-x: hidden; /* Prevent horizontal scrolling */
}

/* Ensure proper z-index hierarchy */
.header {
    z-index: 1000; /* Highest priority for fixed header */
}

.sidebar {
    z-index: 100; /* Higher than main content but lower than header */
}

.main-content {
    z-index: 10; /* Base level for main content */
}

/* Fix any potential floating element overlaps */
.floating-elements,
.dropdown-menus,
.modal-overlays {
    z-index: 500; /* Between sidebar and header */
}

/* Practice Hero Section */
.practice-hero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 120px 0 60px; /* Increased top padding to account for fixed header */
    position: relative;
    overflow: hidden;
    margin-top: 80px; /* Add margin to account for fixed header */
    width: 100%;
    box-sizing: border-box;
}

.practice-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="50" cy="50" r="2" fill="rgba(255,255,255,0.1)"/><circle cx="20" cy="20" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="80" cy="30" r="1.5" fill="rgba(255,255,255,0.1)"/><circle cx="30" cy="80" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="70" cy="70" r="2" fill="rgba(255,255,255,0.1)"/></svg>');
    animation: float 20s ease-in-out infinite;
}

.practice-hero-content {
    text-align: center;
    position: relative;
    z-index: 2;
}

.practice-hero h1 {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    font-weight: 700;
    line-height: 1.2;
}

.practice-hero .highlight {
    background: linear-gradient(45deg, #ff6b6b, #ffa500);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.practice-hero p {
    font-size: 1.3rem;
    margin-bottom: 2rem;
    opacity: 0.9;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.practice-options {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
    margin-top: 2rem;
}

.practice-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.practice-option:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.practice-option i {
    font-size: 1.2rem;
    color: #ffa500;
}

/* Dashboard Container */
.dashboard-container {
    display: flex;
    min-height: calc(100vh - 80px); /* Account for fixed header */
    background: #f8fafc;
    position: relative;
    z-index: 1;
    width: 100%;
    margin: 0;
    padding: 0;
}

/* Enhanced Sidebar */
.sidebar {
    width: 320px;
    min-width: 320px; /* Prevent shrinking */
    max-width: 320px; /* Prevent growing */
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border-right: 1px solid #e2e8f0;
    padding: 0;
    position: sticky;
    top: 0;
    height: calc(100vh - 80px); /* Account for fixed header */
    box-shadow: 2px 0 15px rgba(0, 0, 0, 0.08);
    overflow-y: auto;
    z-index: 100;
    flex-shrink: 0; /* Prevent flex shrinking */
}

.sidebar-header {
    padding: 2rem 2rem 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-align: center;
}

.sidebar-header h3 {
    margin: 0 0 0.5rem;
    font-size: 1.4rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.sidebar-header p {
    margin: 0;
    font-size: 0.9rem;
    opacity: 0.9;
}

.sidebar h3 {
    padding: 0 2rem;
    margin-bottom: 1.5rem;
    color: #2d3748;
    font-size: 1.3rem;
    font-weight: 600;
    border-bottom: 2px solid #667eea;
    padding-bottom: 0.5rem;
}

.sidebar ul {
    list-style: none;
    padding: 1.5rem 0;
    margin: 0;
}

.sidebar li {
    margin: 0;
    padding: 0;
}

.subject-item {
    display: flex;
    align-items: center;
    padding: 1.2rem 1.5rem;
    margin: 0.5rem 1rem;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    background: #ffffff;
    border: 2px solid transparent;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    z-index: 1; /* Ensure subject items are above the background */
}

.subject-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 4px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.subject-item:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08), rgba(118, 75, 162, 0.08));
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.15);
    border-color: rgba(102, 126, 234, 0.2);
}

.subject-item:hover::before {
    transform: scaleY(1);
}

.subject-item.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
    transform: translateY(-1px);
}

.subject-item.active::before {
    transform: scaleY(1);
    background: rgba(255, 255, 255, 0.3);
}

.subject-icon {
    width: 45px;
    height: 45px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    transition: all 0.3s ease;
}

.subject-item:hover .subject-icon {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.2), rgba(118, 75, 162, 0.2));
    transform: scale(1.1);
}

.subject-item.active .subject-icon {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
}

.subject-icon i {
    font-size: 1.3rem;
    color: #667eea;
}

.subject-item.active .subject-icon i {
    color: white;
}

.subject-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.subject-name {
    font-weight: 600;
    font-size: 1.1rem;
    color: #2d3748;
}

.subject-item.active .subject-name {
    color: white;
}

.subject-desc {
    font-size: 0.85rem;
    color: #718096;
    line-height: 1.2;
}

.subject-item.active .subject-desc {
    color: rgba(255, 255, 255, 0.8);
}

.subject-badge {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.3s ease;
    position: relative;
    z-index: 2;
}

.subject-item:hover .subject-badge {
    background: rgba(102, 126, 234, 0.2);
    transform: scale(1.05);
}

.subject-item.active .subject-badge {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.sidebar li[data-subject] {
    display: flex;
    align-items: center;
    padding: 1rem 2rem;
    margin: 0.3rem 1rem;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.sidebar li[data-subject]::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 4px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.sidebar li[data-subject]:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    transform: translateX(5px);
}

.sidebar li[data-subject]:hover::before {
    transform: scaleY(1);
}

.sidebar li.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.sidebar li.active::before {
    transform: scaleY(1);
    background: rgba(255, 255, 255, 0.3);
}

.sidebar li i {
    margin-right: 0.8rem;
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

/* Main Content */
.main-content {
    flex: 1;
    flex-shrink: 1; /* Allow shrinking if needed */
    flex-grow: 1; /* Allow growing to fill space */
    padding: 2rem;
    background: #f8fafc;
    min-height: calc(100vh - 80px); /* Ensure proper height */
    overflow-x: hidden; /* Prevent horizontal scroll */
    position: relative;
    z-index: 1;
    width: calc(100% - 320px); /* Account for sidebar width */
    max-width: calc(100% - 320px);
}

.content-header {
    margin-bottom: 2rem;
    text-align: center;
    position: relative;
    z-index: 1;
}

.content-header h1 {
    font-size: 2.5rem;
    color: #2d3748;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.content-header p {
    font-size: 1.2rem;
    color: #718096;
}

/* Enhanced Tabs */
.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    background: white;
    padding: 0.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    overflow-x: auto;
    position: relative;
    z-index: 5;
}

.tab {
    padding: 1rem 1.5rem;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    color: #64748b;
    position: relative;
    overflow: hidden;
}

.tab::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.5s;
}

.tab:hover::before {
    left: 100%;
}

.tab:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    color: #667eea;
    transform: translateY(-2px);
}

.tab.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.tab i {
    font-size: 1.1rem;
}

/* Tab Content */
.tab-content {
    display: none;
    animation: fadeInUp 0.5s ease-in-out;
    position: relative;
    z-index: 1;
    margin-top: 1rem;
    clear: both; /* Ensure proper clearing */
}

.tab-content.active {
    display: block;
}

.tab-content h2 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: #2d3748;
    font-weight: 600;
}

/* Enhanced Test Cards */
.test-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.test-item {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
    margin-bottom: 0; /* Remove any bottom margin that might cause overlap */
}

.test-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea, #764ba2, #ff6b6b);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.test-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.test-item:hover::before {
    transform: scaleX(1);
}

.test-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 2;
}

.test-badge:contains('LIVE') {
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    color: white;
    animation: pulse 2s infinite;
}

.test-item:has(.test-badge:contains('LIVE')) .test-badge {
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    color: white;
    animation: pulse 2s infinite;
}

.test-item:has(.test-badge:contains('UPCOMING')) .test-badge {
    background: linear-gradient(45deg, #ffa500, #ff7f50);
    color: white;
}

.test-item h3 {
    font-size: 1.3rem;
    margin-top: 1rem;
    margin-bottom: 0.8rem;
    color: #2d3748;
    font-weight: 600;
    line-height: 1.4;
    padding-right: 1rem;
    clear: left;
}

.test-item p {
    color: #718096;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.test-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.test-meta span {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.9rem;
    color: #64748b;
    background: #f1f5f9;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
}

.test-meta i {
    color: #667eea;
    font-size: 0.8rem;
}

.start-test-btn {
    width: 100%;
    padding: 0.8rem 1.5rem;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
}

.start-test-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: all 0.3s ease;
}

.start-test-btn:hover::before {
    width: 300px;
    height: 300px;
}

.start-test-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.start-test-btn:disabled {
    background: #cbd5e0;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.start-test-btn:disabled:hover {
    transform: none;
    box-shadow: none;
}

/* Test Category Styles */
.test-category {
    margin-bottom: 3rem;
}

.category-title {
    font-size: 1.5rem;
    color: #2d3748;
    margin-bottom: 1.5rem;
    padding: 1rem 0;
    border-bottom: 2px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-weight: 600;
}

.category-title i {
    color: #667eea;
    font-size: 1.3rem;
}

/* Enhanced Test Difficulty Badges */
.test-difficulty-badge {
    position: absolute;
    top: 1rem;
    left: 1rem;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 3;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

.test-difficulty-badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.test-difficulty-badge.easy {
    background: linear-gradient(45deg, #48bb78, #38a169);
    color: white;
    box-shadow: 0 2px 8px rgba(72, 187, 120, 0.3);
}

.test-difficulty-badge.medium {
    background: linear-gradient(45deg, #ed8936, #dd6b20);
    color: white;
    box-shadow: 0 2px 8px rgba(237, 137, 54, 0.3);
}

.test-difficulty-badge.hard {
    background: linear-gradient(45deg, #e53e3e, #c53030);
    color: white;
    box-shadow: 0 2px 8px rgba(229, 62, 62, 0.3);
}

/* Specific fixes for Cell Biology and other biology topic tests */
.test-item[data-difficulty="medium"] .test-difficulty-badge.medium,
.test-item .test-difficulty-badge.medium {
    background: linear-gradient(45deg, #ed8936, #dd6b20);
    color: white;
    box-shadow: 0 2px 8px rgba(237, 137, 54, 0.3);
    transform: none;
}

/* Ensure Cell Biology and other topic test titles are properly spaced */
#topicTestCards .test-item {
    padding-top: 2.5rem;
}

#topicTestCards .test-item h3[data-title*="Cell Biology"],
#topicTestCards .test-item h3:first-of-type {
    margin-top: 0.5rem;
    padding-top: 0;
}

/* Better badge hover effects */
.test-difficulty-badge.medium:hover {
    background: linear-gradient(45deg, #dd6b20, #c05621);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 16px rgba(237, 137, 54, 0.4);
}

/* Debug and Layout Assurance */
.sidebar {
    display: block !important; /* Force display */
    visibility: visible !important; /* Force visibility */
}

.sidebar-header {
    display: block !important;
    visibility: visible !important;
}

.subject-item {
    display: flex !important;
    visibility: visible !important;
}

/* Ensure proper box-sizing for all elements */
*, *::before, *::after {
    box-sizing: border-box;
}

/* Container width fix */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
    box-sizing: border-box;
}

/* Fix any transform issues that might hide content */
.sidebar * {
    transform: none !important;
    opacity: 1 !important;
}

/* Ensure z-index doesn't hide sidebar */
.sidebar {
    z-index: 100 !important;
    position: relative;
    background: #ffffff !important;
}

/* Additional enhancements for better UX */
.loading-state {
    opacity: 0.7;
    pointer-events: none;
    position: relative;
}

.loading-state::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    border: 2px solid #667eea;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    transform: translate(-50%, -50%);
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Enhanced focus states for accessibility */
.tab:focus,
.start-test-btn:focus,
.sidebar li[data-subject]:focus {
    outline: 3px solid rgba(102, 126, 234, 0.5);
    outline-offset: 2px;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Custom scrollbar for webkit browsers */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #5a67d8, #6b46c1);
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-20px);
    }
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(255, 107, 107, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 107, 107, 0);
    }
}

/* Sidebar Footer with Progress */
.sidebar-footer {
    margin-top: auto;
    padding: 1.5rem;
    border-top: 1px solid #e2e8f0;
    background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
}

.progress-summary h4 {
    margin: 0 0 1rem;
    font-size: 1rem;
    color: #2d3748;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.progress-summary h4 i {
    color: #667eea;
}

.progress-item {
    margin-bottom: 1rem;
}

.progress-item:last-child {
    margin-bottom: 0;
}

.progress-item > span {
    display: block;
    font-size: 0.85rem;
    color: #718096;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 3px;
    transition: width 0.8s ease;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress-text {
    font-size: 0.8rem;
    color: #667eea;
    font-weight: 600;
    margin-top: 0.3rem;
    display: block;
    text-align: right;
}

.score-display {
    text-align: center;
    padding: 0.5rem;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    border-radius: 10px;
    border: 2px solid rgba(102, 126, 234, 0.2);
}

/* Enhanced animations and micro-interactions */
.subject-item {
    animation: slideInFromLeft 0.6s ease forwards;
}

.subject-item:nth-child(1) { animation-delay: 0.1s; }
.subject-item:nth-child(2) { animation-delay: 0.2s; }
.subject-item:nth-child(3) { animation-delay: 0.3s; }
.subject-item:nth-child(4) { animation-delay: 0.4s; }

@keyframes slideInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.progress-summary {
    animation: fadeInUp 0.8s ease 0.5s both;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .practice-hero {
        margin-top: 70px; /* Adjust for smaller header on mobile */
        padding: 60px 0 40px; /* Reduced padding for better mobile experience */
    }
    
    .practice-hero h1 {
        font-size: 2.2rem; /* Better mobile font size */
        line-height: 1.3;
    }
    
    .practice-hero p {
        font-size: 1rem; /* Optimized mobile text size */
        padding: 0 15px;
    }
    
    .practice-options {
        flex-direction: column;
        align-items: center;
    }
    
    .dashboard-container {
        flex-direction: column;
        min-height: auto;
        padding: 0;
        margin: 0;
    }
    
    .sidebar {
        width: 100%;
        position: relative;
        height: auto;
        overflow-y: visible;
        padding: 0;
        margin: 0;
    }
    
    .sidebar-header {
        text-align: center;
        padding: 1.5rem;
    }
    
    .sidebar ul {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 0.5rem;
        padding: 1rem;
        overflow-x: visible;
    }
    
    .subject-item {
        margin: 0;
        width: 100%;
    }
    
    .sidebar-footer {
        display: none;
    }
    
    .sidebar li[data-subject] {
        margin: 0;
        min-width: auto;
        width: 100%;
        justify-content: flex-start;
    }
    
    .main-content {
        padding: 1rem;
        min-height: auto;
        width: 100%; /* Reset width for mobile */
        max-width: 100%; /* Reset max-width for mobile */
    }
    
    .content-header h1 {
        font-size: 2rem;
    }
    
    .tabs {
        flex-direction: column;
        gap: 0.3rem;
    }
    
    .test-cards {
        grid-template-columns: 1fr;
    }
    
    .test-meta {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .state-badge {
        position: relative;
        top: auto;
        right: auto;
        margin-bottom: 0.5rem;
        align-self: flex-start;
    }
    
    .test-item:has(.state-badge) {
        padding-top: 1.5rem;
    }
    
    .test-item:has(.state-badge) .test-difficulty-badge {
        top: 1rem;
        left: 1rem;
    }
    
    .category-title {
        font-size: 1.3rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

@media (max-width: 480px) {
    .practice-hero {
        padding: 40px 0 30px; /* Further reduced padding for small screens */
        margin-top: 60px; /* Further adjust for very small screens */
    }
    
    .practice-hero h1 {
        font-size: 1.8rem; /* Smaller font for very small screens */
        line-height: 1.2;
    }
    
    .practice-hero p {
        font-size: 0.9rem; /* Smaller text for readability */
        padding: 0 10px;
    }
    
    .practice-option {
        padding: 0.8rem 1.2rem;
    }
    
    .tab {
        padding: 0.8rem 1rem;
        font-size: 0.9rem;
    }
    
    .test-item {
        padding: 1rem;
    }
    
    .test-item h3 {
        font-size: 1.1rem;
    }
    
    .dashboard-container {
        padding: 0;
        margin: 0;
    }
    
    .sidebar {
        margin: 0;
        padding: 0;
    }
    
    .main-content {
        padding: 1rem 0.5rem;
        margin: 0;
    }
    
    .test-cards {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 0;
    }
    
    .subject-item {
        margin: 0.5rem 0;
    }
    
    /* Ensure no horizontal overflow on small screens */
    .sidebar ul {
        grid-template-columns: 1fr;
        padding: 0.5rem;
    }
}

/* Desktop Layout Fixes */
@media (min-width: 769px) {
    .dashboard-container {
        display: flex;
        flex-direction: row;
        align-items: stretch;
    }
    
    .sidebar {
        width: 320px;
        min-width: 320px;
        max-width: 320px;
        flex-shrink: 0;
        position: sticky;
        top: 0;
        height: calc(100vh - 80px);
        overflow-y: auto;
    }
    
    .main-content {
        flex: 1;
        width: calc(100% - 320px);
        max-width: calc(100% - 320px);
        min-width: 0; /* Allow shrinking */
        overflow-x: hidden;
    }
    
    /* Ensure test cards don't overflow */
    .test-cards {
        max-width: 100%;
        overflow-x: hidden;
    }
    
    .test-item {
        max-width: 100%;
        box-sizing: border-box;
    }
}

/* Final Layout Fixes */
@media (min-width: 1200px) {
    .main-content {
        max-width: calc(100vw - 320px - 40px); /* Account for sidebar and padding */
    }
    
    .test-cards {
        grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
        max-width: 100%;
    }
}

@media (min-width: 769px) and (max-width: 1199px) {
    .main-content {
        max-width: calc(100vw - 320px - 20px);
    }
    
    .test-cards {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
}

/* Ensure no horizontal scrolling */
html, body {
    overflow-x: hidden;
    max-width: 100vw;
}

.dashboard-container {
    max-width: 100vw;
    overflow-x: hidden;
}

/* Tab content positioning */
.tab-content {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Enhanced Test Difficulty Badge Positioning and Styling */
.test-difficulty-badge {
    position: absolute;
    top: 1rem;
    left: 1rem;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 3;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

.test-difficulty-badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.test-difficulty-badge.easy {
    background: linear-gradient(45deg, #48bb78, #38a169);
    color: white;
    box-shadow: 0 2px 8px rgba(72, 187, 120, 0.3);
}

.test-difficulty-badge.medium {
    background: linear-gradient(45deg, #ed8936, #dd6b20);
    color: white;
    box-shadow: 0 2px 8px rgba(237, 137, 54, 0.3);
}

.test-difficulty-badge.hard {
    background: linear-gradient(45deg, #e53e3e, #c53030);
    color: white;
    box-shadow: 0 2px 8px rgba(229, 62, 62, 0.3);
}

/* Ensure proper spacing for test titles when difficulty badge is present */
.test-item h3 {
    margin-top: 1rem;
    margin-left: 0;
    padding-right: 1rem;
    clear: left;
    line-height: 1.4;
}

/* For topic tests (like Cell Biology), ensure no overlap */
#topicTestCards .test-item {
    position: relative;
    min-height: 280px;
}

#topicTestCards .test-item h3 {
    margin-top: 1.2rem;
    margin-bottom: 1rem;
    padding-top: 0.5rem;
    line-height: 1.4;
}

/* Responsive adjustments for difficulty badges */
@media (max-width: 768px) {
    .test-difficulty-badge {
        font-size: 0.7rem;
        padding: 0.25rem 0.6rem;
        top: 0.8rem;
        left: 0.8rem;
    }
    
    .test-item h3 {
        margin-top: 1.2rem;
        font-size: 1.2rem;
    }
}
