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

body {
    font-family: 'Inter', sans-serif;
    background-color: #0a0a0a;
    color: white;
    overflow-x: hidden;
}

/* Hazy Background Effect */
.hazy-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background-image: linear-gradient(rgba(10, 10, 10, 0.6), rgba(10, 10, 10, 0.9)), 
                      url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"><rect width="100" height="100" fill="%230a0a0a"/></svg>');
    background-size: cover;
    background-position: center;
    filter: blur(40px);
    transform: scale(1.1);
    transition: background-image 1s ease;
}

/* Glass Panel Effect */
.glass-panel {
    background: rgba(26, 26, 26, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Loading Spinner */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.loading.hidden {
    display: none;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(238, 43, 52, 0.2);
    border-top: 4px solid #ee2b34;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading p {
    margin-top: 25px;
    color: #ee2b34;
    font-size: 18px;
    font-weight: 500;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 3000;
    display: flex;
    flex-direction: column-reverse;
    gap: 12px;
    max-width: 400px;
    width: 100%;
}

.toast {
    background: rgba(26, 26, 26, 0.98);
    backdrop-filter: blur(20px);
    border-radius: 12px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: slideInBottom 0.3s ease-out;
    position: relative;
    overflow: hidden;
}

.toast.toast-success {
    border-left: 3px solid #10b981;
}

.toast.toast-error {
    border-left: 3px solid #ef4444;
}

.toast.toast-info {
    border-left: 3px solid #3b82f6;
}

.toast.toast-warning {
    border-left: 3px solid #f59e0b;
}

.toast-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.toast-success .toast-icon {
    color: #10b981;
}

.toast-error .toast-icon {
    color: #ef4444;
}

.toast-info .toast-icon {
    color: #3b82f6;
}

.toast-warning .toast-icon {
    color: #f59e0b;
}

.toast-content {
    flex: 1;
}

.toast-title {
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 2px;
}

.toast-message {
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
}

.toast-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
    flex-shrink: 0;
}

.toast-close:hover {
    color: #fff;
}

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: currentColor;
    opacity: 0.3;
    animation: progress 3s linear;
}

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

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes progress {
    from {
        width: 100%;
    }
    to {
        width: 0%;
    }
}

/* Mobile Toast */
@media (max-width: 768px) {
    .toast-container {
        bottom: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
}

/* Similar Movies */
.similar-movie-card {
    position: relative;
    aspect-ratio: 2/3;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(26, 26, 26, 0.8);
}

.similar-movie-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(238, 43, 52, 0.3);
    border-color: rgba(238, 43, 52, 0.5);
}

.similar-movie-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.similar-movie-card:hover img {
    transform: scale(1.05);
}

.similar-movie-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.95), transparent);
}

.similar-movie-title {
    font-size: 13px;
    font-weight: 600;
    color: white;
    margin-bottom: 2px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.similar-movie-year {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
}



/* Search History Dropdown */
.history-dropdown {
    position: absolute;
    top: 110%;
    left: 0;
    right: 0;
    background: rgba(26, 26, 26, 0.98);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    z-index: 200;
    max-width: 100%;
}

.history-dropdown.hidden {
    display: none;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(238, 43, 52, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.history-header span {
    color: #ee2b34;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.clear-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.clear-btn:hover {
    background: rgba(255, 107, 107, 0.2);
    color: #ff6b6b;
}

#history-list {
    list-style: none;
    max-height: 250px;
    overflow-y: auto;
}

#history-list::-webkit-scrollbar {
    width: 6px;
}

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

#history-list::-webkit-scrollbar-thumb {
    background: rgba(238, 43, 52, 0.5);
    border-radius: 3px;
}

#history-list li {
    padding: 12px 16px;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 14px;
}

#history-list li:hover {
    background: rgba(238, 43, 52, 0.15);
    color: #fff;
    padding-left: 20px;
}

#history-list li:last-child {
    border-bottom: none;
}

.no-history {
    padding: 30px 20px;
    color: rgba(255, 255, 255, 0.3);
    text-align: center;
    font-size: 14px;
    font-style: italic;
}

/* Autocomplete Suggestions Dropdown */
.autocomplete-dropdown {
    position: absolute;
    top: 110%;
    left: 0;
    right: 0;
    background: rgba(26, 26, 26, 0.98);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(238, 43, 52, 0.2);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    z-index: 200;
    max-width: 100%;
}

.autocomplete-dropdown.hidden {
    display: none;
}

#autocomplete-list {
    list-style: none;
    max-height: 350px;
    overflow-y: auto;
}

#autocomplete-list::-webkit-scrollbar {
    width: 6px;
}

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

#autocomplete-list::-webkit-scrollbar-thumb {
    background: rgba(238, 43, 52, 0.5);
    border-radius: 3px;
}

#autocomplete-list li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

#autocomplete-list li:hover {
    background: rgba(238, 43, 52, 0.15);
}

#autocomplete-list li:last-child {
    border-bottom: none;
}

#autocomplete-list .movie-poster {
    width: 40px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

#autocomplete-list .movie-info {
    flex: 1;
    min-width: 0;
}

#autocomplete-list .movie-title {
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#autocomplete-list .movie-year {
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
}

.autocomplete-loading {
    padding: 20px;
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    font-size: 14px;
}

.autocomplete-no-results {
    padding: 30px 20px;
    text-align: center;
    color: rgba(255, 255, 255, 0.3);
    font-size: 14px;
    font-style: italic;
}


/* Mobile Responsive */
@media (max-width: 768px) {
    header {
        padding: 12px 20px !important;
    }

    header .max-w-7xl {
        flex-direction: column;
        gap: 12px;
    }

    header .flex-1 {
        width: 100%;
        max-width: 100%;
    }

    #search-button {
        display: block;
        width: 100%;
    }

    main {
        padding: 30px 20px !important;
    }

    .max-w-6xl {
        grid-template-columns: 1fr !important;
    }

    .glass-panel {
        padding: 24px !important;
    }

    h2 {
        font-size: 2rem !important;
    }

    .grid-cols-2 {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 480px) {
    h2 {
        font-size: 2rem !important;
    }

    .glass-panel {
        padding: 20px !important;
    }
}