/* Custom CSS for 2025 Challenges Hugo Site */

:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --transition-speed: 0.3s;
}

/* Dark mode variables */
[data-theme="dark"] {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --light-color: #212529;
    --dark-color: #f8f9fa;
    --bg-color: #121212;
    --text-color: #f8f9fa;
    --card-bg: #2d2d2d;
    --border-color: #444;
}

/* Base styles */
body {
    font-family: var(--font-family);
    transition: background-color var(--transition-speed), color var(--transition-speed);
}

[data-theme="dark"] body {
    background-color: var(--bg-color);
    color: var(--text-color);
}

[data-theme="dark"] .card {
    background-color: var(--card-bg);
    border-color: var(--border-color);
}

[data-theme="dark"] .card-header,
[data-theme="dark"] .card-footer {
    background-color: rgba(0, 0, 0, 0.2);
    border-color: var(--border-color);
}

[data-theme="dark"] .bg-light {
    background-color: var(--light-color) !important;
}

[data-theme="dark"] .text-muted {
    color: #adb5bd !important;
}

[data-theme="dark"] .table {
    color: var(--text-color);
}

[data-theme="dark"] .table-hover tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.075);
}

/* Theme switch */
.theme-switch-wrapper {
    display: flex;
    align-items: center;
}

.theme-switch {
    display: inline-block;
    height: 24px;
    position: relative;
    width: 48px;
    margin-right: 10px;
}

.theme-switch input {
    display: none;
}

.slider {
    background-color: #ccc;
    bottom: 0;
    cursor: pointer;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
    transition: .4s;
}

.slider:before {
    background-color: white;
    bottom: 4px;
    content: "";
    height: 16px;
    left: 4px;
    position: absolute;
    transition: .4s;
    width: 16px;
}

input:checked + .slider {
    background-color: var(--primary-color);
}

input:checked + .slider:before {
    transform: translateX(24px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Challenge specific styles */
.challenge-content {
    margin-bottom: 2rem;
}

.challenge-meta {
    margin-bottom: 1.5rem;
}

.challenge-header {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color, #dee2e6);
}

.challenge-meta-inline .badge {
    font-size: 0.9rem;
    padding: 0.5rem 0.75rem;
}

.challenge-title-section h1 {
    margin-bottom: 1rem;
}

.milestone-item {
    transition: transform var(--transition-speed);
}

.milestone-item:hover {
    transform: translateY(-3px);
}

[data-theme="dark"] .challenge-header {
    border-bottom-color: var(--border-color, #444);
}

.challenge-gallery img {
    transition: transform var(--transition-speed);
    object-fit: cover;
    height: 180px;
    width: 100%;
}

.challenge-gallery img:hover {
    transform: scale(1.03);
}

.challenge-gallery .figure {
    height: 100%;
    margin-bottom: 0;
}

.challenge-gallery .figure-caption {
    font-size: 0.85rem;
    padding: 0.5rem;
}

/* Video container styles */
.video-container {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    margin-bottom: 0;
}

.video-container video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background-color: #000;
}

/* Ensure figures with videos have proper spacing */
.figure.card .video-container {
    margin: 0;
    border-top-left-radius: calc(0.25rem - 1px);
    border-top-right-radius: calc(0.25rem - 1px);
}

/* Adjust video height in gallery */
.challenge-gallery .video-container {
    padding-bottom: 100%; /* Square aspect ratio for gallery thumbnails */
}

.challenge-gallery .col {
    margin-bottom: 1rem;
}

/* Gallery image adjustments */
.challenge-gallery img {
    height: 280px; /* Further increased height */
    transition: all 0.3s ease;
    object-fit: cover;
    width: 100%;
}

.challenge-gallery .figure-caption {
    font-size: 0.85rem;
    line-height: 1.1; /* Further reduced line spacing */
    padding: 0.3rem 0.4rem; /* Minimized padding */
    color: var(--dark-color);
    margin-bottom: 0;
}

.challenge-gallery .figure.card {
    padding: 0; /* Remove padding */
    overflow: hidden;
    margin-bottom: 0.75rem; /* Reduced margin */
}

.challenge-gallery .card-body {
    padding: 0.3rem 0.4rem; /* Minimized padding */
}

[data-theme="dark"] .challenge-gallery .figure-caption {
    color: var(--light-color);
}

.gallery-image-link {
    display: block;
    overflow: hidden;
    border-top-left-radius: calc(0.25rem - 1px);
    border-top-right-radius: calc(0.25rem - 1px);
    cursor: zoom-in;
    flex-grow: 1; /* Take up available space */
}

.gallery-image-link:hover img {
    transform: scale(1.05);
}

/* Lightbox styles */
.lightbox-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: #000;
}

.lightbox-image-container {
    width: 100%;
    height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.lightbox-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
    cursor: grab;
}

.lightbox-image:active {
    cursor: grabbing;
}

.lightbox-caption {
    color: #fff;
    background-color: rgba(0, 0, 0, 0.7);
    width: 100%;
    padding: 10px;
    font-size: 1rem;
}

.lightbox-nav {
    position: absolute;
    width: 100%;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 10;
}

.lightbox-nav .btn {
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.lightbox-nav .btn:hover {
    opacity: 1;
}

.lightbox-nav .btn-prev {
    margin-right: auto;
}

.lightbox-nav .btn-next {
    margin-left: auto;
}

.modal-xl {
    max-width: 90%;
}

/* Responsive adjustments */
@media (max-width: 992px) {
    .challenge-gallery img {
        height: 240px;
    }
    
    .lightbox-image-container {
        height: 60vh;
    }
}

@media (max-width: 768px) {
    .challenge-gallery img {
        height: 220px;
    }
    
    .challenge-header {
        flex-direction: column;
    }
    
    .challenge-actions {
        margin-top: 1rem;
        align-self: flex-start;
    }
    
    .modal-xl {
        max-width: 100%;
        margin: 0.5rem;
    }
    
    .lightbox-nav .btn {
        padding: 0.25rem 0.5rem;
    }
}

@media (max-width: 576px) {
    .challenge-gallery img {
        height: 260px;
    }
    
    .lightbox-image-container {
        height: 50vh;
    }
    
    .challenge-gallery .row {
        row-gap: 0.5rem !important;
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .challenge-gallery img {
        height: 160px;
    }
    
    .challenge-header {
        flex-direction: column;
    }
    
    .challenge-actions {
        margin-top: 1rem;
        align-self: flex-start;
    }
}

@media (max-width: 576px) {
    .challenge-gallery img {
        height: 200px;
    }
    .jumbotron {
        padding: 2rem 1rem;
    }
    
    .challenge-sidebar {
        margin-top: 2rem;
    }
}