/*
Theme Name: BloomToon
Author: Your Name
Description: Manga Theme
Version: 1.0
*/

body {
    background-color: #ffffff !important;
    color: #111111;
    font-family: 'Cairo', sans-serif;
    margin: 0;
    padding: 0;
    direction: rtl;
}

/* 
   إزالة تجميد الصفحة للسماح بالسكرول الطبيعي 
*/
body.home {
    height: auto;
    overflow: visible;
}

/* Tappytoon App Shell */
.main-header {
    position: relative;
    height: 64px;
    background: #fff;
    display: flex;
    align-items: center;
    padding: 0 15px;
}

#app-scroll-area {
    /* Space for fixed header - matched to 64px */
    min-height: calc(100vh - 64px);
    background: #fff;
    position: relative;
    /* Removed fixed positioning to allow natural scroll with footer */
}

/* 
   Home View Desktop Constraint (80%) 
   Applying width constraint to the main scroll area on desktop
*/
@media (min-width: 1024px) {
    #app-scroll-area {
        max-width: none;
        margin: 0 !important;
        box-shadow: none;
        padding-bottom: 0 !important;
        width: 100%;
        position: relative;
    }
}

/* Top Tab Bar / Filter Bar (Tappytoon Pill Style) */
.top-tab-bar {
    display: flex;
    padding: 10px 13px;
    gap: 6px;
    background: #ffffff;
    position: relative;
    z-index: 100;
    overflow-x: auto;
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE 10+ */
}

.top-tab-bar::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari */
}

.tab-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    font-weight: 700;
    color: #444;
    padding: 8px 20px;
    cursor: pointer;
    background: #ffffff;
    border: 1px solid #eee;
    border-radius: 50px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}

.tab-btn .tab-icon {
    font-size: 18px;
    line-height: 1;
}

.tab-btn.active {
    background: #111111;
    color: #ffffff;
    border-color: #111111;
    transform: scale(0.98);
}

.tab-btn:active {
    transform: scale(0.95);
}

/* View Containers & Transitions */
.app-view {
    display: none;
    /* Hidden by default */
    padding: 0;
    /* Removed padding to allow full-width content like sliders */
    animation: fadeIn 0.3s ease-in-out;
}

.app-view.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 2-Column Content Grid (Reserved for views) */
.manga-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    padding: 0 15px 20px;
    /* Added padding here instead of parent */
}

.view-section-title {
    padding: 20px 15px 10px;
    font-size: 20px;
    font-weight: 900;
    margin: 0;
}

.manga-card {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    position: relative;
    cursor: pointer;
}

.card-image-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 2/3;
    border-radius: 10px;
    overflow: hidden;
    background: #f9f9f9;
}

.card-image-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.manga-card:hover img {
    transform: scale(1.04);
}

/* Badges (UP, NEW, HOT) */
.card-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 10;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 900;
    color: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.badge-up {
    background: #2ecc71;
}

.badge-new {
    background: #f1c40f;
}

.badge-hot {
    background: #e74c3c;
}

/* Metadata */
.card-info {
    padding: 8px 4px;
}

.card-title {
    font-size: 14px;
    font-weight: 700;
    color: #222;
    margin: 0 0 3px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
}

.card-meta {
    font-size: 11px;
    color: #999;
    font-weight: 600;
}

.nav-item svg {
    width: 24px;
    height: 24px;
}

.hero-slider-area {
    padding: 20px 0;
    background: #ffffff;
}

.myHeroSwiper {
    padding: 0 10% !important;
    /* هذا السر لظهور الكروت الجانبية مقطوعة */
}

.swiper-slide {
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    transition: transform 0.3s ease;
}

.swiper-slide-active {
    transform: scale(1.05);
    /* تكبير الكارت الذي في المنتصف قليلاً */
}

.slider-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.slider-overlay {
    position: absolute;
    bottom: 0;
    width: 100%;
    padding: 20px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    color: #fff;
    text-align: right;
}

/* تنسيقات لإصلاح شكل السلايدر والكروت */
.main-slider-container {
    padding: 20px 0;
    background: #fff;
    overflow: hidden;
}

/* Swiper properties delegated to slider.php inline media queries */

.card-item {
    position: relative;
    height: 100%;
    background: #f0f0f0;
}

.card-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-text {
    position: absolute;
    bottom: 0;
    width: 100%;
    padding: 20px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    color: #fff;
    text-align: right;

}

/* Hide Site Title & Description */
.site-title,
.site-description,
.screen-reader-text.site-title {
    display: none !important;
}

/* Base Styles */
.horizontal-manga-section {
    padding: 8px 0;
    background-color: #ffffff;
    overflow: hidden;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px 16px;
}

.section-title {
    font-size: 15px;
    font-weight: 900;
    color: #111;
    margin: 0;
    font-family: 'Cairo', sans-serif;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 20px;
    background: linear-gradient(to bottom, #2394fc, #0066d6);
    border-radius: 4px;
    flex-shrink: 0;

}

.see-more {
    font-size: 11px;
    color: #888;
    text-decoration: none;
    font-weight: 600;
}

.horizontal-scroll-container {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 10px 15px;
    gap: 12px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE 10+ */
    touch-action: pan-x;
    pointer-events: auto;
}

.horizontal-scroll-container::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari */
}

.manga-scroll-card {
    min-width: 140px;
    width: 140px;
    flex: 0 0 140px;
    /* Force fix width and prevent shrinking */
    text-decoration: none;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease;
}

.manga-scroll-card:hover {
    transform: translateY(-4px);
}

.card-thumb-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 2 / 3;
    /* Standardize to 2/3 */
    border-radius: 5px;
    overflow: hidden;
    background: #f1f5f9;
}

/* Fallback for browsers without aspect-ratio support */
@supports not (aspect-ratio: 1/1) {
    .card-thumb-wrap {
        height: 0;
        padding-top: 150%;
    }

    .scroll-thumb {
        position: absolute;
        top: 0;
        left: 0;
    }
}

.scroll-thumb {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block;
}

.scroll-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: #2394fc;
    color: #fff;
    font-size: 8px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    z-index: 2;
}

.card-meta {
    padding: 8px 2px 0;
}

.scroll-card-title {
    font-size: 14px;
    font-weight: 700;
    color: #333;
    margin: 0;
    font-family: 'Cairo', sans-serif;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
    min-height: 1.4em;
    /* Ensure space for 1 line even if empty */
}

/* Desktop optimization */
@media (min-width: 1024px) {
    .horizontal-manga-section {
        padding: 40px 24px;
        /* مسافات جانبية جيدة في الكمبيوتر لكي لا تلتصق العناوين بالحواف */
    }

    .manga-scroll-card {
        min-width: 220px;
        width: 220px;
        flex: 0 0 220px;
        /* Enforce consistency on desktop */
    }

    .section-title {
        font-size: 22px;
    }

    .section-title::before {
        width: 5px;
        height: 26px;
    }

    .horizontal-scroll-container {
        gap: 24px;
        padding: 0 0 15px;
        /* مسافة للأسفل في الكمبيوتر */
    }
}

/* Most Read Section Styles */
.most-read-section {
    padding: 24px 0;
    background-color: #ffffff;
}

.tabs-scroll-container {
    display: flex;
    overflow-x: auto;
    padding: 0 24px 20px;
    gap: 8px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.tabs-scroll-container::-webkit-scrollbar {
    display: none;
}

.tab-pill {
    padding: 6px 14px;
    border-radius: 50px;
    background-color: #f1f5f9;
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tab-pill.active {
    background-color: #2394fc;
    color: #ffffff;
}

.most-read-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
    padding: 0 11px;
    transition: opacity 0.3s ease;
}

.premium-manga-card {
    text-decoration: none;
    display: block;
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    background: #f1f5f9;
    height: 100%;
    /* Ensure consistent card height in grid if needed */
}

.card-image-content {
    width: 100%;
    aspect-ratio: 2 / 3;
    /* Standardize to 2/3 */
    position: relative;
    overflow: hidden;
}

/* Fallback for aspect-ratio */
@supports not (aspect-ratio: 1/1) {
    .card-image-content {
        padding-top: 150%;
        /* 3/2 */
        height: 0;
    }

    .card-image-content img {
        position: absolute;
        top: 0;
        left: 0;
    }
}

.card-image-content img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block;
}

.card-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 40px 12px 12px;
    /* Balanced padding */
    /* Stronger, shorter gradient strictly at the bottom */
    background: linear-gradient(to top,
            rgba(0, 0, 0, 0.95) 0%,
            rgba(0, 0, 0, 0.4) 60%,
            transparent 100%);
    color: #ffffff;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    transition: all 0.4s ease;
    z-index: 2;
}

/* Let's keep a very subtle hint of the dynamic color only at the very bottom edge if it exists */
.card-overlay::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100%;
    background: var(--avg-color, transparent);
    opacity: 0.3;
    /* Very subtle */
    z-index: -1;
    border-radius: 0 0 12px 12px;
}

.card-title-premium {
    font-size: 14px;
    font-weight: 800;
    margin: 0 0 4px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

.card-meta-premium {
    font-size: 10px;
    font-weight: 600;
    opacity: 0.9;
    color: #2394fc;
    /* Accent color to make it pop */
}

.premium-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 10;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 900;
    color: #fff;
    background: #2394fc;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Desktop sizing for 2x2 feels sparse, let's keep it tight as 2x2 but slightly larger cards */
@media (min-width: 1024px) {
    .most-read-section {
        padding: 40px 24px;
    }

    .most-read-grid {
        grid-template-columns: repeat(4, 1fr);
        /* 4 كروت وليس 2 للكمبيوتر */
        max-width: none;
        margin: 0;
        gap: 24px;
        padding: 0;
    }

    /* إصلاح توسيط عنوان القسم الأكثر قراءة الذي كان يجعله في المنتصف */
    .most-read-section .section-header {
        max-width: none;
        margin: 0;
        padding: 0 0 24px;
    }

    .most-read-section .tabs-scroll-container {
        justify-content: flex-start;
        /* تبويبات على اليمين وليست بالوسط */
        max-width: none;
        margin: 0;
        padding: 0 0 30px;
    }
}

/* [Continue Reading - Minimalist Elegant] */
.continue-reading-section {
    margin: 0px 0 5px;
}

.continue-reading-section .section-header-premium {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 15px;
    margin-bottom: 12px;
}

.continue-reading-section .section-title-premium {
    margin: 0;
    font-size: 15px;
    font-weight: 900;
    color: #111;
    display: flex;
    align-items: center;
    gap: 10px;
}

.continue-reading-section .section-title-premium::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 20px;
    background: linear-gradient(to bottom, #2394fc, #0066d6);
    border-radius: 4px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(35, 148, 252, 0.4);
}

.continue-reading-section .view-all-link {
    font-size: 11px;
    color: #bbb;
    text-decoration: none;
    font-weight: 600;
}

.reading-scroll-container {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 8px;
    padding: 0 8px 15px;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x;
    pointer-events: auto;
    align-items: flex-start;
    /* Ensure cards align top */
}

.reading-scroll-container::-webkit-scrollbar {
    display: none;
}

.reading-card {
    flex: 0 0 180px;
    width: 180px;
    text-decoration: none;
    background: transparent;
}

.reading-card-image {
    position: relative;
    width: 100%;
    height: 101px;
    /* Fallback for 180 * (9/16) */
    aspect-ratio: 16 / 9;
    border-radius: 6px;
    overflow: hidden;
    background: #f1f5f9;
}

/* Ensure height is consistent if aspect-ratio is supported */
@supports (aspect-ratio: 16/9) {
    .reading-card-image {
        height: auto;
    }
}

.reading-card-image img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block;
    transition: transform 0.3s ease;
}

.reading-card:hover .reading-card-image img {
    transform: scale(1.05);
}

.reading-card-info {
    padding: 8px 4px;
    /* Reduced padding for cleaner look */
}

.reading-manga-title {
    margin: 0;
    font-size: 12px;
    font-weight: 800;
    color: #111;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.reading-chapter-info {
    margin: 1px 0 0;
    font-size: 10px;
    font-weight: 600;
    color: #2394fc;
}

/* Minimalist Progress Bar */
.reading-progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: rgba(0, 0, 0, 0.1);
}

.progress-fill {
    width: 70%;
    height: 100%;
    background: #2394fc;
}

@media (min-width: 1040px) {
    .reading-card {
        flex: 0 0 320px !important;
        width: 320px !important;
        min-width: 320px !important;
    }

    .reading-card-image {
        height: 180px !important;
        /* Fixed height for 320px width (16:9) */
    }

    .reading-scroll-container {
        gap: 40px !important;
    }

    .continue-reading-section .section-title-premium {
        font-size: 28px !important;
    }

    .reading-manga-title {
        font-size: 20px !important;
        /* تكبير اسم المانجا/الرواية أكثر */
    }

    .reading-chapter-info {
        font-size: 15px !important;
        /* تكبير اسم وتفاصيل الفصل أكثر */
    }
}

/* [Trending Now Section - Black Theme] */
.trending-section {
    background: #000000;
    padding: 20px 0 10px;
    margin: 20px 0 30px;
    color: #fff;
    overflow: hidden;
    position: relative;
}

@media (min-width: 1024px) {
    .trending-section {
        padding: 40px 24px 20px;
    }
}

.section-header-trending {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    margin-bottom: 20px;
}

.section-title-trending {
    margin: 0;
    font-size: 18px;
    font-weight: 900;
    color: #ffffff;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title-trending::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 22px;
    background: linear-gradient(to bottom, #2394fc, #0066d6);
    border-radius: 4px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(35, 148, 252, 0.5);
}

.view-all-trending {
    font-size: 0px;
    color: #000000;
    text-decoration: none;
    font-weight: 700;
}

.trending-tabs-container {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    padding: 0 20px 25px;
    scrollbar-width: none;
}

.trending-tabs-container::-webkit-scrollbar {
    display: none;
}

.trending-tab-pill {
    padding: 8px 18px;
    background: #1a1a1a;
    border-radius: 40px;
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
    cursor: pointer;
    color: #f1f1f1;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.trending-tab-pill.active {
    background: #fff;
    color: #000;
    box-shadow: 0 5px 15px rgba(255, 255, 255, 0.2);
}

.trending-scroll-container {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 12px;
    /* Tighter gap between cards */
    padding: 0 16px 20px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x;
    pointer-events: auto;
    transition: opacity 0.4s ease;
}

.trending-scroll-container::-webkit-scrollbar {
    display: none;
}

.trending-item {
    flex: 0 0 150px;
    width: 150px;
    flex-shrink: 0;
    position: relative;
    background: #000;
    /* Matching trending theme */
}

.ranking-number {
    position: absolute;
    left: -3px;
    bottom: 10px;
    font-size: 70px;
    /* Increased larger numbers */
    font-weight: 950;
    color: #fff;
    line-height: 1;
    z-index: 10;
    pointer-events: none;

    text-shadow: 0 0 25px rgba(0, 0, 0, 0.6);
    letter-spacing: -12px;
    font-family: 'Arial Black', sans-serif;
}

.trending-card:hover {
    transform: none;
    /* Strictly disable any hover movement */
}

/* Fix ranking badge position - PIN to image wrap bottom instead of item bottom */
.trending-rank-badge {
    position: absolute;
    bottom: -15px;
    /* Relative to trending-card footer */
    left: -8px;
    font-size: 80px;
    font-weight: 850;
    line-height: 1;
    z-index: 10;
    pointer-events: none;
    font-family: 'Arial Black', sans-serif;
    letter-spacing: -4px;
    background: linear-gradient(175deg, #ffffff 0%, #b0b0b0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 4px 6px rgba(0, 4, 10, 0.9)) drop-shadow(0 1px 0 rgba(0, 0, 0, 1));
}

@media (min-width: 1024px) {
    .trending-rank-badge {
        font-size: 100px;
        bottom: -20px;
        left: -12px;
    }
}

/* Ensure the wrapper uses standard aspect ratio strictly */
.trending-image-wrap {
    position: relative;
    aspect-ratio: 2 / 3;
    /* Taller portrait for better cover fit */
    border-radius: 12px;
    overflow: hidden;
    background: #1a1a1a;
}

.trending-image-wrap img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block;
}

@media (min-width: 1024px) {
    .trending-item {
        flex: 0 0 220px;
        width: 220px;
    }

    .trending-scroll-container {
        gap: 24px;
    }

    .section-title-trending {
        font-size: 24px;
    }
}


.trending-info {
    padding-top: 15px;
    padding-bottom: 5px;
}


.trending-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(0deg, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 0.6) 40%, rgba(0, 0, 0, 0) 100%);
    padding: 40px 12px 12px;
}

.trending-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.trending-title {
    margin: 0;
    font-size: 12px;
    font-weight: 900;
    color: #fff;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
    min-height: 1.4em;
}

.trending-sub-meta {
    font-size: 9px;
    font-weight: 800;
    color: #2394fc;
}

/* [Browse by Genre Section] */
.browse-genre-section {
    padding: 50px 8px;
    background: #ffffff;
    margin: -15px 0 -15px;
    /* pull sliders closer together */
}

.browse-genre-title {
    margin: 0 0 18px;
    font-size: 18px;
    font-weight: 900;
    color: #111;
}

.browse-genre-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.browse-genre-card {
    display: block;
    position: relative;
    border-radius: 5px;
    overflow: hidden;
    height: 67px;
    /* Shorter */
    text-decoration: none;
    transition: transform 0.25s ease;
}

.browse-genre-bg {
    position: absolute;
    inset: 0;
    transition: transform 0.3s ease;
}

.browse-genre-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.08);
}

.browse-genre-info {
    position: absolute;
    bottom: 5px;
    left: 5px;
    z-index: 2;
}

.browse-genre-name {
    font-size: 10px;
    /* Smaller text */
    font-weight: 900;
    color: #fff;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.101);
    letter-spacing: -0.9px;
}

/* [Social Links Section] */
.social-links-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 80px 15px 15px;
    background: #fff;
}

.social-banner-link {
    display: block;
    width: 100%;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease;
}

.social-banner-link:active {
    transform: scale(0.98);
}

.social-banner-link img {
    width: 100%;
    height: auto;
    display: block;
}

/* [Re-Refined Modern App Bottom Nav] */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: #ffffff;
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 10000;
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -5px 30px rgba(0, 0, 0, 0.04);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #c0c0c0;
    flex: 1;
    height: 100%;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    -webkit-tap-highlight-color: transparent;
    position: relative;
    gap: 2px;
}

.nav-icon-wrapper {
    position: relative;
    width: 44px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 15px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: transparent;
}

.nav-item.active .nav-icon-wrapper {
    background: rgba(35, 148, 252, 0.08);
    /* Soft active blob */
    color: #2394fc;
}

.nav-item.active {
    color: #111;
}

.nav-item.active .nav-icon-wrapper {
    color: #2394fc;
    transform: translateY(-2px);
}

.nav-item svg {
    width: 22px;
    height: 22px;
    stroke-width: 2px;
    transition: all 0.3s ease;
}

.nav-item.active svg {
    stroke-width: 2.3px;
    transform: scale(1.1);
}

.nav-item span {
    font-size: 11px;
    font-weight: 700;
    transition: all 0.2s ease;
}

.nav-item.active span {
    font-weight: 900;
    color: #111;
}

/* Adjust scroll area for bottom nav */
#app-scroll-area {
    padding-bottom: 80px !important;
}

@media (min-width: 1024px) {
    .bottom-nav {
        display: none !important;
    }

    .site-main-wrapper {
        margin-right: 0 !important;
    }
}

/* Global Grid System */
.manga-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    padding: 15px;
}

@media (min-width: 768px) {
    .manga-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (min-width: 1024px) {
    .manga-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}

.manga-card {
    text-decoration: none;
    color: inherit;
    display: block;
    transition: transform 0.3s ease;
}

.manga-card:hover {
    transform: translateY(-5px);
}

.card-image-wrap {
    position: relative;
    aspect-ratio: 2/3;
    border-radius: 12px;
    overflow: hidden;
    background: #f1f5f9;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.card-image-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 9px;
    font-weight: 900;
    color: #fff;
    z-index: 2;
}

.badge-hot {
    background: #ff4757;
}

.badge-new {
    background: #2394fc;
}

.card-info {
    padding: 8px 0;
}

.card-title {
    font-size: 13px;
    font-weight: 800;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
    color: #1e293b;
}

.card-meta {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 4px;
}

/* Specific badge for novels in grids */
.novel-badge-inline {
    background: #ff4757;
    color: #fff;
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 10px;
    margin-left: 5px;
}

/* [Real-time BEST Ranking Section] */
.best-ranking-section {
    padding: 24px 0;
    background-color: #ffffff;
}

.ranking-tabs-container {
    display: flex;
    overflow-x: auto;
    padding: 0 24px 20px;
    gap: 8px;
    scrollbar-width: none;
}

.ranking-tabs-container::-webkit-scrollbar {
    display: none;
}

.ranking-tab-pill {
    padding: 6px 16px;
    border-radius: 50px;
    background-color: #f3f4f6;
    color: #4b5563;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ranking-tab-pill.active {
    background-color: #111;
    color: #fff;
}

.ranking-slider-container {
    display: flex;
    overflow-x: auto;
    padding: 0 20px 10px;
    gap: 15px;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    transition: opacity 0.3s ease;
}

.ranking-slider-container::-webkit-scrollbar {
    display: none;
}

.ranking-column {
    flex: 0 0 85%;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-snap-align: start;
}

.ranking-item-card {
    display: flex;
    align-items: center;
    gap: 4px;
    text-decoration: none;
    color: inherit;
    padding: 4px 0;
}

.ranking-thumb {
    position: relative;
    flex: 0 0 60px;
    width: 60px;
    height: 90px;
    border-radius: 8px;
    overflow: hidden;
    background: #f1f5f9;
}

.ranking-thumb img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block;
}

.ranking-badge-overlay {
    position: absolute;
    top: 4px;
    left: 8px;
    background: #ff47566c;
    color: #fff;
    font-size: 8px;
    font-weight: 900;
    width: 24px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 2px;
}

.ranking-num-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 25px;
    text-align: center;
}

.rank-digit {
    font-size: 18px;
    font-weight: 900;
    color: #111;
    line-height: 1;
    display: block;
    width: 25px;
}

.rank-trend {
    font-size: 9px;
    font-weight: 700;
    margin-top: 4px;
}

.rank-trend.up {
    color: #ff4757;
}

.rank-trend.down {
    color: #2394fc;
}

.rank-trend.stay {
    color: #9ca3af;
}

.ranking-info {
    flex: 1;
    min-width: 0;
}

.rank-title {
    font-size: 14px;
    font-weight: 700;
    color: #111;
    margin: 0 0 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rank-author {
    font-size: 10px;
    color: #6b7280;
    margin: 0;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Desktop sizing for ranking */
@media (min-width: 1024px) {
    .ranking-column {
        flex: 0 0 30%;
    }
}

/* --- Daily Updates View (Tappytoon Style) --- */
.new-updates-view {
    padding-bottom: 80px;
    background: #fff;
}

.day-selector-wrapper {
    background: #fff;
    padding: 10px 0;
    position: relative;
    z-index: 90;
    border-bottom: 1px solid #f1f1f1;
}

.day-selector-scroll {
    display: flex;
    overflow-x: auto;
    padding: 0 15px;
    gap: 15px;
    scrollbar-width: none;
}

.day-selector-scroll::-webkit-scrollbar {
    display: none;
}

.day-pill {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 45px;
    padding: 8px 0;
    cursor: pointer;
    font-weight: 700;
    color: #999;
    border-bottom: 2px solid transparent;
    transition: all 0.3s;
}

.day-pill.active {
    color: #111;
    border-bottom-color: #111;
}

.day-short {
    font-size: 14px;
}

/* Filter Toolbar */
.filter-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #fff;
}

.sort-trigger,
.genre-trigger {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    font-weight: 700;
    color: #333;
    cursor: pointer;
}

.sort-trigger svg,
.genre-trigger svg {
    width: 18px;
    height: 18px;
}

/* Updates Grid */
.updates-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    padding: 0 10px;
}

.update-card {
    text-decoration: none;
    color: inherit;
    margin-bottom: 15px;
}

.update-thumb-wrap {
    position: relative;
    aspect-ratio: 1 / 1.4;
    border-radius: 6px;
    overflow: hidden;
    background: #f8f8f8;
}

.update-thumb-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.update-status-badge {
    position: absolute;
    top: 5px;
    left: 5px;
    padding: 2px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 4px;
    display: flex;
}

.update-status-badge svg {
    width: 14px;
    height: 14px;
    fill: #00ff88;
}

.update-card-title {
    margin-top: 8px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Bottom Sheet Modals */
.bt-bottom-sheet {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 5000;
    /* Higher than nav */
    display: none;
    align-items: flex-end;
}

.bt-bottom-sheet.open {
    display: flex;
}

.sheet-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
}

.sheet-content {
    position: relative;
    width: 100%;
    background: #fff;
    border-radius: 20px 20px 0 0;
    padding: 20px;
    animation: sheetUp 0.3s ease-out;
    direction: rtl;
}

@keyframes sheetUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

.sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.sheet-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 800;
}

.apply-btn {
    background: none;
    border: none;
    color: #2394fc;
    font-weight: 800;
    font-size: 16px;
    cursor: pointer;
}

.sheet-body {
    max-height: 50vh;
    overflow-y: auto;
}

.radio-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #f5f5f5;
    cursor: pointer;
}

.radio-item span {
    font-weight: 600;
    color: #444;
}

.radio-item input {
    display: none;
}

.radio-check {
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-radius: 50%;
    position: relative;
}

.radio-item input:checked+span+.radio-check {
    border-color: #2394fc;
    background: #2394fc;
}

.radio-item input:checked+span+.radio-check::after {
    content: "";
    position: absolute;
    top: 4px;
    left: 4px;
    width: 8px;
    height: 8px;
    background: #fff;
    border-radius: 50%;
}

/* Latest Chapter Pulse Animation */
.update-chapters-list {
    margin-top: 4px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.update-chapter-label {
    font-size: 10px;
    font-weight: 800;
    color: #2394fc;
    display: flex;
    align-items: center;
    gap: 4px;
}

.ch-dot {
    font-size: 14px;
    line-height: 1;
    color: inherit;
}

.animated-pulse {
    animation: chColorChange 3s infinite ease-in-out;
}

@keyframes chColorChange {
    0% {
        color: #2394fc;
    }

    50% {
        color: #111;
    }

    100% {
        color: #2394fc;
    }
}

/* Completed Section Badges */
.completed-ribbon {
    position: absolute;
    top: 6px;
    right: 6px;
    background: #2394fc;
    color: #fff;
    font-size: 9px;
    font-weight: 900;
    padding: 2px 7px;
    border-radius: 4px;
    z-index: 3;
}

.completed-badge-main {
    background: #2394fc;
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    padding: 3px 10px;
    border-radius: 20px;
}

/* ============ Profile / Settings Page ============ */

/* Hide main header when in profile */
body:has(#app-scroll-area[data-module="profile"]) .main-header {
    display: none !important;
    height: 0 !important;
    overflow: hidden;
}

/* Remove the header spacing gap */
#app-scroll-area[data-module="profile"] {
    margin-top: 0 !important;
    min-height: 100vh !important;
}

.profile-page-wrap {
    background: #ffffff;
    min-height: 100vh;
    padding-bottom: 80px;
    direction: rtl;
}

/* -- Guest Header -- */
.guest-header {
    background: #ffffff;
    padding: 40px 14px 12px;
}

.guest-id-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.guest-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.guest-login-link {
    font-size: 12.5px;
    font-weight: 900;
    color: #111;
    text-decoration: none;
}

.guest-login-link:hover {
    color: #2394fc;
}

.guest-id {
    font-size: 11px;
    color: #888;
    font-weight: 600;
}

.guest-avatar-display img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
}

/* -- Menu Card -- */
.profile-menu-card {
    background: #f8f8f8;
    border-radius: 14px;
    margin: 10px 12px 0;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.profile-menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-bottom: 1px solid #f5f5f5;
    text-decoration: none;
    color: #222;
    transition: background 0.15s;
}

.profile-menu-item:hover {
    background: #fafafa;
}

.pmi-left {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11.5px;
    font-weight: 700;
}

.pmi-icon {
    width: 14px;
    height: 14px;
    stroke: #555;
    flex-shrink: 0;
}

.pmi-arrow {
    width: 11px;
    height: 11px;
    stroke: #ccc;
}

.logout-item .pmi-icon {
    stroke: #ff4757;
}

.logout-item {
    color: #ff4757;
}

/* -- Recommendations Card -- */
.guest-recommendations {
    margin: 14px 14px 0;
    background: #f8f8f8;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.05);
    padding: 14px;
}

.rec-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    margin-bottom: 12px;
    direction: rtl;
}

.rec-title {
    font-size: 14px;
    font-weight: 900;
    margin: 0;
    color: #111;
}

.rec-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.rec-card {
    text-decoration: none;
    color: inherit;
}

.rec-thumb {
    position: relative;
    aspect-ratio: 2/3;
    border-radius: 8px;
    overflow: hidden;
    background: #c5c5c5;
}

.rec-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.rec-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    font-size: 9px;
    font-weight: 900;
    padding: 2px 6px;
    border-radius: 4px;
    color: #fff;
}

.rec-badge.exc {
    background: #ff4757;
}

.rec-badge.free {
    background: #2394fc;
}

.rec-card-title {
    font-size: 11px;
    font-weight: 700;
    margin: 6px 0 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: #222;
}

/* -- Logged-in View -- */
.logged-profile-view {
    direction: rtl;
}

.loggedin-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 60px 20px 20px;
    background: #eaecf8;
}


.loggedin-name {
    font-size: 18px;
    font-weight: 900;
    margin: 0 0 4px;
    color: #111;
}

.loggedin-username {
    font-size: 13px;
    color: #888;
    font-weight: 600;
}

.loggedin-stats {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    background: #fff;
    margin: 0 14px;
    border-radius: 0 0 16px 16px;
    padding: 14px 0;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.stat-num {
    font-size: 20px;
    font-weight: 900;
    color: #111;
}

.stat-lbl {
    font-size: 11px;
    color: #cbcbcb;
    font-weight: 600;
}

.stat-sep {
    width: 1px;
    height: 30px;
    background: #eee;
}

/* Footer Styles & Fixed Nav Collision Fix */
.footer-section {
    background-color: #ffffff;
    border-top: 1px solid #e2e8f0 !important;
    padding-bottom: 95px !important;
    /* Fix overlap with bottom nav on mobile */
}

@media (min-width: 1024px) {
    .footer-section {
        padding-bottom: 48px !important;
        /* Normal padding for desktop */
    }
}

/* Simple Social Links */
.footer-social-simple {
    padding: 5px 0;
}

.simple-social-link {
    color: #94a3b8;
    text-decoration: none;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.simple-social-link:hover {
    transform: scale(1.1);
}

.simple-social-link.instagram:hover {
    color: #E4405F;
}

.simple-social-link.telegram:hover {
    color: #0088cc;
}

.simple-social-link.discord:hover {
    color: #5865F2;
}

.footer-disclaimer {
    max-width: 600px;
    margin: 0 auto;
    font-weight: 700;
    font-size: 13px;
    color: #64748b !important;
}