/* Dark Theme - Modern Design */
:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #2a2a2a;
    --text-primary: #e0e0e0;
    --text-secondary: #b0b0b0;
    --accent: #d97706;
    --accent-hover: #f59e0b;
    --border: #333;
    --success: #4caf50;
    --danger: #f44336;
    --warning: #ff9800;
}

/* Import elegant fonts */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700&family=Inter:wght@300;400;500;600&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px;
    width: 100%;
    box-sizing: border-box;
}

@media (min-width: 768px) {
    .container {
        padding: 20px;
    }
}

/* Header */
.header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar {
    padding: 0;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 12px;
    height: 60px;
}

@media (min-width: 768px) {
    .navbar .container {
        padding: 0 20px;
        height: 64px;
    }
}

.logo {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    transition: all 0.3s ease;
    line-height: 1.2;
}

.logo-name {
    font-family: 'Playfair Display', serif;
    font-size: 22px;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transition: all 0.3s ease;
}

@media (min-width: 768px) {
    .logo-name {
        font-size: 28px;
    }
}

.logo-tagline {
    font-family: 'Inter', sans-serif;
    font-size: 9px;
    font-weight: 300;
    color: var(--text-secondary);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-top: 2px;
    opacity: 0.8;
    transition: all 0.3s ease;
}

@media (min-width: 768px) {
    .logo-tagline {
        font-size: 11px;
        letter-spacing: 2px;
    }
}

.logo:hover .logo-name {
    background: linear-gradient(135deg, var(--accent-hover) 0%, #fb923c 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transform: translateY(-1px);
}

.logo:hover .logo-tagline {
    color: var(--accent);
    opacity: 1;
}

.mobile-menu-toggle {
    display: flex;
    flex-direction: column;
    gap: 5px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 10px;
    z-index: 101;
    border-radius: 8px;
    transition: background 0.2s;
}

.mobile-menu-toggle:hover {
    background: var(--bg-tertiary);
}

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

/* Nav actions (cart + hamburger on mobile) */
.nav-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

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

/* Cart button in navbar (mobile) */
.cart-btn-nav {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.2s ease;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
}

.cart-btn-nav:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.cart-btn-nav svg {
    width: 20px;
    height: 20px;
}

.cart-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: white;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 10px;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid var(--bg-secondary);
    line-height: 1;
}

.cart-badge.visible {
    display: flex;
}

/* Desktop cart in nav-links */
.nav-cart-desktop {
    display: none !important;
}

@media (min-width: 768px) {
    .nav-cart-desktop {
        display: flex !important;
        align-items: center;
        gap: 6px;
        position: relative;
    }
    
    .nav-cart-desktop svg {
        flex-shrink: 0;
    }
}

.cart-badge-desktop {
    background: #ef4444;
    color: white;
    font-size: 10px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    line-height: 1;
}

.cart-badge-desktop.visible {
    display: inline-flex;
}

/* Nav buttons */
.nav-btn {
    font-weight: 500;
    border-radius: 8px !important;
    text-align: center;
    transition: all 0.2s ease !important;
}

.nav-btn-outline {
    border: 1px solid var(--border) !important;
    color: var(--text-secondary) !important;
}

.nav-btn-outline:hover {
    border-color: var(--accent) !important;
    color: var(--accent) !important;
    background: rgba(217, 119, 6, 0.05) !important;
}

.nav-btn-accent {
    background: linear-gradient(135deg, var(--accent), var(--accent-hover)) !important;
    color: white !important;
    border: none !important;
}

.nav-btn-accent:hover {
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.3) !important;
    transform: translateY(-1px);
}

@media (min-width: 768px) {
    .nav-btn {
        padding: 8px 16px !important;
        font-size: 13px !important;
        height: 38px;
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
    }
}

.mobile-menu-toggle span {
    width: 22px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all 0.3s ease;
    display: block;
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

.nav-links {
    position: fixed;
    top: 0;
    right: -100%;
    width: 280px;
    height: 100vh;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 80px 24px 30px;
    gap: 4px;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.5);
    overflow-y: auto;
}

.nav-links.active {
    right: 0;
}

@media (min-width: 768px) {
    .nav-links {
        position: static;
        width: auto;
        height: auto;
        background: transparent;
        border-left: none;
        flex-direction: row;
        align-items: center;
        padding: 0;
        gap: 4px;
        box-shadow: none;
        overflow-y: visible;
    }
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s ease;
    padding: 14px 16px;
    border-radius: 10px;
    font-size: 15px;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
}

@media (min-width: 768px) {
    .nav-links a {
        padding: 8px 14px;
        border-radius: 8px;
        font-size: 14px;
        width: auto;
        height: 38px;
    }
}

.nav-links a:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.nav-links .user-info {
    padding: 14px 16px;
    width: 100%;
    color: var(--accent);
    font-weight: 500;
    font-size: 14px;
    border-top: 1px solid var(--border);
    margin-top: 12px;
    padding-top: 20px;
}

@media (min-width: 768px) {
    .nav-links .user-info {
        padding: 8px 12px;
        width: auto;
        border-top: none;
        margin-top: 0;
        padding-top: 8px;
    }
}

.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 99;
}

.mobile-menu-overlay.active {
    display: block;
}

/* Main Content */
.main-content {
    min-height: calc(100vh - 200px);
}

/* About Author Section */
.about-author-section {
    margin: 40px 0 60px;
    padding: 0;
}

.about-author-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

@media (min-width: 768px) {
    .about-author-content {
        border-radius: 16px;
        padding: 40px;
    }
}

.about-author-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    align-items: start;
    max-width: 1000px;
    margin: 0 auto;
    text-align: center;
}

@media (min-width: 768px) {
    .about-author-layout {
        grid-template-columns: 180px 1fr;
        gap: 35px;
        text-align: left;
    }
}

.about-author-image-wrapper {
    position: relative;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    overflow: hidden;
    border: 4px solid var(--accent);
    box-shadow: 0 6px 20px rgba(217, 119, 6, 0.25);
    flex-shrink: 0;
    background: var(--bg-tertiary);
    padding: 4px;
    transition: all 0.3s ease;
    margin: 0 auto;
}

@media (min-width: 768px) {
    .about-author-image-wrapper {
        width: 180px;
        height: 180px;
        margin: 0;
    }
}

.about-author-image-wrapper:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(217, 119, 6, 0.35);
    border-color: var(--accent-hover);
}

.about-author-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 50%;
    transition: transform 0.3s ease;
}

.about-author-image-wrapper:hover .about-author-image {
    transform: scale(1.05);
}

.about-author-text {
    flex: 1;
}

.about-author-title {
    font-size: 24px;
    color: var(--accent);
    margin-bottom: 16px;
    font-weight: 700;
    font-family: 'Playfair Display', serif;
}

@media (min-width: 768px) {
    .about-author-title {
        font-size: 32px;
        margin-bottom: 25px;
    }
}

.about-author-description {
    font-size: 15px;
    color: var(--text-primary);
    line-height: 1.8;
    margin-bottom: 16px;
    text-align: left;
}

@media (min-width: 768px) {
    .about-author-description {
        font-size: 17px;
        line-height: 1.9;
        margin-bottom: 20px;
        text-align: justify;
    }
}

.about-author-description strong {
    color: var(--accent);
    font-weight: 600;
}

.about-author-signature {
    margin-top: 35px;
    padding-top: 25px;
    border-top: 1px solid var(--border);
    text-align: right;
    font-style: italic;
    color: var(--text-secondary);
    font-size: 16px;
    line-height: 1.8;
}

.signature-name {
    display: block;
    margin-top: 8px;
    color: var(--accent);
    font-weight: 600;
    font-style: normal;
    font-size: 18px;
}

/* Page Header */
.page-header {
    margin-bottom: 24px;
    text-align: center;
}

@media (min-width: 768px) {
    .page-header {
        margin-bottom: 40px;
    }
}

.page-header h1 {
    font-size: 26px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

@media (min-width: 768px) {
    .page-header h1 {
        font-size: 36px;
        margin-bottom: 10px;
    }
}

.subtitle {
    color: var(--text-secondary);
    font-size: 15px;
}

@media (min-width: 768px) {
    .subtitle {
        font-size: 18px;
    }
}

/* Section titles */
.section-title {
    font-size: 24px;
}

@media (min-width: 768px) {
    .section-title {
        font-size: 32px;
    }
}

/* Books Grid */
.books-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    margin-bottom: 40px;
}

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

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

.book-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    text-decoration: none;
    display: block;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

@media (min-width: 768px) {
    .book-card {
        border-radius: 16px;
    }
    
    .book-card:hover {
        transform: translateY(-8px);
        border-color: var(--accent);
        box-shadow: 0 20px 50px rgba(217, 119, 6, 0.2), 0 8px 24px rgba(0, 0, 0, 0.3);
    }
}

.book-cover-wrapper {
    width: 100%;
    overflow: hidden;
    background: var(--bg-tertiary);
    position: relative;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (min-width: 768px) {
    .book-cover-wrapper {
        padding: 24px;
    }
}

.book-cover-wrapper::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(to top, var(--bg-secondary), transparent);
    pointer-events: none;
    z-index: 5;
}

.book-cover {
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: 320px;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
    transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@media (min-width: 768px) {
    .book-cover {
        max-height: 420px;
    }
    
    .book-card:hover .book-cover {
        transform: scale(1.05);
    }
}

.book-badges-on-cover {
    position: absolute;
    bottom: 10px;
    right: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    z-index: 10;
    justify-content: flex-end;
    max-width: calc(100% - 20px);
}

@media (min-width: 768px) {
    .book-badges-on-cover {
        bottom: 14px;
        right: 14px;
        gap: 6px;
        max-width: calc(100% - 28px);
    }
}

.book-badges-on-cover .book-badge {
    display: inline-block;
    padding: 5px 10px;
    background: linear-gradient(135deg, rgba(217, 119, 6, 0.95) 0%, rgba(245, 158, 11, 0.95) 100%);
    color: white;
    font-size: 10px;
    font-weight: 600;
    border-radius: 20px;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    letter-spacing: 0.3px;
}

@media (min-width: 768px) {
    .book-badges-on-cover .book-badge {
        padding: 6px 14px;
        font-size: 11px;
    }
}

.book-info {
    padding: 16px 14px;
}

@media (min-width: 768px) {
    .book-info {
        padding: 22px 20px;
    }
}

.book-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

@media (min-width: 768px) {
    .book-title {
        font-size: 20px;
        margin-bottom: 10px;
    }
}

.book-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.book-badge {
    display: inline-block;
    padding: 4px 12px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
    color: white;
    font-size: 12px;
    font-weight: 500;
    border-radius: 12px;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(217, 119, 6, 0.3);
}

.book-description {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: calc(3 * 1.6em);
}

@media (min-width: 768px) {
    .book-description {
        font-size: 14px;
    }
}

/* Book Page Layout */
.book-page-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    align-items: start;
}

@media (min-width: 768px) {
    .book-page-layout {
        grid-template-columns: 1fr 320px;
        gap: 30px;
    }
}

.book-left-section {
    display: flex;
    flex-direction: column;
}

.book-right-section {
    position: sticky;
    top: 80px;
    align-self: start;
}

/* Book Header */
.book-header {
    display: flex;
    flex-direction: row;
    gap: 30px;
    background: var(--bg-secondary);
    padding: 30px;
    border-radius: 12px;
    border: 1px solid var(--border);
    align-items: flex-start;
}

.book-header-cover {
    width: 200px;
    flex-shrink: 0;
}

.book-cover-image-wrapper {
    position: relative;
    width: 100%;
}

.book-cover-image-wrapper img {
    width: 100%;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.book-header-cover .book-badges-on-cover {
    bottom: 15px;
    right: 15px;
    left: auto;
    top: auto;
}

.book-header-cover .book-badges-on-cover .book-badge {
    font-size: 12px;
    padding: 6px 14px;
}

.book-header-info h1 {
    font-size: 32px;
    margin-bottom: 15px;
    color: var(--text-primary);
}

.book-badges-under-cover {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.book-badges-under-cover .book-badge {
    display: inline-block;
    padding: 6px 14px;
    color: white;
    font-size: 13px;
    font-weight: 600;
    border-radius: 12px;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.book-meta-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
    padding: 15px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.book-meta-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.book-meta-label {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 14px;
    min-width: 120px;
}

.book-meta-value {
    color: var(--text-primary);
    font-size: 14px;
}

.book-cover-image-wrapper {
    transition: transform 0.3s ease;
}

.book-cover-image-wrapper:hover {
    transform: scale(1.02);
}

/* Cover Zoom Modal */
#cover-zoom-modal {
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.cover-zoom-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cover-zoom-content img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.8);
}

.close-zoom {
    position: absolute;
    top: -40px;
    right: 0;
    font-size: 40px;
    color: white;
    cursor: pointer;
    z-index: 2001;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-zoom:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
}

.book-header-info .book-badges {
    margin-bottom: 20px;
}

.book-header-info .book-badge {
    font-size: 13px;
    padding: 5px 14px;
}

.book-description-full {
    color: var(--text-secondary);
    line-height: 1.8;
    font-size: 16px;
}

/* Chapters */
.chapters-section {
    background: var(--bg-secondary);
    padding: 30px;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.chapters-section h2 {
    margin-bottom: 20px;
    color: var(--text-primary);
}

.chapters-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chapter-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.3s;
}

.chapter-item:hover {
    background: var(--bg-primary);
    border-color: var(--accent);
    transform: translateX(5px);
}

.chapter-item-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 15px;
}

.chapter-item-main {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
}

.chapter-number {
    font-weight: 600;
    color: var(--accent);
    font-size: 14px;
}

.chapter-read-count {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border);
}

.chapter-title-wrapper {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.chapter-read-count-header {
    font-size: 14px;
    color: var(--text-secondary);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border-radius: 12px;
    border: 1px solid var(--border);
    font-weight: 500;
}

.chapter-title {
    color: var(--text-secondary);
}

/* Chapter Page */
.chapter-header {
    margin-bottom: 30px;
}

.chapter-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.chapter-header h1 {
    font-size: 36px;
    margin: 0;
    color: var(--text-primary);
    flex: 1;
    min-width: 200px;
}

.chapter-nav-top,
.chapter-nav-bottom {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
}

.chapter-nav-bottom {
    margin-top: 30px;
}

.chapter-content {
    background: var(--bg-secondary);
    padding: 40px;
    border-radius: 12px;
    border: 1px solid var(--border);
    font-size: 18px;
    line-height: 1.8;
    color: var(--text-primary);
    margin-bottom: 30px;
}

/* Quill Editor Styles */
.ql-editor {
    color: var(--text-primary);
    font-size: 18px;
    line-height: 1.8;
}

.ql-editor h1,
.ql-editor h2,
.ql-editor h3 {
    color: var(--text-primary);
    margin-top: 1.5em;
    margin-bottom: 0.5em;
}

.ql-editor p {
    margin-bottom: 1em;
}

.ql-editor ul,
.ql-editor ol {
    margin-left: 2em;
    margin-bottom: 1em;
}

.ql-editor a {
    color: var(--accent);
    text-decoration: underline;
}

.ql-editor a:hover {
    color: var(--accent-hover);
}

.ql-editor img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1em 0;
}

/* Quill Editor in Modal */
#chapter-content-editor .ql-editor {
    min-height: 400px;
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

#chapter-content-editor .ql-container {
    font-family: inherit;
}

#chapter-content-editor .ql-toolbar {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px 8px 0 0;
}

#chapter-content-editor .ql-container {
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 8px 8px;
}

#chapter-content-editor .ql-stroke {
    stroke: var(--text-secondary);
}

#chapter-content-editor .ql-fill {
    fill: var(--text-secondary);
}

#chapter-content-editor .ql-picker-label {
    color: var(--text-secondary);
}

#chapter-content-editor .ql-picker-options {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
}

#chapter-content-editor .ql-picker-item:hover {
    color: var(--accent);
}

.chapter-actions {
    margin-bottom: 40px;
}

.like-section {
    display: flex;
    gap: 12px;
    flex-shrink: 0;
}

.like-btn, .dislike-btn {
    padding: 14px 28px;
    border: 2px solid var(--border);
    border-radius: 12px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 16px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.like-btn::before, .dislike-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.like-btn:active::before, .dislike-btn:active::before {
    width: 300px;
    height: 300px;
}

.like-btn:hover {
    background: rgba(76, 175, 80, 0.1);
    border-color: var(--success);
    color: var(--success);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.2);
}

.like-btn.active {
    background: linear-gradient(135deg, var(--success) 0%, #66bb6a 100%);
    border-color: var(--success);
    color: white;
    box-shadow: 0 4px 16px rgba(76, 175, 80, 0.4);
    transform: translateY(-2px);
}

.dislike-btn:hover {
    background: rgba(244, 67, 54, 0.1);
    border-color: var(--danger);
    color: var(--danger);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(244, 67, 54, 0.2);
}

.dislike-btn.active {
    background: linear-gradient(135deg, var(--danger) 0%, #ef5350 100%);
    border-color: var(--danger);
    color: white;
    box-shadow: 0 4px 16px rgba(244, 67, 54, 0.4);
    transform: translateY(-2px);
}

.like-btn span, .dislike-btn span {
    font-weight: 600;
    font-size: 15px;
    background: rgba(0, 0, 0, 0.1);
    padding: 4px 10px;
    border-radius: 12px;
    margin-left: 4px;
}

.like-btn.active span, .dislike-btn.active span {
    background: rgba(255, 255, 255, 0.2);
}

/* Comments */
.comments-section {
    background: var(--bg-secondary);
    padding: 30px;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.comments-section h2 {
    margin-bottom: 20px;
    color: var(--text-primary);
}

.comment-form {
    margin-bottom: 30px;
}

.comment-form textarea {
    width: 100%;
    padding: 15px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 16px;
    resize: vertical;
    min-height: 100px;
    margin-bottom: 10px;
}

.comment-form textarea:focus {
    outline: none;
    border-color: var(--accent);
}

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

.comment-item {
    padding: 20px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.comment-author {
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 8px;
}

.comment-content {
    color: var(--text-primary);
    line-height: 1.6;
    margin-bottom: 8px;
}

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

/* Forms */
.auth-container {
    max-width: 500px;
    margin: 50px auto;
    background: var(--bg-secondary);
    padding: 40px;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.auth-container h1 {
    text-align: center;
    margin-bottom: 30px;
    color: var(--text-primary);
}

.auth-form .form-group {
    margin-bottom: 20px;
}

.auth-form label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-weight: 500;
}

.auth-form input {
    width: 100%;
    padding: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 16px;
    font-family: inherit;
}

.auth-form input:focus {
    outline: none;
    border-color: var(--accent);
}

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

.auth-link a {
    color: var(--accent);
    text-decoration: none;
}

.auth-link a:hover {
    text-decoration: underline;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s;
    border: 1px solid transparent;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--border);
}

.btn-secondary:hover {
    background: var(--bg-primary);
    border-color: var(--accent);
}

.btn-block {
    width: 100%;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #d32f2f;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 40px;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border);
}

.pagination-btn {
    padding: 10px 20px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 8px;
    border: 1px solid var(--border);
    transition: all 0.3s;
}

.pagination-btn:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.pagination-info {
    color: var(--text-secondary);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.info-text {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.info-text a {
    color: var(--accent);
    text-decoration: none;
}

.info-text a:hover {
    text-decoration: underline;
}

/* Footer */
.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    padding: 24px 0;
    margin-top: 40px;
    color: var(--text-secondary);
}

@media (min-width: 768px) {
    .footer {
        padding: 30px 0;
        margin-top: 60px;
    }
}

.footer .container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 16px;
    padding: 0 15px;
    text-align: center;
}

@media (min-width: 768px) {
    .footer .container {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 20px;
    }
}

.footer-content-wrapper {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 16px;
    width: 100%;
}

@media (min-width: 768px) {
    .footer-content-wrapper {
        gap: 20px;
    }
}

.footer p {
    margin: 0;
}

.footer-text {
    font-size: 13px;
    line-height: 1.7;
    text-align: center;
    flex: 1;
    min-width: 100%;
    word-break: break-word;
}

@media (min-width: 768px) {
    .footer-text {
        font-size: 14px;
        line-height: 1.6;
    }
}

.social-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-shrink: 0;
    width: 100%;
}

@media (min-width: 768px) {
    .social-links {
        gap: 15px;
        width: auto;
    }
}

.social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    border-radius: 50%;
    transition: all 0.3s ease;
    text-decoration: none;
    border: 1px solid var(--border);
}

@media (min-width: 768px) {
    .social-link {
        width: 40px;
        height: 40px;
    }
}

.social-link:hover {
    color: var(--accent);
    background: var(--bg-secondary);
    border-color: var(--accent);
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.3);
}

.social-link svg {
    width: 20px;
    height: 20px;
}

/* Donation Section (Homepage) - Simplified */
.donation-section-simple {
    margin: 50px 0;
}

.donation-box {
    background: var(--bg-secondary);
    border: 2px solid var(--accent);
    border-radius: 16px;
    padding: 40px;
    text-align: center;
    width: 100%;
    margin: 0 auto;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(217, 119, 6, 0.2);
}

.donation-box:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(217, 119, 6, 0.3);
    border-color: var(--accent-hover);
}

.donation-box-title {
    font-size: 28px;
    color: var(--text-primary);
    margin-bottom: 25px;
    font-weight: 600;
    line-height: 1.4;
}

.donation-box-content {
    text-align: left;
    max-width: 800px;
    margin: 0 auto 30px;
}

.donation-box-text {
    font-size: 16px;
    color: var(--text-primary);
    margin-bottom: 18px;
    line-height: 1.8;
    text-align: justify;
}

.donation-box-text.highlight {
    text-align: center;
    margin-top: 25px;
    padding: 20px;
    background: rgba(217, 119, 6, 0.1);
    border-left: 4px solid var(--accent);
    border-radius: 8px;
    font-size: 17px;
}

.donation-box-text.highlight strong {
    color: var(--accent);
    font-weight: 700;
}

.donate-btn-simple {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 20px 50px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
    color: white !important;
    border: none;
    border-radius: 50px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 25px rgba(217, 119, 6, 0.4);
    min-width: 280px;
    position: relative;
    overflow: hidden;
    letter-spacing: 0.5px;
    text-decoration: none !important;
}

a.donate-btn-simple {
    text-decoration: none !important;
    color: white !important;
}

a.donate-btn-simple:hover {
    text-decoration: none !important;
    color: white !important;
}

a.donate-btn-simple:visited {
    text-decoration: none !important;
    color: white !important;
}

a.donate-btn-simple:active {
    text-decoration: none !important;
    color: white !important;
}

.donate-btn-simple::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.donate-btn-simple:hover::before {
    width: 400px;
    height: 400px;
}

.donate-btn-simple:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 10px 35px rgba(217, 119, 6, 0.6);
    background: linear-gradient(135deg, var(--accent-hover) 0%, #fb923c 100%);
}

.donate-btn-simple:active {
    transform: translateY(-2px) scale(1);
}

.donate-btn-icon {
    font-size: 24px;
    display: inline-block;
    animation: pulse-heart 2s ease-in-out infinite;
}

@keyframes pulse-heart {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

.donate-btn-text {
    position: relative;
    z-index: 1;
}

.donate-btn-arrow {
    font-size: 20px;
    transition: transform 0.3s ease;
    position: relative;
    z-index: 1;
}

.donate-btn-simple:hover .donate-btn-arrow {
    transform: translateX(8px);
}

/* Footer Donate Button */
.donate-btn-footer {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(217, 119, 6, 0.3);
}

.donate-btn-footer:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(217, 119, 6, 0.4);
}

.donate-icon {
    font-size: 20px;
}

.footer-link {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.3s;
}

.footer-link:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

/* Donation Modal - Simplified */
.donation-modal-content {
    max-width: 500px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.donation-modal-header {
    padding: 25px 25px 15px;
    border-bottom: 1px solid var(--border);
}

.donation-modal-header h2 {
    color: var(--text-primary);
    font-size: 24px;
    margin: 0;
    font-weight: 600;
}

.donation-form {
    padding: 25px;
}

.donation-form p {
    color: var(--text-primary);
    line-height: 1.7;
    margin-bottom: 20px;
    font-size: 15px;
}

/* Footer responsive - mobile first is handled via base styles */
/* About author responsive is already handled above */

/* Donation section mobile */
@media (max-width: 768px) {
    .donation-section-simple {
        margin: 40px 0;
    }
    
    .donation-box {
        padding: 30px 20px;
    }
    
    .donation-box-title {
        font-size: 22px;
        margin-bottom: 20px;
    }
    
    .donation-box-content {
        margin-bottom: 25px;
    }
    
    .donation-box-text {
        font-size: 15px;
        margin-bottom: 16px;
        text-align: left;
    }
    
    .donation-box-text.highlight {
        padding: 15px;
        font-size: 16px;
        text-align: center;
    }
    
    .donate-btn-simple {
        padding: 18px 30px;
        font-size: 16px;
        width: 100%;
        min-width: unset;
        gap: 10px;
    }
    
    .donate-btn-icon {
        font-size: 20px;
    }
    
    .donate-btn-arrow {
        font-size: 18px;
    }
    
    .donation-modal-content {
        margin: 20px;
        max-width: calc(100% - 40px);
    }
    
    .donation-modal-header {
        padding: 20px 20px 15px;
    }
    
    .donation-modal-header h2 {
        font-size: 20px;
    }
    
    .donation-form {
        padding: 20px;
    }
    
    .donation-form p {
        font-size: 14px;
    }
}

/* Error Page */
.error-page {
    text-align: center;
    padding: 60px 16px;
}

.error-page h1 {
    font-size: 48px;
    color: var(--accent);
    margin-bottom: 16px;
}

@media (min-width: 768px) {
    .error-page {
        padding: 100px 20px;
    }
    
    .error-page h1 {
        font-size: 72px;
        margin-bottom: 20px;
    }
}

.error-page p {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

@media (min-width: 768px) {
    .error-page p {
        font-size: 20px;
        margin-bottom: 30px;
    }
}

/* Admin Styles */
.admin-content {
    min-height: calc(100vh - 200px);
    padding: 40px 0;
}

.admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--bg-secondary);
    padding: 30px;
    border-radius: 12px;
    border: 1px solid var(--border);
    text-align: center;
}

.stat-card h3 {
    font-size: 36px;
    color: var(--accent);
    margin-bottom: 10px;
}

.stat-card p {
    color: var(--text-secondary);
    font-size: 16px;
}

.admin-table {
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border);
    overflow: hidden;
}

.admin-table table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th,
.admin-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.admin-table th {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-weight: 600;
}

.admin-table tr:hover {
    background: var(--bg-tertiary);
}

.admin-table td {
    color: var(--text-secondary);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    overflow-y: auto;
}

.modal-content {
    background: var(--bg-secondary);
    margin: 50px auto;
    padding: 30px;
    border-radius: 12px;
    max-width: 800px;
    border: 1px solid var(--border);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h2 {
    color: var(--text-primary);
}

.close,
.close-modal {
    font-size: 30px;
    cursor: pointer;
    color: var(--text-secondary);
    background: none;
    border: none;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: color 0.3s;
}

.close:hover,
.close-modal:hover {
    color: var(--text-primary);
}

.modal-content {
    position: relative;
    max-width: 450px;
    margin: 50px auto;
    animation: modalFadeIn 0.3s ease;
}

/* Wider modal for chapter editing */
#chapter-modal .modal-content {
    max-width: 900px;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-form {
    margin-top: 20px;
}

/* Responsive modals */
@media (max-width: 768px) {
    .modal-content {
        margin: 20px;
        padding: 20px;
        max-width: 100%;
    }
}

/* Book page mobile overrides */
@media (max-width: 767px) {
    .book-header {
        flex-direction: column;
        padding: 20px;
        align-items: center;
    }
    
    .book-header-cover {
        width: 160px;
    }
    
    .book-header-info h1 {
        font-size: 22px;
        text-align: center;
    }
    
    .book-right-section {
        position: static;
    }
}

.chapter-header-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
}

@media (min-width: 768px) {
    .chapter-header-top {
        flex-direction: row;
        align-items: center;
        gap: 20px;
    }
}

.chapter-header h1 {
    font-size: 22px;
    margin-bottom: 0;
}

@media (min-width: 768px) {
    .chapter-header h1 {
        font-size: 32px;
    }
}

.like-section {
    width: 100%;
    justify-content: flex-start;
    gap: 10px;
}

.like-btn, .dislike-btn {
    padding: 12px 16px;
    font-size: 14px;
    min-height: 44px;
    flex: 1;
    justify-content: center;
}

@media (min-width: 768px) {
    .like-btn, .dislike-btn {
        padding: 10px 20px;
        min-height: auto;
        flex: none;
    }
}

.chapter-content {
    padding: 20px;
    font-size: 16px;
}

@media (min-width: 768px) {
    .chapter-content {
        padding: 35px;
        font-size: 17px;
    }
}

.chapter-nav-top,
.chapter-nav-bottom {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.chapter-nav-top .btn,
.chapter-nav-bottom .btn {
    width: 100%;
    text-align: center;
}

@media (min-width: 768px) {
    .chapter-nav-top,
    .chapter-nav-bottom {
        display: flex;
        gap: 15px;
    }
    
    .chapter-nav-top .btn,
    .chapter-nav-bottom .btn {
        width: auto;
    }
}

.comments-section {
    padding: 20px;
}

@media (min-width: 768px) {
    .comments-section {
        padding: 30px;
    }
}

.pagination {
    flex-direction: column;
    gap: 12px;
}

.pagination-btn {
    width: 100%;
    text-align: center;
}

@media (min-width: 768px) {
    .pagination {
        flex-direction: row;
        gap: 15px;
    }
    
    .pagination-btn {
        width: auto;
    }
}

.admin-table {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.admin-table table {
    min-width: 600px;
}

.chapters-section {
    padding: 16px 12px;
    border-radius: 10px;
}

@media (min-width: 768px) {
    .chapters-section {
        padding: 25px 20px;
        border-radius: 12px;
    }
}

.chapters-section h2 {
    font-size: 18px;
    margin-bottom: 12px;
    text-align: center;
}

@media (min-width: 768px) {
    .chapters-section h2 {
        font-size: 22px;
        margin-bottom: 20px;
    }
}

.chapters-list {
    gap: 8px;
    max-height: none;
}

@media (min-width: 768px) {
    .chapters-list {
        gap: 12px;
    }
}

.chapter-item {
    padding: 12px 10px;
    border-radius: 10px;
    min-height: 56px;
    display: flex;
    align-items: center;
}

@media (min-width: 768px) {
    .chapter-item {
        padding: 14px 16px;
        min-height: auto;
    }
}

.chapter-item-content {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
}

.chapter-item-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chapter-number {
    font-size: 12px;
    font-weight: 600;
}

.chapter-title {
    font-size: 14px;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

@media (min-width: 768px) {
    .chapter-number {
        font-size: 14px;
    }
    
    .chapter-title {
        font-size: 16px;
        -webkit-line-clamp: unset;
        line-clamp: unset;
    }
}

.chapter-read-count {
    flex-shrink: 0;
    font-size: 11px;
    padding: 4px 8px;
    white-space: nowrap;
}

.chapter-title-wrapper {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

@media (min-width: 768px) {
    .chapter-title-wrapper {
        flex-direction: row;
        align-items: center;
        gap: 15px;
    }
}

/* Small phone tweaks */
@media (max-width: 380px) {
    .add-to-cart-btn {
        font-size: 12px;
        padding: 10px 12px;
        gap: 6px;
    }
    
    .cart-btn-price {
        font-size: 11px;
    }
    
    .admin-stats {
        grid-template-columns: 1fr;
    }
    
    .stat-card {
        padding: 20px;
    }
    
    .stat-card h3 {
        font-size: 28px;
    }
}

/* Paid book / locked chapter styles */
.chapter-locked {
    opacity: 0.7;
    position: relative;
}

.chapter-locked::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 10px,
        rgba(255, 255, 255, 0.02) 10px,
        rgba(255, 255, 255, 0.02) 20px
    );
    pointer-events: none;
    border-radius: inherit;
}

.chapter-locked:hover {
    opacity: 0.85;
}

/* Book card with purchase section */
article:has(.book-card-purchase) .book-card {
    border-radius: 14px 14px 0 0;
    border-bottom: none;
}

@media (min-width: 768px) {
    article:has(.book-card-purchase) .book-card {
        border-radius: 16px 16px 0 0;
    }
}

article:has(.book-card-purchase) .book-card:hover {
    transform: none;
}

article:has(.book-card-purchase):hover .book-card {
    border-color: var(--accent);
    box-shadow: 0 20px 50px rgba(217, 119, 6, 0.2), 0 8px 24px rgba(0, 0, 0, 0.3);
}

article:has(.book-card-purchase):hover .book-card-purchase {
    border-color: var(--accent);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

article:has(.book-card-purchase) {
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

article:has(.book-card-purchase):hover {
    transform: translateY(-8px);
}

@media (hover: none) and (pointer: coarse) {
    article:has(.book-card-purchase):hover {
        transform: none;
    }
    
    article:has(.book-card-purchase):hover .book-card {
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
        border-color: var(--border);
    }
}

.book-card-purchase button:hover {
    background: linear-gradient(135deg, #15803d, #166534) !important;
    box-shadow: 0 6px 20px rgba(22, 163, 74, 0.4) !important;
    transform: translateY(-1px);
}

.book-card-purchase button:active {
    transform: translateY(0);
}

.book-card-purchase button:disabled {
    background: #374151 !important;
    box-shadow: none !important;
    cursor: default;
}

/* Add to cart button */
.add-to-cart-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 14px;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: white;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 0 4px 16px rgba(217, 119, 6, 0.3);
    position: relative;
    overflow: hidden;
}

@media (min-width: 768px) {
    .add-to-cart-btn {
        gap: 10px;
        padding: 14px 20px;
        font-size: 14px;
        border-radius: 12px;
    }
}

.add-to-cart-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
    transition: left 0.5s;
}

.add-to-cart-btn:hover::before {
    left: 100%;
}

.add-to-cart-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(217, 119, 6, 0.4);
    background: linear-gradient(135deg, var(--accent-hover), #fbbf24);
}

.add-to-cart-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(217, 119, 6, 0.3);
}

.add-to-cart-btn:disabled {
    background: var(--bg-tertiary) !important;
    box-shadow: none !important;
    cursor: default;
    color: var(--text-secondary);
}

.add-to-cart-btn:disabled::before {
    display: none;
}

.cart-btn-icon {
    font-size: 14px;
}

@media (min-width: 768px) {
    .cart-btn-icon {
        font-size: 16px;
    }
}

.cart-btn-text {
    flex: 1;
    text-align: left;
}

.cart-btn-price {
    background: rgba(0, 0, 0, 0.2);
    padding: 3px 8px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

@media (min-width: 768px) {
    .cart-btn-price {
        padding: 4px 12px;
        font-size: 13px;
    }
}

/* Touch-friendly tap targets */
@media (hover: none) and (pointer: coarse) {
    .book-card:hover {
        transform: none;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    }
    
    .book-card:hover .book-cover {
        transform: none;
    }
    
    .add-to-cart-btn:active {
        transform: scale(0.96);
    }
    
    .nav-links a,
    .btn,
    button {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Safe area for notched devices */
@supports (padding: env(safe-area-inset-bottom)) {
    .footer {
        padding-bottom: calc(24px + env(safe-area-inset-bottom));
    }
    
    .navbar {
        padding-top: env(safe-area-inset-top);
    }
}

/* Cart Page */
.cart-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 60px 20px;
    min-height: 50vh;
}

.cart-empty-state h2 {
    font-size: 22px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.cart-empty-state p {
    color: var(--text-secondary);
    font-size: 15px;
    margin-bottom: 28px;
    max-width: 320px;
}

.cart-empty-icon {
    margin-bottom: 24px;
    opacity: 0.4;
}

.cart-cta-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: white;
    text-decoration: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 15px;
    transition: all 0.2s ease;
    box-shadow: 0 4px 16px rgba(217, 119, 6, 0.3);
}

.cart-cta-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(217, 119, 6, 0.4);
}

.cart-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 20px 0;
}

@media (min-width: 768px) {
    .cart-layout {
        grid-template-columns: 1fr 380px;
        gap: 32px;
        padding: 30px 0;
    }
}

.cart-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.cart-section-header h1 {
    font-size: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
}

@media (min-width: 768px) {
    .cart-section-header h1 {
        font-size: 24px;
    }
}

.cart-item-count {
    font-size: 13px;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    padding: 4px 12px;
    border-radius: 20px;
}

.cart-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 12px;
    transition: border-color 0.2s;
}

.cart-item:hover {
    border-color: var(--accent);
}

.cart-item-cover {
    width: 50px;
    height: 68px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

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

.cart-item-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
}

.cart-item-type {
    font-size: 12px;
    color: var(--text-secondary);
}

.cart-item-price {
    font-size: 15px;
    font-weight: 700;
    color: var(--accent);
    white-space: nowrap;
    flex-shrink: 0;
}

.cart-item-remove {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-item-remove:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

/* Cart Summary */
.cart-summary-section {
    align-self: start;
}

@media (min-width: 768px) {
    .cart-summary-section {
        position: sticky;
        top: 80px;
    }
}

.cart-summary-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 24px;
}

.cart-summary-card h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.cart-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    font-size: 14px;
    color: var(--text-secondary);
}

.cart-summary-value {
    color: var(--text-primary);
    font-weight: 500;
}

.cart-free-badge {
    color: #16a34a;
    font-size: 13px;
    font-weight: 500;
}

.cart-summary-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    margin-top: 12px;
    border-top: 2px solid var(--border);
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.cart-summary-total span:last-child {
    color: var(--accent);
    font-size: 22px;
}

.cart-email-section {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.cart-email-section label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.cart-email-section input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 14px;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.cart-email-section input:focus {
    outline: none;
    border-color: var(--accent);
}

.cart-email-hint {
    display: block;
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 6px;
}

.cart-checkout-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
    padding: 16px;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 16px rgba(217, 119, 6, 0.3);
}

.cart-checkout-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(217, 119, 6, 0.4);
}

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

.cart-checkout-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.cart-trust-signals {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cart-trust-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

.cart-trust-item svg {
    flex-shrink: 0;
    color: #16a34a;
}
