/* Text shadow utility */
.text-shadow-lg {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* Loading Spinner */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    border-top-color: rgb(220, 38, 38);
    animation: spin 1s ease-in-out infinite;
}

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

/* Movie Cards */
.movie-card img {
    transition: transform 0.3s ease-in-out;
}

/* Search Results Styling */
#search-results {
    scrollbar-width: thin;
    scrollbar-color: rgba(229, 9, 20, 0.5) rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(8px);
    max-height: 70vh;
    overflow-y: auto;
}

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

#search-results::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

#search-results::-webkit-scrollbar-thumb {
    background-color: rgba(229, 9, 20, 0.5);
    border-radius: 3px;
}

/* Search Input States */
#search-input {
    transition: all 0.3s ease;
}

#search-input.searching {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='rgba(255, 255, 255, 0.5)'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1.5rem;
}

/* Search Results Animation */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#search-results:not(.hidden) {
    animation: slideDown 0.2s ease-out;
}

/* Swiper Customization */
.swiper {
    padding: 10px;
    margin: 0 -10px;
}

.swiper-button-next,
.swiper-button-prev {
    color: #fff;
    background: rgba(0, 0, 0, 0.7);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.swiper-button-next:hover,
.swiper-button-prev:hover {
    background: rgba(229, 9, 20, 0.8);
    transform: scale(1.1);
}

.swiper-button-next:after,
.swiper-button-prev:after {
    font-size: 18px;
}

/* Search Item Styling */
.search-item {
    transition: all 0.2s ease-in-out;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    outline: none;
    cursor: pointer;
}

.search-item:last-child {
    border-bottom: none;
}

.search-item:hover,
.search-item.active,
.search-item:focus {
    transform: translateX(5px);
    background: rgba(229, 9, 20, 0.1);
}

.search-item:focus-visible {
    box-shadow: 0 0 0 2px rgba(229, 9, 20, 0.5) inset;
}

/* Loading States */
#loading-state {
    transition: opacity 0.3s ease-out;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    position: relative;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    border-top-color: #f5c518;
    animation: spin 1s ease-in-out infinite;
    margin: 0 auto;
}

.trending-swiper .loading-spinner {
    margin: 2rem auto;
}

.search-item .loading-spinner {
    width: 16px;
    height: 16px;
    border-width: 2px;
    margin-right: 8px;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(0.9); opacity: 0.7; }
}

/* Movie Details Page */
.movie-backdrop-blur {
    backdrop-filter: blur(8px);
}

/* Hide scrollbar but keep functionality */
.scrollbar-hide {
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

.scrollbar-hide::-webkit-scrollbar {
    display: none;  /* Chrome, Safari and Opera */
}

/* Cast member container */
#movie-cast {
    scroll-behavior: smooth;
    scroll-padding: 1rem;
    -webkit-overflow-scrolling: touch;
}

/* Cast member width on mobile */
#movie-cast > div {
    flex: 0 0 auto;
    width: 140px;
}

@media (min-width: 768px) {
    #movie-cast > div {
        width: auto;
    }
}

/* Animations */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

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

.fade-in {
    animation: fadeIn 0.5s ease-out forwards;
}

.cast-member {
    animation: fadeIn 0.5s ease-out forwards;
    animation-delay: calc(var(--animation-order) * 0.1s);
    opacity: 0;
}

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

.fade-in {
    animation: fadeIn 0.5s ease-out forwards;
}

.cast-member {
    animation: fadeIn 0.5s ease-out forwards;
    animation-delay: calc(var(--animation-order) * 0.1s);
    opacity: 0;
}

.search-item img {
    animation: fadeIn 0.3s ease-in;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .hero-backdrop {
        background-position: center 30%;
    }
}

@media (max-width: 768px) {
    .swiper {
        padding: 5px;
        margin: 0 -5px;
    }
    
    #search-results {
        max-height: 65vh;
    }
}

@media (max-width: 640px) {
    .swiper-button-next,
    .swiper-button-prev {
        display: none;
    }

    .hero-backdrop {
        background-position: center top;
    }

    #search-results {
        max-height: 60vh;
    }
    
    .search-item {
        padding: 0.5rem 0.75rem;
    }
}

/* Focus and Active States */
input:focus {
    box-shadow: 0 0 0 2px rgba(229, 9, 20, 0.3);
}

.search-item:active {
    background: rgba(229, 9, 20, 0.2);
}

/* Container Spacing */
.container {
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
}

/* Movie Detail Page */
.no-poster img,
.no-poster .gradient-overlay {
    display: none;
}

.no-poster {
    background-color: #1f1f1f;
    transition: transform 0.3s ease;
}

.no-poster:hover {
    transform: scale(1.02);
}

.no-poster svg {
    transition: transform 0.3s ease;
}

.no-poster:hover svg {
    transform: scale(1.1);
}

#movie-content {
    min-height: 80vh;
    opacity: 0;
    transition: opacity 0.5s ease-out;
}

#movie-info {
    opacity: 0;
    transition: opacity 0.5s ease-out;
}

#movie-backdrop {
    transition: opacity 0.7s ease;
}

#similar-movies {
    opacity: 0;
    transition: opacity 0.5s ease-out;
}

