/* My Drama Specific Styles - Mobile Optimized with Overlay Text */
:root {
    /* My Drama Colors */
    --drama-primary: #ff3366;
    --drama-secondary: #6c5ce7;
    --drama-accent: #00cec9;
    --drama-dark: #0f0f23;
    --drama-card: #1a1a2e;
    --drama-card-hover: #22223a;
    --drama-text: #ffffff;
    --drama-text-secondary: #b8b8d1;
    --drama-border: #2d2d44;
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #ff3366, #6c5ce7);
    --gradient-secondary: linear-gradient(135deg, #00cec9, #0984e3);
    --gradient-dark: linear-gradient(135deg, #1a1a2e, #16213e);
}

/* Base Card Styles */
.series-card,
.trending-card,
.top-pick-card,
.new-release-card,
.episode-card,
.top-rated-card,
.must-watch-card {
    position: relative;
    background: var(--drama-card);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    border: 1px solid var(--drama-border);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.series-card:hover,
.trending-card:hover,
.top-pick-card:hover,
.new-release-card:hover,
.episode-card:hover,
.top-rated-card:hover,
.must-watch-card:hover {
    transform: translateY(-4px);
    border-color: var(--drama-primary);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

/* Thumbnail Container - Square Aspect Ratio */
.card-thumbnail-container {
    position: relative;
    width: 100%;
    padding-top: 140%; /* 5:7 ratio for portrait */
    overflow: hidden;
    flex: 1;
}

/* Video thumbnails have different ratio */
.video-thumbnail-container {
    padding-top: 56.25%; /* 16:9 ratio for videos */
}

.card-thumbnail-container img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.series-card:hover .card-thumbnail-container img,
.trending-card:hover .card-thumbnail-container img,
.episode-card:hover .card-thumbnail-container img {
    transform: scale(1.05);
}

/* Text Overlay on Thumbnail */
.thumbnail-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        transparent 50%,
        rgba(15, 15, 35, 0.8) 75%,
        rgba(15, 15, 35, 0.95) 100%
    );
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 0.75rem;
}

/* Text Content on Thumbnail */
.overlay-content {
    position: relative;
    z-index: 2;
    color: white;
}

.overlay-title {
    font-size: 0.85rem;
    font-weight: 600;
    margin: 0 0 0.25rem;
    color: var(--drama-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.overlay-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.65rem;
    color: var(--drama-text-secondary);
}

.overlay-meta span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.overlay-meta .rating {
    color: #fdcb6e;
}

/* Badges on Thumbnail */
.thumbnail-badges {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    right: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    z-index: 3;
}

.left-badges {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.right-badges {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    align-items: flex-end;
}

.badge {
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.badge.exclusive {
    background: var(--gradient-primary);
    color: white;
}

.badge.new {
    background: var(--gradient-secondary);
    color: white;
}

.trending-rank {
    width: 24px;
    height: 24px;
    background: var(--gradient-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.7rem;
}

/* Episode Number Badge */
.episode-badge {
    background: #4CAF50;
    color: white;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.6rem;
    font-weight: 700;
    z-index: 1;
}

.episode-number {
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.6rem;
    font-weight: 600;
}

.rating-badge {
    background: rgba(255, 193, 7, 0.9);
    color: #333;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.6rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.15rem;
}

/* Card Title Below Thumbnail */
.card-title-container {
    padding: 0.75rem;
    background: var(--drama-card);
    border-top: 1px solid var(--drama-border);
}

.card-title-main {
    font-size: 0.875rem;
    font-weight: 600;
    margin: 0 0 0.25rem;
    color: var(--drama-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-subtitle {
    font-size: 0.75rem;
    color: var(--drama-text-secondary);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Card Meta Information */
.card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.65rem;
    color: var(--drama-text-secondary);
    margin-top: 0.25rem;
}

.card-meta span {
    display: flex;
    align-items: center;
    gap: 0.15rem;
}

/* Progress Bar for Continue Watching */
.progress-container {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 4;
    padding: 0 0.75rem 0.75rem;
}

.progress-bar {
    height: 3px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-primary);
    transition: width 0.3s ease;
}

/* Grid Layouts */
.top-picks-grid,
.new-releases-grid,
.trending-grid,
.latest-episodes-grid {
    display: grid;
    gap: 1rem;
}

/* Desktop Grid */
.top-picks-grid,
.new-releases-grid,
.latest-episodes-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

.trending-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

/* Must Watch Section - Updated for index.php */
.must-watch-section {
    padding: 1.5rem;
    margin: 2rem 0;
}

.must-watch-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.must-watch-card {
    background: var(--drama-card);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--drama-border);
}

.must-watch-thumbnail {
    position: relative;
    padding-top: 56.25%; /* 16:9 */
    overflow: hidden;
}

.must-watch-thumbnail img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.must-watch-content {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
}

.must-watch-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.must-watch-title {
    font-size: 1.125rem;
    font-weight: 700;
    margin: 0;
    color: var(--drama-text);
}

.view-count {
    font-size: 0.75rem;
    color: var(--drama-text-secondary);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.must-watch-description {
    color: var(--drama-text-secondary);
    font-size: 0.875rem;
    line-height: 1.5;
    margin-bottom: 1rem;
    flex: 1;
}

.must-watch-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: var(--gradient-primary);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    align-self: flex-start;
}

.must-watch-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 51, 102, 0.3);
}

/* Categories Section - Updated for index.php */
.categories-section {
    padding: 1.5rem;
    margin: 2rem 0;
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
}

.category-card {
    background: var(--drama-card);
    border-radius: 12px;
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    transition: all 0.3s ease;
    border: 1px solid var(--drama-border);
}

.category-card:hover {
    transform: translateY(-4px);
    border-color: var(--drama-primary);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.category-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.75rem;
}

.category-icon i {
    font-size: 1.25rem;
    color: white;
}

.category-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--drama-text);
    text-align: center;
    margin-bottom: 0.25rem;
}

.category-count {
    font-size: 0.75rem;
    color: var(--drama-text-secondary);
}

/* Horizontal Scroll Sections */
.horizontal-section {
    position: relative;
    margin-bottom: 2rem;
}

.horizontal-container {
    display: flex;
    overflow-x: auto;
    gap: 1rem;
    padding: 0.5rem;
    scrollbar-width: thin;
    scrollbar-color: #ff3366 transparent;
}

.horizontal-container::-webkit-scrollbar {
    height: 6px;
}

.horizontal-container::-webkit-scrollbar-track {
    background: #1a1a2e;
    border-radius: 3px;
}

.horizontal-container::-webkit-scrollbar-thumb {
    background: #ff3366;
    border-radius: 3px;
}

.horizontal-item {
    flex: 0 0 auto;
    width: 180px;
}

/* Social Bar - From index.php */
.social-bar {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1000;
}

.social-icon {
    width: 40px;
    height: 40px;
    background: #ff3366;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.3s ease;
}

.social-icon:hover {
    transform: scale(1.1);
    background: #ff6699;
}

/* Ad Banner - From index.php */
.ad-banner {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    border-radius: 10px;
    margin: 20px 0;
    text-align: center;
}

.ad-banner h4 {
    margin: 0 0 10px 0;
    font-size: 18px;
}

.ad-banner p {
    margin: 0;
    opacity: 0.9;
}

/* No Data Message */
.no-data-message {
    padding: 20px;
    text-align: center;
    background: #1a1a2e;
    border-radius: 10px;
    color: #888;
    margin: 20px 0;
}

.no-data-message i {
    font-size: 40px;
    margin-bottom: 10px;
    display: block;
}

/* Default Thumbnail */
.default-thumbnail {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #666;
    font-size: 14px;
    position: absolute;
    top: 0;
    left: 0;
}

.default-thumbnail i {
    font-size: 48px;
    margin-bottom: 10px;
    color: #ff3366;
}

/* Mobile Responsive Design */
@media (max-width: 768px) {
    .top-picks-grid,
    .new-releases-grid,
    .latest-episodes-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .trending-grid,
    .must-watch-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .horizontal-item {
        width: 160px;
    }
    
    /* Thumbnail adjustments for mobile */
    .card-thumbnail-container {
        padding-top: 140%; /* Maintain ratio */
    }
    
    .video-thumbnail-container {
        padding-top: 56.25%;
    }
    
    .thumbnail-overlay {
        padding: 0.5rem;
    }
    
    .overlay-title {
        font-size: 0.75rem;
    }
    
    .overlay-meta {
        font-size: 0.6rem;
    }
    
    .badge {
        font-size: 0.55rem;
        padding: 0.15rem 0.3rem;
    }
    
    .trending-rank {
        width: 20px;
        height: 20px;
        font-size: 0.6rem;
    }
    
    .card-title-container {
        padding: 0.5rem;
    }
    
    .card-title-main {
        font-size: 0.75rem;
    }
    
    .card-subtitle {
        font-size: 0.7rem;
    }
    
    .card-meta {
        font-size: 0.6rem;
    }
    
    /* Categories Grid */
    .categories-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.75rem;
    }
    
    .category-card {
        padding: 1rem 0.5rem;
    }
    
    .category-icon {
        width: 40px;
        height: 40px;
    }
    
    .category-icon i {
        font-size: 1rem;
    }
    
    .category-name {
        font-size: 0.75rem;
    }
    
    .category-count {
        font-size: 0.65rem;
    }
    
    /* Must Watch */
    .must-watch-section {
        padding: 1rem;
        margin: 1.5rem 0;
    }
    
    .must-watch-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .must-watch-thumbnail {
        padding-top: 56.25%;
    }
    
    .must-watch-content {
        padding: 1rem;
    }
    
    .must-watch-title {
        font-size: 1rem;
    }
    
    .must-watch-description {
        font-size: 0.75rem;
    }
    
    /* Hide social bar on mobile */
    .social-bar {
        display: none;
    }
}

@media (max-width: 480px) {
    .top-picks-grid,
    .new-releases-grid,
    .latest-episodes-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    
    .horizontal-item {
        width: 140px;
    }
    
    .categories-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    
    /* More compact for small screens */
    .card-thumbnail-container {
        padding-top: 130%; /* Slightly less tall */
    }
    
    .thumbnail-overlay {
        padding: 0.4rem;
    }
    
    .overlay-title {
        font-size: 0.7rem;
    }
    
    .overlay-meta {
        font-size: 0.55rem;
    }
    
    .card-title-container {
        padding: 0.4rem;
    }
    
    .card-title-main {
        font-size: 0.7rem;
    }
    
    .card-subtitle {
        font-size: 0.65rem;
    }
    
    .badge {
        font-size: 0.5rem;
        padding: 0.1rem 0.25rem;
    }
    
    .trending-rank {
        width: 18px;
        height: 18px;
        font-size: 0.55rem;
    }
    
    .must-watch-section,
    .categories-section {
        padding: 0.75rem;
        margin: 1rem 0;
    }
}

@media (max-width: 360px) {
    .top-picks-grid,
    .new-releases-grid,
    .latest-episodes-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.35rem;
    }
    
    .horizontal-item {
        width: 130px;
    }
    
    .categories-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.35rem;
    }
    
    .thumbnail-overlay {
        padding: 0.35rem;
    }
    
    .overlay-title {
        font-size: 0.65rem;
    }
    
    .overlay-meta {
        font-size: 0.5rem;
    }
    
    .card-title-main {
        font-size: 0.65rem;
    }
}

/* Desktop Optimizations */
@media (min-width: 769px) and (max-width: 1024px) {
    .top-picks-grid,
    .new-releases-grid,
    .latest-episodes-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .trending-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .must-watch-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .categories-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .horizontal-item {
        width: 200px;
    }
}

@media (min-width: 1025px) {
    .top-picks-grid,
    .new-releases-grid,
    .latest-episodes-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .trending-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .must-watch-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .categories-grid {
        grid-template-columns: repeat(6, 1fr);
    }
    
    .horizontal-item {
        width: 220px;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    .series-card:hover,
    .trending-card:hover,
    .top-pick-card:hover,
    .new-release-card:hover,
    .episode-card:hover,
    .top-rated-card:hover,
    .must-watch-card:hover {
        transform: none;
    }
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

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

/* Utility Classes */
.text-gradient {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--drama-text-secondary);
}

.empty-state i {
    font-size: 2rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--drama-text);
}

/* View Count Format */
.view-count {
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
}

/* Rating */
.rating {
    display: flex;
    align-items: center;
    gap: 0.15rem;
    color: #fdcb6e;
}

/* Episode Info */
.episode-info,
.episode-count {
    display: flex;
    align-items: center;
    gap: 0.15rem;
}

/* Section Header */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--drama-text);
    margin: 0;
}

.section-subtitle {
    color: var(--drama-text-secondary);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.section-more {
    color: var(--drama-primary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.section-more:hover {
    gap: 0.75rem;
}

/* Content Section */
.content-section {
    padding: 0 1rem 2rem;
    margin-bottom: 1rem;
}

/* Swiper Styles */
.swiper-button-next,
.swiper-button-prev {
    color: #fff;
    background: rgba(255, 51, 102, 0.8);
    width: 50px;
    height: 50px;
    border-radius: 50%;
}

.swiper-button-next:after,
.swiper-button-prev:after {
    font-size: 20px;
}

.swiper-pagination-bullet {
    background: #fff;
    opacity: 0.5;
}

.swiper-pagination-bullet-active {
    background: #ff3366;
    opacity: 1;
}