/* ========================================
   GALLERY STYLES - Festuj.cz
   ======================================== */

/* Variables */
:root {
    --festuj-orange: #f58526;
    --festuj-gray: #afafb2;
    --transition-speed: 250ms;
}

/* ========================================
   NAVIGATION STYLES
   ======================================== */

/* Dropdown menu */
.dropdown-menu:hover .dropdown-content {
    display: block !important;
}

.dropdown-content {
    z-index: 1000;
    border: 2px solid transparent;
    transition: border-color 0.3s ease;
}

/* Animace oranžového ohraničení celého dropdownu */
@keyframes dropdownBorderAnimation {
    0% {
        border-top-color: transparent;
        border-right-color: transparent;
        border-bottom-color: transparent;
        border-left-color: transparent;
    }
    25% {
        border-top-color: var(--festuj-orange);
        border-right-color: transparent;
        border-bottom-color: transparent;
        border-left-color: transparent;
    }
    50% {
        border-top-color: var(--festuj-orange);
        border-right-color: var(--festuj-orange);
        border-bottom-color: transparent;
        border-left-color: transparent;
    }
    75% {
        border-top-color: var(--festuj-orange);
        border-right-color: var(--festuj-orange);
        border-bottom-color: var(--festuj-orange);
        border-left-color: transparent;
    }
    100% {
        border-top-color: var(--festuj-orange);
        border-right-color: var(--festuj-orange);
        border-bottom-color: var(--festuj-orange);
        border-left-color: var(--festuj-orange);
    }
}

.dropdown-menu:hover .dropdown-content {
    animation: dropdownBorderAnimation 0.6s ease forwards;
}

/* Jednotlivé položky - lehké oranžové zabarvení při hoveru */
.dropdown-content a {
    position: relative;
    transition: all 0.3s ease;
}

.dropdown-content a:hover {
    background: rgba(245, 133, 38, 0.1);
    border-left-color: var(--festuj-orange);
}

/* Oranžová šipka když je dropdown aktivní */
.dropdown-menu:hover .nav-link svg {
    color: var(--festuj-orange);
}

.dropdown-menu .nav-link svg {
    transition: color 0.3s ease, transform 0.3s ease;
}

.dropdown-menu:hover .nav-link svg {
    transform: rotate(180deg);
}

/* Vypnout oranžovou linku pod "Naše akce" */
.dropdown-menu .nav-link::after {
    display: none;
}

/* Nav links */
.nav-link {
    position: relative;
    transition: color 0.3s ease;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--festuj-orange);
    transition: width 0.3s ease;
}

.nav-link:hover::after {
    width: 100%;
}

/* ========================================
   GALLERY GRID
   ======================================== */

#gallery-grid {
    opacity: 1;
    transition: opacity var(--transition-speed) ease;
}

#gallery-grid.loading {
    opacity: 0.5;
}

.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 0.5rem;
    cursor: pointer;
    aspect-ratio: 1;
    background: #e5e7eb;
    opacity: 0;
    animation: fadeIn 0.4s ease forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Stagger animation for gallery items */
.gallery-item:nth-child(1) { animation-delay: 0.05s; }
.gallery-item:nth-child(2) { animation-delay: 0.1s; }
.gallery-item:nth-child(3) { animation-delay: 0.15s; }
.gallery-item:nth-child(4) { animation-delay: 0.2s; }
.gallery-item:nth-child(5) { animation-delay: 0.25s; }
.gallery-item:nth-child(6) { animation-delay: 0.3s; }
.gallery-item:nth-child(7) { animation-delay: 0.35s; }
.gallery-item:nth-child(8) { animation-delay: 0.4s; }

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-speed) ease;
}

.gallery-item:hover img {
    transform: scale(1.1);
}

.gallery-item::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent 60%, rgba(0,0,0,0.5));
    opacity: 0;
    transition: opacity var(--transition-speed) ease;
}

.gallery-item:hover::after {
    opacity: 1;
}

/* Gallery item caption */
.gallery-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1rem;
    color: white;
    font-size: 0.875rem;
    font-weight: 600;
    transform: translateY(100%);
    transition: transform var(--transition-speed) ease;
    z-index: 1;
}

.gallery-item:hover .gallery-caption {
    transform: translateY(0);
}

/* ========================================
   LIGHTBOX
   ======================================== */

.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    opacity: 0;
    transition: opacity 300ms ease;
}

.lightbox.active {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
}

.lightbox-image {
    max-width: 90%;
    max-height: 90vh;
    object-fit: contain;
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 300ms ease, transform 300ms ease;
}

.lightbox.active .lightbox-image {
    opacity: 1;
    transform: scale(1);
}

.lightbox-spinner {
    display: none;
    position: absolute;
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.25);
    border-top-color: var(--festuj-orange);
    border-radius: 50%;
    animation: lightbox-spin 800ms linear infinite;
}

.lightbox-spinner.active {
    display: block;
}

@keyframes lightbox-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Lightbox Controls */
.lightbox-close,
.lightbox-prev,
.lightbox-next {
    position: absolute;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-size: 2rem;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    backdrop-filter: blur(10px);
    z-index: 10000;
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
    background: var(--festuj-orange);
    border-color: var(--festuj-orange);
    transform: scale(1.1);
}

.lightbox-close {
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    line-height: 1;
    padding: 0;
}

.lightbox-prev,
.lightbox-next {
    top: 50%;
    transform: translateY(-50%);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

.lightbox-prev:hover,
.lightbox-next:hover {
    transform: translateY(-50%) scale(1.1);
}

/* Lightbox Counter */
.lightbox-counter {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    backdrop-filter: blur(10px);
}

/* ========================================
   SKELETON LOADER
   ======================================== */

.skeleton-loader {
    background: linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 50%, #e5e7eb 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

/* Mobile (320px - 767px) */
@media (max-width: 767px) {
    .lightbox-prev,
    .lightbox-next {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }
    
    .lightbox-prev {
        left: 10px;
    }
    
    .lightbox-next {
        right: 10px;
    }
    
    .lightbox-close {
        width: 40px;
        height: 40px;
        top: 10px;
        right: 10px;
        font-size: 2rem;
    }
    
    .lightbox-counter {
        bottom: 20px;
        font-size: 0.875rem;
        padding: 8px 16px;
    }
    
    .lightbox-image {
        max-width: 95%;
    }
}

/* Tablet (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
    #gallery-grid {
        gap: 1rem;
    }
}

/* Desktop (1024px+) */
@media (min-width: 1024px) {
    #gallery-grid {
        gap: 1.5rem;
    }
    
    .gallery-item {
        border-radius: 0.75rem;
    }
}

/* Large Desktop (1440px+) */
@media (min-width: 1440px) {
    #gallery-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* ========================================
   FILTERS
   ======================================== */

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='%23666' d='M8 12L2 6h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1.5rem center;
    padding-right: 4.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

select:hover {
    box-shadow: 0 4px 12px rgba(245, 133, 38, 0.15);
}

select:focus {
    box-shadow: 0 4px 16px rgba(245, 133, 38, 0.25);
}

/* Filter container */
.filter-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Labels */
label {
    font-family: 'Inter', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ========================================
   ACCESSIBILITY
   ======================================== */

/* Focus states */
.gallery-item:focus,
.lightbox-close:focus,
.lightbox-prev:focus,
.lightbox-next:focus,
select:focus {
    outline: 3px solid var(--festuj-orange);
    outline-offset: 2px;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
    .lightbox,
    header,
    footer,
    #event-filter,
    #year-filter {
        display: none !important;
    }
    
    #gallery-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 0.5rem !important;
    }
}
