﻿/* استایل عمومی برای استفاده از فونت */
body, p, span, div, a, * {
    font-family: 'B Nazanin', BNazanin, Tahoma, Arial, sans-serif;
    font-weight: bold;
    font-size: 14px;
    direction: rtl;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'B Titr', BTitrBd, Tahoma, Arial, sans-serif;
    direction: rtl;
}

/* ===== استایل متن با رنگ سیاه و دور سفید ===== */
.text-bordered {
    color: black;
    font-weight: normal;
    text-shadow: 0 0 2px white, 0 0 4px rgba(255,255,255,0.8), 0 0 6px rgba(255,255,255,0.6);
    -webkit-font-smoothing: antialiased;
}

.text-bordered-strong {
    color: black;
    font-weight: bold;
    text-shadow: 0 0 1px white, 0 0 2px white, 0 0 3px rgba(255,255,255,0.8), 0 0 4px rgba(255,255,255,0.6), 0 0 5px rgba(255,255,255,0.4);
    -webkit-font-smoothing: antialiased;
}

.text-bordered-reverse {
    color: white;
    font-weight: normal;
    text-shadow: 0 0 1px black, 0 0 2px black, 0 0 3px rgba(0,0,0,0.8), 0 0 4px rgba(0,0,0,0.6), 0 0 5px rgba(0,0,0,0.4);
    -webkit-font-smoothing: antialiased;
}

.text-bordered-reverse-strong {
    color: white;
    font-weight: bold;
    text-shadow: 0 0 1px black, 0 0 2px black, 0 0 3px black, 0 0 4px rgba(0,0,0,0.8), 0 0 5px rgba(0,0,0,0.6), 0 0 6px rgba(0,0,0,0.4);
    -webkit-font-smoothing: antialiased;
}

/* Base / Typography */
html, body {
    direction: rtl;
    font-family: 'B Nazanin', BNazanin, Tahoma, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Links */
a, a:focus {
    cursor: pointer;
    text-decoration: none;
    color: inherit;
}

/* Buttons */
.btn {
    font-weight: bold;
}

.UserMenuClick {
    cursor: pointer;
}

/* Loader + overlay */
#loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    transition: opacity 0.5s ease;
}

#loadingOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

/* User menu */
#UserMenu {
    display: none;
    position: absolute;
    top: 70px;
    left: 10px;
    width: 260px;
    z-index: 1050;
    background-color: #212529;
    color: #fff;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: .375rem;
    box-shadow: 0 .5rem 1rem rgba(0,0,0,0.15);
    padding: 1rem;
}

.user-name {
    max-width: 100px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    display: inline-block;
    vertical-align: middle;
}

.basket-box {
    position: relative;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.basket-badge {
    position: absolute;
    top: 0;
    right: 8px;
    transform: translate(50%, -40%);
    font-size: 0.65rem;
    padding: 2px 5px;
}

#LoginModal .modal-dialog {
    width: auto;
    max-width: 90vw;
    min-width: 300px;
}

#LoginModal .modal-body {
    padding: 0;
    overflow: hidden;
}

#LoginFrame {
    width: 100%;
    border: none;
    display: block;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* ===== بخش عنوان‌ها ===== */
.section-title {
    background: #fff3cd;
    border-radius: .5rem;
    padding: .35rem .75rem;
    display: inline-block;
}

/* ===== کارت‌های عمومی ===== */
.card-img-top {
    object-fit: cover;
}

.card-title,
.card-text {
    margin-bottom: .4rem;
}

.card.h-100 {
    display: flex;
    flex-direction: column;
}

.card-body {
    flex: 1 1 auto;
}

/* ===== کارت‌های کتاب (دسکتاپ) ===== */
.book-card {
    width: 200px;
    flex: 0 0 auto;
}

    .book-card img {
        width: 100%;
        height: auto;
        object-fit: cover;
        display: block;
        border-radius: 10px 10px 0 0;
    }

/* ===== کارت‌های تازه‌ترین (Grid دو سطری) ===== */
.latest-book-card {
    width: 180px;
    height: 300px;
    flex-shrink: 0;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    border: 1px solid rgba(0,0,0,0.08);
}

    .latest-book-card img {
        width: 100%;
        height: 100%;
        object-fit: contain;
        display: block;
        background: #f8f9fa;
        padding: 5px;
    }

    .latest-book-card .card-body {
        padding: 4px;
    }

    .latest-book-card h6 {
        font-size: 0.85rem;
        margin-bottom: 2px;
    }

    .latest-book-card .text-muted {
        font-size: 0.75rem;
    }

    .latest-book-card .btn {
        font-size: 0.8rem;
        padding: 0.25rem 0.5rem;
    }

/* ===== کارت‌های به‌زودی ===== */
.coming-book-card {
    width: 200px !important;
    flex: 0 0 auto !important;
    flex-shrink: 0 !important;
}

    .coming-book-card img {
        width: 100%;
        height: auto;
        object-fit: cover;
        display: block;
        border-radius: 10px 10px 0 0;
    }

    .coming-book-card .card-body {
        padding: 8px;
    }

/* ===== کارت‌های نویسندگان ===== */
#authorsScroll .card {
    width: 150px !important;
    flex: 0 0 auto !important;
    flex-shrink: 0 !important;
}

/* ===== اسکرول افقی ===== */
#latestBooksScroll,
#comingSoonScroll,
#authorsScroll {
    scroll-behavior: smooth;
}

    #latestBooksScroll::-webkit-scrollbar,
    #comingSoonScroll::-webkit-scrollbar,
    #authorsScroll::-webkit-scrollbar {
        height: 6px;
    }

    #latestBooksScroll::-webkit-scrollbar-thumb,
    #comingSoonScroll::-webkit-scrollbar-thumb,
    #authorsScroll::-webkit-scrollbar-thumb {
        background: #888;
        border-radius: 10px;
    }

    #latestBooksScroll::-webkit-scrollbar-track,
    #comingSoonScroll::-webkit-scrollbar-track,
    #authorsScroll::-webkit-scrollbar-track {
        background: #f1f1f1;
    }

/* ===== اسکرول تازه‌ترین کتاب‌ها (Grid) ===== */
#latestBooksScroll {
    display: grid !important;
    grid-template-rows: 1fr 1fr !important;
    grid-auto-flow: column !important;
    gap: 16px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    height: 680px !important;
    padding: 10px 20px !important;
    align-content: start !important;
}

/* ===== اسکرول به‌زودی و نویسندگان (Flex) ===== */
#comingSoonScroll {
    display: flex !important;
    flex-direction: row !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    gap: 1rem !important;
    padding: 0.5rem 1rem 1rem 1rem !important;
    margin: 0 2rem !important;
    flex-wrap: nowrap !important;
}

#authorsScroll {
    display: flex !important;
    flex-direction: row !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    gap: 1rem !important;
    padding: 0.5rem 1rem 1rem 1rem !important;
    margin: 0 2rem !important;
    flex-wrap: nowrap !important;
}

/* ===== موبایل ===== */
@media (max-width: 576px) {
    .book-card {
        width: 150px;
    }

        .book-card img {
            width: 150px;
            height: auto;
        }

        .book-card h6 {
            font-size: 0.8rem;
        }

        .book-card .text-muted {
            font-size: 0.7rem;
        }

        .book-card .btn {
            font-size: 0.75rem;
            padding: 0.25rem 0.5rem;
        }

    .latest-book-card {
        width: 140px;
        height: 240px;
    }

        .latest-book-card h6 {
            font-size: 0.7rem;
        }

        .latest-book-card .text-muted {
            font-size: 0.6rem;
        }

        .latest-book-card .btn {
            font-size: 0.65rem;
            padding: 0.15rem 0.3rem;
        }

    #latestBooksScroll {
        height: 520px !important;
        padding: 8px 10px !important;
        gap: 12px !important;
    }

    #comingSoonScroll,
    #authorsScroll {
        margin: 0 0.5rem !important;
        padding: 0.5rem !important;
        gap: 0.5rem !important;
    }
}
