/* Aroice Photo Collage - Minimal Shuffled Gallery */

/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&display=swap');

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0a0a0a;
    color: #ffffff;
    overflow-x: hidden;
    line-height: 1.4;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Skip link for accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: #ffffff;
    color: #000000;
    padding: 8px 12px;
    text-decoration: none;
    border-radius: 4px;
    z-index: 1000;
    font-size: 14px;
    font-weight: 500;
    transition: top 0.3s ease;
}

.skip-link:focus {
    top: 6px;
}

/* Background */
.background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, #1a1a1a 0%, #0a0a0a 70%);
    z-index: -1;
}

/* Enhanced Header */
.gallery-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(10, 10, 10, 0.85);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
}

.gallery-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1400px;
    margin: 0 auto;
    padding: 15px 20px;
    position: relative;
}

.nav-left,
.nav-center,
.nav-right {
    flex: 1;
    display: flex;
    align-items: center;
}

.nav-left {
    justify-content: flex-start;
}

.nav-center {
    justify-content: center;
}

.nav-right {
    justify-content: flex-end;
}

.back-link {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 14px;
    font-weight: 400;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.back-link:hover,
.back-link:focus {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    outline: none;
    transform: translateY(-1px);
}

.gallery-title {
    text-align: center;
    color: #ffffff;
}

.title-main {
    display: block;
    font-size: 20px;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.title-subtitle {
    display: block;
    font-size: 12px;
    font-weight: 300;
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.control-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    width: 36px;
    height: 36px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.control-btn:active {
    transform: translateY(0);
}

/* Search button specific styling */
.search-btn {
    position: relative;
}

.search-btn:hover {
    background: rgba(102, 126, 234, 0.2);
    border-color: rgba(102, 126, 234, 0.3);
    color: #667eea;
}

.search-btn.active {
    background: rgba(102, 126, 234, 0.3);
    border-color: rgba(102, 126, 234, 0.5);
    color: #667eea;
}

.photo-counter {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 6px 12px;
}

.counter-text {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
    letter-spacing: 0.5px;
}

.loading-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #60a5fa, #3b82f6);
    width: 0%;
    transition: width 0.3s ease;
    box-shadow: 0 0 10px rgba(96, 165, 250, 0.5);
}

/* Main Container */
.gallery-container {
    margin-top: 90px;
    padding: 40px 20px 20px;
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
}

/* Gallery Introduction - Minimal */
.gallery-intro {
    text-align: center;
    margin-bottom: 80px;
    padding: 0 20px;
}

.gallery-heading {
    font-size: clamp(4rem, 10vw, 8rem);
    font-weight: 200;
    letter-spacing: -3px;
    color: #ffffff;
    opacity: 0.95;
    margin: 0;
    line-height: 0.85;
    background: linear-gradient(135deg, #ffffff 0%, #e0e0e0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-align: center;
}

/* Photo Collage Grid - Masonry Layout without gaps */
.photo-collage {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    grid-gap: 16px;
    grid-auto-rows: 10px; /* Small row height for masonry effect */
    padding: 0;
    margin: 0;
    line-height: 0;
}

/* Enhanced Photo Items - Stable Grid Layout */
.photo-item {
    position: relative;
    display: block;
    width: 100%;
    overflow: hidden;
    border-radius: 12px;
    background: linear-gradient(135deg, #0f0f0f 0%, #1a1a1a 100%);
    cursor: pointer;
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.4);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    align-self: start; /* Prevent grid stretching */
    
    /* Disable user selection and context menu */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-context-menu: none;
}

.photo-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, transparent 50%);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
    pointer-events: none;
    border-radius: 12px;
}

.photo-item:nth-child(odd) {
    transform: translateY(2px);
}

.photo-item:nth-child(even) {
    transform: translateY(-1px);
}

.photo-item:nth-child(3n) {
    transform: translateY(1px);
}

/* Touch states for mobile */
.photo-item:active {
    transform: translateY(-2px) scale(0.97);
}

/* Infinite scroll loading states */
.photo-item.entering {
    animation: slideInUp 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes slideInUp {
    0% {
        opacity: 0;
        transform: translateY(40px) scale(0.9);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Scroll sentinel for infinite loading */
.scroll-sentinel {
    height: 1px;
    width: 100%;
    background: transparent;
}

@keyframes fadeInUp {
    0% {
        opacity: 0;
        transform: translateY(30px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Photo Images - Stable Layout */
.photo-item img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    object-position: center;
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    filter: brightness(0.95) contrast(1.05) saturate(1.08);
    user-select: none;
    -webkit-user-drag: none;
    -webkit-touch-callout: none;
    position: relative;
    z-index: 0;
    
    /* Prevent layout shifts during loading */
    background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
}

/* Enhanced Hover Effects */
.photo-item:hover {
    transform: translateY(-12px) scale(1.03);
    z-index: 15;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.photo-item:hover::before {
    opacity: 1;
}

.photo-item:hover img {
    transform: scale(1.05);
    filter: brightness(1.08) contrast(1.18) saturate(1.25);
}

/* Enhanced Focus states for accessibility */
.photo-item:focus {
    outline: 3px solid rgba(255, 255, 255, 0.9);
    outline-offset: 4px;
    transform: translateY(-6px) scale(1.02);
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.5);
}

/* Footer */
.gallery-footer {
    margin-top: 80px;
    padding: 40px 20px;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 30px;
    opacity: 0.6;
}

.footer-content p {
    font-size: 14px;
    font-weight: 300;
    margin: 0;
}

.footer-links {
    display: flex;
    gap: 20px;
}

.footer-links a {
    color: inherit;
    text-decoration: none;
    font-size: 14px;
    font-weight: 300;
    transition: opacity 0.3s ease;
}

.footer-links a:hover,
.footer-links a:focus {
    opacity: 1;
    outline: none;
}

/* Enhanced Modal for image viewing */
.image-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.98);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(25px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.image-modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    margin: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: modalSlideIn 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-image {
    max-width: 100%;
    max-height: 80vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 16px;
    box-shadow: 0 30px 100px rgba(0, 0, 0, 0.9);
    filter: brightness(1.08) contrast(1.12) saturate(1.05);
    transition: all 0.3s ease;
}

.modal-info {
    margin-top: 24px;
    text-align: center;
    max-width: 600px;
    padding: 20px 24px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    animation: fadeInUp 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.3s both;
}

.modal-title {
    font-size: 24px;
    font-weight: 500;
    color: #ffffff;
    margin: 0 0 8px 0;
    letter-spacing: 0.5px;
    line-height: 1.3;
}

.modal-year {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 300;
    margin: 0;
    letter-spacing: 1px;
}

.modal-close {
    position: fixed;
    top: 24px;
    right: 24px;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    width: 52px;
    height: 52px;
    color: #ffffff;
    cursor: pointer;
    font-size: 26px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(25px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 200;
    z-index: 1001;
    line-height: 1;
    user-select: none;
}

.modal-close:hover,
.modal-close:focus {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: scale(1.08) rotate(90deg);
    outline: none;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

@keyframes modalSlideIn {
    0% {
        opacity: 0;
        transform: scale(0.85) translateY(40px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes fadeInUp {
    0% {
        opacity: 0;
        transform: translateY(30px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Enhanced Loading Animation */
.photo-item.loading {
    background: linear-gradient(135deg, #0f0f0f 0%, #1a1a1a 50%, #0f0f0f 100%);
    min-height: 280px;
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.photo-item.loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(110deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.03) 25%, 
        rgba(255, 255, 255, 0.08) 50%, 
        rgba(255, 255, 255, 0.03) 75%, 
        transparent 100%);
    background-size: 200% 100%;
    animation: smoothShimmer 2.5s ease-in-out infinite;
    transform: skewX(-15deg);
}

.photo-item.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 2px;
    height: 24px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 2px;
    animation: breathe 2s ease-in-out infinite;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
}

/* Smooth shimmer effect */
@keyframes smoothShimmer {
    0% {
        background-position: -200% 0;
        opacity: 0.6;
    }
    50% {
        opacity: 1;
    }
    100% {
        background-position: 200% 0;
        opacity: 0.6;
    }
}

/* Breathing effect for loading indicator */
@keyframes breathe {
    0%, 100% {
        opacity: 0.3;
        transform: translate(-50%, -50%) scaleY(1);
    }
    50% {
        opacity: 0.8;
        transform: translate(-50%, -50%) scaleY(1.2);
    }
}

/* Image transition on load */
.photo-item img {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.photo-item:not(.loading) img {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Responsive Design - Masonry Grid Layout */
@media (max-width: 1200px) {
    .photo-collage {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        grid-gap: 12px;
        grid-auto-rows: 8px;
    }
    
    .photo-item {
        border-radius: 8px;
    }
}

@media (max-width: 900px) {
    .gallery-container {
        margin-top: 75px;
        padding: 25px 15px;
    }
    
    .photo-collage {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        grid-gap: 10px;
        grid-auto-rows: 8px;
    }
    
    .photo-item {
        border-radius: 8px;
    }
    
    .gallery-intro {
        margin-bottom: 50px;
    }
    
    .gallery-nav {
        padding: 12px 15px;
    }
    
    .title-main {
        font-size: 18px;
    }
    
    .title-subtitle {
        font-size: 11px;
    }
    
    .header-controls {
        gap: 8px;
    }
    
    .control-btn {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }
    
    .photo-counter {
        padding: 4px 8px;
    }
    
    .counter-text {
        font-size: 11px;
    }
}

@media (max-width: 768px) {
    .gallery-container {
        margin-top: 75px;
        padding: 20px 12px;
    }
    
    .photo-collage {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        grid-gap: 8px;
        grid-auto-rows: 6px;
    }
    
    .photo-item {
        border-radius: 6px;
        box-shadow: 0 3px 15px rgba(0, 0, 0, 0.4);
    }
    
    .photo-item:hover {
        transform: translateY(-6px) scale(1.02);
        box-shadow: 0 12px 35px rgba(0, 0, 0, 0.6);
    }
    
    .gallery-nav {
        padding: 12px 15px;
        align-items: center;
    }
    
    .title-main {
        font-size: 16px;
    }
    
    .title-subtitle {
        font-size: 10px;
    }
    
    .back-link {
        font-size: 13px;
        padding: 6px 10px;
        border-radius: 10px;
        background: rgba(255, 255, 255, 0.08);
        backdrop-filter: blur(10px);
    }
    
    .header-controls {
        gap: 6px;
    }
    
    .control-btn {
        width: 30px;
        height: 30px;
        font-size: 11px;
        background: rgba(255, 255, 255, 0.08);
        backdrop-filter: blur(10px);
    }
    
    .photo-counter {
        padding: 3px 6px;
        background: rgba(255, 255, 255, 0.08);
        backdrop-filter: blur(10px);
        border-radius: 10px;
    }
    
    .counter-text {
        font-size: 10px;
    }
    
    .gallery-intro {
        margin-bottom: 40px;
        padding: 0 10px;
    }
    
    .gallery-heading {
        font-size: clamp(3rem, 10vw, 5rem);
        letter-spacing: -2px;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 15px;
    }
    
    /* Enhanced modal for mobile */
    .modal-close {
        top: 16px;
        right: 16px;
        width: 46px;
        height: 46px;
        font-size: 22px;
    }
    
    .modal-content {
        margin: 16px;
        max-width: 92vw;
        max-height: 88vh;
    }
    
    .modal-image {
        max-height: 70vh;
        border-radius: 12px;
    }
    
    .modal-info {
        margin-top: 16px;
        padding: 16px 20px;
    }
    
    .modal-title {
        font-size: 20px;
        margin-bottom: 6px;
    }
    
    .modal-year {
        font-size: 14px;
    }
}

@media (max-width: 600px) {
    .gallery-container {
        padding: 18px 10px;
        margin-top: 60px;
    }
    
    .photo-collage {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        grid-gap: 8px;
        grid-auto-rows: 6px;
    }
    
    .photo-item {
        border-radius: 6px;
    }
    
    .gallery-heading {
        font-size: clamp(2.5rem, 12vw, 4rem);
        letter-spacing: -1.5px;
    }
    
    .gallery-intro {
        margin-bottom: 35px;
    }
}

@media (max-width: 480px) {
    .gallery-container {
        padding: 15px 8px;
        margin-top: 85px; /* Increased for better spacing */
    }
    
    .photo-collage {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        grid-gap: 6px;
        grid-auto-rows: 5px;
    }
    
    .photo-item {
        border-radius: 4px;
    }
    
    .gallery-header {
        padding: 0;
        background: rgba(0, 0, 0, 0.95);
        backdrop-filter: blur(20px);
    }
    
    .gallery-nav {
        padding: 10px 12px;
        flex-direction: row; /* Keep horizontal layout */
        gap: 8px;
        align-items: center;
        justify-content: space-between;
    }
    
    .nav-left {
        flex: 0 0 auto;
        justify-content: flex-start;
    }
    
    .nav-center {
        flex: 1;
        text-align: center;
        order: 0; /* Keep natural order */
    }
    
    .nav-right {
        flex: 0 0 auto;
        justify-content: flex-end;
    }
    
    .title-main {
        font-size: 13px;
        font-weight: 600;
    }
    
    .title-subtitle {
        font-size: 8px;
        opacity: 0.8;
        margin-top: 1px;
    }
    
    .back-link {
        font-size: 11px;
        gap: 4px;
        padding: 6px 10px;
        border-radius: 12px;
        background: rgba(255, 255, 255, 0.1);
        backdrop-filter: blur(10px);
    }
    
    .header-controls {
        gap: 6px;
        justify-content: flex-end;
        align-items: center;
    }
    
    .control-btn {
        width: 32px;
        height: 32px;
        font-size: 11px;
        border-radius: 8px;
        background: rgba(255, 255, 255, 0.1);
        backdrop-filter: blur(10px);
    }
    
    .photo-counter {
        padding: 4px 8px;
        border-radius: 12px;
        background: rgba(255, 255, 255, 0.1);
        backdrop-filter: blur(10px);
        margin-left: 4px;
    }
    
    .counter-text {
        font-size: 10px;
        font-weight: 500;
    }
    
    .gallery-heading {
        font-size: clamp(2.2rem, 11vw, 3.5rem);
        letter-spacing: -1px;
    }
    
    .gallery-intro {
        margin-bottom: 30px;
        padding: 0 5px;
    }
    
    /* Mobile modal improvements */
    .modal-close {
        top: 12px;
        right: 12px;
        width: 42px;
        height: 42px;
        font-size: 20px;
    }
    
    .modal-content {
        margin: 10px;
        max-width: 95vw;
        max-height: 90vh;
    }
    
    .modal-image {
        border-radius: 10px;
        max-height: 65vh;
    }
    
    .modal-info {
        margin-top: 12px;
        padding: 12px 16px;
    }
    
    .modal-title {
        font-size: 18px;
        margin-bottom: 4px;
    }
    
    .modal-year {
        font-size: 13px;
    }
}

/* Extra small screens */
@media (max-width: 380px) {
    .gallery-container {
        padding: 12px 6px;
    }
    
    .photo-collage {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        grid-gap: 4px;
        grid-auto-rows: 4px;
    }
    
    .photo-item {
        border-radius: 3px;
    }
    
    .gallery-heading {
        font-size: clamp(2rem, 10vw, 3rem);
    }
    
    .gallery-intro {
        margin-bottom: 25px;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .photo-item {
        border: 2px solid #ffffff;
    }
    
    .back-link:focus,
    .modal-close:focus {
        outline: 3px solid #ffffff;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .photo-item,
    .photo-item img,
    .image-modal,
    .back-link {
        transition: none;
    }
    
    .photo-item:hover {
        transform: none;
    }
    
    .photo-item:hover img {
        transform: none;
    }
    
    .photo-item.loading {
        animation: none;
    }
}

/* Print styles */
@media print {
    .gallery-header,
    .gallery-footer {
        display: none;
    }
    
    .photo-collage {
        grid-template-columns: repeat(3, 1fr);
        grid-gap: 15px;
    }
    
    .photo-item {
        break-inside: avoid;
        page-break-inside: avoid;
    }
    
    .photo-item img {
        filter: none;
    }
    
    .gallery-heading {
        color: #000000;
        -webkit-text-fill-color: #000000;
    }
}

/* ===== SEARCH FUNCTIONALITY STYLES ===== */

/* Search Overlay */

.search-overlay {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    z-index: 10000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 80px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: auto;
}

/* Dedicated blur layer behind search popup */
 .search-overlay-blur {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(32px) saturate(1.2);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Remove blur background content when search is active */
body.search-active {
    overflow: hidden;
}

.search-container {
    width: 90%;
    max-width: 900px;
    max-height: 80vh;
    background: rgba(15, 15, 15, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    backdrop-filter: blur(8px) saturate(1.1);
    padding: 30px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    transform: scale(0.9) translateY(-20px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), 
                0 10px 40px rgba(0, 0, 0, 0.4);
    position: relative;
    overflow: hidden;
    z-index: 2;
}

.search-overlay.active .search-container {
    transform: scale(1) translateY(0);
}

/* Search Header */
.search-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.search-header h3 {
    color: #ffffff;
    font-size: 24px;
    font-weight: 600;
    margin: 0;
    background: linear-gradient(135deg, #ffffff 0%, #cccccc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.search-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 10px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.3s ease;
}

.search-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

/* Search Input */
.search-input-container {
    position: relative;
    display: flex;
    align-items: center;
}

#search-input {
    width: 100%;
    padding: 15px 20px;
    padding-right: 50px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    color: #ffffff;
    font-size: 16px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    outline: none;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    backdrop-filter: blur(10px);
}

#search-input::placeholder {
    color: rgba(255, 255, 255, 0.6);
    transition: color 0.3s ease;
}

#search-input:focus {
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 25px rgba(255, 255, 255, 0.1), 
                0 0 0 3px rgba(255, 255, 255, 0.05);
    transform: translateY(-1px);
}

#search-input:focus::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.search-clear {
    position: absolute;
    right: 10px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 8px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    opacity: 0;
    visibility: hidden;
    transform: scale(0.8);
}

.search-clear.visible {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}

.search-clear:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    transform: scale(1.1);
}

/* Search Filters */
.search-filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    padding: 10px 0;
}

.filter-btn {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    font-weight: 300;
}

.filter-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.9);
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

.filter-btn.active {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.1);
    font-weight: 400;
}

/* Search Results */
.search-results {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.search-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.results-count {
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    font-weight: 500;
}

.results-sort {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 10px;
    padding: 8px 12px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.results-sort:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.search-results-grid {
    flex: 1;
    overflow-y: auto;
    padding: 20px 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    grid-auto-rows: 150px;
    gap: 22px;
    max-height: 420px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
    align-items: stretch;
}

.search-results-grid::-webkit-scrollbar {
    width: 6px;
}

.search-results-grid::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.search-results-grid::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.search-results-grid::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Search Result Items */
.search-result-item {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.4s ease-out forwards;
}

.search-result-item:nth-child(even) {
    animation-delay: 0.1s;
}

.search-result-item:nth-child(3n) {
    animation-delay: 0.2s;
}

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

.search-result-item:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4), 0 4px 12px rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
}

.search-result-item:active {
    transform: translateY(-1px) scale(0.98);
}

.search-result-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.search-result-item:hover img {
    transform: scale(1.05);
}

.search-result-info {
    padding: 10px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
}

.search-result-title {
    color: #ffffff;
    font-size: 12px;
    font-weight: 500;
    margin: 0 0 4px 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.search-result-year {
    color: rgba(255, 255, 255, 0.6);
    font-size: 11px;
    margin: 0;
}

/* Search Highlight */
.search-highlight {
    background: rgba(255, 255, 255, 0.9);
    color: #000000;
    padding: 1px 3px;
    border-radius: 3px;
    font-weight: 600;
}

/* No Results */
.no-results {
    text-align: center;
    padding: 40px 20px;
    color: rgba(255, 255, 255, 0.6);
    
}

.no-results i {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}

.no-results h4 {
    color: rgba(255, 255, 255, 0.8);
    margin: 0 0 10px 0;
    font-size: 18px;
}

.no-results p {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
}

/* Mobile Search Styles */
@media (max-width: 768px) {
    .search-overlay {
        padding-top: 60px;
        align-items: flex-start;
    }
    
    .search-container {
        width: 95%;
        padding: 20px;
        max-height: 85vh;
        border-radius: 15px;
        transform: scale(0.95) translateY(-15px);
    }
    
    .search-overlay.active .search-container {
        transform: scale(1) translateY(0);
    }
    
    .search-header h3 {
        font-size: 20px;
    }
    
    #search-input {
        padding: 12px 15px;
        padding-right: 45px;
        font-size: 16px;
        border-radius: 12px;
    }
    
    .search-filters {
        gap: 8px;
        justify-content: flex-start;
        overflow-x: auto;
        padding: 5px 0;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    
    .search-filters::-webkit-scrollbar {
        display: none;
    }
    
    .filter-btn {
        padding: 8px 14px;
        font-size: 13px;
        white-space: nowrap;
        flex-shrink: 0;
    }
    
    .search-results-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        grid-gap: 12px;
        max-height: 320px;
        padding: 15px 0;
    }
}

/* No Results and Loading States */
.search-no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 20px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 16px;
    font-weight: 300;
}

.search-loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 20px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 16px;
    font-weight: 300;
}

.search-loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    margin-left: 10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: rgba(255, 255, 255, 0.8);
    animation: spin 1s linear infinite;
    vertical-align: middle;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Search Result Count */
.search-count {
    font-size: 14px;
    color: #888;
    margin-bottom: 15px;
    font-weight: 300;
}

.search-count strong {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 400;
}    .search-result-item img {
        height: 100px;
    }
    
    .search-result-info {
        padding: 8px;
    }
    
    .search-result-title {
        font-size: 11px;
    }
    
    .search-result-year {
        font-size: 10px;
    }


@media (max-width: 480px) {
    .search-overlay {
        padding-top: 40px;
    }
    
    .search-container {
        padding: 15px;
        border-radius: 12px;
        transform: scale(0.98) translateY(-10px);
    }
    
    .search-overlay.active .search-container {
        transform: scale(1) translateY(0);
    }
    
    .search-results-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    
    .search-results-grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        grid-gap: 10px;
        max-height: 250px;
    }
}
