/* =============================================
   کتابخوان - استایل اصلی
   طراحی مدرن و شیک
   ============================================= */

:root {
    /* رنگ‌های اصلی - تم آبی مدرن */
    --primary: #0ea5e9;
    --primary-dark: #0284c7;
    --primary-light: #38bdf8;
    --secondary: #f59e0b;
    
    /* رنگ‌های گرادیانت */
    --gradient-primary: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
    --gradient-secondary: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    --gradient-success: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --gradient-header: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    
    /* رنگ‌های خنثی */
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    
    /* تنظیمات */
    --header-height: 64px;
    --bottom-nav-height: 60px;
    --border-radius: 16px;
    --border-radius-lg: 24px;
    --transition: all 0.3s ease;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
    --shadow-primary: 0 4px 20px rgba(14, 165, 233, 0.3);
}

/* فونت */
body, input, button, textarea, select, p, span:not(.fa):not(.fas):not(.far):not(.fab), 
div, a, h1, h2, h3, h4, h5, h6, label, td, th, li {
    font-family: 'Vazirmatn', 'Tahoma', sans-serif;
}

/* آیکون‌های Font Awesome */
.fa, .fas, .far, .fab, .fal, .fad,
[class^="fa-"], [class*=" fa-"] {
    font-family: "Font Awesome 6 Free", "Font Awesome 6 Brands" !important;
}

html {
    font-size: 16px;
}

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    padding-bottom: calc(var(--bottom-nav-height) + 20px);
    line-height: 1.7;
}

/* =============================================
   استایل اسکرول سفارشی
   ============================================= */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--primary-light), var(--primary));
    border-radius: 10px;
    border: 2px solid var(--bg-primary);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--primary), var(--primary-dark));
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--primary) var(--bg-primary);
}

/* اسکرول افقی دسته‌بندی‌ها */
.categories-scroll::-webkit-scrollbar {
    height: 4px;
}

.categories-scroll::-webkit-scrollbar-thumb {
    background: var(--primary-light);
    border-radius: 4px;
}

@media (min-width: 992px) {
    body {
        padding-bottom: 0;
    }
}

/* =============================================
   هدر
   ============================================= */
.main-header {
    background: var(--gradient-header);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-lg);
}

.main-header .navbar {
    padding: 12px 0;
}

.main-header .navbar-brand {
    color: #fff;
    font-weight: 700;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.main-header .navbar-brand i {
    font-size: 1.5rem;
}

.main-header .nav-link {
    color: rgba(255,255,255,0.85);
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 10px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
}

.main-header .nav-link:hover,
.main-header .nav-link.active {
    color: #fff;
    background: rgba(255,255,255,0.15);
}

.main-header .navbar-toggler {
    border: none;
    padding: 8px;
}

.main-header .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.9%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* جستجو */
.search-form {
    flex: 1;
    max-width: 400px;
    margin: 0 24px;
}

.search-wrapper {
    position: relative;
}

.search-wrapper i {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-wrapper .form-control {
    padding: 12px 16px 12px 44px;
    border-radius: 12px;
    border: none;
    background: rgba(255,255,255,0.15);
    color: #fff;
    font-size: 14px;
}

.search-wrapper .form-control::placeholder {
    color: rgba(255,255,255,0.6);
}

.search-wrapper .form-control:focus {
    background: rgba(255,255,255,0.25);
    box-shadow: none;
}

.search-toggle {
    color: #fff;
    font-size: 1.2rem;
}

.search-collapse {
    background: var(--primary-dark);
}

/* منوی کاربر */
.user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* پروفایل موبایل */
.mobile-profile {
    margin-right: 8px;
}

.mobile-profile-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    color: #fff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    padding: 0;
}

.mobile-profile-btn:hover,
.mobile-profile-btn:focus {
    background: rgba(255,255,255,0.25);
    color: #fff;
}

.wallet-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: rgba(255,255,255,0.15);
    border-radius: 10px;
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: var(--transition);
}

.wallet-badge:hover {
    background: rgba(255,255,255,0.25);
    color: #fff;
}

.user-dropdown {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(255,255,255,0.15);
    border-radius: 10px;
    color: #fff !important;
    border: none;
    transition: var(--transition);
}

.user-dropdown:hover,
.user-dropdown:focus,
.user-dropdown.show {
    background: rgba(255,255,255,0.25);
    color: #fff !important;
}

.user-dropdown .fa-chevron-down {
    font-size: 10px;
    opacity: 0.8;
}

.user-name {
    font-weight: 500;
    font-size: 14px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.btn-auth {
    background: rgba(255,255,255,0.15);
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
}

.btn-auth:hover {
    background: rgba(255,255,255,0.25);
    color: #fff;
}

/* =============================================
   نویگیشن پایین (موبایل)
   ============================================= */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    display: flex;
    justify-content: space-around;
    padding: 8px 0;
    box-shadow: 0 -2px 20px rgba(0,0,0,0.08);
    z-index: 1000;
    border-top: 1px solid var(--border-color);
}

.bottom-nav .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 11px;
    transition: var(--transition);
}

.bottom-nav .nav-item i {
    font-size: 20px;
}

.bottom-nav .nav-item.active {
    color: var(--primary);
}

/* =============================================
   محتوای اصلی
   ============================================= */
.main-content {
    min-height: calc(100vh - var(--header-height) - 100px);
    padding: 20px 0;
}

/* بنر */
.hero-banner {
    background: var(--gradient-primary);
    border-radius: var(--border-radius-lg);
    padding: 30px;
    color: #fff;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
}

.hero-banner::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 300px;
    height: 300px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
}

.hero-banner h2 {
    font-weight: 700;
    margin-bottom: 8px;
}

.hero-banner p {
    opacity: 0.9;
    margin-bottom: 16px;
}

.hero-banner .btn,
.hero-banner .btn-hero {
    background: #fff;
    color: var(--primary);
    border: none;
    padding: 10px 24px;
    border-radius: 10px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    position: relative;
    z-index: 10;
    text-decoration: none;
}

.hero-banner .btn:hover,
.hero-banner .btn-hero:hover {
    background: rgba(255,255,255,0.9);
    transform: translateY(-2px);
}

/* آواتار کوچک برای dropdown */
.user-avatar-sm {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
}

.dropdown-header {
    padding: 12px 16px;
}

.dropdown-header .fw-bold {
    color: var(--text-color);
    font-size: 14px;
}

/* =============================================
   دسته‌بندی‌ها
   ============================================= */
.section-title {
    font-weight: 700;
    font-size: 1.25rem;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.section-title a {
    font-size: 14px;
    font-weight: 500;
    color: var(--primary);
    text-decoration: none;
}

.categories-scroll {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 8px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.categories-scroll::-webkit-scrollbar {
    display: none;
}

.category-card {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 20px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    text-decoration: none;
    color: var(--text-primary);
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    min-width: 90px;
}

.category-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    color: var(--primary);
}

.category-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.category-card span {
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}

/* =============================================
   کارت کتاب
   ============================================= */
.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
}

@media (min-width: 768px) {
    .books-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }
}

.book-card {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    text-decoration: none;
    color: var(--text-primary);
    display: block;
}

.book-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
    color: var(--text-primary);
}

.book-cover {
    position: relative;
    aspect-ratio: 3/4;
    overflow: hidden;
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
}

.book-cover img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    transition: var(--transition);
}

.book-card:hover .book-cover img {
    transform: scale(1.02);
}

.book-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--gradient-secondary);
    color: #fff;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
}

.book-like {
    position: absolute;
    bottom: 10px;
    left: 10px;
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    color: #fff;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
}

.book-like i {
    color: #ef4444;
}

.book-info {
    padding: 12px;
}

.book-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.5;
}

.book-author {
    color: var(--text-secondary);
    font-size: 12px;
    margin-bottom: 8px;
}

.book-price {
    display: flex;
    align-items: center;
    gap: 8px;
}

.book-price .current {
    font-weight: 700;
    color: var(--primary);
    font-size: 14px;
}

.book-price .old {
    text-decoration: line-through;
    color: var(--text-muted);
    font-size: 12px;
}

.book-price .free {
    color: #10b981;
    font-weight: 600;
}

/* =============================================
   صفحه جزئیات کتاب
   ============================================= */
.book-detail-header {
    background: var(--gradient-primary);
    padding: 24px 0;
    margin: -20px -12px 24px;
    color: #fff;
}

@media (min-width: 768px) {
    .book-detail-header {
        border-radius: 0 0 var(--border-radius-lg) var(--border-radius-lg);
        margin: -20px 0 24px;
    }
}

/* wrapper برای ریسپانسیو */
.book-detail-wrapper {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    padding: 0 16px;
}

/* استایل پیش‌فرض تصویر کتاب */
.book-detail-cover {
    width: 160px;
    height: auto;
    border-radius: var(--border-radius);
    box-shadow: 0 8px 30px rgba(0,0,0,0.3);
    object-fit: contain;
}

/* تبلت و بالاتر */
@media (min-width: 768px) {
    .book-detail-cover {
        width: 180px;
    }
}

/* موبایل */
@media (max-width: 575.98px) {
    .book-detail-wrapper {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 0 20px;
    }
    
    .book-detail-cover-wrapper {
        margin-bottom: 16px;
    }
    
    .book-detail-cover {
        width: 225px;
    }
    
    .book-detail-info {
        width: 100%;
        padding: 0 8px;
    }
    
    .book-detail-meta {
        justify-content: center;
    }
    
    .book-actions {
        flex-direction: column;
        align-items: center;
        gap: 12px;
        padding: 0 4px;
    }
    
    .btn-buy {
        width: 100%;
        flex: none;
        padding: 14px 16px;
        font-size: 14px;
    }
    
    .action-buttons-wrapper {
        display: flex;
        gap: 12px;
        justify-content: center;
    }
    
    .btn-buy .price-tag {
        white-space: nowrap;
    }
    
    .btn-action {
        width: 44px;
        height: 44px;
    }
}

.book-detail-info h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.book-detail-author {
    opacity: 0.9;
    margin-bottom: 12px;
}

.book-detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 13px;
    opacity: 0.85;
}

.book-detail-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.book-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    align-items: center;
}

/* دسکتاپ: همه در یک خط */
.action-buttons-wrapper {
    display: flex;
    gap: 12px;
}

.btn-buy {
    background: #fff;
    color: var(--primary);
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-action {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: rgba(255,255,255,0.15);
    border: none;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: var(--transition);
}

.btn-action:hover {
    background: rgba(255,255,255,0.25);
}

.btn-action.active {
    background: #fff;
    color: #ef4444;
}

/* محتوای جزئیات */
.detail-card {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
}

.detail-card h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.detail-card h3 i {
    color: var(--primary);
}

/* =============================================
   نظرات
   ============================================= */
.comment-item {
    padding: 16px 0;
    border-bottom: 1px solid var(--border-color);
}

.comment-item:last-child {
    border-bottom: none;
}

.comment-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.comment-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-light);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.comment-user {
    font-weight: 600;
    font-size: 14px;
}

.comment-date {
    color: var(--text-muted);
    font-size: 12px;
}

.comment-content {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.7;
}

.comment-rating {
    color: #f59e0b;
    font-size: 12px;
    margin-top: 4px;
}

/* فرم نظر */
.comment-form {
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    padding: 16px;
    margin-top: 16px;
}

.comment-form textarea {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    resize: none;
}

/* =============================================
   مودال احراز هویت
   ============================================= */
#authModal .modal-content {
    border-radius: var(--border-radius-lg);
    border: none;
    overflow: hidden;
}

#authModal .modal-header {
    background: var(--gradient-primary);
    color: #fff;
    border: none;
    padding: 20px;
}

#authModal .modal-header .btn-close {
    filter: brightness(0) invert(1);
}

#authModal .modal-body {
    padding: 24px;
}

.auth-icon {
    width: 80px;
    height: 80px;
    background: var(--bg-primary);
    border-radius: 50%;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: var(--primary);
}

.auth-icon.success {
    background: #dcfce7;
    color: #22c55e;
}

.auth-desc {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.otp-input {
    font-size: 24px;
    letter-spacing: 8px;
    font-weight: 600;
}

.hide {
    display: none !important;
}

/* =============================================
   کیف پول
   ============================================= */
.wallet-header {
    background: var(--gradient-primary);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    color: #fff;
    text-align: center;
    margin-bottom: 24px;
}

.wallet-balance {
    font-size: 2rem;
    font-weight: 700;
    margin: 12px 0;
}

.wallet-label {
    opacity: 0.85;
    font-size: 14px;
}

.amount-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.amount-option {
    padding: 12px;
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
}

.amount-option:hover,
.amount-option.active {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

/* =============================================
   فوتر
   ============================================= */
.main-footer {
    background: var(--text-primary);
    color: #fff;
    padding: 40px 0 20px;
    margin-top: 40px;
}

.footer-brand {
    font-size: 1.3rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.footer-desc {
    color: rgba(255,255,255,0.7);
    font-size: 14px;
}

.main-footer h6 {
    font-weight: 600;
    margin-bottom: 16px;
}

.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links li {
    margin-bottom: 8px;
}

.footer-links a {
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-size: 14px;
    transition: var(--transition);
}

.footer-links a:hover {
    color: #fff;
}

.btn-install {
    background: var(--gradient-primary);
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 500;
}

.footer-bottom {
    text-align: center;
    color: rgba(255,255,255,0.5);
    font-size: 13px;
}

/* =============================================
   لودینگ و اسکرول بی‌نهایت
   ============================================= */
.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.loading-spinner::after {
    content: '';
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* =============================================
   ریدر کتاب
   ============================================= */
.reader-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #fff;
    z-index: 2000;
    display: flex;
    flex-direction: column;
}

.reader-header {
    background: var(--bg-secondary);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.reader-title {
    font-weight: 600;
    font-size: 14px;
    flex: 1;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 12px;
}

.reader-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    font-size: 18px;
    line-height: 2;
    text-align: justify;
    transition: var(--transition);
    user-select: none;
    -webkit-user-select: none;
}

.reader-content.theme-light {
    background: #fff;
    color: var(--text-primary);
}

.reader-content.theme-sepia {
    background: #f5efe6;
    color: #5c4b37;
}

.reader-content.theme-dark {
    background: #1a1a2e;
    color: #e0e0e0;
}

.reader-footer {
    background: var(--bg-secondary);
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

.reader-progress {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.reader-progress input[type="range"] {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    background: var(--border-color);
    border-radius: 3px;
    direction: ltr;
}

.reader-progress input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
}

.reader-controls {
    display: flex;
    justify-content: center;
    gap: 16px;
}

.reader-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: var(--transition);
}

.reader-btn:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.reader-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* پنل تنظیمات ریدر */
.reader-settings {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    padding: 16px;
    width: 280px;
    margin-bottom: 8px;
    display: none;
}

.reader-settings.show {
    display: block;
}

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.settings-row:last-child {
    margin-bottom: 0;
}

.settings-label {
    font-size: 13px;
    color: var(--text-secondary);
}

.theme-options {
    display: flex;
    gap: 8px;
}

.theme-option {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
}

.theme-option:hover,
.theme-option.active {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.3);
}

.theme-option.light {
    background: #fff;
}

.theme-option.sepia {
    background: #f5efe6;
}

.theme-option.dark {
    background: #1a1a2e;
}

.font-size-control {
    display: flex;
    align-items: center;
    gap: 12px;
}

.font-size-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.font-size-value {
    font-weight: 600;
    min-width: 40px;
    text-align: center;
}

/* هایلایت */
.highlight {
    padding: 2px 0;
    border-radius: 2px;
}

.highlight-yellow { background: rgba(251, 191, 36, 0.4); }
.highlight-green { background: rgba(34, 197, 94, 0.4); }
.highlight-blue { background: rgba(59, 130, 246, 0.4); }
.highlight-pink { background: rgba(236, 72, 153, 0.4); }

/* منوی هایلایت */
.highlight-menu {
    position: absolute;
    background: var(--text-primary);
    border-radius: 8px;
    padding: 8px;
    display: flex;
    gap: 8px;
    box-shadow: var(--shadow-lg);
    z-index: 100;
}

.highlight-color {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: var(--transition);
}

.highlight-color:hover {
    transform: scale(1.1);
}

/* =============================================
   Toast
   ============================================= */
.toast {
    background: var(--bg-secondary);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
}

.toast-success {
    border-right: 4px solid #22c55e;
}

.toast-error {
    border-right: 4px solid #ef4444;
}

/* =============================================
   دکمه‌های کلی
   ============================================= */
.btn-primary {
    background: var(--gradient-primary);
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    transition: var(--transition);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-primary);
    background: var(--gradient-primary);
}

.btn-outline-primary {
    border: 2px solid var(--primary);
    color: var(--primary);
    border-radius: 12px;
    padding: 10px 22px;
    font-weight: 600;
    transition: var(--transition);
}

.btn-outline-primary:hover {
    background: var(--primary);
    color: #fff;
}

/* =============================================
   ریسپانسیو
   ============================================= */
@media (max-width: 575.98px) {
    .hero-banner {
        padding: 20px;
        border-radius: var(--border-radius);
    }
    
    .hero-banner h2 {
        font-size: 1.25rem;
    }
    
    .books-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .book-info {
        padding: 10px;
    }
    
    .book-title {
        font-size: 13px;
    }
    
    .detail-card {
        padding: 16px;
    }
}

/* =============================================
   انیمیشن‌ها
   ============================================= */
.fade-in {
    animation: fadeIn 0.3s ease-out;
}

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

.scale-in {
    animation: scaleIn 0.2s ease-out;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* =============================================
   استایل‌های جدید - جستجوی لحظه‌ای
   ============================================= */

/* جستجوی موبایل - همیشه نمایش */
.mobile-search-bar {
    background: var(--gradient-header);
    padding: 0 0 12px;
}

.mobile-search-form {
    position: relative;
}

.mobile-search-form .search-wrapper {
    background: rgba(255,255,255,0.15);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.2);
    transition: all 0.3s ease;
}

.mobile-search-form .search-wrapper:focus-within {
    background: rgba(255,255,255,0.95);
    border-color: transparent;
}

.mobile-search-form .search-wrapper input {
    border: none;
    padding-right: 45px;
    height: 44px;
    background: transparent;
    color: #fff;
}

.mobile-search-form .search-wrapper:focus-within input {
    color: #1e293b;
}

.mobile-search-form .search-wrapper input::placeholder {
    color: rgba(255,255,255,0.7);
}

.mobile-search-form .search-wrapper:focus-within input::placeholder {
    color: #94a3b8;
}

.mobile-search-form .search-wrapper i {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255,255,255,0.7);
    z-index: 1;
    transition: color 0.3s ease;
}

.mobile-search-form .search-wrapper:focus-within i {
    color: #6366f1;
}

/* نتایج جستجوی لحظه‌ای */
.live-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    margin-top: 8px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.live-search-results.active {
    display: block;
}

.live-search-results .search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    text-decoration: none;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

.live-search-results .search-result-item:last-child {
    border-bottom: none;
}

.live-search-results .search-result-item:hover {
    background: var(--bg-primary);
}

.live-search-results .result-cover {
    width: 45px;
    height: 60px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
}

.live-search-results .result-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.live-search-results .result-info {
    flex: 1;
    min-width: 0;
}

.live-search-results .result-title {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.live-search-results .result-author {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.live-search-results .result-price {
    font-size: 0.85rem;
    color: var(--primary);
    font-weight: 600;
}

.live-search-results .no-results {
    padding: 30px;
    text-align: center;
    color: var(--text-muted);
}

.live-search-results .search-loading {
    padding: 20px;
    text-align: center;
}

/* آیکون کاربر موبایل */
.mobile-user-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

/* منوی موبایل */
.offcanvas-end {
    width: 280px;
}

.mobile-user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px;
    background: var(--bg-primary);
    border-radius: 12px;
    margin-bottom: 15px;
}

.user-avatar-large {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.2rem;
}

.mobile-user-info .user-details h6 {
    margin: 0;
    font-weight: 600;
}

.mobile-user-info .user-details p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-muted);
    direction: ltr;
    text-align: right;
}

.mobile-wallet {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    background: var(--gradient-primary);
    border-radius: 12px;
    color: #fff;
    margin-bottom: 20px;
}

.mobile-wallet i {
    font-size: 1.2rem;
}

.mobile-nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mobile-nav-list li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 15px;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 12px;
    transition: var(--transition);
}

.mobile-nav-list li a:hover,
.mobile-nav-list li a.active {
    background: var(--bg-primary);
    color: var(--primary);
}

.mobile-nav-list li a i {
    width: 20px;
    text-align: center;
}

/* دکمه نصب اپلیکیشن */
.install-app-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.btn-install-app {
    width: 100%;
    padding: 14px;
    background: var(--gradient-success);
    border: none;
    border-radius: 12px;
    color: #fff;
    font-weight: 600;
}

/* بنر نصب PWA */
.pwa-install-banner {
    position: fixed;
    bottom: 70px;
    left: 15px;
    right: 15px;
    background: var(--gradient-primary);
    border-radius: 16px;
    padding: 12px 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 1050;
    box-shadow: var(--shadow-lg);
}

@media (min-width: 992px) {
    .pwa-install-banner {
        bottom: 20px;
        left: auto;
        right: 20px;
        max-width: 350px;
    }
}

.pwa-banner-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    color: #fff;
}

.pwa-banner-content i {
    font-size: 1.5rem;
}

.pwa-banner-text {
    display: flex;
    flex-direction: column;
}

.pwa-banner-text strong {
    font-size: 0.95rem;
}

.pwa-banner-text span {
    font-size: 0.8rem;
    opacity: 0.9;
}

/* =============================================
   اصلاح ستاره‌های امتیاز برای RTL
   ============================================= */
/* =============================================
   اصلاح ستاره‌های امتیاز برای RTL
   ============================================= */

/* ستاره‌های امتیازدهی - استفاده از direction: ltr برای حل مشکل */
.rating-stars {
    display: inline-flex;
    direction: ltr;
    unicode-bidi: bidi-override;
}

.rating-stars .star {
    cursor: pointer;
    font-size: 1.5rem;
    color: #e2e8f0;
    padding: 3px;
    transition: color 0.15s ease;
}

/* hover effect - از چپ به راست */
.rating-stars:hover .star {
    color: #fbbf24;
}

.rating-stars .star:hover ~ .star {
    color: #e2e8f0;
}

/* ستاره‌های فعال */
.rating-stars .star.active {
    color: #fbbf24;
}

/* نمایش امتیاز فقط خواندنی */
.rating-display {
    display: inline-flex;
    gap: 2px;
}

.rating-display .star {
    color: #e2e8f0;
    font-size: 0.9rem;
}

.rating-display .star.filled {
    color: #fbbf24;
}

.rating-display .star.filled {
    color: #fbbf24;
}

/* =============================================
   جستجو در سرچ container
   ============================================= */
.search-container {
    position: relative;
    flex: 1;
    max-width: 400px;
    margin: 0 20px;
}

.search-container .search-wrapper {
    position: relative;
}

.search-container .search-wrapper i {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255,255,255,0.7);
    transition: color 0.3s ease;
}

.search-container .search-wrapper:focus-within i {
    color: #6366f1;
}

.search-container .search-wrapper input {
    width: 100%;
    padding: 10px 45px 10px 15px;
    border: none;
    border-radius: 12px;
    background: rgba(255,255,255,0.15);
    color: #fff;
    transition: all 0.3s ease;
}

.search-container .search-wrapper input::placeholder {
    color: rgba(255,255,255,0.7);
}

.search-container .search-wrapper input:focus {
    outline: none;
    background: rgba(255,255,255,0.95);
    color: #1e293b;
    box-shadow: 0 0 0 3px rgba(255,255,255,0.3);
}

.search-container .search-wrapper input:focus::placeholder {
    color: #94a3b8;
}

/* Toggle منوی موبایل */
.navbar-toggler {
    border: none;
    padding: 8px 12px;
    background: rgba(255,255,255,0.15);
    border-radius: 10px;
    color: #fff;
}

.navbar-toggler:focus {
    box-shadow: none;
}

/* =============================================
   سبد خرید
   ============================================= */

/* آیکن سبد در هدر */
.cart-badge {
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: rgba(255,255,255,0.15);
    border-radius: 10px;
    color: #fff;
    text-decoration: none;
    font-weight: 500;
    margin-left: 10px;
    transition: all 0.3s ease;
}

/* سبد خرید موبایل */
.cart-badge.mobile-cart {
    padding: 8px;
    margin-left: auto;
    margin-right: 10px;
}

.cart-badge.mobile-cart .cart-count {
    top: -3px;
    right: -3px;
    min-width: 16px;
    height: 16px;
    font-size: 0.65rem;
}

/* اجبار منوی موبایل به سمت راست */
.offcanvas.offcanvas-end {
    right: 0 !important;
    left: auto !important;
    transform: translateX(100%);
}

.offcanvas.offcanvas-end.show {
    transform: translateX(0);
}

.cart-badge:hover {
    background: rgba(255,255,255,0.25);
    color: #fff;
}

.cart-badge .cart-count {
    background: #ef4444;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: -5px;
    right: -5px;
}

.cart-badge .cart-count:empty,
.cart-badge .cart-count:contains('۰') {
    display: none;
}

/* دکمه افزودن به سبد خرید */
.btn-add-cart {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-add-cart .price-tag,
.btn-add-free .price-tag {
    background: rgba(255,255,255,0.2);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.9rem;
    margin-right: 5px;
}

.free-tag {
    background: rgba(16, 185, 129, 0.3) !important;
    color: #fff;
}

.btn-add-free {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    color: #fff !important;
}

.btn-add-free:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%) !important;
    color: #fff !important;
}

.btn-go-cart {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    border: none !important;
    color: #fff !important;
    padding: 14px 28px !important;
    border-radius: 14px !important;
    font-weight: 600 !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 10px !important;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3) !important;
    transition: all 0.3s ease !important;
    text-decoration: none !important;
}

.btn-go-cart:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4) !important;
    color: #fff !important;
}

.btn-go-cart i {
    font-size: 1.1rem;
}

/* باکس نیاز به ورود */
.login-required-box {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 2px dashed #cbd5e1;
    border-radius: 16px;
    padding: 24px;
    text-align: center;
}

/* بخش نظرات */
.comments-count {
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--text-muted);
}

.comments-list {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 1px solid var(--border-color);
}

.comments-pagination {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.comments-pagination .pagination {
    gap: 5px;
    margin: 0;
}

.comments-pagination .page-link {
    border-radius: 10px;
    padding: 8px 14px;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.comments-pagination .page-item.active .page-link {
    background: var(--gradient-primary);
    border-color: transparent;
    color: #fff;
}

.comments-pagination .page-link:hover {
    background: var(--primary-light);
    border-color: var(--primary-light);
    color: #fff;
}

.comments-pagination .page-item.disabled .page-link {
    background: transparent;
    color: var(--text-muted);
}
