/* ============================================================================
   UI/UX PRO MAX UPGRADE - HH3D
   Date: 2026-03-20
   Focus: Glassmorphism, Native-like Mobile UX, Immersive 3D Aesthetics
   ========================================================================== */

:root {
    --duration-fast: 150ms;
    --duration-normal: 250ms;
    --duration-slow: 400ms;
    --easing-smooth: cubic-bezier(0.4, 0, 0.2, 1);
    --easing-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ============================================================================
   BODY & BASE LAYOUT
   ========================================================================== */
body {
    background: var(--bg-body);
    background-image: var(--gradient-bg);
    background-attachment: fixed;
    overflow-x: hidden;
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: var(--container-max);
    width: 100%;
    margin: 0 auto;
    padding: 0 1.25rem;
}

/* ============================================================================
   HEADER - Advanced Glassmorphism
   ========================================================================== */
.header {
    height: 75px;
    background: rgba(10, 15, 30, 0.75);
    backdrop-filter: blur(30px) saturate(210%);
    -webkit-backdrop-filter: blur(30px) saturate(210%);
    border-bottom: 1px solid var(--primary-glow);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: all var(--duration-normal) var(--easing-smooth);
    display: flex;
    align-items: center;
}

.header.scrolled {
    height: 68px;
    background: rgba(8, 11, 20, 0.95);
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
}

.movie-year {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.quality-tag {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    color: var(--text-primary);
    border: 1px solid rgba(255,255,255,0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 800;
    font-size: 1.5rem;
    text-decoration: none;
    color: var(--text-primary);
}

.logo i {
    background: var(--gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 10px var(--primary-glow));
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 0;
}

.main-nav .nav-link {
    font-size: 0.9rem;
    font-weight: 500;
    text-transform: none;
    padding: 0 18px;
    height: 75px;
    line-height: 75px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s;
    position: relative;
    white-space: nowrap;
}

.main-nav .nav-link i {
    font-size: 1.1rem;
    opacity: 0.7;
}

.main-nav .nav-link:hover,
.main-nav .nav-link.active {
    color: #fff;
}

.main-nav .nav-link.active i,
.main-nav .nav-link:hover i {
    opacity: 1;
    color: var(--primary);
}

.main-nav .nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 15px;
    right: 15px;
    height: 3px;
    background: var(--gradient);
    border-radius: 3px 3px 0 0;
    box-shadow: 0 -4px 10px var(--primary-glow);
}

/* Desktop Search Box */
.search-box {
    position: relative;
    width: 320px;
    display: flex;
    align-items: center;
    transition: width var(--duration-normal) var(--easing-smooth);
}

.search-box input {
    width: 100%;
    height: 44px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    padding: 0 50px 0 1.25rem;
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: all var(--duration-normal) var(--easing-smooth);
}

.search-box input:focus {
    width: 400px;
    background: rgba(0, 0, 0, 0.3);
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0, 217, 255, 0.15);
    outline: none;
}

.search-box button {
    position: absolute;
    right: 4px;
    width: 36px;
    height: 36px;
    background: var(--gradient);
    border: none;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform var(--duration-fast);
}

.search-box button:hover { transform: scale(1.05); }

/* ============================================================================
   TRENDING SLIDER - Premium Overlapped Style
   ========================================================================== */
.trending-section {
    padding: 2.5rem 0;
}

.trending-slider {
    display: flex;
    overflow-x: auto;
    gap: 20px;
    padding: 10px 5px 35px;
    scroll-behavior: smooth;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.trending-slider::-webkit-scrollbar { display: none; }

.trending-card {
    flex: 0 0 200px;
    position: relative;
    cursor: pointer;
    transition: all var(--duration-normal) var(--easing-smooth);
}

.trending-card:hover { transform: translateY(-5px); }

.trending-poster-wrap {
    position: relative;
    aspect-ratio: 2/3;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.05);
    background: #111;
    transition: all 0.3s ease;
}

/* Rank Glow Borders */
.rank-1 .trending-poster-wrap { border-color: #FFD700; box-shadow: 0 0 20px rgba(255, 215, 0, 0.3); }
.rank-2 .trending-poster-wrap { border-color: #C0C0C0; box-shadow: 0 0 15px rgba(192, 192, 192, 0.2); }
.rank-3 .trending-poster-wrap { border-color: #00D9FF; box-shadow: 0 0 15px rgba(0, 217, 255, 0.2); }

.trending-card:hover .trending-poster-wrap {
    border-color: var(--primary);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.5), 0 0 15px var(--primary-glow);
}

.trending-poster-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.trending-card:hover .trending-poster-wrap img { transform: scale(1.08); }

/* Large Italic Rank Number - Overlapping Outside the Wrapper */
.rank-number {
    position: absolute;
    bottom: 25px; /* Stay relative to trending-card bottom */
    right: -12px;
    font-size: 8rem;
    font-weight: 900;
    font-style: italic;
    font-family: 'Poppins', sans-serif;
    line-height: .8;
    z-index: 15;
    background: linear-gradient(to bottom, #fff 50%, rgba(255,255,255,0.2) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    opacity: 0.9;
    filter: drop-shadow(0 0 15px rgba(0,0,0,0.9));
    pointer-events: none;
    transition: all 0.3s ease;
    user-select: none;
}

.rank-1 .rank-number { background: linear-gradient(to bottom, #FFD700, #B8860B); -webkit-background-clip: text; }
.rank-2 .rank-number { background: linear-gradient(to bottom, #E0E0E0, #757575); -webkit-background-clip: text; }
.rank-3 .rank-number { background: linear-gradient(to bottom, #00D9FF, #0077FF); -webkit-background-clip: text; }

.trending-card:hover .rank-number {
    transform: scale(1.1) rotate(-3deg);
    opacity: 1;
}

/* Trending Badges */
.trending-badges-top {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    display: flex;
    justify-content: space-between;
    z-index: 5;
}

.ep-badge {
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    color: #fff;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
}

.ql-badge {
    background: var(--gradient);
    color: #fff;
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 800;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.trending-info {
    padding: 15px 5px 0;
    text-align: left;
}

.trending-title {
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.2s;
}

.trending-card:hover .trending-title {
    color: var(--primary);
}

/* ============================================================================
   MOVIE CARDS - Immersive Floating Effect
   ========================================================================== */
.movies-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 3rem 1.75rem;
    padding: 1.5rem 0;
}

.movie-card {
    position: relative;
    transition: all var(--duration-normal) var(--easing-smooth);
}

.poster-wrapper {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    aspect-ratio: 2/3;
    background: var(--bg-card);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-glass);
    transition: all var(--duration-normal) var(--easing-smooth);
}

.movie-card:hover .poster-wrapper {
    box-shadow: 0 25px 50px rgba(0, 217, 255, 0.25);
    transform: translateY(-10px);
    border-color: var(--primary-glow);
}

.movie-poster {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.5s ease, transform 0.8s var(--easing-smooth);
}

.movie-poster.loaded { opacity: 1; }

.movie-card:hover .movie-poster { transform: scale(1.12); }

/* Badges with Blur */
.rating-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    bottom: auto;
    right: auto;
    background: rgba(18, 24, 38, 0.85);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(251, 191, 36, 0.3);
    color: var(--accent-gold);
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 800;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.4);
}

.source-badge {
    position: absolute;
    top: 45px;
    left: 12px;
    bottom: auto;
    right: auto;
    background: var(--gradient);
    color: white;
    padding: 3px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-weight: 700;
    z-index: 5;
    box-shadow: 0 4px 15px var(--primary-glow);
    white-space: nowrap;
    opacity: 0.95;
    letter-spacing: 0.3px;
}

/* Hover Action UI */
.poster-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.2) 50%, transparent 100%);
    opacity: 0;
    transition: opacity var(--duration-normal);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.movie-card:hover .poster-overlay { opacity: 1; }

.play-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--gradient);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 0 30px var(--primary-glow);
    transform: scale(0.8);
    transition: transform var(--duration-normal) var(--easing-bounce);
}

.movie-card:hover .play-icon { transform: scale(1); }

.direct-watch-badge {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    top: auto;
    right: auto;
    background: rgba(255, 255, 255, 0.95);
    color: #000;
    padding: 10px 24px;
    border-radius: var(--radius-full);
    font-weight: 800;
    font-size: 0.85rem;
    white-space: nowrap;
    opacity: 0;
    transition: all var(--duration-normal) var(--easing-smooth);
    z-index: 10;
}

.movie-card:hover .direct-watch-badge {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.movie-info { padding: 1.25rem 0.5rem 0.5rem; }

.movie-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
    white-space: normal;
}

.movie-year {
    font-size: 0.9rem;
    color: var(--text-tertiary);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.movie-year span:last-child {
    background: rgba(255,255,255,0.05);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid rgba(255,255,255,0.1);
}

/* ============================================================================
   MOBILE NAVIGATION - Native App Style
   ========================================================================== */
.mobile-app-bar {
    position: fixed;
    bottom: 1.5rem;
    left: 1.5rem;
    right: 1.5rem;
    height: 68px;
    background: rgba(18, 24, 38, 0.85);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 24px;
    display: none; /* Desktop hidden */
    justify-content: space-around;
    align-items: center;
    z-index: 1000;
    box-shadow: 0 15px 40px rgba(0,0,0,0.6);
    transition: all 0.4s var(--easing-smooth);
}

.mobile-app-bar.nav-hidden {
    transform: translateY(140%);
    opacity: 0;
}

.app-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    color: var(--text-tertiary);
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 600;
    width: 64px;
    transition: all 0.2s;
    position: relative;
}

.app-nav-item i {
    font-size: 1.4rem;
    transition: transform var(--duration-normal) var(--easing-bounce);
}

.app-nav-item.active { color: var(--primary); }

.app-nav-item.active i {
    transform: translateY(-6px) scale(1.15);
    filter: drop-shadow(0 0 10px var(--primary-glow));
}

.app-nav-item.active::after {
    content: '';
    position: absolute;
    bottom: -8px;
    width: 20px;
    height: 4px;
    background: var(--gradient);
    border-radius: 2px;
    box-shadow: 0 0 10px var(--primary-glow);
}

/* ============================================================================
   RESPONSIVE DESIGN
   ========================================================================== */
@media (max-width: 991px) {
    .search-box input:focus { width: 320px; }
}

@media (max-width: 768px) {
    .header { height: 68px; }
    .header .main-nav, .header .search-box { display: none; }
    .header .logo { font-size: 1.25rem; }
    
    .mobile-app-bar { display: flex; }
    
    .movies-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem 1.25rem;
    }
    
    .section-title { font-size: 1.5rem; }
    
    .rank-badge {
        font-size: 4.5rem;
        bottom: -0.5rem;
        left: -0.5rem;
    }
}

@media (max-width: 480px) {
    .container { padding: 0 1.25rem; }
    .movies-grid { gap: 1.5rem 0.85rem; }
    .movie-title { font-size: 0.9rem; }
}

/* ============================================================================
   UTIL & ANIMATIONS
   ========================================================================== */
.fade-in-up {
    animation: fadeInUp 0.5s var(--easing-smooth) both;
}

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

.loading-trending {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    min-height: 250px;
    color: var(--primary);
    font-size: 2rem;
}

footer {
    padding: 3rem 0;
    background: rgba(0,0,0,0.4);
    border-top: var(--border-glass);
    text-align: center;
}
/* ============================================================================
   HISTORY SECTION - horizontal scrolling with premium feel
   ========================================================================== */
.history-section { padding: 0.5rem 0 1.5rem; position: relative; z-index: 20; color: #fff; }
.history-slider { display: flex; overflow-x: auto; gap: 15px; padding: 5px 5px 15px; scroll-behavior: smooth; scrollbar-width: none; -ms-overflow-style: none; scroll-snap-type: x mandatory; }
.history-slider::-webkit-scrollbar { display: none; }
.history-card { flex: 0 0 130px; cursor: pointer; scroll-snap-align: start; transition: transform 0.3s ease; }
.history-card:hover { transform: translateY(-5px); }
.history-poster-wrap { position: relative; aspect-ratio: 100/150; border-radius: 12px; overflow: hidden; background: #111; border: 1px solid rgba(255,255,255,0.1); }
.history-poster-wrap img { width: 100%; height: 100%; object-fit: cover; }
.history-badge { position: absolute; top: 6px; right: 6px; background: #00bcd4; color: #fff; padding: 2px 6px; border-radius: 4px; font-size: 0.6rem; font-weight: 700; display: flex; align-items: center; gap: 3px; box-shadow: 0 2px 5px rgba(0,0,0,0.5); }
.history-title { margin-top: 8px; font-size: 0.8rem; font-weight: 600; color: #ccc; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.3; }
.history-card:hover .history-title { color: #fff; }
