@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;800&display=swap');

:root {
    --bg-main: #0a0b1e;
    --bg-secondary: #14162b;
    --accent-primary: #6366f1;
    /* Indigo */
    --accent-secondary: #ec4899;
    /* Pink */
    --accent-glow: #8b5cf6;
    /* Violet */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --header-height: 75px;
    --glass-bg: rgba(20, 22, 43, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-main);
    background-image:
        radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(236, 72, 153, 0.1) 0%, transparent 40%);
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
    padding-top: var(--header-height);
    min-height: 100vh;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-main);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(to bottom, var(--accent-primary), var(--accent-secondary));
    border-radius: 4px;
}

/* Header */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 4%;
    z-index: 1000;
    transition: all 0.3s ease;
}

.logo {
    font-weight: 800;
    font-size: 2rem;
    color: #fff;
    /* Default color for emojis */
    display: flex;
    align-items: center;
    gap: 5px;
    letter-spacing: 0;
}

.rainbow-text {
    background: linear-gradient(to left, #ef5350, #f48fb1, #7e57c2, #2196f3, #26c6da, #43a047, #eeff41, #f9a825, #ff5722);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    animation: rainbow 1s linear infinite;
    background-size: 200% 100%;
}

@keyframes rainbow {
    0% {
        background-position: 0% 50%;
    }

    100% {
        background-position: 100% 50%;
    }
}

.search-bar-container {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 50px;
    padding: 8px 20px;
    display: flex;
    align-items: center;
    width: 500px;
    height: 50px;
    transition: all 0.3s ease;
}

.search-bar-container:focus-within {
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.3);
    border-color: var(--accent-primary);
}

.search-bar-container input {
    background: transparent;
    border: none;
    color: #fff;
    margin-left: 10px;
    width: 100%;
    outline: none;
    font-family: 'Outfit', sans-serif;
}

.search-icon {
    color: var(--text-secondary);
    transition: color 0.3s;
}

.search-bar-container:focus-within .search-icon {
    color: var(--text-primary);
}

/* GRID */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 30px;
    padding: 30px 4%;
    perspective: 800px;
    /* For 3D feel */
}

.media-card {
    background: var(--bg-secondary);
    border-radius: 16px;
    aspect-ratio: 16/9;
    position: relative;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid var(--glass-border);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.media-card:hover {
    transform: translateX(20px)translateY(-20px)translateZ(20px) scale(1.2);
    box-shadow: 0 20px 30px rgba(0, 0, 0, 0.4), 0 0 20px rgba(99, 102, 241, 0.2);
    border-color: var(--accent-primary);
}

.media-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, transparent 60%);
    opacity: 0.6;
    transition: opacity 0.3s;
}

.media-card:hover::after {
    opacity: 0.8;
}

.poster-placeholder {
    width: 100%;
    height: 100%;
    background: #1e1e2e;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.poster-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.6s ease-in-out;
}

.poster-img.fade-in {
    opacity: 1;
}

.card-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 15px;
    z-index: 10;
    transform: translateY(5px);
    transition: transform 0.3s;
}

.media-card:hover .card-info {
    transform: translateY(0);
}

.card-title {
    font-weight: 700;
    font-size: 1.1rem;
    color: #fff;
    margin-bottom: 4px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    gap: 8px;
    align-items: center;
}

.media-type-badge {
    background: linear-gradient(45deg, var(--accent-primary), var(--accent-secondary));
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* DATA LOADING STATUS */
.status-bar {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    text-align: center;
    padding: 10px;
    color: var(--accent-glow);
    font-weight: 1000;
    font-size: 2rem;
    letter-spacing: 1px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.6;
    }
}

/* DETAIL VIEW */
.view {
    display: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.view.active {
    display: block;
    opacity: 1;
}

.view.hidden {
    display: none !important;
}

#detail-view {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 11, 30, 0.95);
    backdrop-filter: blur(20px);
    padding: var(--header-height) 4% 20px 4%;
    overflow-y: auto;
    z-index: 2000;
}

.detail-content {
    max-width: 1100px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 40px;
    margin-top: 40px;
    animation: slideUp 0.5s cubic-bezier(0.165, 0.84, 0.44, 1);
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.detail-poster-placeholder {
    width: 100%;
    height: 500px;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    background: #202030;
    position: relative;
    border: 1px solid var(--glass-border);
}

.detail-info {
    padding-top: 20px;
}

#detail-title {
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 20px;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

#related-search {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    color: #fff;
    text-decoration: none;
    padding: 16px 32px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 1.1rem;
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.4);
    transition: all 0.3s;
}

#related-search:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 30px rgba(236, 72, 153, 0.5);
}

.meta-row {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 30px;
}

.badge {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9rem;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    color: #fff;
    text-decoration: none;
    padding: 16px 32px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 1.1rem;
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.4);
    transition: all 0.3s;
}

.action-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 30px rgba(236, 72, 153, 0.5);
}

#back-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    padding: 10px 20px;
    border-radius: 30px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
}

#back-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Related Grid */
.related-section {
    margin-top: 60px;
    padding-top: 40px;
    border-top: 1px solid var(--glass-border);
}

.small-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

/* Responsive */
@media (max-width: 800px) {
    .detail-content {
        grid-template-columns: 1fr;
    }

    .detail-poster-placeholder {
        height: 300px;
    }

    #detail-title {
        font-size: 2.5rem;
    }
}