/* style.css v2.4 - Revert Global Card & Add Scoped Donghua Style */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
    --primary-color: #00aaff;
    --background-color: #0B0C10;
    --surface-color: #1F2833;
    --surface-color-darker: #161d25;
    --text-color: #C5C6C7;
    --text-color-heading: #FFFFFF;
    --border-color: #2c3a47;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
}

main {
    padding: 1rem;
    padding-bottom: 65px; /* Space for bottom nav */
}

/* ... Spotlight (Kept) ... */
.spotlight-section { 
    margin-bottom: 3rem; 
    position: relative;
    margin-left: 1rem;
    margin-right: 1rem;
}

.spotlight-section h2 { font-size: 1.8rem; font-weight: 700; color: var(--text-color-heading); margin-bottom: 1rem; padding-bottom: 0.5rem; border-bottom: 3px solid var(--primary-color); display: inline-block; }

.spotlight-section .section-header-row {
    display: flex; /* Restore header visibility */
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 1rem;
}

.spotlight-slider-container { 
    position: relative; 
    width: 100%; 
    aspect-ratio: 16 / 9; 
    border-radius: 12px; /* Keep radius on the slider itself */
    overflow: hidden; 
    background-color: var(--surface-color); 
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2); 
}
/* ... rest of spotlight slide css ... */
.spotlight-slide { position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0; transition: opacity 1s ease-in-out; z-index: 1; cursor: pointer; }
.spotlight-slide.active { opacity: 1; z-index: 2; }
.spotlight-slide .slide-poster { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s ease-in-out; }
.spotlight-slide.active .slide-poster { transform: scale(1.05); }
.spotlight-slide .slide-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: linear-gradient(to top, rgba(11, 12, 16, 0.9) 15%, rgba(11, 12, 16, 0.5) 50%, transparent 100%); z-index: 2; }
.spotlight-slide .rank { position: absolute; top: 0; left: 0; z-index: 4; font-size: 1.2rem; font-weight: 700; color: white; background: var(--primary-color); padding: 0.5rem 1rem; border-bottom-right-radius: 12px; box-shadow: 0 4px 10px rgba(0,0,0,0.5); }
.spotlight-slide .slide-content { position: absolute; bottom: 0; left: 0; width: 100%; padding: 2rem; z-index: 3; color: white; transform: translateY(20px); opacity: 0; transition: all 0.6s ease-out; transition-delay: 0.3s; }
.spotlight-slide.active .slide-content { transform: translateY(0); opacity: 1; }
.slide-content .slide-title { font-size: 2.2rem; font-weight: 700; margin-bottom: 0.5rem; text-shadow: 2px 2px 8px rgba(0,0,0,0.8); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slide-content .slide-rating { font-size: 1.1rem; font-weight: bold; color: #ffc107; margin-bottom: 1rem; }
.slide-content .slide-genres { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.slide-content .genre-badge { background-color: rgba(255, 255, 255, 0.1); color: #f0f0f0; padding: 0.4rem 0.8rem; border-radius: 20px; font-size: 0.8rem; border: 1px solid rgba(255, 255, 255, 0.2); }

/* --- Anime List Section --- */
.anime-list-section { 
    margin-bottom: 3rem; 
    padding: 0; /* No padding for full width feel */
}
.anime-list-section h2 { font-size: 1.8rem; font-weight: 700; color: var(--text-color-heading); margin-bottom: 1.5rem; padding-bottom: 0.5rem; border-bottom: 3px solid var(--primary-color); display: inline-block; }
.anime-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem 0.5rem; }

/* --- STANDARD CARD STYLES (Restored for Home/No-Sub) --- */
.anime-card {
    background-color: transparent;
    text-decoration: none;
    color: var(--text-color);
    transition: transform 0.3s ease;
    display: flex; /* Flex for column layout (image then title) */
    flex-direction: column;
}

.anime-card:hover {
    transform: translateY(-8px);
}

.anime-card .card-img-container {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 0.75rem;
    background-color: var(--surface-color);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    transition: box-shadow 0.3s ease;
}

.anime-card:hover .card-img-container {
    box-shadow: 0 10px 25px rgba(0,0,0,0.5), 0 0 0 3px var(--primary-color);
}

.anime-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.anime-card:hover img {
    transform: scale(1.05);
}

.anime-card h3 {
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.4em;
    height: 2.8em;
    overflow: hidden;
    text-overflow: ellipsis;
    /* Ensure title is visible for standard cards */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* --- BADGES (Standard) --- */
.type-badge {
    position: absolute;
    top: 0;
    left: 0;
    padding: 4px 12px 6px 8px;
    border-radius: 0 0 16px 0;
    font-size: 0.75rem;
    font-weight: 700;
    color: white;
    z-index: 2;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(0, 0, 0, 0.8);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 2px 2px 5px rgba(0,0,0,0.3);
}

.type-badge.anime { background: #00aaff; }
.type-badge.donghua { background: #e91e63; }

.sub-badge {
    position: absolute;
    top: 0;
    right: 0;
    padding: 4px 8px;
    border-radius: 0 0 0 10px;
    font-size: 0.7rem;
    font-weight: 700;
    color: white;
    z-index: 2;
    box-shadow: -2px 2px 5px rgba(0,0,0,0.3);
}

.sub-badge.no-sub { background: #607d8b; }
.sub-badge.sub-indo { background: #4caf50; }

.episode-badge {
    position: absolute;
    bottom: 0;
    left: 0;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 4px 12px 4px 8px;
    border-radius: 0 16px 0 0;
    font-size: 0.75rem;
    font-weight: 600;
    border-top: 1px solid rgba(255,255,255,0.1);
    border-right: 1px solid rgba(255,255,255,0.1);
    z-index: 2;
}

/* --- OVERLAY CARD STYLES (Scoped for Donghua/Special Cards) --- */
/* Use .overlay-card class explicitly for these */
.overlay-card {
    display: block; /* Ensure block layout for absolute positioning context inside */
    position: relative;
    overflow: hidden;
    border-radius: 12px;
}

.overlay-card .card-img-container {
    margin-bottom: 0; /* No margin needed for overlay style */
    height: 100%;
    border-radius: 12px; /* Ensure radius on container */
}

/* Adjust badges for overlay card context if needed */
.overlay-card .episode-badge {
    bottom: auto; 
    top: 0; 
    right: 0; 
    left: auto;
    border-radius: 0 0 0 12px;
}

.card-overlay-gradient {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60%;
    background: linear-gradient(to top, rgba(0,0,0,0.95) 10%, rgba(0,0,0,0.7) 40%, transparent 100%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 10px;
    z-index: 2;
    pointer-events: none;
}

.overlay-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #fff;
    line-height: 1.3;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 4px;
}

.overlay-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 2px;
}

.status-pill {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 4px;
    color: #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

.status-pill.badge-ongoing { background: linear-gradient(135deg, #00d2ff, #3a7bd5); }
.status-pill.badge-completed { background: linear-gradient(135deg, #FFD700, #FFA500); }

/* --- Skeletons --- */
@keyframes shimmer { 0% { background-position: -480px 0; } 100% { background-position: 480px 0; } }
.skeleton-card, .skeleton-spotlight-card { position: relative; overflow: hidden; background-color: var(--surface-color); }
.skeleton-card::after, .skeleton-spotlight-card::after { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.05), transparent); background-size: 1000px 100%; animation: shimmer 1.5s infinite linear; }
.skeleton-spotlight-card { width: 100%; height: 100%; border-radius: 16px; }
.anime-card.skeleton { background: none; }
.anime-card.skeleton .skeleton-img { width: 100%; aspect-ratio: 3 / 4; border-radius: 12px; margin-bottom: 0.75rem; background-color: var(--surface-color); }
.anime-card.skeleton .skeleton-title { height: 1rem; width: 80%; border-radius: 4px; background-color: var(--surface-color); }

/* --- APK Banner --- */
.apk-banner { 
    display: none; 
    background: linear-gradient(45deg, var(--primary-color), #0077b3); 
    color: white; 
    text-align: center; 
    padding: 0.75rem; 
    margin: 0.5rem 0.5rem 1rem 0.5rem; /* Reduced margin */
    border-radius: 12px; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.3); 
    position: relative; 
    font-weight: 500; 
}
.apk-banner p { margin: 0; font-size: 0.9rem; }
.apk-banner a { color: white; font-weight: bold; text-decoration: underline; }
.apk-banner .close-btn { position: absolute; top: 2px; right: 5px; background: none; border: none; color: white; font-size: 20px; cursor: pointer; padding: 5px; line-height: 1; opacity: 0.8; }
.apk-banner .close-btn:hover { opacity: 1; }

/* --- Responsive --- */
@media (max-width: 768px) {
    main { padding: 5px; padding-bottom: 70px; } 
    
    .spotlight-section h2, .anime-list-section h2 { font-size: 1.4rem; margin-left: 5px; margin-bottom: 0.5rem; }
    
    .spotlight-section .section-header-row { margin-bottom: 0.5rem; }

    /* Spotlight: Slightly wider but still spaced */
    .spotlight-section { 
        margin-left: 5px; 
        margin-right: 5px;
        margin-bottom: 2rem;
    }
    
    /* Anime List: Full width */
    .anime-list-section { 
        margin-top: 1rem;
        padding: 0;
    }
    
    .slide-content .slide-title { font-size: 1.5rem; }
    
    /* Grid: 3 columns, tight gap */
    .anime-grid { 
        grid-template-columns: repeat(3, 1fr); 
        gap: 6px; 
    } 
    
    .anime-card h3 { font-size: 0.8rem; height: 2.4em; -webkit-line-clamp: 2; }
    .overlay-title { font-size: 0.8rem; }
    
    /* Adjust badges for small cards */
    .type-badge { font-size: 0.6rem; padding: 2px 8px 4px 6px; }
    .episode-badge { font-size: 0.6rem; padding: 2px 8px 2px 6px; }
}
@media (max-width: 480px) {
    .anime-grid { grid-template-columns: repeat(3, 1fr); gap: 0.35rem; } /* Tightest gap for max card size */
}