/* DramaShort Custom Styles */

/* Drama Card Hover Effects */
.drama-card {
    transition: all 0.2s ease-in-out;
}

.drama-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

/* Drama Card Images */
.drama-card img {
    object-fit: contain; /* Prevent cropping */
    object-position: center;
    background-color: #f8f9fa; /* Light background for letterboxing */
    transition: transform 0.2s ease;
}

.drama-card:hover img {
    transform: scale(1.02); /* Subtle zoom effect */
}

/* Text Truncation */
.line-clamp-1 {
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Section Titles */
.section-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 1rem;
}

/* More Links */
.more-link {
    color: #6b7280;
    font-size: 0.875rem;
    text-decoration: none;
    transition: color 0.2s ease;
}

.more-link:hover {
    color: #374151;
}

/* Drama Titles */
.drama-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: #1f2937;
    line-height: 1.2;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

/* Drama Meta Info */
.drama-meta {
    font-size: 0.75rem;
    color: #6b7280;
}

/* Episode Count Badge */
.episode-count {
    background-color: #f3f4f6;
    color: #374151;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Featured Drama Gradient Overlay */
.featured-overlay {
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.4) 50%, transparent 100%);
}

/* Search Input Styling */
.search-input {
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.search-input:focus {
    outline: none;
    border-color: #ec4899;
    box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.1);
    background-color: #ffffff;
}

/* Language Selector */
.language-selector {
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
    color: #374151;
    transition: all 0.2s ease;
}

.language-selector:focus {
    outline: none;
    border-color: #ec4899;
    box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.1);
}

/* Navigation Hover Effects */
.nav-link {
    color: #374151;
    font-weight: 500;
    font-size: 0.875rem;
    text-decoration: none;
    transition: color 0.2s ease;
}

.nav-link:hover {
    color: #ec4899;
}

/* Button Styles */
.btn-primary {
    background-color: #ec4899;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: background-color 0.2s ease;
    border: none;
    cursor: pointer;
}

.btn-primary:hover {
    background-color: #db2777;
}

/* Grid Responsive Adjustments */
@media (max-width: 640px) {
    .section-title {
        font-size: 1.25rem;
    }
    
    .drama-title {
        font-size: 0.8rem;
    }
    
    .drama-meta {
        font-size: 0.7rem;
    }
    
    /* Mobile specific adjustments */
    .FirstList_firstListBox__eN_W1 {
        grid-template-columns: repeat(2, 1fr);
        grid-column-gap: 12px;
        padding: 0 4px;
    }
    
    .FirstList_itemBox__AfNNm {
        width: 100%;
        max-width: none;
    }
    
    .FirstList_bookImage__ZbBGO {
        height: 240px; /* Smaller height on mobile */
    }
    
    .FirstList_bookName__cULmf {
        font-size: 14px;
        line-height: 1.3;
        padding-top: 12px;
    }
    
    /* Home title adjustments */
    .HomeTitle_titleText___rwoq {
        font-size: 20px !important;
        line-height: 24px !important;
    }
    
    .HomeTitle_titleWrap__Yr37H {
        padding-bottom: 20px;
        height: auto;
    }
}

/* Loading Animation */
.loading-spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Image Lazy Loading */
.lazy-image {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lazy-image.loaded {
    opacity: 1;
}

/* Mobile Menu */
.mobile-menu {
    transform: translateY(-10px);
    opacity: 0;
    transition: all 0.2s ease;
}

.mobile-menu.show {
    transform: translateY(0);
    opacity: 1;
}

/* Footer Styling */
.footer-link {
    color: #6b7280;
    font-size: 0.875rem;
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-link:hover {
    color: #374151;
}

/* Aspect Ratios */
.aspect-w-16 {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 */
}

.aspect-w-3 {
    position: relative;
    padding-bottom: 133.33%; /* 3:4 */
}

.aspect-w-16 > *,
.aspect-w-3 > * {
    position: absolute;
    height: 100%;
    width: 100%;
    top: 0;
    left: 0;
    object-fit: cover;
}

/* Global Thumbnail Styles - Prevent Cropping */
.drama-thumbnail,
.drama-poster,
.drama-card img,
img[alt*="Drama"],
img[src*="cover"] {
    object-fit: contain !important;
    object-position: center !important;
    background-color: #f8f9fa;
}

/* Specific container styles for consistent sizing */
.drama-poster-container,
.related-drama-thumb,
.drama-thumbnail-container {
    background-color: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Hover effects for thumbnails */
.drama-card:hover .drama-thumbnail,
.drama-card:hover img {
    transform: scale(1.02);
    transition: transform 0.2s ease;
}
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Dark theme scrollbar for filter page */
.bg-black ::-webkit-scrollbar-track {
    background: #18181b;
}

.bg-black ::-webkit-scrollbar-thumb {
    background: #3f3f46;
}

.bg-black ::-webkit-scrollbar-thumb:hover {
    background: #52525b;
}

/* Filter button styles */
.filter-btn {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.filter-btn:focus {
    outline: none;
    ring: 2px;
    ring-color: rgba(236, 72, 153, 0.5);
}

/* Dark theme body override for filter page */
.bg-black {
    color: white;
    background-color: #000000;
}

.bg-black body {
    background-color: #000000 !important;
}

/* Filter page specific styles */
.filter-page-container {
    background: linear-gradient(135deg, #000000 0%, #0a0a0a 100%);
    min-height: 100vh;
}

/* Hover effects for filter cards */
.bg-zinc-900\/50:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(236, 72, 153, 0.1);
}

/* Animation for filter buttons */
.filter-btn {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.filter-btn:hover {
    transform: translateY(-1px);
}

/* Responsive adjustments for filter page */
@media (max-width: 768px) {
    .bg-zinc-900 {
        margin: 0 8px;
        border-radius: 16px;
    }
    
    .filter-btn {
        font-size: 0.875rem;
        padding: 0.5rem 0.75rem;
    }
    
    .filter-btn.text-sm {
        font-size: 0.8rem;
        padding: 0.375rem 0.625rem;
    }
}

/* Drama Title Styles */
.drama-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: #1f2937;
    line-height: 1.2;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

/* Mobile Dropdown Styles */
#mobile-search-dropdown,
#mobile-lang-dropdown {
    animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile Icon Buttons */
#mobile-search-btn,
#mobile-lang-btn {
    border-radius: 0.375rem;
    transition: all 0.2s ease;
}

#mobile-search-btn:hover,
#mobile-lang-btn:hover {
    background-color: #f3f4f6;
}

/* Mobile Language Grid */
#mobile-lang-dropdown button {
    transition: all 0.2s ease;
}

#mobile-lang-dropdown button:hover {
    background-color: #f3f4f6;
}

/* Mobile Search Input */
#mobile-search-dropdown input {
    transition: all 0.2s ease;
}

#mobile-search-dropdown input:focus {
    outline: none;
    border-color: #ec4899;
    box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.1);
}

/* Featured Content Styles */
.SwiperArea_swiperWrap__rDlnx {
    padding: 20px 16px 60px; /* Add horizontal padding */
    display: none;
    overflow: hidden; /* Prevent content overflow */
}

.SwiperArea_swiperBox__ElCPm {
    height: 460px;
    display: flex;
    align-items: center;
    flex-direction: row;
    gap: 20px;
    max-width: 100%; /* Ensure it doesn't exceed container */
}

.SwiperArea_leftCard__XVsr9 {
    width: 892px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: row;
    background-color: rgba(50, 50, 57, 0.07);
    border-radius: 4px;
    overflow: hidden;
}

.SwiperArea_leftCardImg___z2BA {
    flex-shrink: 0;
    width: 345px;
    height: 460px;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    border-radius: 4px;
    background-color: #f8f9fa; /* Add background for letterboxing */
}

.SwiperArea_leftCardImg___z2BA img {
    object-fit: contain; /* Prevent cropping */
    object-position: center;
    width: 100%;
    height: 100%;
}

.SwiperArea_leftCardContent__tkosD {
    padding: 20px 20px 28px;
    height: 460px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex: 1 1;
}

.SwiperArea_leftCardContentTop__MdPT7 {
    max-width: 507px;
}

.SwiperArea_leftBookName__RivVY {
    display: block;
    font-size: 24px;
    font-weight: 500;
    color: rgba(0, 0, 0, 0.9);
    line-height: 32px;
    margin-bottom: 20px;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    overflow: hidden;
}

.SwiperArea_chapterCount__Cx0P3 {
    display: inline-block;
    font-size: 14px;
    font-weight: 400;
    color: rgba(0, 0, 0, 0.9);
    line-height: 20px;
    margin-bottom: 20px;
}

.SwiperArea_intro___hP_c {
    display: inline-block;
    font-size: 14px;
    font-weight: 400;
    color: rgba(0, 0, 0, 0.6);
    line-height: 20px;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 10;
    word-wrap: break-word;
    overflow: hidden;
}

.SwiperArea_leftCard__XVsr9:hover {
    transition: background-color 0.3s;
    background-color: rgba(50, 50, 57, 0.07);
}

.SwiperArea_leftCard__XVsr9:hover .SwiperArea_leftBookName__RivVY {
    transition: color 0.3s;
    color: #ff375f;
}

.SwiperArea_rightCard__iiynC {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.SwiperArea_rightCardItem__tWHir {
    width: 528px;
    height: 220px;
    background-color: rgba(50, 50, 57, 0.07);
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    flex-direction: row;
}

.SwiperArea_rightCardItemImg__RV6yA {
    width: 165px;
    height: 220px;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    border-radius: 4px;
    background-color: #f8f9fa; /* Add background for letterboxing */
}

.SwiperArea_rightCardItemImg__RV6yA img {
    object-fit: contain; /* Prevent cropping */
    object-position: center;
    width: 100%;
    height: 100%;
}

.SwiperArea_rightCardContent__5mJzc {
    padding: 20px 20px 20px 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex: 1 1;
}

.SwiperArea_rightCardContentTop__H2KPu {
    max-width: 325px;
}

.SwiperArea_bookName__PRLED {
    display: block;
    font-size: 24px;
    font-weight: 500;
    color: rgba(0, 0, 0, 0.9);
    line-height: 32px;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    overflow: hidden;
    margin-bottom: 8px;
}

.SwiperArea_rightCardItem__tWHir:hover {
    transition: background-color 0.3s;
    background-color: rgba(50, 50, 57, 0.07);
}

.SwiperArea_rightCardItem__tWHir:hover .SwiperArea_bookName__PRLED {
    transition: color 0.3s;
    color: #ff375f;
}

/* Image Styles */
.image_imageBox__Mubn5 {
    user-select: none;
    position: relative;
    overflow: hidden;
    display: block;
}

.image_imageItem__IZeBT {
    object-fit: contain; /* Changed from cover to contain to prevent cropping */
    object-position: center; /* Center the image */
    width: 100%;
    height: 100%;
    transition: all 0.5s;
    background-color: #f8f9fa; /* Add light background for letterboxing */
}

.image_imageScaleBox__JFwzM:hover .image_imageItem__IZeBT {
    transform: scale(1.05); /* Reduced scale to prevent overflow */
}

/* Tag Styles */
.typeTwoTag_typeTagBox__JKnVQ {
    font-size: 12px;
    font-weight: 400;
    gap: 8px;
    display: flex;
    flex-wrap: wrap;
    height: 24px;
    overflow: hidden;
}

.typeTwoTag_leftTag__49wGv {
    color: rgba(0, 0, 0, 0.6);
    border-radius: 12px;
    padding: 0 10px;
    background-color: rgba(50, 50, 57, 0.07);
    height: 24px;
    line-height: 24px;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: color 0.3s;
}

.typeTwoTag_leftTag__49wGv:hover {
    color: #ff375f;
}

/* Tablet adjustments */
@media (min-width: 641px) and (max-width: 1023px) {
    .FirstList_firstListBox__eN_W1 {
        grid-template-columns: repeat(4, 1fr);
        grid-column-gap: 12px;
        padding: 0 12px;
    }
    
    .FirstList_itemBox__AfNNm {
        width: 100%;
        max-width: 200px;
    }
}

/* Show on desktop only */
@media (min-width: 768px) {
    .SwiperArea_swiperWrap__rDlnx {
        display: block;
    }
}

/* Home Title Styles */
.HomeTitle_titleWrap__Yr37H {
    padding-bottom: 32px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.HomeTitle_titleText___rwoq {
    font-size: 34px;
    color: rgba(0, 0, 0, 0.9);
    font-weight: 500;
    line-height: 48px;
}

.HomeTitle_moreBox__fZcQq {
    justify-content: flex-end;
    min-width: 100px;
    height: 100%;
    font-size: 16px;
    color: rgba(0, 0, 0, 0.9);
    font-weight: 400;
    display: flex;
    align-items: center;
}

.HomeTitle_moreBox__fZcQq:after {
    content: "";
    display: inline-block;
    width: 15px;
    height: 15px;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"/></svg>') 0 0/100% 100% no-repeat;
    filter: grayscale(1);
    margin-left: 5px;
}

.HomeTitle_moreBox__fZcQq:hover {
    color: #ff375f;
}

.HomeTitle_moreBox__fZcQq:hover:after {
    filter: none;
}

@media (min-width: 768px) {
    .HomeTitle_titleWrap__Yr37H {
        padding-bottom: 28px;
        height: 57px;
    }
    
    .HomeTitle_titleText___rwoq {
        font-size: 24px;
        font-weight: 900;
        color: rgba(0, 0, 0, 0.9);
        line-height: 29px;
    }
}

/* First List Styles */
.FirstList_firstListBox__eN_W1 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-column-gap: 16px;
    padding: 0 8px; /* Add padding to prevent edge cutting */
}

.FirstList_itemBox__AfNNm {
    width: 100%;
    max-width: 218px;
    padding-bottom: 32px;
    margin: 0 auto; /* Center items */
}

.FirstList_bookImage__ZbBGO {
    width: 100%;
    height: 294px;
    overflow: hidden;
    border-radius: 8px;
    display: flex;
    align-items: center;
    background-color: #f8f9fa; /* Add background for letterboxing */
}

.FirstList_bookImage__ZbBGO img {
    object-fit: contain; /* Prevent cropping */
    object-position: center;
    width: 100%;
    height: 100%;
}

.FirstList_chapterCount__OyG6t {
    display: none;
    background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.6));
    position: absolute;
    z-index: 10;
    width: 100%;
    height: 56px;
    top: 248px;
    left: 0;
    padding: 25px 8px 0;
    text-align: right;
    font-size: 13px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.8);
    line-height: 18px;
}

.FirstList_chapterCount__OyG6t:before {
    content: "";
    display: inline-block;
    width: 16px;
    height: 16px;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 10l4.553-2.276A1 1 0 0121 8.618v6.764a1 1 0 01-1.447.894L15 14M5 18h8a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v8a2 2 0 002 2z"/></svg>') 0 0/100% 100% no-repeat;
    margin-right: 4px;
}

.FirstList_bookName__cULmf {
    padding-top: 16px;
    display: block;
    width: 100%;
    color: rgba(0, 0, 0, 0.9);
    font-size: 16px; /* Reduced font size for mobile */
    font-weight: 400;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2; /* Allow 2 lines */
    word-wrap: break-word;
    line-height: 1.4;
    height: auto;
    white-space: normal; /* Allow text wrapping */
}

.FirstList_bookNameBox__LdUXf {
    display: none;
    position: relative;
    z-index: 2;
    opacity: 0;
    padding: 12px;
    background: rgba(50, 50, 57, 0.07);
    border-radius: 0 0 4px 4px;
}

.FirstList_bookNameHover__f03t0 {
    display: block;
    font-size: 16px;
    font-weight: 500;
    color: #ff375f;
    line-height: 22px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    word-wrap: break-word;
    margin-bottom: 10px;
}

@media (min-width: 768px) {
    .FirstList_firstListBox__eN_W1 {
        display: grid;
        grid-template-columns: repeat(6, 1fr);
        grid-column-gap: 14px;
        padding: 0 16px 10px; /* Add horizontal padding */
    }
    
    .FirstList_itemBox__AfNNm {
        padding-bottom: 0;
        width: 100%;
        max-width: 228px;
        height: 410px;
        position: relative;
        margin: 0 auto; /* Center items */
    }
    
    .FirstList_bookImage__ZbBGO {
        width: 100%;
        height: 304px;
        position: relative;
        z-index: 9;
    }
    
    .FirstList_chapterCount__OyG6t {
        display: flex;
        align-items: center;
        border-radius: 0 0 8px 8px;
    }
    
    .FirstList_bookName__cULmf {
        width: 100%;
        font-weight: 500;
        color: rgba(0, 0, 0, 0.9);
        font-size: 16px;
        line-height: 22px;
        position: absolute;
        top: 316px;
        left: 0;
        z-index: 1;
        opacity: 1;
        padding-top: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        word-wrap: break-word;
        white-space: normal;
        height: auto;
        min-height: 44px; /* Ensure space for 2 lines */
    }
    
    .FirstList_bookNameBox__LdUXf {
        display: block;
        border-radius: 0 0 8px 8px;
        width: 100%;
    }
    
    .FirstList_itemBox__AfNNm:hover .FirstList_bookName__cULmf {
        opacity: 0;
    }
    
    .FirstList_itemBox__AfNNm:hover .FirstList_bookNameBox__LdUXf {
        opacity: 1;
    }
    
    .FirstList_itemBox__AfNNm:hover .FirstList_bookImage__ZbBGO {
        border-radius: 8px 8px 0 0;
    }
    
    .FirstList_itemBox__AfNNm:hover .FirstList_chapterCount__OyG6t {
        border-radius: 0;
    }
}