/* =========================================
   1. VARIABLES & RESET
   ========================================= */
:root {
    --bg-color: #0b0d11;       /* Deep Dark Background */
    --surface-color: #161b22;  /* Card Background */
    --border-color: #2b303b;   /* Borders */
    --text-main: #ffffff;
    --text-muted: #9499a0;
    --gap-x: 5%;               /* Side Spacing */
}

* { box-sizing: border-box; }

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
    margin: 0; padding: 0;
    overflow-x: hidden;
}

/* Scrollbar Styling */
::-webkit-scrollbar { width: 8px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg-color); }
::-webkit-scrollbar-thumb { background: #333; border-radius: 4px; }

/* =========================================
   2. SEARCH SECTION (Wide & Matte)
   ========================================= */
.search-container {
    display: flex;
    justify-content: center;
    width: 100%;
    padding: 3rem 0; /* Top-Bottom Gap */
}

.search-bar {
    /* FORCE WIDE: Screen ka 90% lega */
    width: 90vw; 
    max-width: 1200px; /* Laptop par hadd se zyada na faile */
    
    padding: 1.2rem 2rem;
    
    /* Matte Black Finish */
    background-color: #121212;
    border: 1px solid var(--border-color);
    border-radius: 12px; /* Soft Rectangle */
    
    color: #fff;
    font-size: 1.2rem;
    font-family: inherit;
    outline: none;
    transition: all 0.2s ease;
}

.search-bar::placeholder { color: #666; }

.search-bar:focus {
    background-color: #000;
    border-color: #777; /* Focus par Grey Border */
}

/* =========================================
   3. TAGS SECTION (Scroll Fixed)
   ========================================= */
.tags-container {
    padding: 0 var(--gap-x); /* Side alignment fix */
    display: flex;
    gap: 1rem;
    
    /* SCROLL FIXES */
    overflow-x: auto;
    justify-content: flex-start; /* Center hata diya taaki left se start ho */
    flex-wrap: nowrap;
    
    margin-bottom: 2.5rem;
    padding-bottom: 10px; /* Scrollbar ke liye jagah */
}

.tag {
    padding: 0.6rem 1.5rem;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 50px;
    font-size: 0.95rem;
    cursor: pointer;
    white-space: nowrap; /* Text tutega nahi */
    transition: all 0.2s ease;
    color: var(--text-muted);
    flex-shrink: 0; /* Button sikudega nahi */
}

.tag:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-color: #fff;
}

.tag.selected {
    background: #fff;
    border-color: #fff;
    color: #000;
    font-weight: 700;
}

/* =========================================
   4. BEST MATCH (Title Visibility Fixed)
   ========================================= */
#best-match-container {
    padding: 0 var(--gap-x);
    margin-bottom: 4rem;
    animation: fadeIn 0.5s ease-out;
}

.section-heading {
    color: #fff;
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    font-weight: 700;
    padding-left: 10px;
    border-left: 4px solid #fff;
}

#best-match-card {
    width: 100%;
    height: 28rem; /* Cinematic Height */
    background: #000;
    border-radius: 16px;
    border: 1px solid #333;
    display: flex;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}

/* IMAGE AREA */
.best-match-backdrop {
    flex: 2;
    height: 100%;
    position: relative;
    z-index: 1; /* Image peeche rahegi */
}

.best-match-backdrop img {
    width: 100%; height: 100%; object-fit: cover;
    /* Smooth Fade to Black */
    mask-image: linear-gradient(to right, black 50%, transparent 100%);
    -webkit-mask-image: linear-gradient(to right, black 50%, transparent 100%);
}

/* TEXT AREA (Visibility Logic) */
.best-match-info {
    flex: 1.5;
    padding: 3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    
    /* Strong Gradient taaki Text dikhe */
    background: linear-gradient(90deg, #0b0d11 40%, transparent 100%);
    
    position: absolute;
    top: 0; left: 0; bottom: 0; right: 0;
    z-index: 10; /* Text Image ke upar rahega */
}

.best-match-title {
    font-size: clamp(2rem, 5vw, 4rem);
    font-weight: 800;
    color: #fff !important; /* Force White Color */
    margin-bottom: 1rem;
    line-height: 1.1;
    
    /* Shadow taaki bright background pe bhi dikhe */
    text-shadow: 0 4px 10px rgba(0,0,0,0.9);
    position: relative;
    z-index: 11;
}

.best-match-meta {
    display: flex; gap: 1rem; color: #ccc; 
    font-size: 1.1rem; margin-bottom: 1.5rem; align-items: center;
    position: relative; z-index: 11;
    text-shadow: 0 2px 5px black;
}

.best-match-desc {
    color: #bbb; font-size: 1.1rem; line-height: 1.6;
    max-width: 80%;
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
    position: relative; z-index: 11;
    text-shadow: 0 2px 5px black;
}

/* =========================================
   5. MAIN MOVIE GRID
   ========================================= */
#main {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
    gap: 1.5rem;
    padding: 0 var(--gap-x) 5rem;
}

.movie {
    background: var(--surface-color);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: 0.3s;
    position: relative;
    aspect-ratio: 2/3;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.movie:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.5);
    z-index: 5;
}

.movie img {
    width: 100%; height: 100%; object-fit: cover;
    transition: 0.4s;
}
.movie:hover img { transform: scale(1.05); }

.movie-info {
    position: absolute; bottom: 0; left: 0; right: 0;
    padding: 2rem 1rem 1rem;
    background: linear-gradient(to top, rgba(0,0,0,0.95) 20%, transparent);
    display: flex; justify-content: space-between; align-items: flex-end;
}

.movie-info h3 {
    font-size: 0.95rem; color: #fff; margin: 0; font-weight: 600;
    text-shadow: 0 2px 5px black;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 75%;
}

.movie-info span {
    padding: 2px 6px; border-radius: 4px; font-size: 0.8rem; font-weight: 700;
    box-shadow: 0 2px 5px black;
}

.green { background: #10b981; color: white; }
.orange { background: #f59e0b; color: black; }
.red { background: #ef4444; color: white; }

/* =========================================
   6. MOBILE RESPONSIVE
   ========================================= */
/* =========================================
   6. MOBILE RESPONSIVENESS (FIXED)
   ========================================= */
@media (max-width: 768px) {
    
    /* 1. Search Bar Fix */
    .search-container { padding: 1.5rem 0; }
    .search-bar { width: 92vw; padding: 1rem; font-size: 1rem; }

    /* 2. Best Match Card - IMAGE ON TOP */
    #best-match-card { 
        flex-direction: column-reverse; /* Image Upar, Text Neeche */
        height: auto;
        border: 1px solid #333;
    }
    
    /* Image Area */
    .best-match-backdrop { 
        width: 100%; 
        height: 14rem; /* Fixed Height */
        flex: none; 
    }
    
    .best-match-backdrop img { 
        /* Image ko neeche se fade karo taaki text ke sath merge ho */
        mask-image: linear-gradient(to bottom, black 50%, transparent 100%);
        -webkit-mask-image: linear-gradient(to bottom, black 50%, transparent 100%);
    }
    
    /* Text Area */
    .best-match-info {
        position: relative;
        /* Background transparent rakho taaki gradient kaam kare */
        background: linear-gradient(to top, var(--bg-color) 20%, transparent 100%); 
        padding: 1.5rem;
        
        /* Text ko upar khicho taaki wo image ke upar chadh jaye */
        margin-top: -5rem; 
        z-index: 20; /* Sabse upar */
    }

    /* TITLE VISIBILITY FIX */
    .best-match-title { 
        font-size: 2.2rem; /* Fixed size for mobile */
        color: #fff !important; /* Force White */
        text-shadow: 0 4px 8px black; /* Black Shadow for Contrast */
        display: block; /* Ensure it's visible */
        margin-top: 1rem;
    }
    
    /* Description chota karo mobile pe */
    .best-match-desc { 
        max-width: 100%; 
        -webkit-line-clamp: 3; 
        font-size: 0.9rem;
        text-shadow: 0 2px 4px black;
    }

    /* 3. Main Grid */
    #main { 
        grid-template-columns: repeat(2, 1fr); /* 2 Columns */
        gap: 12px;
    }
}


/* =========================================
   BOTTOM SEO FOOTER (Read More Style)
   ========================================= */
.bottom-seo-container {
    background-color: #05070a; /* Darkest Black */
    border-top: 1px solid #222;
    padding: 30px var(--gap-x);
    margin-top: 50px;
    text-align: center;
    position: relative;
    width: 100%;
}

.seo-content-wrapper {
    color: #666; /* Muted Text (ankhon me nahi chubhega) */
    font-size: 0.9rem;
    line-height: 1.6;
    max-width: 800px;
    margin: 0 auto 15px;
    text-align: left; /* Padhne me aasan */
    
    /* MAGIC: Sirf 2 Line Dikhane ka code */
    display: -webkit-box;
    -webkit-line-clamp: 2; /* Kitni lines dikhani hain */
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: all 0.5s ease; /* Smooth animation */
}

/* Jab Button Dabega tab ye class lag jayegi */
.seo-content-wrapper.expanded {
    -webkit-line-clamp: unset; /* Limit hata do */
    color: #888; /* Thoda bright kar do padhne ke liye */
}

.seo-content-wrapper h1, 
.seo-content-wrapper h2, 
.seo-content-wrapper h3 {
    font-size: 1.1rem;
    color: #ccc;
    margin-top: 20px;
    margin-bottom: 10px;
}

#readMoreBtn {
    background: transparent;
    border: 1px solid #333;
    color: #fff;
    padding: 8px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: 0.3s;
}

#readMoreBtn:hover {
    background: #222;
    border-color: #fff;
}

.copyright {
    margin-top: 30px;
    color: #444;
    font-size: 0.8rem;
    border-top: 1px solid #1a1a1a;
    padding-top: 20px;
}
