/* ================================
   Monthly Challenge Styles
   ================================ */

/* Challenge Header Card */
.challenge-header-card {
    border-radius: 20px;
    padding: 40px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

/* Enhanced styling for black background cards */
.challenge-header-card[style*="#000000"] {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 20px rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.challenge-header-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--theme-primary), var(--theme-secondary));
}

/* Challenge Title */
.challenge-title {
    font-size: 3.5rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 30px;
    color: var(--theme-primary);
    display: inline-block;
    width: 100%;
}

/* Apply gradient text only in dark mode for better reliability */
[data-bs-theme="dark"] .challenge-title {
    background: linear-gradient(135deg, var(--theme-primary), var(--theme-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Light mode: Force solid color for maximum visibility */
[data-bs-theme="light"] .challenge-title,
:root:not([data-bs-theme="dark"]) .challenge-title {
    color: #4c63d2 !important;
    -webkit-text-fill-color: #4c63d2 !important;
    background: none !important;
    -webkit-background-clip: initial !important;
    background-clip: initial !important;
}

/* Fallback for browsers that don't support background-clip: text */
@supports not (-webkit-background-clip: text) {
    .challenge-title {
        color: var(--theme-primary);
        background: none !important;
        -webkit-text-fill-color: initial;
    }
}

/* Challenge Preview for Non-Authenticated Users */
.challenge-preview {
    margin-bottom: 30px;
}

.preview-description {
    background: var(--theme-background, rgba(255, 255, 255, 0.8));
    border-radius: 15px;
    padding: 25px;
    border: 1px solid var(--theme-primary);
    position: relative;
    backdrop-filter: blur(10px);
}

.preview-fade {
    position: relative;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px dashed var(--theme-primary);
}

.unlock-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: linear-gradient(135deg, var(--theme-primary), var(--theme-secondary));
    color: white;
    padding: 15px 25px;
    border-radius: 10px;
    font-weight: 600;
    margin-top: 15px;
}

.unlock-content i {
    font-size: 1.2rem;
}

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

/* Challenge Content */
.challenge-description {
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 20px;
    text-align: center;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    color: #495057;
}

.challenge-description p {
    margin-bottom: 10px;
}

.challenge-info-box {
    background: var(--theme-background, rgba(255, 255, 255, 0.8));
    border: 1px solid var(--theme-primary);
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 30px;
    backdrop-filter: blur(10px);
}

/* Dark mode: make info boxes darker */
[data-bs-theme="dark"] .challenge-info-box,
/* Black background card styling */
.challenge-header-card[style*="#000000"] .challenge-info-box,
.challenge-header-card[style*="#212529"] .challenge-info-box {
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Challenge Stats */
.challenge-stats-row {
    display: flex;
    justify-content: space-around;
    margin: 30px 0;
    flex-wrap: wrap;
    gap: 20px;
}

.stat-item {
    text-align: center;
    padding: 15px;
    background: var(--theme-background, rgba(255, 255, 255, 0.5));
    border-radius: 12px;
    border: 1px solid var(--theme-primary);
    flex: 1;
    min-width: 150px;
}

/* Dark mode: make stat items darker */
[data-bs-theme="dark"] .stat-item,
/* Black background stat items */
.challenge-header-card[style*="#000000"] .stat-item,
.challenge-header-card[style*="#212529"] .stat-item {
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-label {
    font-size: 0.9rem;
    color: var(--theme-text);
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--theme-primary);
    margin-bottom: 5px;
}

/* Progress Container */
.progress-container {
    margin: 30px 0;
}

.progress {
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    height: 12px;
    overflow: hidden;
}

.progress-bar {
    background: linear-gradient(90deg, var(--theme-primary), var(--theme-secondary)) !important;
    border-radius: 10px;
    transition: width 0.6s ease;
}

.progress-label {
    margin-top: 8px;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--theme-text);
}

/* Submit Score Button */
.submit-score-btn {
    background: linear-gradient(135deg, var(--theme-primary), var(--theme-secondary)) !important;
    border: none;
    border-radius: 25px;
    padding: 15px 30px;
    font-weight: 600;
    color: white;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.submit-score-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    filter: brightness(1.1);
}

/* Auth Prompt */
.auth-prompt {
    text-align: center;
    background: linear-gradient(135deg, var(--theme-primary), var(--theme-secondary), var(--theme-accent));
    color: white;
    padding: 40px;
    border-radius: 15px;
    margin-top: 30px;
    box-shadow: 0 5px 20px rgba(var(--theme-primary-rgb), 0.3);
}

.auth-prompt h4 {
    font-size: 2rem;
    margin-bottom: 15px;
    font-weight: 700;
    color: white;
}

.auth-prompt p {
    font-size: 1.2rem;
    margin-bottom: 30px;
    opacity: 0.95;
    color: white;
}

.auth-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.auth-buttons .btn {
    padding: 15px 30px;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 50px;
    min-width: 140px;
}

/* ================================
   Leaderboard Styles
   ================================ */

.leaderboard-card {
    background: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.leaderboard-card .card-header {
    background: linear-gradient(135deg, var(--theme-primary), var(--theme-secondary));
    color: white;
    padding: 20px 30px;
    border: none;
}

.leaderboard-card .card-header h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
}

.leaderboard-content {
    padding: 20px 0;
}

.leaderboard-entry {
    display: flex;
    align-items: center;
    padding: 15px 30px;
    transition: background-color 0.2s ease;
}

.leaderboard-entry:hover {
    background: #f8f9fa;
}

.leaderboard-entry.current-user {
    background: linear-gradient(135deg, 
        rgba(var(--theme-primary-rgb), 0.2), 
        rgba(var(--theme-secondary-rgb), 0.2));
    border-left: 4px solid var(--theme-accent);
}

.leaderboard-entry .rank {
    width: 60px;
    text-align: center;
    font-weight: 700;
}

.rank-1 { color: #ffd700; font-size: 1.5rem; }
.rank-2 { color: #c0c0c0; font-size: 1.4rem; }
.rank-3 { color: #cd7f32; font-size: 1.3rem; }

.rank-number {
    font-size: 1.2rem;
    color: #6c757d;
}

.leaderboard-entry .profile-pic {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    overflow: hidden;
    margin-right: 15px;
    flex-shrink: 0;
}

.leaderboard-entry .user-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.leaderboard-entry .user-avatar-default {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #e9ecef;
    color: #495057;
    font-size: 1.5rem;
}

.leaderboard-entry .username {
    flex: 1;
    font-weight: 600;
    font-size: 1.1rem;
    margin-left: 15px;
}

.leaderboard-entry .score {
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--theme-primary);
    margin-right: 20px;
}

.leaderboard-entry .date {
    color: #6c757d;
    font-size: 0.9rem;
    width: 80px;
    text-align: right;
}

/* ================================
   Modal Styles
   ================================ */

.modal-content {
    border-radius: 20px;
    border: none;
    overflow: hidden;
}

.modal-header {
    background: linear-gradient(135deg, var(--theme-primary), var(--theme-secondary));
    color: white;
    border: none;
    padding: 20px 30px;
}

.modal-title {
    font-weight: 700;
    font-size: 1.3rem;
}

.btn-close {
    filter: brightness(0) invert(1);
}

/* Time Input Styles */
.time-input-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin: 30px 0;
}

.time-input-group {
    text-align: center;
}

.time-input {
    width: 80px;
    height: 60px;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    border: 2px solid #dee2e6;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.time-input:focus {
    border-color: var(--theme-primary);
    box-shadow: 0 0 0 0.2rem rgba(var(--theme-primary-rgb), 0.25);
}

.time-input-group label {
    display: block;
    margin-top: 8px;
    font-size: 0.9rem;
    color: #6c757d;
    font-weight: 600;
}

.time-separator {
    font-size: 2rem;
    font-weight: 700;
    color: var(--theme-primary);
}

/* Dark mode: make preview darker */
[data-bs-theme="dark"] .preview-description,
/* Black background preview description */
.challenge-header-card[style*="#000000"] .preview-description,
.challenge-header-card[style*="#212529"] .preview-description {
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ================================
   Responsive Design
   ================================ */

@media (max-width: 768px) {
    .challenge-title {
        font-size: 2.5rem;
    }
    
    .challenge-stats-row {
        flex-direction: column;
        gap: 15px;
    }
    
    .stat-item {
        min-width: auto;
    }
    
    .auth-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .auth-buttons .btn {
        min-width: 200px;
    }
    
    .leaderboard-entry {
        padding: 12px 20px;
        font-size: 0.95rem;
    }
    
    .leaderboard-entry .username {
        margin-left: 10px;
    }
    
    .time-input-container {
        gap: 15px;
    }
    
    .time-input {
        width: 70px;
        height: 55px;
        font-size: 1.3rem;
    }
}
