/* main page */
body {
    padding-top: 70px; /* adjust to your navbar height */
    margin: 0;
    padding: 0;
    background: #f7eddd;
    font-family: Arial, sans-serif;
}

.container {
    margin-top: 70px; /* same as navbar height */
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 20px;
    padding: 20px;
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
}

.left-column {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 0; /* Prevents overflow */
}

.right-column {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.card {
    background: #c5b6a0;
    padding: 20px;
    border-radius: 12px;
    min-height: 90px;
    font-weight: bold;
    color: #4b443b;
}

.card h3 {
    font-weight: 800;
    font-size: 18px;
    margin: 0 0 12px 0;
    padding-bottom: 6px;
    border-bottom: 2px solid #4b443b;
    display: inline-block;
}

.tall {
    height: auto;
}

.short {
    height: 200px;
}

.featured-box {
    background: #4b443b;
    height: 150px;
    width: 100%; /* Changed from 80% to be responsive */
    margin-top: 10px;
    border-radius: 6px;
}

/* Recommended movies main page - Fixed for full title visibility */
.recommended-items,
.series-items,
.movies-items {
    display: grid;
    gap: var(--size-3, 16px);
    grid-auto-flow: column;
    grid-auto-columns: 16%;
    overflow-x: auto;
    overflow-y: visible; /* Changed from hidden */
    padding-bottom: 0.5rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

/* Movie items - Updated to allow full title visibility */
.recommended-items .item,
.series-items .item,
.movies-items .item {
    display: flex; /* Changed from inline-block */
    flex-direction: column;
    width: 150px;
    min-width: 150px; /* Added min-width */
    background-color: #eee;
    border-radius: 6px;
    text-align: center;
    cursor: pointer;
    flex-shrink: 0;
    overflow: visible; /* Changed from hidden */
}

/* Updated movie title - REMOVED truncation */
.movie-title {
    padding: 10px;
    text-align: center;
    font-weight: 500;
    color: #4b443b;
    font-size: 14px;
    line-height: 1.4;
    
    /* Handle long text - show full title */
    word-wrap: break-word;
    word-break: break-word;
    white-space: normal;
    
    /* REMOVED the truncation properties */
    /* display: -webkit-box; */
    /* -webkit-line-clamp: 2; */
    /* -webkit-box-orient: vertical; */
    /* overflow: hidden; */
    /* text-overflow: ellipsis; */
    
    /* Allow title to take remaining space */
    flex-grow: 1;
    
    /* Add some spacing */
    margin: 0;
}

/* Optional: Add a min-height to ensure consistent card sizing */
.movie-card {
    display: flex;
    flex-direction: column;
    height: auto; /* Changed from 100% */
    min-height: 280px; /* Adjust based on your needs */
}

.movie-card a {
    display: flex;
    flex-direction: column;
    height: 100%;
    text-decoration: none;
}

.movie-card img {
    width: 100%;
    height: auto;
    display: block;
}

.viewed-date {
    padding: 0 10px 10px 10px;
    margin: 0;
    font-size: 11px;
    color: #888;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Container stays vertical */
.featured-upnext {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding-top: 10px;
}

/* Each item */
.featured-upnext-item {
    display: flex;
    align-items: center;
    gap: 15px;
    background: #4b443b;
    color: #f7eddd;
    padding: 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.featured-upnext-item:hover {
    background: #7d7d7d;
    transform: scale(1.02);
}

/* Bigger poster */
.featured-upnext-item img {
    width: 80px;
    height: 120px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}

/* Better text layout */
.featured-upnext-item span {
    font-size: 15px;
    font-weight: 600;
    color: #f7eddd;
    line-height: 1.3;

    /* Prevent overflow */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ========== RESPONSIVE DESIGN ========== */

/* Large laptops and desktops */
@media screen and (min-width: 1401px) {
    .recommended-items,
    .series-items,
    .movies-items {
        grid-auto-columns: 14%; /* Show 7 items on very large screens */
    }
}

/* Tablets and smaller desktops */
@media screen and (max-width: 1024px) {
    .container {
        grid-template-columns: 1fr 280px;
        gap: 15px;
        padding: 15px;
    }
    
    .recommended-items,
    .series-items,
    .movies-items {
        grid-auto-columns: 20%; /* Show more items on smaller screens */
    }
}

/* Laptop screens (1025px to 1400px) */
@media screen and (min-width: 1025px) and (max-width: 1400px) {
    .recommended-items,
    .series-items,
    .movies-items {
        grid-auto-columns: 18%; /* Show 5-6 items with better spacing */
    }
}

/* Tablets */
@media screen and (max-width: 768px) {
    body {
        padding-top: 60px;
    }
    
    .container {
        grid-template-columns: 1fr; /* Stack columns vertically */
        margin-top: 60px;
        gap: 20px;
        padding: 15px;
    }
    
    .right-column {
        order: 2; /* Move right column below left column */
    }
    
    .left-column {
        order: 1;
    }
    
    .featured-box {
        width: 100%;
        height: 120px; /* Slightly smaller on tablets */
    }
    
    .recommended-items,
    .series-items,
    .movies-items {
        grid-auto-columns: 30%; /* Show fewer items but larger */
    }
    
    .recommended-items .item,
    .series-items .item,
    .movies-items .item {
        width: 140px;
        min-width: 140px;
    }
    
    .movie-title {
        font-size: 13px;
    }
    
    .featured-upnext-item img {
        width: 70px;
        height: 105px;
    }
    
    .featured-upnext-item span {
        font-size: 14px;
    }
}

/* Mobile devices */
@media screen and (max-width: 480px) {
    .container {
        padding: 10px;
        gap: 15px;
    }
    
    .card {
        padding: 15px;
        min-height: 70px;
    }
    
    .short {
        height: 150px;
    }
    
    .featured-box {
        height: 100px;
    }
    
    .recommended-items,
    .series-items,
    .movies-items {
        grid-auto-columns: 45%; /* Show 2 items at a time */
        gap: 12px;
    }
    
    .recommended-items .item,
    .series-items .item,
    .movies-items .item {
        width: 100%; /* Take full width of grid column */
        min-width: 120px;
        margin-right: 0;
    }
    
    .movie-title {
        font-size: 12px;
        padding: 8px;
    }
    
    .featured-upnext-item {
        padding: 10px;
        gap: 12px;
    }
    
    .featured-upnext-item img {
        width: 60px;
        height: 90px;
    }
    
    .featured-upnext-item span {
        font-size: 13px;
        -webkit-line-clamp: 2;
    }
    
    .movie-card {
        min-height: 250px;
    }
}

/* Small mobile devices */
@media screen and (max-width: 380px) {
    .recommended-items,
    .series-items,
    .movies-items {
        grid-auto-columns: 100%; /* Show 1 item at a time */
    }
    
    .recommended-items .item,
    .series-items .item,
    .movies-items .item {
        width: 100%;
        max-width: 250px;
        margin: 0 auto; /* Center the item */
    }
}

/* Handle landscape orientation on mobile */
@media screen and (max-height: 500px) and (orientation: landscape) {
    .container {
        margin-top: 60px;
    }
    
    .recommended-items,
    .series-items,
    .movies-items {
        grid-auto-columns: 25%;
    }
    
    .featured-box {
        height: 80px;
    }
    
    .featured-upnext-item img {
        width: 50px;
        height: 75px;
    }
}

/* Force visibility for featured section */
#featured-upnext {
    min-height: 200px;
}

#featured-upnext p {
    margin: 0;
}

.featured-upnext-item {
    display: flex !important;
    align-items: center;
    gap: 15px;
    background: #4b443b;
    color: #f7eddd;
    padding: 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 10px;
}

/* Additional fixes for scrollbars */
.recommended-items::-webkit-scrollbar,
.series-items::-webkit-scrollbar,
.movies-items::-webkit-scrollbar {
    height: 8px;
}

.recommended-items::-webkit-scrollbar-track,
.series-items::-webkit-scrollbar-track,
.movies-items::-webkit-scrollbar-track {
    background: #e0d5c5;
    border-radius: 4px;
}

.recommended-items::-webkit-scrollbar-thumb,
.series-items::-webkit-scrollbar-thumb,
.movies-items::-webkit-scrollbar-thumb {
    background: #4b443b;
    border-radius: 4px;
}

.recommended-items::-webkit-scrollbar-thumb:hover,
.series-items::-webkit-scrollbar-thumb:hover,
.movies-items::-webkit-scrollbar-thumb:hover {
    background: #2c2822;
}

/* Force visibility on mobile */
@media screen and (max-width: 768px) {
    .right-column,
    .card.tall,
    #featured-upnext,
    .featured-upnext-item {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    #featured-upnext {
        min-height: 150px;
    }
    
    .featured-upnext-item {
        display: flex !important;
        margin-bottom: 12px;
    }
    
    .featured-upnext-item img {
        width: 70px !important;
        height: 105px !important;
        display: block !important;
    }
}