/**
 * Competition UX Improvements
 * Clickable competition cards with images and proper theme support
 */

/* ===========================================
   1. COMPETITION CARDS - Browse Page (Clickable Design)
   =========================================== */

/* Card link wrapper - makes entire card clickable */
.competition-card-link {
    text-decoration: none !important;
    color: inherit !important;
    display: block;
    height: 100%;
}

.competition-card-link:hover {
    text-decoration: none !important;
    color: inherit !important;
}

/* Main card styling */
.competition-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid #dee2e6;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    background-color: #ffffff;
}

.competition-card:hover {
    box-shadow: 0 12px 40px rgba(0,0,0,0.15) !important;
}

/* Image wrapper for positioning overlays */
.competition-image-wrapper {
    position: relative;
    height: 180px;
    overflow: hidden;
}

/* Competition image */
.competition-card .competition-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.competition-card:hover .competition-image {
    transform: scale(1.05);
}

/* Placeholder for competitions without images */
.competition-image-placeholder {
    width: 100%;
    height: 180px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.competition-image-placeholder i {
    font-size: 4rem;
    color: rgba(255, 255, 255, 0.5);
}

/* Status badge overlay */
.status-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.status-open { background-color: #28a745; color: white; }
.status-closingsoon { background-color: #fd7e14; color: white; }
.status-full { background-color: #dc3545; color: white; }
.status-upcoming { background-color: #007bff; color: white; }
.status-ended { background-color: #6c757d; color: white; }
.status-cancelled { background-color: #6c757d; color: white; }

/* Joined indicator overlay */
.joined-indicator {
    position: absolute;
    top: 12px;
    left: 12px;
    background: #28a745;
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* Card body */
.competition-card .card-body {
    padding: 1.25rem;
}

.competition-card .competition-name {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: #212529;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.competition-card .card-text {
    color: #6c757d;
}

.competition-card .card-text .text-dark {
    color: #212529 !important;
}

.competition-description {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.5;
}

/* Card footer */
.competition-card .card-footer {
    padding: 0.75rem 1.25rem;
}

/* ===========================================
   1b. LEGACY SIMPLIFIED CARDS (kept for compatibility)
   =========================================== */

/* Simplified card structure */
.competition-card-simplified {
    transition: all 0.3s ease;
    border: 1px solid #dee2e6;
    overflow: hidden;
    background-color: #ffffff;
}

.competition-card-simplified:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1) !important;
    transform: translateY(-2px);
}

/* Essential info section (always visible) */
.competition-essential {
    padding: 1.25rem;
}

.competition-essential .competition-name {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #212529;
    line-height: 1.3;
}

.competition-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    align-items: center;
}

.competition-meta-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.875rem;
    color: #6c757d;
}

.competition-meta-item i {
    font-size: 0.875rem;
    opacity: 0.7;
}

/* Status badges with better visual hierarchy */
.competition-status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-block;
}

.status-active {
    background-color: #28a745;
    color: white;
}

/* Collapse toggle button */
.competition-toggle-details {
    background: none;
    border: none;
    color: #007bff;
    font-size: 0.875rem;
    padding: 0.25rem 0;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.competition-toggle-details:hover {
    color: #0056b3;
    text-decoration: underline;
}

.competition-toggle-details i {
    transition: transform 0.3s ease;
    font-size: 0.75rem;
}

.competition-toggle-details[aria-expanded="true"] i {
    transform: rotate(180deg);
}

/* Collapsible details section */
.competition-details-collapse {
    border-top: 1px solid #e9ecef;
    padding: 0;
    background-color: #f8f9fa;
}

.competition-details-content {
    padding: 1rem 1.25rem;
}

.competition-details-content h6 {
    font-size: 0.875rem;
    font-weight: 600;
    color: #212529;
    margin-bottom: 0.5rem;
    margin-top: 1rem;
}

.competition-details-content h6:first-child {
    margin-top: 0;
}

.competition-details-content p {
    font-size: 0.875rem;
    color: #495057;
    line-height: 1.5;
    margin-bottom: 0.5rem;
}

/* Action buttons */
.competition-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e9ecef;
}

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

/* ===========================================
   2. COMPETITION DETAILS PAGE - Tabs
   =========================================== */

/* Enhanced tab navigation */
.competition-tabs {
    border-bottom: 2px solid var(--bs-gray-300, #dee2e6);
    margin-bottom: 1.5rem;
}

.competition-tabs .nav-link {
    color: var(--bs-gray-600, #6c757d);
    border: none;
    border-bottom: 3px solid transparent;
    padding: 0.75rem 1rem;
    font-weight: 500;
    transition: all 0.2s ease;
    background: none;
}

.competition-tabs .nav-link:hover {
    color: var(--bs-primary, #007bff);
    background-color: var(--bs-gray-50, #f8f9fa);
}

.competition-tabs .nav-link.active {
    color: var(--bs-primary, #007bff);
    border-bottom-color: var(--bs-primary, #007bff);
    background: none;
}

.competition-tabs .nav-link i {
    margin-right: 0.5rem;
}

/* Tab content sections */
.tab-pane {
    animation: fadeIn 0.3s ease;
}

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

/* Overview section - Quick stats */
.competition-quick-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bs-white, #ffffff);
    border: 1px solid var(--bs-gray-200, #e9ecef);
    border-radius: 0.5rem;
    padding: 1rem;
    text-align: center;
}

.stat-card-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--bs-primary, #007bff);
    margin-bottom: 0.25rem;
}

.stat-card-label {
    font-size: 0.875rem;
    color: var(--bs-gray-600, #6c757d);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===========================================
   3. MOBILE OPTIMIZATIONS
   =========================================== */

@media (max-width: 767px) {
    /* Mobile card improvements */
    .competition-card-simplified {
        margin-bottom: 1rem;
        border-radius: 0.5rem;
    }

    .competition-essential {
        padding: 1rem;
    }

    .competition-essential .competition-name {
        font-size: 1.1rem;
    }

    .competition-meta-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .competition-meta-item {
        width: 100%;
    }

    .competition-actions {
        flex-direction: column;
    }

    .competition-actions .btn {
        width: 100%;
        padding: 0.75rem;
    }

    /* Mobile tabs - horizontal scroll */
    .competition-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
        margin-left: -1rem;
        margin-right: -1rem;
        padding: 0 1rem;
    }

    .competition-tabs .nav-item {
        display: inline-block;
        float: none;
    }

    .competition-tabs .nav-link {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }

    /* Mobile quick stats */
    .competition-quick-stats {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }

    .stat-card {
        padding: 0.75rem;
    }

    .stat-card-value {
        font-size: 1.25rem;
    }

    /* Sticky action button on mobile */
    .mobile-sticky-actions {
        position: fixed;
        bottom: 60px; /* Above mobile nav if present */
        left: 0;
        right: 0;
        background: white;
        border-top: 1px solid var(--bs-gray-200, #e9ecef);
        padding: 0.75rem 1rem;
        z-index: 1020;
        display: none;
    }

    @media (max-width: 767px) {
        .mobile-sticky-actions {
            display: block;
        }

        .desktop-actions {
            display: none;
        }
    }
}

/* ===========================================
   4. DARK MODE SUPPORT (Class-based)
   =========================================== */

/* Dark mode for clickable cards */
html.dark-mode .competition-card {
    background-color: #1e1e1e;
    border-color: #444;
}

html.dark-mode .competition-card .competition-name {
    color: #f8f9fa;
}

html.dark-mode .competition-card .card-text {
    color: #adb5bd;
}

html.dark-mode .competition-card .card-text .text-dark {
    color: #f8f9fa !important;
}

html.dark-mode .competition-card .card-footer {
    border-color: #444;
}

html.dark-mode .competition-card .text-muted {
    color: #adb5bd !important;
}

html.dark-mode .competition-card .text-success {
    color: #5cb85c !important;
}

html.dark-mode .competition-card .text-primary {
    color: #6ea8fe !important;
}

/* Dark mode for simplified cards (legacy) */
html.dark-mode .competition-card-simplified {
    background-color: #1e1e1e;
    border-color: #444;
}

html.dark-mode .competition-essential .competition-name {
    color: #f8f9fa;
}

html.dark-mode .competition-meta-item {
    color: #adb5bd;
}

html.dark-mode .competition-details-collapse {
    background-color: #2d2d2d;
    border-color: #444;
}

html.dark-mode .competition-details-content h6 {
    color: #f8f9fa;
}

html.dark-mode .competition-details-content p {
    color: #dee2e6;
}

/* Dark mode for tabs */
html.dark-mode .competition-tabs .nav-link {
    color: #adb5bd;
}

html.dark-mode .competition-tabs .nav-link:hover {
    background-color: #2d2d2d;
}

html.dark-mode .competition-tabs .nav-link.active {
    color: #6ea8fe;
    border-bottom-color: #6ea8fe;
}

/* Dark mode for stat cards */
html.dark-mode .stat-card {
    background-color: #2d2d2d;
    border-color: #444;
}

html.dark-mode .stat-card-value {
    color: #6ea8fe;
}

html.dark-mode .stat-card-label {
    color: #adb5bd;
}

/* Dark mode filter sidebar */
html.dark-mode .filter-sidebar .card {
    background-color: #1e1e1e;
    border-color: #444;
}

html.dark-mode .filter-sidebar .card-title {
    color: #f8f9fa;
}

html.dark-mode .filter-sidebar .form-label {
    color: #f8f9fa;
}

html.dark-mode .filter-sidebar .form-select {
    background-color: #2d2d2d;
    border-color: #444;
    color: #f8f9fa;
}

html.dark-mode .filter-sidebar .text-muted {
    color: #adb5bd !important;
}

/* ===========================================
   5. ANIMATIONS & TRANSITIONS
   =========================================== */

/* Smooth collapse animation */
.collapsing {
    transition: height 0.35s ease;
}

/* Button hover effects */
.btn-join-competition {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.btn-join-competition::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-join-competition:hover::before {
    width: 300px;
    height: 300px;
}

/* ===========================================
   6. ACCESSIBILITY
   =========================================== */

/* Focus indicators */
.competition-toggle-details:focus,
.competition-tabs .nav-link:focus,
.btn:focus {
    outline: 2px solid var(--bs-primary, #007bff);
    outline-offset: 2px;
}

/* Screen reader only content */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

/* Ensure minimum touch target sizes */
.competition-toggle-details,
.competition-actions .btn,
.competition-tabs .nav-link {
    min-height: 44px;
    min-width: 44px;
}