/* ============================================
   MSBooks.ro — DLE 19 Template CSS
   Biblioteca Digitală a Viitorului
   Mobile-first, SEO-optimized, performant
   ============================================ */

/* CSS Variables — Light Theme */
:root {
    --brand: #8B5CF6;
    --brand-600: #7C3AED;
    --brand-50: #F5F3FF;
    --accent: #F59E0B;
    
    --bg: #FAF8F5;
    --surface: #FFFFFF;
    --elevated: #F5F2EE;
    --border: #E7E2DD;
    
    --text: #1A1714;
    --text-muted: #6B6560;
    --text-light: #A8A29E;
    
    --success: #10B981;
    --error: #EF4444;
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;
    
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.08);
    --shadow-book: 0 4px 20px -2px rgba(0,0,0,0.08);
    --shadow-book-hover: 0 12px 40px -4px rgba(0,0,0,0.15);
    
    --max-width: 1280px;
    --navbar-height: 64px;
    
    --font-display: 'Playfair Display', Georgia, serif;
    --font-body: 'Inter', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

/* Dark Theme */
[data-theme="dark"] {
    --bg: #0F0E0D;
    --surface: #1A1917;
    --elevated: #252422;
    --border: #3A3836;
    
    --text: #F5F2EE;
    --text-muted: #A8A29E;
    --text-light: #6B6560;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background 0.3s, color 0.3s;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

input, textarea {
    font-family: inherit;
    font-size: inherit;
}

::selection {
    background: rgba(139, 92, 246, 0.2);
}

/* Container */
.container {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 16px;
}

@media (min-width: 640px) {
    .container { padding: 0 24px; }
}

@media (min-width: 1024px) {
    .container { padding: 0 32px; }
}

/* ============================================
   NAVBAR
   ============================================ */
.msbooks-navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: var(--navbar-height);
    transition: transform 0.3s ease, background 0.3s, box-shadow 0.3s;
}

.msbooks-navbar.scrolled {
    background: rgba(var(--surface), 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: var(--shadow-sm);
    border-bottom: 1px solid var(--border);
}

.msbooks-navbar.hidden {
    transform: translateY(-100%);
}

[data-theme="dark"] .msbooks-navbar.scrolled {
    background: rgba(26, 25, 23, 0.95);
}

.navbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 16px;
}

@media (min-width: 640px) {
    .navbar-inner { padding: 0 24px; }
}

/* Logo */
.navbar-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: var(--brand);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.logo-text {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
}

.logo-accent {
    color: var(--brand);
}

/* Nav Links */
.navbar-nav {
    display: none;
    align-items: center;
    gap: 28px;
}

@media (min-width: 768px) {
    .navbar-nav { display: flex; }
}

.nav-link {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    transition: color 0.2s;
    position: relative;
}

.nav-link:hover {
    color: var(--text);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--brand);
    border-radius: 2px;
    transition: width 0.2s;
}

.nav-link:hover::after {
    width: 100%;
}

/* Actions */
.navbar-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: background 0.2s, color 0.2s;
}

.nav-btn:hover {
    background: var(--elevated);
    color: var(--text);
}

.nav-btn-fav {
    position: relative;
}

.fav-count {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    background: var(--error);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-icon-moon,
[data-theme="dark"] .theme-icon-sun {
    display: none;
}

[data-theme="dark"] .theme-icon-moon {
    display: block;
}

/* Mobile Menu Toggle */
.nav-menu-toggle {
    display: flex;
}

@media (min-width: 768px) {
    .nav-menu-toggle { display: none; }
}

/* Mobile Menu */
.navbar-mobile {
    display: none;
    position: absolute;
    top: var(--navbar-height);
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 8px 16px;
    box-shadow: var(--shadow-lg);
}

.navbar-mobile.active {
    display: block;
}

.mobile-link {
    display: block;
    padding: 12px 0;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text);
    border-bottom: 1px solid var(--border);
}

.mobile-link:last-child {
    border-bottom: none;
}

/* Search Overlay */
.search-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    backdrop-filter: blur(4px);
    z-index: 999;
    align-items: flex-start;
    justify-content: center;
    padding-top: 120px;
}

.search-overlay.active {
    display: flex;
}

.search-box {
    width: 100%;
    max-width: 640px;
    margin: 0 16px;
    position: relative;
}

.search-form {
    display: flex;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    padding: 4px;
    box-shadow: var(--shadow-lg);
}

.search-icon {
    margin-left: 16px;
    color: var(--text-light);
    flex-shrink: 0;
}

.search-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    padding: 12px 16px;
    font-size: 1rem;
    color: var(--text);
}

.search-input::placeholder {
    color: var(--text-light);
}

.search-submit {
    padding: 10px 20px;
    background: var(--brand);
    color: #fff;
    font-weight: 600;
    font-size: 0.875rem;
    border-radius: var(--radius-full);
    transition: background 0.2s;
    flex-shrink: 0;
}

.search-submit:hover {
    background: var(--brand-600);
}

.search-close {
    position: absolute;
    top: -48px;
    right: 0;
    width: 40px;
    height: 40px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    box-shadow: var(--shadow-md);
}

/* Scroll Progress */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    z-index: 1001;
    background: transparent;
}

.scroll-progress::after {
    content: '';
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--brand), var(--accent));
    width: 0%;
    transition: width 0.1s linear;
}

/* ============================================
   HERO SECTION
   ============================================ */
.hero-section {
    position: relative;
    min-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 120px 16px 64px;
    overflow: hidden;
}

.hero-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0.4;
    pointer-events: none;
}

.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 700px;
    width: 100%;
}

.hero-title {
    font-family: var(--font-display);
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 700;
    line-height: 1.1;
    color: var(--text);
    letter-spacing: -0.02em;
}

.hero-subtitle {
    margin-top: 16px;
    font-size: 1.125rem;
    color: var(--text-muted);
    max-width: 520px;
    margin-left: auto;
    margin-right: auto;
}

.hero-search {
    margin-top: 32px;
    display: flex;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    padding: 4px;
    box-shadow: var(--shadow-md);
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
}

.hero-search-icon {
    margin-left: 16px;
    color: var(--text-light);
    flex-shrink: 0;
}

.hero-search-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    padding: 14px 16px;
    font-size: 1rem;
    color: var(--text);
}

.hero-search-input::placeholder {
    color: var(--text-light);
}

.hero-search-btn {
    padding: 12px 24px;
    background: var(--brand);
    color: #fff;
    font-weight: 600;
    font-size: 0.9375rem;
    border-radius: var(--radius-full);
    transition: background 0.2s;
    flex-shrink: 0;
}

.hero-search-btn:hover {
    background: var(--brand-600);
}

.hero-tags {
    margin-top: 20px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.hero-tag {
    padding: 6px 14px;
    background: var(--elevated);
    color: var(--text-muted);
    font-size: 0.8125rem;
    font-weight: 500;
    border-radius: var(--radius-full);
    transition: background 0.2s, color 0.2s;
}

.hero-tag:hover {
    background: var(--brand-50);
    color: var(--brand);
}

.hero-stats {
    margin-top: 28px;
    display: flex;
    justify-content: center;
    gap: 24px;
    font-size: 0.8125rem;
    color: var(--text-light);
}

.hero-stat {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ============================================
   BREADCRUMB
   ============================================ */
.breadcrumb {
    padding: 80px 0 16px;
    background: var(--bg);
}

.breadcrumb .container {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.breadcrumb-item {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.breadcrumb-item a:hover {
    color: var(--brand);
    text-decoration: underline;
}

.breadcrumb-item.active {
    color: var(--text);
    font-weight: 500;
}

.breadcrumb-sep {
    font-size: 0.75rem;
    color: var(--text-light);
}

/* ============================================
   BOOK CARD (shortstory)
   ============================================ */
.book-card {
    display: flex;
    flex-direction: column;
}

.book-card-cover {
    position: relative;
    aspect-ratio: 2 / 3;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--elevated);
    box-shadow: var(--shadow-book);
    transition: box-shadow 0.3s, transform 0.3s;
}

.book-card:hover .book-card-cover {
    box-shadow: var(--shadow-book-hover);
    transform: translateY(-4px);
}

.book-cover-link {
    display: block;
    width: 100%;
    height: 100%;
}

.book-cover-link img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}

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

.book-cover-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    text-align: center;
}

.placeholder-text {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-muted);
}

.book-card-badges {
    position: absolute;
    top: 10px;
    left: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 3;
}

.badge {
    padding: 3px 10px;
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: var(--radius-full);
    color: #fff;
}

.badge-new {
    background: var(--success);
}

.badge-trending {
    background: var(--brand);
}

.badge-category {
    background: var(--elevated);
    color: var(--text-muted);
}

.book-card-actions-hover {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.3s;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 16px;
    z-index: 2;
}

.book-card:hover .book-card-actions-hover {
    opacity: 1;
}

.actions-wrap {
    display: flex;
    gap: 8px;
    transform: translateY(8px);
    transition: transform 0.3s;
}

.book-card:hover .actions-wrap {
    transform: translateY(0);
}

.btn-read {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #fff;
    color: var(--text);
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    transition: background 0.2s;
}

.btn-read:hover {
    background: var(--brand-50);
}

.btn-download {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(8px);
    color: #fff;
    border-radius: var(--radius-md);
    transition: background 0.2s;
}

.btn-download:hover {
    background: rgba(255,255,255,0.3);
}

.btn-fav {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: rgba(0,0,0,0.3);
    backdrop-filter: blur(4px);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s;
    z-index: 3;
}

.book-card:hover .btn-fav {
    opacity: 1;
}

.btn-fav:hover {
    background: rgba(239, 68, 68, 0.8);
}

.btn-fav.active svg {
    fill: #EF4444;
    stroke: #EF4444;
}

/* Card Info */
.book-card-info {
    margin-top: 12px;
}

.book-title {
    display: block;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.2s;
}

.book-title:hover {
    color: var(--brand);
}

.book-author {
    display: block;
    margin-top: 4px;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.book-rating {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
}

.stars {
    display: flex;
    gap: 2px;
}

.star {
    width: 12px;
    height: 12px;
    fill: #D6D3D1;
    stroke: none;
}

.star.filled {
    fill: var(--accent);
}

.star.half {
    fill: url(#star-half);
}

.rating-count {
    font-size: 0.75rem;
    color: var(--text-light);
}

/* ============================================
   SECTIONS
   ============================================ */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.section-title {
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.01em;
}

.section-title-sm {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 16px;
}

.section-link {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--brand);
    display: flex;
    align-items: center;
    gap: 4px;
    transition: gap 0.2s;
}

.section-link:hover {
    gap: 8px;
}

/* Books Grid */
.books-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

@media (min-width: 640px) {
    .books-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }
}

@media (min-width: 1024px) {
    .books-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 24px;
    }
}

@media (min-width: 1280px) {
    .books-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* Wide Cards Grid */
.books-grid-wide {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

@media (min-width: 640px) {
    .books-grid-wide {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .books-grid-wide {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Book Card Wide */
.book-card-wide {
    display: flex;
    gap: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 12px;
    transition: box-shadow 0.3s, transform 0.3s;
}

.book-card-wide:hover {
    box-shadow: var(--shadow-book-hover);
    transform: translateY(-2px);
}

.book-wide-cover {
    width: 90px;
    height: 126px;
    border-radius: var(--radius-md);
    overflow: hidden;
    flex-shrink: 0;
    background: var(--elevated);
}

.book-wide-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.book-wide-info {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex: 1;
    min-width: 0;
}

.book-wide-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-wide-title:hover {
    color: var(--brand);
}

.book-wide-author {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.book-wide-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
    padding-top: 8px;
}

.book-wide-downloads {
    font-size: 0.75rem;
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: 4px;
}

.book-wide-actions {
    display: flex;
    gap: 6px;
}

/* Categories Grid */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

@media (min-width: 640px) {
    .categories-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 16px;
    }
}

@media (min-width: 1024px) {
    .categories-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}

.category-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    background: var(--elevated);
    border-radius: var(--radius-xl);
    padding: 16px;
    text-align: center;
    transition: background 0.3s, color 0.3s, transform 0.3s;
    gap: 8px;
}

.category-card:hover {
    background: var(--brand);
    color: #fff;
    transform: scale(1.05);
}

.category-card svg {
    width: 36px;
    height: 36px;
    color: var(--brand);
    transition: color 0.3s;
}

.category-card:hover svg {
    color: #fff;
}

.category-card span {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text);
    transition: color 0.3s;
}

.category-card:hover span {
    color: #fff;
}

/* ============================================
   BOOK DETAIL (fullstory)
   ============================================ */
.book-detail {
    padding-top: 24px;
}

.book-detail-grid {
    display: grid;
    gap: 32px;
}

@media (min-width: 1024px) {
    .book-detail-grid {
        grid-template-columns: 320px 1fr;
        gap: 48px;
    }
}

/* Cover Column */
.book-detail-cover-wrap {
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-book);
    background: var(--elevated);
}

.book-detail-cover {
    width: 100%;
    aspect-ratio: 2 / 3;
    object-fit: cover;
    display: block;
}

.book-cover-placeholder-lg {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    text-align: center;
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-muted);
}

.book-detail-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    justify-content: center;
}

.btn-fav-detail,
.btn-share-detail {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--surface);
    transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.btn-fav-detail:hover {
    border-color: var(--error);
    color: var(--error);
    background: rgba(239, 68, 68, 0.05);
}

.btn-fav-detail.active {
    border-color: var(--error);
    color: var(--error);
    background: rgba(239, 68, 68, 0.05);
}

.btn-fav-detail.active svg {
    fill: var(--error);
    stroke: var(--error);
}

.btn-share-detail:hover {
    border-color: var(--brand);
    color: var(--brand);
}

/* Info Column */
.book-detail-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.book-detail-title {
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.book-detail-author {
    margin-top: 8px;
    font-size: 1rem;
    color: var(--text-muted);
}

.book-detail-author span {
    color: var(--text);
    font-weight: 500;
}

.book-detail-rating {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
}

.book-detail-rating .stars {
    gap: 3px;
}

.book-detail-rating .star {
    width: 18px;
    height: 18px;
}

.rating-value {
    font-weight: 600;
    color: var(--text);
}

.rating-count {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.book-detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 16px;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.meta-item svg {
    color: var(--text-light);
}

.book-detail-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 24px;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--brand);
    color: #fff;
    font-weight: 600;
    font-size: 0.9375rem;
    border-radius: var(--radius-lg);
    transition: background 0.2s, transform 0.2s;
}

.btn-primary:hover {
    background: var(--brand-600);
    transform: translateY(-1px);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-weight: 600;
    font-size: 0.9375rem;
    border-radius: var(--radius-lg);
    transition: background 0.2s, border-color 0.2s;
}

.btn-secondary:hover {
    background: var(--elevated);
    border-color: var(--brand);
}

.btn-lg {
    padding: 14px 28px;
    font-size: 1rem;
}

.btn-full {
    width: 100%;
    justify-content: center;
}

/* Description */
.book-detail-desc {
    margin-top: 32px;
}

.book-detail-desc h2 {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 12px;
}

.desc-content {
    font-size: 0.9375rem;
    line-height: 1.7;
    color: var(--text-muted);
}

.desc-content p {
    margin-bottom: 12px;
}

/* Technical Info */
.book-detail-tech {
    margin-top: 24px;
}

.tech-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

@media (min-width: 640px) {
    .tech-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.tech-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px;
}

.tech-label {
    display: block;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-light);
    margin-bottom: 6px;
}

.tech-value {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text);
}

/* Ad Slots */
.ad-slot-inline {
    margin: 32px 0;
    padding: 24px;
    background: var(--elevated);
    border: 1px dashed var(--border);
    border-radius: var(--radius-lg);
    text-align: center;
}

.ad-label {
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-light);
}

.ad-slot-sidebar {
    display: none;
}

@media (min-width: 1024px) {
    .ad-slot-sidebar {
        display: block;
        width: 300px;
        flex-shrink: 0;
    }
    
    .ad-slot-sidebar .ad-label {
        display: block;
        padding: 60px 20px;
        background: var(--elevated);
        border: 1px dashed var(--border);
        border-radius: var(--radius-lg);
    }
}

/* Related Section */
.related-section {
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid var(--border);
}

.comments-section {
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid var(--border);
}

/* ============================================
   SEARCH PAGE
   ============================================ */
.search-results-page {
    padding-top: 80px;
    padding-bottom: 48px;
    min-height: 60vh;
}

.search-header {
    background: var(--elevated);
    border-radius: var(--radius-xl);
    padding: 24px;
    margin-bottom: 24px;
}

.search-header-form {
    max-width: 640px;
}

.search-input-wrap {
    display: flex;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    padding: 4px;
}

.search-input-wrap .search-icon {
    margin-left: 14px;
    color: var(--text-light);
    flex-shrink: 0;
}

.search-input-wrap .search-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    padding: 10px 14px;
    font-size: 0.9375rem;
    color: var(--text);
}

.search-input-wrap .search-submit {
    padding: 8px 18px;
    background: var(--brand);
    color: #fff;
    font-weight: 600;
    font-size: 0.8125rem;
    border-radius: var(--radius-full);
    flex-shrink: 0;
}

.search-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 24px;
}

.search-count {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.search-count strong {
    color: var(--text);
    font-weight: 600;
}

.search-sort {
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-sort span {
    font-size: 0.8125rem;
    color: var(--text-light);
}

.sort-link {
    padding: 6px 14px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    transition: all 0.2s;
}

.sort-link:hover,
.sort-link.active {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

.search-empty {
    text-align: center;
    padding: 64px 0;
}

.search-empty svg {
    margin: 0 auto 16px;
    color: var(--text-light);
}

.search-empty h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}

.search-empty p {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 24px;
}

.search-suggestions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.suggestion-tag {
    padding: 8px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    transition: all 0.2s;
}

.suggestion-tag:hover {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

/* ============================================
   LOGIN MODAL
   ============================================ */
.login-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.login-modal.active {
    display: flex;
}

.login-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
}

.login-panel {
    position: relative;
    width: 100%;
    max-width: 440px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 32px;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.login-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: background 0.2s;
}

.login-close:hover {
    background: var(--elevated);
}

.login-tabs {
    display: flex;
    gap: 4px;
    background: var(--elevated);
    border-radius: var(--radius-md);
    padding: 4px;
    margin-bottom: 24px;
}

.login-tab {
    flex: 1;
    padding: 10px;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: calc(var(--radius-md) - 2px);
    color: var(--text-muted);
    transition: all 0.2s;
    text-align: center;
}

.login-tab.active {
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-sm);
}

.login-content {
    display: none;
}

.login-content.active {
    display: block;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text);
}

.form-input-wrap {
    display: flex;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 0 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input-wrap:focus-within {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.form-icon {
    color: var(--text-light);
    flex-shrink: 0;
}

.form-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    padding: 11px 12px;
    font-size: 0.9375rem;
    color: var(--text);
}

.form-input::placeholder {
    color: var(--text-light);
}

.form-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8125rem;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    cursor: pointer;
}

.form-check input {
    display: none;
}

.check-box {
    width: 18px;
    height: 18px;
    border: 1px solid var(--border);
    border-radius: 5px;
    background: var(--surface);
    transition: all 0.2s;
    position: relative;
}

.form-check input:checked + .check-box {
    background: var(--brand);
    border-color: var(--brand);
}

.check-box::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 6px;
    width: 4px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    opacity: 0;
    transition: opacity 0.2s;
}

.form-check input:checked + .check-box::after {
    opacity: 1;
}

.form-forgot {
    color: var(--brand);
    font-weight: 500;
    transition: opacity 0.2s;
}

.form-forgot:hover {
    opacity: 0.8;
}

.login-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
    font-size: 0.75rem;
    color: var(--text-light);
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.login-social {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.social-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text);
    background: var(--surface);
    transition: background 0.2s;
}

.social-btn:hover {
    background: var(--elevated);
}

/* ============================================
   CHAT WIDGET
   ============================================ */
.chat-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1500;
}

.chat-trigger {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-full);
    background: var(--brand);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.4);
    transition: transform 0.3s, box-shadow 0.3s;
    position: relative;
}

.chat-trigger:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 24px rgba(139, 92, 246, 0.5);
}

.chat-pulse {
    position: absolute;
    inset: -4px;
    border-radius: var(--radius-full);
    border: 2px solid var(--brand);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(1.3); opacity: 0; }
}

.chat-panel {
    display: none;
    position: absolute;
    bottom: 72px;
    right: 0;
    width: 360px;
    max-width: calc(100vw - 48px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    flex-direction: column;
    animation: chatIn 0.3s ease;
}

.chat-panel.active {
    display: flex;
}

@keyframes chatIn {
    from { opacity: 0; transform: translateY(12px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--brand);
    color: #fff;
}

.chat-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-header-info {
    display: flex;
    flex-direction: column;
}

.chat-name {
    font-size: 0.875rem;
    font-weight: 600;
}

.chat-status {
    font-size: 0.6875rem;
    opacity: 0.8;
    display: flex;
    align-items: center;
    gap: 4px;
}

.chat-status::before {
    content: '';
    width: 6px;
    height: 6px;
    background: #10B981;
    border-radius: var(--radius-full);
}

.chat-header-actions {
    display: flex;
    gap: 4px;
}

.chat-header-actions button {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    opacity: 0.8;
    transition: opacity 0.2s, background 0.2s;
}

.chat-header-actions button:hover {
    opacity: 1;
    background: rgba(255,255,255,0.15);
}

.chat-body {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    max-height: 320px;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-message {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    max-width: 85%;
}

.chat-message-bot {
    align-self: flex-start;
}

.chat-message-user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-message-avatar {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    background: var(--brand-50);
    color: var(--brand);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chat-message-user .chat-message-avatar {
    background: var(--elevated);
    color: var(--text-muted);
}

.chat-message-bubble {
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--text);
    background: var(--elevated);
    border-bottom-left-radius: 4px;
}

.chat-message-user .chat-message-bubble {
    background: var(--brand);
    color: #fff;
    border-bottom-left-radius: 14px;
    border-bottom-right-radius: 4px;
}

.chat-typing {
    display: flex;
    gap: 3px;
    padding: 14px;
}

.chat-typing span {
    width: 6px;
    height: 6px;
    background: var(--text-light);
    border-radius: var(--radius-full);
    animation: typing 1.4s infinite ease-in-out both;
}

.chat-typing span:nth-child(1) { animation-delay: -0.32s; }
.chat-typing span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

.chat-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
}

.chat-form {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--elevated);
    border-radius: var(--radius-full);
    padding: 4px 4px 4px 14px;
}

.chat-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 0.875rem;
    color: var(--text);
    padding: 8px 0;
}

.chat-input::placeholder {
    color: var(--text-light);
}

.chat-send {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: var(--brand);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}

.chat-send:hover {
    background: var(--brand-600);
}

/* ============================================
   CONTINUE READING
   ============================================ */
.continue-reading {
    padding: 24px 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.continue-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

@media (min-width: 640px) {
    .continue-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .continue-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.continue-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 12px;
    transition: box-shadow 0.3s;
}

.continue-item:hover {
    box-shadow: var(--shadow-md);
}

.continue-thumb {
    width: 48px;
    height: 64px;
    border-radius: var(--radius-md);
    overflow: hidden;
    flex-shrink: 0;
    background: var(--elevated);
}

.continue-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.continue-info {
    flex: 1;
    min-width: 0;
}

.continue-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.continue-author {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.continue-progress {
    margin-top: 8px;
    height: 4px;
    background: var(--elevated);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.continue-progress-bar {
    height: 100%;
    background: var(--brand);
    border-radius: var(--radius-full);
    transition: width 0.3s;
}

/* ============================================
   NEWSLETTER SECTION
   ============================================ */
.newsletter-section {
    background: var(--brand);
    padding: 64px 16px;
}

@media (min-width: 640px) {
    .newsletter-section {
        padding: 80px 24px;
    }
}

.newsletter-inner {
    max-width: 560px;
    margin: 0 auto;
    text-align: center;
}

.newsletter-title {
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 700;
    color: #fff;
    margin-bottom: 12px;
}

.newsletter-desc {
    font-size: 1rem;
    color: rgba(255,255,255,0.8);
    margin-bottom: 24px;
}

.newsletter-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 440px;
    margin: 0 auto;
}

@media (min-width: 640px) {
    .newsletter-form {
        flex-direction: row;
    }
}

.newsletter-input {
    flex: 1;
    padding: 14px 20px;
    border: none;
    border-radius: var(--radius-full);
    font-size: 0.9375rem;
    background: #fff;
    color: var(--text);
    outline: none;
}

.newsletter-input::placeholder {
    color: var(--text-light);
}

.newsletter-btn {
    padding: 14px 28px;
    background: var(--text);
    color: var(--brand);
    font-weight: 700;
    font-size: 0.9375rem;
    border-radius: var(--radius-full);
    transition: background 0.2s;
    white-space: nowrap;
}

.newsletter-btn:hover {
    background: #fff;
}

.newsletter-note {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.6);
    margin-top: 12px;
}

/* ============================================
   FOOTER
   ============================================ */
.msbooks-footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 48px 16px 24px;
}

@media (min-width: 640px) {
    .msbooks-footer {
        padding: 64px 24px 24px;
    }
}

.footer-inner {
    max-width: var(--max-width);
    margin: 0 auto;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 32px;
}

@media (min-width: 640px) {
    .footer-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (min-width: 1024px) {
    .footer-grid {
        grid-template-columns: 2fr 1fr 1fr 1fr;
        gap: 48px;
    }
}

.footer-brand {
    max-width: 300px;
}

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

.footer-logo .logo-icon {
    width: 28px;
    height: 28px;
}

.footer-logo .logo-text {
    font-size: 1.125rem;
}

.footer-desc {
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.footer-social {
    display: flex;
    gap: 12px;
}

.social-link {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    background: var(--elevated);
    transition: background 0.2s, color 0.2s;
}

.social-link:hover {
    background: var(--brand);
    color: #fff;
}

.footer-heading {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.footer-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.footer-links a,
.footer-contact {
    font-size: 0.875rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--brand);
}

.footer-bottom {
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-light);
}

@media (min-width: 640px) {
    .footer-bottom {
        flex-direction: row;
        justify-content: space-between;
        text-align: left;
    }
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast-container {
    position: fixed;
    top: 80px;
    right: 16px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
    max-width: 320px;
}

.toast-success {
    border-left: 3px solid var(--success);
}

.toast-error {
    border-left: 3px solid var(--error);
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(20px); }
}

/* ============================================
   SKELETON LOADING
   ============================================ */
.skeleton {
    background: linear-gradient(90deg, var(--elevated) 25%, var(--surface) 50%, var(--elevated) 75%);
    background-size: 200% 100%;
    animation: skeletonPulse 1.5s ease-in-out infinite;
    border-radius: var(--radius-md);
}

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

/* ============================================
   PAGINATION
   ============================================ */
.pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.pagination a,
.pagination span {
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: all 0.2s;
}

.pagination a {
    color: var(--text-muted);
    background: var(--surface);
    border: 1px solid var(--border);
}

.pagination a:hover {
    border-color: var(--brand);
    color: var(--brand);
}

.pagination span {
    color: #fff;
    background: var(--brand);
}

/* ============================================
   MAIN CONTENT LAYOUT
   ============================================ */
.msbooks-main {
    padding-top: var(--navbar-height);
    min-height: calc(100vh - var(--navbar-height));
}

[available=main] .msbooks-main {
    padding-top: 0;
}

.msbooks-content-wrapper {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 24px 16px 48px;
}

@media (min-width: 640px) {
    .msbooks-content-wrapper {
        padding: 32px 24px 64px;
    }
}

@media (min-width: 1024px) {
    .msbooks-content-wrapper {
        padding: 40px 32px 80px;
    }
}

/* Section spacing */
.content-section {
    padding: 40px 0;
}

@media (min-width: 640px) {
    .content-section {
        padding: 56px 0;
    }
}

/* ============================================
   ADDITIONAL DLE INTEGRATION STYLES
   ============================================ */
.addcomments,
.comments {
    margin-top: 24px;
}

.comments-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.comment-item {
    display: flex;
    gap: 12px;
    padding: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.comment-avatar img {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    object-fit: cover;
}

.comment-body {
    flex: 1;
}

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

.comment-author {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text);
}

.comment-date {
    font-size: 0.75rem;
    color: var(--text-light);
}

.comment-text {
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--text-muted);
}

/* Navigation (DLE pagination) */
.navigation {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 32px;
}

.navigation a,
.navigation span {
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: all 0.2s;
}

.navigation a {
    color: var(--text-muted);
    background: var(--surface);
    border: 1px solid var(--border);
}

.navigation a:hover {
    border-color: var(--brand);
    color: var(--brand);
}

.navigation span {
    color: #fff;
    background: var(--brand);
}

/* Vote / Rating DLE integration */
.rating-box {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Print styles */
@media print {
    .msbooks-navbar,
    .chat-widget,
    .scroll-progress,
    .ad-slot-inline,
    .ad-slot-sidebar,
    .newsletter-section,
    .msbooks-footer,
    .btn-fav,
    .book-card-actions-hover,
    .btn-read,
    .btn-download {
        display: none !important;
    }
    
    body {
        background: #fff !important;
        color: #000 !important;
    }
    
    .book-detail-grid {
        grid-template-columns: 200px 1fr !important;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    html {
        scroll-behavior: auto;
    }
}


/* ============================================
   CONTENT WRAPPER — Grid 5 cărți pe rând
   ============================================ */

.msbooks-content-wrapper {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    align-items: start;
}

/* Toate elementele NON-carte ocupă tot rândul (info, pagination, comments, etc.) */
.msbooks-content-wrapper > *:not(.book-card) {
    grid-column: 1 / -1;
}

/* Cardurile de carte se adaptează la grid */
.msbooks-content-wrapper > .book-card {
    width: 100%;
    min-width: 0;
    margin: 0 !important;
}

.msbooks-content-wrapper > .book-card .book-card-cover {
    aspect-ratio: 2 / 3;
    width: 100%;
}

/* --- Responsive --- */
@media (min-width: 640px) {
    .msbooks-content-wrapper {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }
}

@media (min-width: 900px) {
    .msbooks-content-wrapper {
        grid-template-columns: repeat(4, 1fr);
        gap: 22px;
    }
}

@media (min-width: 1200px) {
    .msbooks-content-wrapper {
        grid-template-columns: repeat(5, 1fr);
        gap: 24px;
    }
}

/* ============================================
   FIX URIAS PENTRU MSBOOKS.RO — GRILA 5 CARTI
   ============================================ */

/* WRAPPER devine grid */
.msbooks-content-wrapper {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 16px !important;
    align-items: start !important;
}

/* Orice NU e carte ocupa tot randul */
.msbooks-content-wrapper > *:not(.book-card):not(.breadcrumb):not(.pagination):not(.msbooks-navbar):not(.msbooks-footer):not(.chat-widget):not(.login-modal) {
    grid-column: 1 / -1 !important;
}

/* Cardurile de carte in grid */
.msbooks-content-wrapper > .book-card {
    width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
}

/* Fix hover overlay - ascuns by default */
.book-card-actions-hover {
    opacity: 0 !important;
    transition: opacity 0.3s ease !important;
}

.book-card:hover .book-card-actions-hover {
    opacity: 1 !important;
}

/* Fix buton fav ascuns by default */
.btn-fav {
    opacity: 0 !important;
    transition: opacity 0.2s ease !important;
}

.book-card:hover .btn-fav {
    opacity: 1 !important;
}

/* Fix stele rating - filled by default via CSS */
.stars[data-rating] .star {
    fill: #D6D3D1 !important;
    stroke: none !important;
}

.stars[data-rating="5"] .star:nth-child(-n+5),
.stars[data-rating="4.5"] .star:nth-child(-n+5),
.stars[data-rating="4"] .star:nth-child(-n+4),
.stars[data-rating="3.5"] .star:nth-child(-n+4),
.stars[data-rating="3"] .star:nth-child(-n+3),
.stars[data-rating="2.5"] .star:nth-child(-n+3),
.stars[data-rating="2"] .star:nth-child(-n+2),
.stars[data-rating="1.5"] .star:nth-child(-n+2),
.stars[data-rating="1"] .star:nth-child(-n+1),
.stars[data-rating="0.5"] .star:nth-child(-n+1) {
    fill: #F59E0B !important;
}

/* Fix placeholder cover */
.book-cover-placeholder {
    background: var(--elevated) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.placeholder-text {
    font-family: var(--font-display) !important;
    font-size: 0.875rem !important;
    font-weight: 600 !important;
    color: var(--text-muted) !important;
    text-align: center !important;
    padding: 16px !important;
}

/* Fix breadcrumb sa nu strice gridul */
.breadcrumb {
    grid-column: 1 / -1 !important;
    margin-bottom: 16px !important;
}

/* Pagination sub carti */
.pagination,
.navigation {
    grid-column: 1 / -1 !important;
    margin-top: 24px !important;
}

/* Responsive grila */
@media (min-width: 640px) {
    .msbooks-content-wrapper {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 20px !important;
    }
}

@media (min-width: 900px) {
    .msbooks-content-wrapper {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 22px !important;
    }
}

@media (min-width: 1200px) {
    .msbooks-content-wrapper {
        grid-template-columns: repeat(5, 1fr) !important;
        gap: 24px !important;
    }
}
