/* =========================================
   GALLERY PAGE V2 STYLES
   ========================================= */

/* --- Header Adjustments --- */
.race-title-bar {
    margin-bottom: 1.5rem;
}

.race-controls-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

/* Custom Selects (Matches Track Records) */
.custom-select {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #fff;
    color: var(--color-text-dark);
    font-size: 0.9rem;
    cursor: pointer;
    outline: none;
    height: 38px;
    min-width: 150px;
}

.custom-select:focus {
    border-color: var(--color-primary);
}

.btn-quick-link {
    background-color: #fff;
    color: var(--color-primary);
    border: 1px solid var(--color-primary);
    width: 38px;
    height: 38px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-quick-link:hover {
    background-color: var(--color-primary);
    color: #fff;
}

/* --- Date Filters Row (Expandable) --- */
.date-filters-wrapper {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    border: 1px solid #eee;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.date-inputs {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.input-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: #555;
}

.custom-date-input {
    padding: 0.4rem;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.btn-apply {
    background-color: var(--color-primary);
    color: #fff;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
}

.btn-clear {
    background: none;
    border: none;
    color: #888;
    text-decoration: underline;
    cursor: pointer;
}

/* --- Gallery Grid V2 --- */
.gallery-grid-v2 {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    padding-bottom: 3rem;
}

.gallery-item-card {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    border: 1px solid #eee;
    display: flex;
    flex-direction: column;
}

.gallery-item-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    border-color: var(--color-secondary);
}

.media-thumbnail-wrapper {
    position: relative;
    width: 100%;
    height: 200px;
    background-color: #f0f0f0;
    overflow: hidden;
}

.media-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.gallery-item-card:hover .media-thumb {
    transform: scale(1.05);
}

/* Type Badge (Video/Photo) */
.media-type-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Play Icon Overlay for Videos */
.play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3rem;
    color: rgba(255, 255, 255, 0.8);
    opacity: 0.8;
    transition: all 0.2s;
}

.gallery-item-card:hover .play-overlay {
    color: var(--color-secondary);
    transform: translate(-50%, -50%) scale(1.1);
}

.media-info {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.media-category {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--color-primary);
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.media-title {
    font-size: 1rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.media-date {
    font-size: 0.8rem;
    color: #999;
    margin-top: auto;
    /* Push to bottom */
}

/* --- Empty & Loading States --- */
.section-empty,
.loading-state {
    text-align: center;
    padding: 4rem 1rem;
    color: #888;
    background: #fff;
    border-radius: 8px;
    margin-top: 1rem;
}

.loading-state {
    color: var(--color-primary);
}

.hidden {
    display: none !important;
}

/* --- Modal Styles --- */
.gallery-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(5px);
    justify-content: center;
    align-items: center;
}

.gallery-modal-content {
    width: 100%;
    max-width: 1000px;
    height: auto;
    max-height: 90vh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.gallery-modal-image {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 4px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

/* Video Wrapper for Responsive Aspect Ratio */
.video-embed-wrap {
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
}

.gallery-modal-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10001;
}

.gallery-modal-close:hover {
    color: var(--color-secondary);
}

/* --- Mobile --- */
@media (max-width: 768px) {
    .race-title-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .race-controls-wrapper {
        width: 100%;
        flex-wrap: wrap;
        margin-left: 0;
    }

    .custom-select {
        flex-grow: 1;
    }

    .date-inputs {
        flex-direction: column;
        align-items: stretch;
    }
}