/* Weekly Challenges Page Styles */

.weekly-challenges-container {
    min-height: calc(100vh - 60px);
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 50%, #0f0f0f 100%);
    position: relative;
    overflow: hidden;
    padding: 40px 20px;
    color: #e0e0e0;
    transition: background 0.3s ease, color 0.3s ease;
}

.weekly-challenges-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 400px;
    background: radial-gradient(circle at 50% 0%, rgba(74, 158, 255, 0.12) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
    transition: background 0.3s ease;
}

/* Contest Cards for Multiple Active Contests */
.contest-card {
    transition: transform 0.2s, box-shadow 0.2s !important;
}

.contest-card:hover {
    transform: translateY(-5px) !important;
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3) !important;
}

.contest-card button:hover {
    background: #f0f0f0 !important;
    transform: scale(1.02);
}

/* Weekly Tab - Progress Stats */
#tab-content-weekly .progress-stats {
    margin-bottom: 30px;
}

/* Weekly Leaderboard Styling */
#weekly-leaderboard .leaderboard-container {
    background: rgba(45, 45, 45, 0.6);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(74, 158, 255, 0.2);
}

#weekly-leaderboard .leaderboard-row.top-three {
    background: rgba(255, 215, 0, 0.1);
}

#weekly-leaderboard .rank-col {
    font-weight: 700;
    font-size: 16px;
}

#weekly-leaderboard .streak-col,
#weekly-leaderboard .points-col {
    font-weight: 600;
    color: #4a9eff;
}

.challenges-header {
    text-align: center;
    margin-bottom: 50px;
    position: relative;
    z-index: 1;
    padding: 30px 20px;
    background: linear-gradient(135deg, rgba(30, 30, 46, 0.6) 0%, rgba(26, 26, 36, 0.6) 100%);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    border: 1px solid rgba(74, 158, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    max-width: 1400px;
    margin: 0 auto 50px;
    transition: all 0.3s ease;
}

.challenges-title {
    font-size: 42px;
    font-weight: 800;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.challenges-title .emoji-icon {
    font-size: 46px;
    display: inline-block;
    animation: floatEmoji 3s ease-in-out infinite;
}

@keyframes floatEmoji {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-8px);
    }
}

.challenges-title .gradient-text {
    background: linear-gradient(135deg, #4a9eff 0%, #7b68ee 50%, #667eea 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: titleGlow 3s ease-in-out infinite;
}

@keyframes titleGlow {
    0%, 100% {
        filter: brightness(1);
    }
    50% {
        filter: brightness(1.2);
    }
}

.challenges-subtitle {
    font-size: 18px;
    color: #b0b0b0;
    font-weight: 400;
    letter-spacing: 0.5px;
    transition: color 0.3s ease;
}

/* Progress Stats */
.progress-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
    position: relative;
    z-index: 1;
    max-width: 1400px;
    margin: 0 auto 40px;
}

.stat-card {
    background: linear-gradient(135deg, rgba(45, 45, 60, 0.6) 0%, rgba(35, 35, 50, 0.6) 100%);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(74, 158, 255, 0.2);
    border-radius: 16px;
    padding: 28px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #4a9eff, #7b68ee, #667eea);
    transform: scaleX(0);
    transition: transform 0.4s ease;
}

.stat-card:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: rgba(74, 158, 255, 0.5);
    box-shadow: 0 12px 48px rgba(74, 158, 255, 0.25), 0 0 0 1px rgba(74, 158, 255, 0.1);
}

.stat-card:hover::before {
    transform: scaleX(1);
}

.stat-card.streak-card {
    border-color: rgba(255, 107, 107, 0.3);
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(74, 158, 255, 0.3);
}

.stat-icon {
    font-size: 42px;
    animation: floatIcon 3s ease-in-out infinite;
}

@keyframes floatIcon {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-5px);
    }
}

.stat-content {
    flex: 1;
}

.stat-label {
    font-size: 13px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
    font-weight: 600;
}

.stat-value {
    font-size: 36px;
    font-weight: 800;
    background: linear-gradient(135deg, #4a9eff 0%, #7b68ee 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -1px;
}

.stat-subtext {
    font-size: 12px;
    color: #666;
    margin-top: 4px;
}

/* Current Challenge Banner */
.current-challenge-banner {
    background: linear-gradient(135deg, rgba(74, 158, 255, 0.12) 0%, rgba(123, 104, 238, 0.12) 100%);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(74, 158, 255, 0.3);
    border-radius: 20px;
    padding: 35px;
    margin-bottom: 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 30px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(74, 158, 255, 0.15);
    transition: all 0.3s ease;
}

.current-challenge-banner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #4a9eff, #7b68ee, #667eea);
}

.current-challenge-banner:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 48px rgba(74, 158, 255, 0.25);
}

.challenge-info h2 {
    font-size: 28px;
    color: #fff;
    margin-bottom: 10px;
}

.challenge-info p {
    color: #b0b0b0;
    margin-bottom: 15px;
}

.challenge-meta {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.meta-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 14px;
    color: #ccc;
}

/* Progress Circle */
.challenge-progress {
    text-align: center;
}

.progress-circle {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto 10px;
}

.progress-circle svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.progress-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.1);
    stroke-width: 8;
}

.progress-bar {
    fill: none;
    stroke: #4a9eff;
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dasharray 0.3s ease;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    font-weight: 700;
    color: #fff;
}

.progress-label {
    font-size: 14px;
    color: #888;
}

/* Tabs */
.challenges-tabs {
    display: flex;
    gap: 12px;
    margin-bottom: 40px;
    border-bottom: 2px solid rgba(74, 158, 255, 0.2);
    padding: 0 20px;
    position: relative;
    z-index: 1;
    max-width: 1400px;
    margin: 0 auto 40px;
}

.tab-btn {
    padding: 14px 28px;
    background: transparent;
    border: none;
    color: #888;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 15px;
    font-weight: 600;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    border-radius: 8px 8px 0 0;
    position: relative;
}

.tab-btn::before {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #4a9eff, #7b68ee, #667eea);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.tab-btn.active {
    color: #4a9eff;
    background: rgba(74, 158, 255, 0.08);
}

.tab-btn.active::before {
    transform: scaleX(1);
}

.tab-btn:hover:not(.active) {
    color: #4a9eff;
    background: rgba(74, 158, 255, 0.05);
}

.tab-content {
    display: none;
    animation: fadeInTab 0.4s ease-in-out;
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.tab-content.active {
    display: block;
}

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

/* Questions Grid */
.questions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

.question-card {
    background: linear-gradient(135deg, rgba(45, 45, 60, 0.6) 0%, rgba(35, 35, 50, 0.6) 100%);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(74, 158, 255, 0.2);
    border-radius: 16px;
    padding: 24px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.question-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(135deg, #4a9eff, #7b68ee);
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.question-card.solved {
    border-color: rgba(46, 213, 115, 0.4);
    background: linear-gradient(135deg, rgba(46, 213, 115, 0.08) 0%, rgba(35, 35, 50, 0.6) 100%);
}

.question-card.solved::before {
    background: linear-gradient(135deg, #2ed573, #00b894);
}

.question-card:hover {
    transform: translateY(-6px) scale(1.02);
    border-color: rgba(74, 158, 255, 0.5);
    box-shadow: 0 12px 48px rgba(74, 158, 255, 0.25);
}

.question-card:hover::before {
    transform: scaleY(1);
}

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.question-number {
    background: rgba(74, 158, 255, 0.2);
    color: #4a9eff;
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 600;
}

.difficulty-badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.difficulty-badge.easy {
    background: rgba(46, 213, 115, 0.2);
    color: #2ed573;
}

.difficulty-badge.medium {
    background: rgba(252, 196, 25, 0.2);
    color: #fcc419;
}

.difficulty-badge.hard {
    background: rgba(255, 71, 87, 0.2);
    color: #ff4757;
}

.question-title {
    font-size: 18px;
    color: #fff;
    margin-bottom: 15px;
}

.question-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    font-size: 14px;
    color: #888;
}

.solved-badge {
    background: rgba(46, 213, 115, 0.2);
    color: #2ed573;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.btn-solve {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #4a9eff 0%, #7b68ee 100%);
    border: none;
    border-radius: 10px;
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(74, 158, 255, 0.3);
    position: relative;
    overflow: hidden;
}

.btn-solve::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #7b68ee 0%, #667eea 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.btn-solve:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 25px rgba(74, 158, 255, 0.5);
}

.btn-solve:hover::before {
    opacity: 1;
}

.btn-solve:active {
    transform: translateY(-1px) scale(1);
}

/* Challenge Modal */
.challenge-modal-content {
    max-width: 95vw;
    max-height: 95vh;
    width: 1600px;
    height: 90vh;
}

.challenge-modal-body {
    padding: 0;
    height: calc(100% - 60px);
    overflow: hidden;
}

.challenge-split-view {
    display: grid;
    grid-template-columns: 400px 1fr;
    height: 100%;
    gap: 0;
}

.challenge-left-panel {
    background: #1e1e1e;
    border-right: 1px solid #333;
    overflow-y: auto;
    padding: 20px;
}

.challenge-right-panel {
    display: flex;
    flex-direction: column;
    background: #0f0f0f;
}

.problem-description-container {
    color: #e0e0e0;
}

.difficulty-badge-container {
    margin-bottom: 15px;
}

.problem-description {
    line-height: 1.6;
}

.description-text {
    margin-bottom: 20px;
}

.example-box {
    background: rgba(74, 158, 255, 0.05);
    border-left: 3px solid #4a9eff;
    padding: 15px;
    margin: 10px 0;
    border-radius: 6px;
    font-size: 14px;
    font-family: 'Courier New', monospace;
}

.editor-header {
    padding: 10px 15px;
    background: #1e1e1e;
    border-bottom: 1px solid #333;
}

.language-select {
    padding: 8px 12px;
    background: #2d2d2d;
    border: 1px solid #3d3d3d;
    border-radius: 6px;
    color: #e0e0e0;
    font-size: 14px;
}

.editor-container {
    flex: 1;
    overflow: hidden;
}

.editor-actions {
    padding: 15px;
    background: #1e1e1e;
    border-top: 1px solid #333;
    display: flex;
    gap: 10px;
}

.btn-run, .btn-submit {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-run {
    background: rgba(74, 158, 255, 0.2);
    color: #4a9eff;
    border: 1px solid #4a9eff;
}

.btn-run:hover {
    background: rgba(74, 158, 255, 0.3);
}

.btn-submit {
    background: linear-gradient(135deg, #2ed573 0%, #1abc9c 100%);
    color: #fff;
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(46, 213, 115, 0.4);
}

.output-section {
    padding: 15px;
    background: #1e1e1e;
    border-top: 1px solid #333;
    max-height: 200px;
    overflow-y: auto;
}

.output-section h3 {
    font-size: 14px;
    color: #888;
    margin-bottom: 10px;
}

.output-content {
    background: #0f0f0f;
    border: 1px solid #333;
    border-radius: 6px;
    padding: 10px;
    min-height: 80px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
}

.output-success {
    color: #2ed573;
}

.output-error {
    color: #ff4757;
}

.loading {
    color: #888;
    text-align: center;
    padding: 20px;
}

.test-summary {
    margin: 10px 0;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
}

.test-details {
    margin-top: 10px;
}

.test-case {
    padding: 8px;
    margin: 5px 0;
    border-radius: 4px;
    font-size: 12px;
}

.test-case.passed {
    background: rgba(46, 213, 115, 0.1);
    border-left: 3px solid #2ed573;
}

.test-case.failed {
    background: rgba(255, 71, 87, 0.1);
    border-left: 3px solid #ff4757;
}

.error-text {
    display: block;
    margin-top: 5px;
    color: #ff6b6b;
}

/* Past Challenges */
.past-challenges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

.past-challenge-card {
    background: linear-gradient(135deg, rgba(45, 45, 45, 0.8) 0%, rgba(35, 35, 50, 0.8) 100%);
    border: 1px solid #3d3d3d;
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
}

.past-challenge-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(74, 158, 255, 0.2);
}

.past-challenge-card h3 {
    color: #fff;
    margin-bottom: 10px;
}

.past-challenge-card p {
    color: #888;
    margin-bottom: 15px;
    font-size: 14px;
}

.btn-view {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid #4a9eff;
    border-radius: 6px;
    color: #4a9eff;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-view:hover {
    background: rgba(74, 158, 255, 0.1);
}

/* Leaderboard */
.leaderboard-table {
    background: #1e1e1e;
    border-radius: 12px;
    overflow: hidden;
}

.leaderboard-header {
    display: grid;
    grid-template-columns: 80px 1fr 100px 100px;
    padding: 15px 20px;
    background: #2d2d2d;
    font-weight: 600;
    color: #888;
    font-size: 13px;
    text-transform: uppercase;
}

.leaderboard-row {
    display: grid;
    grid-template-columns: 80px 1fr 100px 100px;
    padding: 15px 20px;
    border-bottom: 1px solid #333;
    transition: background 0.3s;
}

.leaderboard-row:hover {
    background: rgba(74, 158, 255, 0.05);
}

.leaderboard-row .rank {
    font-weight: 700;
    color: #4a9eff;
}

.leaderboard-row .points {
    color: #2ed573;
    font-weight: 600;
}

/* Utility Classes */
.no-data, .error-message {
    text-align: center;
    padding: 60px 20px;
    color: #888;
    font-size: 16px;
}

.no-challenge, .upcoming-challenge {
    text-align: center;
    padding: 80px 20px;
}

.no-challenge-icon, .upcoming-icon {
    font-size: 80px;
    margin-bottom: 20px;
}

.no-challenge h2, .upcoming-challenge h2 {
    color: #fff;
    margin-bottom: 10px;
}

.upcoming-date {
    color: #4a9eff;
    font-size: 18px;
    font-weight: 600;
    margin: 10px 0;
}

.upcoming-subtext {
    color: #888;
}

/* Responsive Design */

/* Large Screens (max-width: 1200px) */
@media (max-width: 1200px) {
    .challenge-split-view {
        grid-template-columns: 350px 1fr;
    }
    
    .weekly-challenges-container {
        padding: 30px 15px;
    }
}

/* Tablets and Small Laptops (max-width: 1024px) */
@media (max-width: 1024px) {
    .challenge-split-view {
        grid-template-columns: 300px 1fr;
    }
    
    .challenges-title {
        font-size: 36px;
    }
    
    .challenges-subtitle {
        font-size: 15px;
    }
    
    .progress-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .challenge-card {
        padding: 18px;
    }
    
    .leaderboard-item {
        padding: 12px;
    }
}

/* ========================================
   LIGHT THEME SUPPORT FOR WEEKLY CHALLENGES
   ======================================== */

/* Container Background */
body[data-theme="light"] .weekly-challenges-container {
    background: linear-gradient(135deg, #f5f7fa 0%, #e8ecf2 50%, #f5f7fa 100%);
    color: #2d3748;
}

body[data-theme="light"] .weekly-challenges-container::before {
    background: radial-gradient(circle at 50% 0%, rgba(49, 130, 206, 0.08) 0%, transparent 70%);
}

/* Header */
body[data-theme="light"] .challenges-header {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(247, 250, 252, 0.95) 100%);
    border: 1px solid rgba(49, 130, 206, 0.2);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

body[data-theme="light"] .challenges-subtitle {
    color: #718096;
}

/* Past Challenge Cards */
body[data-theme="light"] .past-challenge-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(247, 250, 252, 0.95) 100%);
    border: 1px solid rgba(203, 213, 224, 0.8);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

body[data-theme="light"] .past-challenge-card:hover {
    box-shadow: 0 6px 20px rgba(49, 130, 206, 0.15);
    border-color: rgba(74, 158, 255, 0.3);
}

body[data-theme="light"] .past-challenge-card h3 {
    color: #2d3748;
}

body[data-theme="light"] .past-challenge-card p {
    color: #718096;
}

body[data-theme="light"] .challenge-meta {
    color: #718096;
}

body[data-theme="light"] .challenge-meta span {
    background: rgba(49, 130, 206, 0.1);
    color: #2d3748;
}

body[data-theme="light"] .btn-view {
    border-color: #4a9eff;
    color: #4a9eff;
}

body[data-theme="light"] .btn-view:hover {
    background: rgba(74, 158, 255, 0.1);
}

/* Tab Buttons */
body[data-theme="light"] .tab-btn {
    color: #718096;
}

body[data-theme="light"] .tab-btn.active {
    color: #3182ce;
    background: rgba(49, 130, 206, 0.1);
}

body[data-theme="light"] .tab-btn:hover:not(.active) {
    color: #3182ce;
    background: rgba(49, 130, 206, 0.05);
}

body[data-theme="light"] .challenges-tabs {
    background: rgba(255, 255, 255, 0.6);
    border-bottom: 2px solid rgba(203, 213, 224, 0.5);
}

/* Tablets and Mobile (max-width: 768px) */
@media (max-width: 768px) {
    .challenge-split-view {
        grid-template-columns: 1fr;
        height: auto;
    }
    
    .challenge-left-panel {
        border-right: none;
        border-bottom: 1px solid #333;
        max-height: 300px;
    }
    
    .current-challenge-banner {
        flex-direction: column;
        text-align: center;
        padding: 25px;
        gap: 15px;
    }
    
    .banner-title {
        font-size: 22px;
    }
    
    .countdown-timer {
        justify-content: center;
    }
    
    .time-block {
        padding: 10px;
    }
    
    .time-number {
        font-size: 20px;
    }
    
    .time-label {
        font-size: 11px;
    }
    
    .progress-stats {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .stat-card {
        padding: 18px;
    }
    
    .stat-icon {
        font-size: 35px;
    }
    
    .stat-number {
        font-size: 26px;
    }
    
    .challenges-title {
        font-size: 30px;
    }
    
    .challenges-subtitle {
        font-size: 14px;
    }
    
    .challenges-header {
        margin-bottom: 30px;
    }
    
    /* Tabs - Mobile Scrollable */
    .challenges-tabs {
        overflow-x: auto;
        overflow-y: hidden;
        gap: 5px;
        scrollbar-width: thin;
        scrollbar-color: rgba(74, 158, 255, 0.3) transparent;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 5px;
    }
    
    .challenges-tabs::-webkit-scrollbar {
        height: 4px;
    }
    
    .challenges-tabs::-webkit-scrollbar-track {
        background: transparent;
    }
    
    .challenges-tabs::-webkit-scrollbar-thumb {
        background: rgba(74, 158, 255, 0.3);
        border-radius: 4px;
    }
    
    .tab-btn {
        padding: 10px 16px;
        font-size: 13px;
        white-space: nowrap;
        flex-shrink: 0;
    }
    
    .tab-buttons {
        flex-direction: row;
        overflow-x: auto;
    }
    
    .tab-button {
        padding: 10px 16px;
        font-size: 13px;
        white-space: nowrap;
    }
    
    /* Leaderboard table - Mobile */
    .leaderboard-header,
    .leaderboard-row {
        grid-template-columns: 60px 1fr 80px 80px;
        padding: 12px 15px;
        font-size: 12px;
    }
    
    .challenge-card {
        padding: 15px;
    }
    
    .challenge-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .challenge-title {
        font-size: 18px;
    }
    
    .questions-list {
        gap: 10px;
    }
    
    .question-item {
        padding: 12px;
    }
    
    .question-title {
        font-size: 14px;
    }
    
    .question-meta span {
        font-size: 11px;
    }
    
    .leaderboard-list {
        gap: 10px;
    }
    
    .leaderboard-item {
        padding: 12px;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .rank-badge {
        position: absolute;
        top: 12px;
        right: 12px;
    }
    
    .leaderboard-user {
        padding-left: 0;
    }
    
    .leaderboard-stats {
        width: 100%;
        justify-content: space-between;
    }
    
    .pagination-controls {
        flex-direction: column;
        gap: 10px;
    }
    
    .pagination-btn {
        width: 100%;
    }
}

/* Small Mobile Devices (max-width: 480px) */
@media (max-width: 480px) {
    .weekly-challenges-container {
        padding: 20px 10px;
    }
    
    .challenges-header {
        margin-bottom: 25px;
    }
    
    .challenges-title {
        font-size: 24px;
    }
    
    .challenges-subtitle {
        font-size: 13px;
    }
    
    .current-challenge-banner {
        padding: 20px 15px;
    }
    
    .banner-title {
        font-size: 18px;
    }
    
    .banner-subtitle {
        font-size: 12px;
    }
    
    .countdown-timer {
        gap: 8px;
    }
    
    .time-block {
        padding: 8px;
        min-width: 50px;
    }
    
    .time-number {
        font-size: 16px;
    }
    
    .time-label {
        font-size: 10px;
    }
    
    .stat-card {
        padding: 15px;
    }
    
    .stat-icon {
        font-size: 30px;
    }
    
    .stat-number {
        font-size: 22px;
    }
    
    .stat-label {
        font-size: 12px;
    }
    
    /* Tabs - Small Mobile */
    .challenges-tabs {
        gap: 3px;
    }
    
    .tab-btn {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .tab-button {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    /* Leaderboard table - Small Mobile */
    .leaderboard-header,
    .leaderboard-row {
        grid-template-columns: 50px 1fr 70px 70px;
        padding: 10px 12px;
        font-size: 11px;
    }
    
    .challenge-card {
        padding: 12px;
    }
    
    .challenge-title {
        font-size: 16px;
    }
    
    .challenge-meta span {
        font-size: 11px;
    }
    
    .question-item {
        padding: 10px;
    }
    
    .question-number {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }
    
    .question-title {
        font-size: 13px;
    }
    
    .difficulty-badge {
        padding: 3px 8px;
        font-size: 10px;
    }
    
    .question-meta span {
        font-size: 10px;
    }
    
    .btn-solve {
        padding: 6px 12px;
        font-size: 11px;
    }
    
    .leaderboard-item {
        padding: 10px;
    }
    
    .rank-badge {
        width: 30px;
        height: 30px;
        font-size: 12px;
        top: 10px;
        right: 10px;
    }
    
    .leaderboard-username {
        font-size: 13px;
    }
    
    .leaderboard-points {
        font-size: 12px;
    }
    
    .leaderboard-stats span {
        font-size: 11px;
    }
    
    .pagination-info {
        font-size: 12px;
    }
    
    .pagination-btn {
        padding: 8px 16px;
        font-size: 12px;
    }
    
    .no-challenges,
    .upcoming-challenge {
        padding: 30px 15px;
    }
    
    .no-challenges-icon,
    .upcoming-icon {
        font-size: 50px;
    }
    
    .no-challenges-title,
    .upcoming-title {
        font-size: 16px;
    }
    
    .no-challenges-text,
    .upcoming-subtext {
        font-size: 12px;
    }
}

/* Extra Small Devices (max-width: 360px) */
@media (max-width: 360px) {
    .challenges-title {
        font-size: 20px;
    }
    
    .challenges-subtitle {
        font-size: 12px;
    }
    
    .banner-title {
        font-size: 16px;
    }
    
    .time-block {
        padding: 6px;
        min-width: 45px;
    }
    
    .time-number {
        font-size: 14px;
    }
    
    /* Tabs - Extra Small Mobile */
    .challenges-tabs {
        gap: 2px;
    }
    
    .tab-btn {
        padding: 6px 8px;
        font-size: 10px;
    }
    
    .tab-button {
        padding: 6px 8px;
        font-size: 10px;
    }
    
    /* Leaderboard table - Extra Small Mobile */
    .leaderboard-header,
    .leaderboard-row {
        grid-template-columns: 40px 1fr 60px 60px;
        padding: 8px 10px;
        font-size: 10px;
    }
    
    .challenge-title {
        font-size: 14px;
    }
    
    .question-title {
        font-size: 12px;
    }
    
    .btn-solve {
        padding: 5px 10px;
        font-size: 10px;
    }
}

/* Animations */
@keyframes slideIn {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(100%);
        opacity: 0;
    }
}

/* Contest Problems Overview Modal Styles */
.contest-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
    z-index: 99999;
    overflow-y: auto;
}

.contest-modal-overlay.active {
    display: flex !important;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.contest-modal-container {
    background: #1e1e2e;
    border-radius: 16px;
    max-width: 900px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s ease;
}

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

.contest-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 32px;
    border-bottom: 1px solid #2d2d3d;
}

.contest-modal-header h2 {
    margin: 0;
    color: #ffffff;
    font-size: 24px;
    font-weight: 700;
}

.contest-modal-close {
    background: none;
    border: none;
    color: #888;
    font-size: 32px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    transition: all 0.2s;
}

.contest-modal-close:hover {
    background: #2d2d3d;
    color: #fff;
}

.contest-modal-info {
    display: flex;
    justify-content: space-around;
    padding: 20px 32px;
    background: #252535;
    border-bottom: 1px solid #2d2d3d;
}

.contest-modal-info-item {
    text-align: center;
}

.contest-modal-info-label {
    color: #888;
    font-size: 12px;
    text-transform: uppercase;
    display: block;
    margin-bottom: 4px;
}

.contest-modal-info-value {
    color: #fff;
    font-size: 18px;
    font-weight: 700;
}

.contest-modal-progress-bar-container {
    height: 6px;
    background: #2d2d3d;
}

.contest-modal-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 0.5s ease;
}

.contest-modal-problems {
    padding: 24px 32px;
    max-height: 500px;
    overflow-y: auto;
}

.contest-modal-problem {
    background: #252535;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.contest-modal-problem:hover {
    background: #2d2d3d;
    border-color: #667eea;
    transform: translateX(4px);
}

.contest-modal-problem.solved {
    border-color: #10b981;
}

.contest-modal-problem-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.contest-modal-problem-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.contest-modal-problem-number {
    background: #667eea;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.contest-modal-problem.solved .contest-modal-problem-number {
    background: #10b981;
}

.contest-modal-problem-name {
    color: #fff;
    font-size: 16px;
    font-weight: 600;
}

.contest-modal-badges {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.contest-modal-difficulty {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.difficulty-easy {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.difficulty-medium {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.difficulty-hard {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.contest-modal-points {
    background: rgba(102, 126, 234, 0.2);
    color: #667eea;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.contest-modal-status {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.contest-modal-status-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #888;
    font-size: 13px;
}

.status-solved { color: #10b981; }
.status-not-attempted { color: #6b7280; }

.contest-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 32px;
    border-top: 1px solid #2d2d3d;
}

.contest-modal-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.contest-modal-btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.contest-modal-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.contest-modal-btn-secondary {
    background: #2d2d3d;
    color: #fff;
}

.contest-modal-btn-secondary:hover {
    background: #3d3d4d;
}

.contest-modal-loading {
    text-align: center;
    padding: 40px;
    color: #888;
}

@media (max-width: 768px) {
    .contest-modal-problem-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .contest-modal-badges {
        align-self: flex-start;
    }
}

/* Challenge Modal - Light Theme */
body[data-theme="light"] .challenge-modal-content {
    background: #ffffff;
    border: 1px solid #e2e8f0;
}

body[data-theme="light"] .challenge-left-panel {
    background: #ffffff;
    border-right: 1px solid #e2e8f0;
}

body[data-theme="light"] .challenge-right-panel {
    background: #f7fafc;
}

body[data-theme="light"] .problem-description-container,
body[data-theme="light"] .problem-description {
    color: #2d3748;
}

body[data-theme="light"] .editor-header {
    background: #f7fafc;
    border-bottom: 1px solid #e2e8f0;
}

body[data-theme="light"] .editor-actions {
    background: #f7fafc;
    border-top: 1px solid #e2e8f0;
}

body[data-theme="light"] .output-section {
    background: #ffffff;
}

body[data-theme="light"] .output-content {
    background: #f7fafc;
    color: #1a202c;
    border: 1px solid #e2e8f0;
}

body[data-theme="light"] .language-select {
    background-color: #ffffff;
    color: #2d3748;
    border: 1px solid #cbd5e0;
}

body[data-theme="light"] .description-text,
body[data-theme="light"] .example-box {
    color: #2d3748;
}

body[data-theme="light"] .example-box {
    background: rgba(49, 130, 206, 0.05);
    border-left: 3px solid #3182ce;
}

body[data-theme="light"] .close {
    color: #718096;
}

body[data-theme="light"] .close:hover {
    color: #2d3748;
}

body[data-theme="light"] .difficulty-badge-container {
    color: #2d3748;
}

body[data-theme="light"] .output-section h3 {
    color: #2d3748;
}

body[data-theme="light"] .editor-container {
    background: #ffffff;
}

body[data-theme="light"] .challenge-split-view {
    background: #e2e8f0;
}

