:root {
    --bg-color: #000000;
    --accent-color: #FF8C00;
    --accent-hover: #FFA500;
    --text-color: #FFFFFF;
    --text-secondary: #AAAAAA;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --input-bg: rgba(0, 0, 0, 0.3);
    --item-bg: rgba(255, 255, 255, 0.05);
    --bottom-nav-bg: rgba(10, 10, 10, 0.95);
    --pdf-bg: #222;
    --title-color: #FFFFFF;
    --cover-bg: linear-gradient(135deg, #111, #222);
    --cover-icon-color: rgba(255, 255, 255, 0.1);
    --review-small-bg: rgba(255, 255, 255, 0.08);
}

:root[data-theme="dark"] {
    --bg-color: #000000;
    --accent-color: #FF8C00;
    --accent-hover: #FFA500;
    --text-color: #FFFFFF;
    --text-secondary: #AAAAAA;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --input-bg: rgba(0, 0, 0, 0.3);
    --item-bg: rgba(255, 255, 255, 0.05);
    --bottom-nav-bg: rgba(10, 10, 10, 0.95);
    --pdf-bg: #222;
    --title-color: #FFFFFF;
    --cover-bg: linear-gradient(135deg, #111, #222);
    --cover-icon-color: rgba(255, 255, 255, 0.1);
    --review-small-bg: rgba(255, 255, 255, 0.08);
}

:root[data-theme="light"] {
    --bg-color: #f4f6f8;
    --text-color: #1a1a1a;
    --text-secondary: #555555;
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(0, 0, 0, 0.1);
    --card-shadow: 0 4px 15px 0 rgba(0, 0, 0, 0.08);
    --input-bg: rgba(0, 0, 0, 0.05);
    --item-bg: rgba(0, 0, 0, 0.03);
    --bottom-nav-bg: rgba(255, 255, 255, 0.95);
    --pdf-bg: #fff;
    --title-color: #1a1a1a;
    --cover-bg: linear-gradient(135deg, #e0e0e0, #f5f5f5);
    --cover-icon-color: rgba(0, 0, 0, 0.1);
    --review-small-bg: rgba(0, 0, 0, 0.05);
}

:root[data-theme="kurdish-nature"] {
    --bg-color: #0b150f;
    --accent-color: #2cbd59;
    --accent-hover: #26a54d;
    --text-color: #e8f5e9;
    --text-secondary: #a5d6a7;
    --glass-bg: rgba(44, 189, 89, 0.05);
    --glass-border: rgba(44, 189, 89, 0.15);
    --card-shadow: 0 8px 32px 0 rgba(11, 21, 15, 0.5);
    --input-bg: rgba(11, 21, 15, 0.4);
    --item-bg: rgba(44, 189, 89, 0.08);
    --bottom-nav-bg: rgba(9, 18, 12, 0.95);
    --pdf-bg: #102116;
    --title-color: #ffffff;
    --cover-bg: linear-gradient(135deg, #102116, #0b150f);
    --cover-icon-color: rgba(44, 189, 89, 0.15);
    --review-small-bg: rgba(44, 189, 89, 0.1);
}

:root[data-theme="kurdish-sun"] {
    --bg-color: #1a0f05;
    --accent-color: #ff9f00;
    --accent-hover: #e58f00;
    --text-color: #fff6e8;
    --text-secondary: #fcd59c;
    --glass-bg: rgba(255, 159, 0, 0.05);
    --glass-border: rgba(255, 159, 0, 0.15);
    --card-shadow: 0 8px 32px 0 rgba(26, 15, 5, 0.5);
    --input-bg: rgba(26, 15, 5, 0.4);
    --item-bg: rgba(255, 159, 0, 0.08);
    --bottom-nav-bg: rgba(22, 13, 4, 0.95);
    --pdf-bg: #2a190b;
    --title-color: #ffffff;
    --cover-bg: linear-gradient(135deg, #2a190b, #1a0f05);
    --cover-icon-color: rgba(255, 159, 0, 0.15);
    --review-small-bg: rgba(255, 159, 0, 0.1);
}

:root[data-theme="kurdish-slate"] {
    --bg-color: #191c22;
    --accent-color: #d4af37;
    --accent-hover: #bda02b;
    --text-color: #f1f2f6;
    --text-secondary: #ced6e0;
    --glass-bg: rgba(212, 175, 55, 0.05);
    --glass-border: rgba(212, 175, 55, 0.15);
    --card-shadow: 0 8px 32px 0 rgba(25, 28, 34, 0.5);
    --input-bg: rgba(25, 28, 34, 0.4);
    --item-bg: rgba(212, 175, 55, 0.08);
    --bottom-nav-bg: rgba(20, 23, 28, 0.95);
    --pdf-bg: #22272f;
    --title-color: #ffffff;
    --cover-bg: linear-gradient(135deg, #22272f, #191c22);
    --cover-icon-color: rgba(212, 175, 55, 0.15);
    --review-small-bg: rgba(212, 175, 55, 0.1);
}

:root[data-theme="kurdish-lavender"] {
    --bg-color: #110d1a;
    --accent-color: #bb86fc;
    --accent-hover: #9e64e8;
    --text-color: #f3effa;
    --text-secondary: #c7b9db;
    --glass-bg: rgba(187, 134, 252, 0.05);
    --glass-border: rgba(187, 134, 252, 0.15);
    --card-shadow: 0 8px 32px 0 rgba(17, 13, 26, 0.5);
    --input-bg: rgba(17, 13, 26, 0.4);
    --item-bg: rgba(187, 134, 252, 0.08);
    --bottom-nav-bg: rgba(13, 9, 20, 0.95);
    --pdf-bg: #1b1527;
    --title-color: #ffffff;
    --cover-bg: linear-gradient(135deg, #1b1527, #110d1a);
    --cover-icon-color: rgba(187, 134, 252, 0.15);
    --review-small-bg: rgba(187, 134, 252, 0.1);
}

:root[data-theme="kurdish-pomegranate"] {
    --bg-color: #1f080c;
    --accent-color: #ff3b5c;
    --accent-hover: #e02d4d;
    --text-color: #ffebee;
    --text-secondary: #ffcdd2;
    --glass-bg: rgba(255, 59, 92, 0.05);
    --glass-border: rgba(255, 59, 92, 0.15);
    --card-shadow: 0 8px 32px 0 rgba(31, 8, 12, 0.5);
    --input-bg: rgba(31, 8, 12, 0.4);
    --item-bg: rgba(255, 59, 92, 0.08);
    --bottom-nav-bg: rgba(25, 6, 9, 0.95);
    --pdf-bg: #2d0e14;
    --title-color: #ffffff;
    --cover-bg: linear-gradient(135deg, #2d0e14, #1f080c);
    --cover-icon-color: rgba(255, 59, 92, 0.15);
    --review-small-bg: rgba(255, 59, 92, 0.1);
}

:root[data-theme="kurdish-turquoise"] {
    --bg-color: #08161f;
    --accent-color: #00d2fc;
    --accent-hover: #00b8de;
    --text-color: #e0f7fa;
    --text-secondary: #b2ebf2;
    --glass-bg: rgba(0, 210, 252, 0.05);
    --glass-border: rgba(0, 210, 252, 0.15);
    --card-shadow: 0 8px 32px 0 rgba(8, 22, 31, 0.5);
    --input-bg: rgba(8, 22, 31, 0.4);
    --item-bg: rgba(0, 210, 252, 0.08);
    --bottom-nav-bg: rgba(6, 17, 24, 0.95);
    --pdf-bg: #0f2430;
    --title-color: #ffffff;
    --cover-bg: linear-gradient(135deg, #0f2430, #08161f);
    --cover-icon-color: rgba(0, 210, 252, 0.15);
    --review-small-bg: rgba(0, 210, 252, 0.1);
}

:root[data-theme="kurdish-rose"] {
    --bg-color: #1a0b12;
    --accent-color: #ff6b8b;
    --accent-hover: #ff477e;
    --text-color: #ffeef2;
    --text-secondary: #fbc4d0;
    --glass-bg: rgba(255, 107, 139, 0.05);
    --glass-border: rgba(255, 107, 139, 0.15);
    --card-shadow: 0 8px 32px 0 rgba(26, 11, 18, 0.5);
    --input-bg: rgba(26, 11, 18, 0.4);
    --item-bg: rgba(255, 107, 139, 0.08);
    --bottom-nav-bg: rgba(20, 8, 14, 0.95);
    --pdf-bg: #2b111e;
    --title-color: #ffffff;
    --cover-bg: linear-gradient(135deg, #2b111e, #1a0b12);
    --cover-icon-color: rgba(255, 107, 139, 0.15);
    --review-small-bg: rgba(255, 107, 139, 0.1);
}

:root[data-theme="kurdish-gold"] {
    --bg-color: #171207;
    --accent-color: #ffd700;
    --accent-hover: #e6c200;
    --text-color: #fffae6;
    --text-secondary: #ffe699;
    --glass-bg: rgba(255, 215, 0, 0.05);
    --glass-border: rgba(255, 215, 0, 0.15);
    --card-shadow: 0 8px 32px 0 rgba(23, 18, 7, 0.5);
    --input-bg: rgba(23, 18, 7, 0.4);
    --item-bg: rgba(255, 215, 0, 0.08);
    --bottom-nav-bg: rgba(18, 14, 5, 0.95);
    --pdf-bg: #271e0c;
    --title-color: #ffffff;
    --cover-bg: linear-gradient(135deg, #271e0c, #171207);
    --cover-icon-color: rgba(255, 215, 0, 0.15);
    --review-small-bg: rgba(255, 215, 0, 0.1);
}

:root[data-theme="kurdish-chestnut"] {
    --bg-color: #14100d;
    --accent-color: #c89666;
    --accent-hover: #b38053;
    --text-color: #f7f3f0;
    --text-secondary: #d8c3b1;
    --glass-bg: rgba(200, 150, 102, 0.05);
    --glass-border: rgba(200, 150, 102, 0.15);
    --card-shadow: 0 8px 32px 0 rgba(20, 16, 13, 0.5);
    --input-bg: rgba(20, 16, 13, 0.4);
    --item-bg: rgba(200, 150, 102, 0.08);
    --bottom-nav-bg: rgba(16, 12, 10, 0.95);
    --pdf-bg: #241d18;
    --title-color: #ffffff;
    --cover-bg: linear-gradient(135deg, #241d18, #14100d);
    --cover-icon-color: rgba(200, 150, 102, 0.15);
    --review-small-bg: rgba(200, 150, 102, 0.1);
}

/* Custom Theme Selection Card Styles */
.theme-card {
    border: 2px solid var(--glass-border) !important;
    border-radius: 16px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
}

.theme-card:hover {
    transform: translateY(-3px);
    border-color: var(--accent-color) !important;
    box-shadow: 0 4px 15px rgba(255, 140, 0, 0.15);
}

.theme-card.active {
    border-color: var(--accent-color) !important;
    background: rgba(255, 140, 0, 0.1) !important;
    box-shadow: 0 0 15px rgba(255, 140, 0, 0.3) !important;
    transform: scale(1.03);
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Noto Kufi Arabic', 'Outfit', sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
    /* Optimized for iOS momentum scrolling */
    -webkit-overflow-scrolling: touch;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

/* Glassmorphism utility */
/* Glassmorphism utility - Optimized for Performance */
.glass-effect {
    background: var(--glass-bg);
    backdrop-filter: blur(4px); /* Reduced blur */
    -webkit-backdrop-filter: blur(4px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); /* Simplified shadow */
    transform: translateZ(0); /* Trigger GPU acceleration */
}

/* Disable blur on low-end or mobile if scrolling is still slow */
@media (max-width: 850px) {
    .glass-effect {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        background: rgba(15, 15, 15, 0.95) !important; /* Solid-ish background for performance */
    }
}

/* Typography */
.orange-text {
    color: var(--accent-color);
}

h1 {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    background: -webkit-linear-gradient(45deg, var(--title-color), var(--accent-color));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* App Bars */
.top-app-bar {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 100;
    border-bottom: 1px solid var(--glass-border);
    border-top: none;
    border-left: none;
    border-right: none;
    /* Ensure no blur during scroll for performance */
    background: var(--bg-color); 
    padding-top: env(safe-area-inset-top);
}

.bottom-nav-bar {
    display: none;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 5%;
    max-width: 1400px;
    margin: 0 auto;
}

.logo {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: 1px;
}

.search-container {
    position: relative;
    width: 30%;
    margin: 0 1rem;
}

.search-container input {
    width: 100%;
    padding: 0.8rem 2.8rem 0.8rem 1rem;
    border-radius: 25px;
    border: 1px solid var(--glass-border);
    background: var(--input-bg);
    color: var(--text-color);
    font-family: 'Noto Kufi Arabic', 'Outfit', sans-serif;
    font-size: 0.95rem;
    outline: none;
    transition: all 0.3s ease;
}

.search-container input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 15px rgba(255, 140, 0, 0.2);
}

.search-icon {
    position: absolute;
    inset-inline-start: 1.2rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 1.2rem;
}

.nav-links a {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 600;
    position: relative;
    padding-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-links a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    inset-inline-start: 0;
    background-color: var(--accent-color);
    transition: width 0.3s ease;
}

.nav-links a:hover::after, .nav-links a.active::after {
    width: 100%;
}

.nav-links a:hover, .nav-links a.active {
    color: var(--accent-color);
}

.story-tab-btn {
    transition: all 0.3s ease;
}

.story-tab-btn.active {
    background: linear-gradient(135deg, var(--accent-color), #d97700) !important;
    color: #fff !important;
    border-color: transparent !important;
}

.story-page {
    animation: fadeIn 0.4s ease;
}

.quotes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

.quote-card {
    position: relative;
    padding: 2.5rem 2rem 2rem;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    overflow: hidden;
}

.quote-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 30px rgba(0,0,0,0.15);
}

.quote-card::before {
    content: '\f10d';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 3rem;
    color: var(--accent-color);
    opacity: 0.1;
}

.quote-text {
    font-size: 1.15rem;
    line-height: 1.7;
    margin-bottom: 1.5rem;
    font-style: italic;
    font-weight: 500;
    white-space: pre-wrap;
    direction: rtl;
    text-align: right;
    word-break: break-word;
    overflow-wrap: break-word;
}

.quote-author {
    font-size: 0.95rem;
    color: var(--accent-color);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 0.5rem;
}

.copy-btn-toast {
    animation: slideInUp 0.3s ease;
}

@keyframes slideInUp {
    from { transform: translate(-50%, 20px); opacity: 0; }
    to { transform: translate(-50%, 0); opacity: 1; }
}

.skeleton-quote {
    height: 150px;
    border-radius: 20px;
    background: var(--glass-bg);
    animation: skeletonPulse 1.5s infinite;
}



/* Forms & Inputs */
.styled-input {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 0.8rem 1rem;
    color: var(--text-color);
    font-family: 'Noto Kufi Arabic', 'Vazirmatn', sans-serif;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s ease;
    direction: rtl; 
    text-align: right;
}

.styled-input:focus {
    border-color: var(--accent-color);
}

.ltr-input {
    direction: ltr !important;
    text-align: left !important;
}

.lang-selector-pills {
    position: relative;
    display: flex;
    background: var(--input-bg);
    border: 1px solid var(--glass-border);
    border-radius: 30px;
    padding: 4px;
    width: fit-content;
    overflow: hidden;
}

.lang-pill {
    position: relative;
    z-index: 1;
    padding: 0.6rem 1.4rem;
    border-radius: 25px;
    border: none;
    background: transparent !important;
    color: var(--text-secondary);
    font-family: 'Noto Kufi Arabic', sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: color 0.3s ease;
    white-space: nowrap;
    box-shadow: none !important;
}

.lang-pill.active {
    color: #fff !important;
}

.lang-bg-slider {
    position: absolute;
    top: 4px;
    bottom: 4px;
    right: 4px;
    width: calc(50% - 4px);
    background: linear-gradient(135deg, var(--accent-color), #d97700);
    border-radius: 25px;
    transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 0;
    box-shadow: 0 4px 15px rgba(255, 140, 0, 0.3);
}

.lang-selector-pills[data-active-lang="badini"] .lang-bg-slider {
    transform: translateX(-100%);
}
/* For LTR/RTL support, we need to be careful with translateX. 
   Since the app is RTL, translateX(-100%) moves it left.
*/

/* Layout */
main {
    margin-top: 100px;
    padding: 2rem 5%;
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
}

.section {
    display: none;
    animation: fadeIn 0.5s ease forwards;
    opacity: 0;
}

.section.active-section {
    display: block;
    opacity: 1;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.section-header {
    margin-bottom: 2rem;
}

.category-chip {
    padding: 0.5rem 1.2rem;
    border-radius: 20px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    white-space: nowrap;
    cursor: pointer;
    font-family: 'Noto Kufi Arabic', sans-serif;
    transition: all 0.3s;
    outline: none;
    flex-shrink: 0;
    user-select: none;
}

.category-chip:hover, .category-chip.active {
    background: var(--accent-color);
    color: #fff;
    border-color: var(--accent-color);
    box-shadow: 0 4px 10px rgba(255, 140, 0, 0.3);
}

.accent-line {
    width: 60px;
    height: 4px;
    background: linear-gradient(to left, var(--accent-color), transparent);
    border-radius: 2px;
}

/* Buttons */
.btn {
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    border: none;
    font-family: 'Noto Kufi Arabic', 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.w-100 {
    width: 100%;
}

.primary-btn {
    background: linear-gradient(135deg, var(--accent-color), #d97700);
    color: #fff; /* Always white text on primary button */
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 140, 0, 0.4);
}

.primary-btn:active {
    transform: translateY(0);
}

.secondary-btn {
    background: transparent;
    color: var(--accent-color);
    border: 1px solid var(--accent-color);
}

.secondary-btn:hover {
    background: rgba(255, 140, 0, 0.1);
    box-shadow: 0 0 10px rgba(255, 140, 0, 0.2);
}

/* Library Grid & Slider */
.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 1.5rem;
}

.books-slider {
    display: flex;
    gap: 1.5rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: 1rem;
    scrollbar-width: none;
    -ms-overflow-style: none;
    width: 100%;
    scroll-behavior: smooth;
}
.books-slider::-webkit-scrollbar {
    display: none;
}
.books-slider .book-card {
    flex: 0 0 180px;
    scroll-snap-align: start;
}
#newestBooksSlider .book-card {
    flex: 0 0 220px; /* Make newest books a bit larger */
}
#newestBooksSlider .book-cover {
    height: 320px;
}

.book-card {
    border-radius: 16px;
    overflow: hidden;
    transition: transform 0.4s ease, box-shadow 0.4s ease;
    display: flex;
    flex-direction: column;
}

/* Hover effects only for desktop */
@media (hover: hover) {
    .book-card:hover {
        transform: translateY(-10px);
        box-shadow: 0 15px 35px rgba(255, 140, 0, 0.15);
        border-color: rgba(255, 140, 0, 0.3);
    }
}

.book-cover {
    width: 100%;
    aspect-ratio: 2/3;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--item-bg); /* Simplified background */
    border-radius: 12px;
    margin-bottom: 0.5rem;
    overflow: hidden;
    position: relative;
}

.book-cover i {
    font-size: 5rem;
    color: var(--cover-icon-color);
    transition: transform 0.5s ease;
}

.book-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.book-cover img.loaded {
    opacity: 1;
}

.book-card:hover .book-cover i {
    transform: scale(1.1);
    color: rgba(255, 140, 0, 0.2);
}

/* Removed expensive reflection effect */
.book-info {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.book-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.book-author {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 1rem;
}

.stars {
    color: var(--accent-color);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.stars i {
    margin-inline-end: 3px;
}

.book-actions {
    margin-top: auto;
}

/* Reader Section */
.reader-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.reader-header .btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
}

.reader-title-container h2 {
    font-size: 1.8rem;
    color: var(--text-color);
    margin-bottom: 0.2rem;
}

.pdf-container {
    width: 100%;
    height: 85vh; /* Increased from 70vh for better viewing */
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 3rem;
    border: 1px solid var(--glass-border);
    /* Improved scrolling on iOS */
    -webkit-overflow-scrolling: touch;
}

.pdf-container iframe {
    width: 100%;
    height: 100%;
    background-color: var(--pdf-bg);
}

.reader-reviews-section h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.create-review-box, .create-post {
    margin: 1.5rem 0 3rem 0;
    padding: 1.8rem;
    border-radius: 16px;
}

.create-review-box h4 {
    margin-bottom: 1rem;
    font-size: 1.2rem;
    color: var(--accent-color);
}

.reader-rating {
    margin-bottom: 1rem;
    font-size: 1.8rem;
    color: var(--text-secondary);
    display: flex;
    gap: 0.5rem;
    cursor: pointer;
}

.reader-rating i:hover {
    transform: scale(1.1);
}

.reader-rating i.active, .reader-rating i.fas {
    color: var(--accent-color);
    text-shadow: 0 0 10px rgba(255, 140, 0, 0.4);
}

.create-review-box textarea, .create-post textarea, textarea.styled-input {
    width: 100%;
    min-height: 120px;
    background: var(--input-bg);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 1rem;
    color: var(--text-color);
    font-family: 'Noto Kufi Arabic', 'Vazirmatn', sans-serif;
    font-size: 1rem;
    resize: vertical;
    outline: none;
    margin-bottom: 1rem;
    white-space: pre-wrap;
}

.create-review-box textarea:focus, .create-post textarea:focus, textarea.styled-input:focus {
    border-color: var(--accent-color);
}

.reviews-list, .feed-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.full-review-item, .post-card {
    padding: 1rem;
    border-radius: 12px;
    background: var(--item-bg);
    border: 1px solid var(--glass-border);
    white-space: pre-wrap;
}

.full-review-header, .post-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.full-review-stars {
    color: var(--accent-color);
    font-size: 0.9rem;
}

.full-review-date {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-color), #d97700);
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    font-size: 1.2rem;
    color: #fff;
}

.post-meta h4 {
    font-size: 1.1rem;
    font-weight: 600;
}

.post-meta span {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.post-content {
    line-height: 1.7;
    font-size: 1.05rem;
    white-space: pre-wrap;
    direction: rtl;
    text-align: right;
    word-break: break-word;
    overflow-wrap: break-word;
}

/* Improved Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    transition: background 0.3s;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--accent-color);
}

/* Hide scrollbars for specific components */
#categoriesContainer::-webkit-scrollbar,
.books-slider::-webkit-scrollbar {
    display: none !important;
}

#categoriesContainer,
.books-slider {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Hide Scroll Arrows on Mobile/Tablet */
@media (max-width: 1024px) {
    #scrollRightBtn, 
    #scrollLeftBtn, 
    #scrollRightNewestBtn, 
    #scrollLeftNewestBtn, 
    #scrollRightAllBtn, 
    #scrollLeftAllBtn, 
    #scrollRightReviewsBtn, 
    #scrollLeftReviewsBtn, 
    #scrollRightSimilarBtn, 
    #scrollLeftSimilarBtn,
    .slider-btn {
        display: none !important;
    }

    #categoriesContainer {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
}

/* Responsive - Mobile & Tablet */
@media (max-width: 850px) {
    .desktop-links {
        display: none !important;
    }
    
    .nav-container {
        flex-direction: column;
        padding: 1rem 5%;
        gap: 1rem;
    }
    
    .logo {
        margin-bottom: 0;
    }

    .search-container {
        width: 100%;
    }

    .bottom-nav-bar {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 70px;
        background: var(--bottom-nav-bg);
        /* Removed heavy blur for mobile performance */
        border-top: 1px solid var(--glass-border);
        border-bottom: none;
        justify-content: space-around;
        align-items: center;
        z-index: 1000;
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* Small Review UI */
.small-review-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--review-small-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--glass-border);
    padding: 10px 18px;
    border-radius: 40px;
    flex-shrink: 0;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.small-review-item:hover {
    transform: translateY(-3px) scale(1.02);
    background: rgba(255, 140, 0, 0.15);
    border-color: var(--accent-color);
    box-shadow: 0 6px 20px rgba(255, 140, 0, 0.2);
}

.small-review-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-color), #d97700);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 800;
    color: #fff;
    box-shadow: 0 2px 8px rgba(255, 140, 0, 0.3);
}

.small-review-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-width: 180px;
}

.small-review-user {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.small-review-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.small-review-rating {
    color: var(--accent-color);
    display: flex;
    gap: 1px;
}

#topSmallReviewsSlider {
    padding: 1.2rem 0.5rem;
    margin-bottom: 1rem;
    gap: 1rem;
    mask-image: linear-gradient(to right, transparent, black 5%, black 95%, transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, black 5%, black 95%, transparent);
}

.latest-review-card {
    flex: 0 0 280px;
    height: 160px;
    padding: 1rem;
    border-radius: 16px;
    background: var(--item-bg);
    border: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    gap: 8px;
    scroll-snap-align: start;
    cursor: pointer;
    transition: all 0.3s ease;
}

.latest-review-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent-color);
    background: var(--glass-bg);
}

.latest-review-card .post-header {
    margin-bottom: 0;
    gap: 0.8rem;
}

.latest-review-card .avatar {
    width: 32px;
    height: 32px;
    font-size: 0.9rem;
}

.latest-review-card .post-meta h4 {
    font-size: 0.9rem;
}

.latest-review-card .post-content {
    font-size: 0.85rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--text-secondary);
}

.latest-review-card .review-book-tag {
    font-size: 0.75rem;
    color: var(--accent-color);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
}

.small-review-bubble {
    font-size: 0.75rem;
    color: var(--text-color);
    background: rgba(255, 140, 0, 0.1);
    padding: 4px 10px;
    border-radius: 10px 0 10px 10px;
    margin-top: 5px;
    font-style: italic;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
    border: 1px solid rgba(255, 140, 0, 0.1);
}

@media (max-width: 850px) {
    .bottom-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        width: 100%;
        height: 100%;
        color: var(--text-secondary);
        text-decoration: none;
        gap: 0.3rem;
    }

    .bottom-nav-item i {
        font-size: 1.4rem;
    }

    .bottom-nav-item span {
        font-size: 0.75rem;
        font-weight: 600;
    }
/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg, var(--glass-bg) 25%, var(--glass-border) 50%, var(--glass-bg) 75%);
    background-size: 200% 100%;
    animation: skeletonLoading 1.5s infinite;
    border-radius: 8px;
}

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

.skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
    width: 80%;
}

.skeleton-title {
    height: 1.5rem;
    margin-bottom: 0.8rem;
    width: 90%;
}

.skeleton-cover {
    width: 100%;
    height: 260px;
    border-radius: 16px;
    margin-bottom: 1rem;
}

/* Performance optimizations */
.book-card, .btn, .nav-link-btn, .category-chip {
    /* Removed will-change to save memory */
    transition: transform 0.3s ease, background-color 0.3s ease, box-shadow 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.book-cover img {
    opacity: 0;
    transition: opacity 0.5s ease;
}

.book-cover img.loaded {
    opacity: 1;
}
    .bottom-nav-item.active {
        color: var(--accent-color);
    }

    .bottom-nav-item.active i {
        transform: translateY(-2px);
        text-shadow: 0 0 10px rgba(255, 140, 0, 0.5);
    }

    main {
        margin-top: 140px; 
        margin-bottom: 90px;
        padding-bottom: calc(90px + env(safe-area-inset-bottom));
    }
    
    h1 {
        font-size: 1.8rem;
    }
    
    .reader-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
}

/* iPad specific optimizations (768px to 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
    .books-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 2rem;
    }

    .nav-container {
        padding: 1rem 3%;
    }

    .search-container {
        width: 40%;
    }

    .nav-links {
        gap: 0.8rem;
    }

    .nav-links a {
        font-size: 0.9rem;
    }
    
    /* Ensure the reader is comfortable on iPad */
    .pdf-container {
        height: 75vh;
    }
}

/* Fix for iOS "sticky" hover state */
@media (hover: none) {
    .book-card:hover {
        transform: none !important;
        box-shadow: var(--card-shadow) !important;
    }
    
    .btn:hover, .category-chip:hover {
        transform: none !important;
    }
}

/* Better touch targets for iOS */
@media (pointer: coarse) {
    .btn, .nav-link-btn, .category-chip, .bottom-nav-item {
        min-height: 44px; /* Apple's recommended minimum touch target */
    }
    
    .search-container input {
        font-size: 16px; /* Prevents auto-zoom on iOS focus */
    }
}

/* Toast Notifications */
.toast-msg {
    background: rgba(20, 20, 20, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    color: #fff;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    gap: 1rem;
    animation: toastSlideIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    transition: opacity 0.3s;
    font-size: 0.95rem;
    pointer-events: auto;
    width: 100%;
}
.toast-msg.error { border-right: 4px solid #e74c3c; }
.toast-msg.success { border-right: 4px solid #2ecc71; }
.toast-msg.info { border-right: 4px solid #3498db; }

@keyframes toastSlideIn {
    0% { transform: translateY(-50px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

/* Home Banner Slider Styling */
#homeSliderContainer {
    position: relative;
    width: 100%;
    height: 380px; /* Stunning premium desktop height */
    overflow: hidden;
    border-radius: 16px;
    margin-bottom: 2rem;
    display: none;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    border: 1px solid var(--glass-border);
}

@media (max-width: 1024px) {
    #homeSliderContainer {
        height: 300px;
    }
}

@media (max-width: 768px) {
    #homeSliderContainer {
        height: 220px;
        border-radius: 12px;
    }
    #sliderPrevBtn, #sliderNextBtn {
        display: none !important;
    }
}

@media (max-width: 480px) {
    #homeSliderContainer {
        height: 160px;
        border-radius: 8px;
        margin-bottom: 1.5rem;
    }
}

.home-slide-item {
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
    display: block;
    position: relative;
    text-decoration: none;
    overflow: hidden;
}
.home-slide-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s cubic-bezier(0.25, 1, 0.5, 1);
}
.home-slide-item:hover img {
    transform: scale(1.05);
}
.slider-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid rgba(0,0,0,0.1);
}
.slider-dot.active {
    background: var(--accent-color);
    transform: scale(1.3);
    box-shadow: 0 0 10px var(--accent-color);
}
#sliderPrevBtn:hover, #sliderNextBtn:hover {
    background: var(--accent-color) !important;
    border-color: var(--accent-color) !important;
    transform: translateY(-50%) scale(1.1) !important;
}
