/* Grid Container */
.tmdb-grid-wrap {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 20px;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

.tmdb-grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 30px;
}

/* Card Styles */
.tmdb-grid-card {
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    background: #1a1a1a;
    aspect-ratio: 2/3;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.tmdb-grid-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 30px rgba(0, 0, 0, 0.5);
    z-index: 2;
}

.tmdb-grid-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: filter 0.3s;
}

.tmdb-grid-card:hover img {
    filter: brightness(0.7);
}

/* Hover Info on Card */
.tmdb-hover-info {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 20px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0) 100%);
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

.tmdb-grid-card:hover .tmdb-hover-info {
    opacity: 1;
    transform: translateY(0);
}

.tmdb-hover-info h3 {
    margin: 0;
    font-size: 1.1rem;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
    font-weight: 600;
    line-height: 1.3;
}

/* Modal Styles */
.tmdb-grid-modal {
    display: none;
    position: fixed;
    z-index: 99999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.tmdb-grid-modal.open {
    display: flex !important;
    align-items: center;
    justify-content: center;
    opacity: 1;
}

.tmdb-grid-modal-content {
    background-color: #2C541D;
    /* Requested Green */
    width: 95%;
    max-width: 1100px;
    max-height: 90vh;
    margin: auto;
    /* Fallback for centering */
    border-radius: 20px;
    position: relative;
    color: #fff;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.8);
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.tmdb-grid-modal-content::-webkit-scrollbar {
    width: 8px;
}

.tmdb-grid-modal-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

/* Modal Header */
.tmdb-modal-header {
    padding: 30px 40px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.tmdb-header-left .tmdb-grid-title {
    font-size: 2.5rem;
    margin: 0;
    font-weight: 800;
    color: #fff;
}

.tmdb-meta-row {
    display: flex;
    gap: 15px;
    margin-top: 10px;
    font-size: 0.95rem;
    opacity: 0.8;
}

.tmdb-header-right {
    text-align: right;
}

.tmdb-grid-close {
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.1);
    padding: 5px 15px;
    border-radius: 15px;
    display: inline-block;
}

.tmdb-grid-rating {
    margin-top: 10px;
    font-size: 1.2rem;
    font-weight: 700;
}

.tmdb-grid-rating span {
    font-weight: 400;
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Hero Section with Poster */
.tmdb-grid-hero-section {
    display: flex;
    padding: 40px;
    gap: 30px;
}

.tmdb-grid-poster-col {
    flex: 0 0 200px;
}

.tmdb-grid-poster {
    width: 100%;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.tmdb-grid-hero-col {
    flex: 1;
    position: relative;
    border-radius: 12px;
    overflow: hidden;
}

.tmdb-grid-hero {
    width: 100%;
    height: 100%;
    min-height: 350px;
    position: relative;
    background: #000;
}

.tmdb-grid-backdrop {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.8;
}

.tmdb-play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 70px;
    height: 70px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 2px solid #fff;
    transition: transform 0.2s;
}

.tmdb-play-overlay:hover {
    transform: translate(-50%, -50%) scale(1.1);
}

/* Sections */
.tmdb-grid-info {
    padding: 0 40px 40px;
}

.tmdb-grid-info h3 {
    font-size: 1.4rem;
    margin: 40px 0 20px;
    border-left: 4px solid #fff;
    padding-left: 15px;
    color: #fff;
}

.tmdb-grid-overview {
    line-height: 1.6;
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Cast Grid */
.tmdb-cast-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 20px;
}

.tmdb-c-item {
    text-align: center;
}

.tmdb-c-item img {
    width: 100%;
    border-radius: 8px;
    margin-bottom: 8px;
}

.tmdb-c-item span {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
}

.tmdb-c-item small {
    display: block;
    font-size: 0.8rem;
    opacity: 0.7;
}

/* Videos Grid */
.tmdb-videos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
}

.tmdb-v-thumb {
    position: relative;
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
}

.tmdb-v-thumb img {
    width: 100%;
    display: block;
}

.tmdb-v-thumb .tmdb-v-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tmdb-v-play::after {
    content: '';
    border-left: 8px solid #fff;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    margin-left: 3px;
}

/* Video Embed */
.tmdb-video-wrapper {
    margin-top: 30px;
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    height: 0;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
}

.tmdb-video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Mobile */
@media (max-width: 768px) {
    .tmdb-grid-hero-section {
        flex-direction: column;
    }

    .tmdb-grid-poster-col {
        display: none;
    }

    .tmdb-modal-header {
        padding: 20px;
    }

    .tmdb-header-left .tmdb-grid-title {
        font-size: 1.5rem;
    }

    .tmdb-grid-info {
        padding: 0 20px 20px;
    }
}