/* ===========================
   Reader App Styles
   =========================== */

/* ===========================
   CSS Variables - Color System
   =========================== */
:root {
    /* Primary Brand Colors */
    --color-primary: #ff6b35;
    --color-primary-hover: #ff8555;
    --color-primary-dark: #ff9670;
    --color-primary-dark-hover: #ffad8c;

    /* Text Colors */
    --color-text: #333;
    --color-text-light: #6c757d;
    --color-text-muted: #999;

    /* Background Colors */
    --color-bg: #ffffff;
    --color-bg-light: #f8f9fa;
    --color-bg-navbar: #ffffff;
    --color-bg-overlay: rgba(108, 117, 125, 0.1);

    /* Border Colors */
    --color-border: #dee2e6;
    --color-border-light: #e9ecef;

    /* Gradient Colors */
    --gradient-card: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    --gradient-progress: linear-gradient(90deg, #ff6b35 0%, #ff8555 100%);

    /* Component Filters */
    --btn-close-filter: none;
}

/* Dark Theme Variables */
[data-theme="dark"] {
    /* Primary Brand Colors (adjusted for dark theme) */
    --color-primary: #ff9670;
    --color-primary-hover: #ffad8c;
    --color-primary-dark: #ff9670;
    --color-primary-dark-hover: #ffad8c;

    /* Text Colors */
    --color-text: #d4d4d4;
    --color-text-light: #aaa;
    --color-text-muted: #888;
    --color-text-white: #fff;

    /* Background Colors */
    --color-bg: #2b2b2b;
    --color-bg-light: #353535;
    --color-bg-hover: #454545;
    --color-bg-navbar: #3a3a3a;
    --color-bg-overlay: rgba(255, 255, 255, 0.08);

    /* Border Colors */
    --color-border: #4a4a4a;
    --color-border-light: #555;

    /* Gradient Colors */
    --gradient-card: linear-gradient(135deg, #353535 0%, #303030 100%);
    --gradient-progress: linear-gradient(90deg, #ff9670 0%, #ffad8c 100%);

    /* Component Filters */
    --btn-close-filter: invert(1) grayscale(100%) brightness(200%);
}

/* Base Styles */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--color-text);
    background-color: var(--color-bg);
    padding-top: 58px;
    /* Adjust for fixed navbar height */
}

/* ===========================
   Navbar Styles
   =========================== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1030;
    transition: transform 0.3s ease-in-out;
    background-color: var(--color-bg-navbar);
}

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

.navbar-brand {
    font-weight: bold;
}

.logo-we {
    color: var(--color-primary);
}

.logo-readly {
    color: var(--color-text);
}

/* ===========================
   Breadcrumb in Navbar
   =========================== */
.navbar .breadcrumb {
    background-color: transparent;
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
}

.navbar .breadcrumb-item {
    display: flex;
    align-items: center;
}

.navbar .breadcrumb-item::before {
    content: "›";
    color: var(--color-text-muted);
    padding: 0 1rem;
    font-weight: 300;
}

/* Book title - orange like "we" in logo - always orange */
.navbar .breadcrumb-item.book-title a,
.navbar .breadcrumb-item.book-title.active {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 700;
}

.navbar .breadcrumb-item.book-title a:hover {
    color: var(--color-primary-hover);
    text-decoration: none;
}

/* Chapter title - black like "readly" in logo */
.navbar .breadcrumb-item.chapter-title,
.navbar .breadcrumb-item.chapter-title.active {
    color: var(--color-text);
    font-weight: 700;
}

/* ===========================
   Button in navbar
   =========================== */
.btn-nav {
    background-color: transparent;
    border: none;
    color: var(--color-text-light);
    font-size: 1.1rem;
    padding: 0.375rem 0.75rem;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

.btn-nav:hover,
.btn-nav:focus,
.btn-nav:active {
    color: var(--color-text);
    background-color: var(--color-bg-overlay);
    border-radius: 4px;
    border: none;
    box-shadow: none;
    outline: none;
}

/* ===========================
   Dropdown Styles
   =========================== */
.dropdown-menu {
    background-color: var(--color-bg);
    border: 1px solid var(--color-border);
}

.dropdown-item {
    color: var(--color-text);
}

.dropdown-item:hover,
.dropdown-item:focus {
    background-color: var(--color-bg-light);
    color: var(--color-text);
}

/* ===========================
   Offcanvas Styles
   =========================== */
.offcanvas {
    background-color: var(--color-bg);
    color: var(--color-text);
}

.offcanvas-header {
    border-bottom: 1px solid var(--color-border);
}

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

.btn-close {
    filter: var(--btn-close-filter);
}

/* ===========================
   Button Styles
   =========================== */
/* Solid Primary Button */
.btn-primary-custom {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}

.btn-primary-custom:hover,
.btn-primary-custom:focus,
.btn-primary-custom:active {
    background-color: var(--color-primary-hover);
    border-color: var(--color-primary-hover);
    color: #fff;
}

/* Outline Primary Button */
.btn-outline-primary-custom {
    background-color: transparent;
    border: 1px solid var(--color-primary);
    color: var(--color-primary);
}

.btn-outline-primary-custom:hover,
.btn-outline-primary-custom:focus,
.btn-outline-primary-custom:active {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}

/* Button Size Utility */
.btn-min-width {
    min-width: 100px;
}

/* ===========================
   Card Styles
   =========================== */
.card {
    background-color: var(--color-bg);
    border: 1px solid var(--color-border);
    color: var(--color-text);
}

.card-body {
    background-color: var(--color-bg);
}

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

.card-text {
    color: var(--color-text);
}

/* ===========================
   Modal Styles
   =========================== */
.modal-content {
    background-color: var(--color-bg);
    border: 1px solid var(--color-border);
    color: var(--color-text);
}

.modal-header {
    border-bottom: 1px solid var(--color-border);
}

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

.modal-body {
    color: var(--color-text);
}

.modal-footer {
    border-top: 1px solid var(--color-border);
}

/* Book Modal Specific Styles */
.modal-book-title {
    color: var(--color-text);
}

.modal-book-author {
    color: var(--color-text-light);
}

.modal-book-description {
    color: var(--color-text);
}

.stat-item {
    color: var(--color-text);
}

.stat-label {
    color: var(--color-text-light);
    font-weight: 600;
}

.stat-value {
    color: var(--color-text);
    font-weight: 700;
}

/* ===========================
   Footer Styles
   =========================== */
footer.footer {
    background-color: var(--color-bg-light);
    border-top: 1px solid var(--color-border);
}

.footer-text {
    color: var(--color-text-light);
}

/* Genre Quick Access */
.genre-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.genre-card {
    background: var(--gradient-card);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 0.75rem 0.5rem;
    text-align: center;
    transition: all 0.3s ease;
    text-decoration: none;
    color: var(--color-text);
    flex: 0 0 auto;
    min-width: 150px;
}

.genre-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

/* ===========================
   Reading Content
   =========================== */
/* Section Headers */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;

}

.section-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--color-text);
}

.view-all-link {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.view-all-link:hover {
    color: var(--color-primary-hover);
}

/* ===========================
   Book Cards
   =========================== */
.book-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    padding-bottom: 1rem;
}

.book-card {
    /* Fixed width with no growing */
    flex: 0 0 200px;
    /* no grow, no shrink, fixed 200px width */
    width: 200px;
}

/* Adjust card width for different screen sizes */
@media (max-width: 768px) {
    .book-card {
        flex: 0 0 180px;
        width: 180px;
    }
}

@media (max-width: 480px) {
    .book-card {
        flex: 0 0 calc(50% - 0.75rem);
        /* 2 cards per row with gap */
        width: calc(50% - 0.75rem);
    }
}

@media (max-width: 360px) {
    .book-card {
        flex: 0 0 100%;
        /* full width on very small screens */
        width: 100%;
    }
}

.book-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.book-card-image-wrapper {
    position: relative;
    width: 100%;
    height: 250px;
    overflow: hidden;
}

.book-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.book-card-link:hover .book-card-image {
    transform: scale(1.05);
}

.book-card-info-btn {
    position: absolute;
    bottom: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 107, 53, 0.9);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0;
    transform: scale(0.8);
    z-index: 10;
}

.book-card-image-wrapper:hover .book-card-info-btn {
    opacity: 1;
    transform: scale(1);
}

.book-card-info-btn:hover {
    background: var(--color-primary);
    transform: scale(1.1);
}

.book-card-info-btn i {
    font-size: 0.875rem;
}

.book-card-title {
    margin-top: 12px;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--color-text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.book-card-link:hover .book-card-title {
    color: var(--color-primary);
}



/* ===========================
   Chapter detail
   =========================== */


.chapter-content {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--color-text);
    max-width: 800px;
    margin: 0 auto;
}

.chapter-content p {
    margin-bottom: 1.2rem;
    text-align: justify;
}

.chapter-header {
    border-bottom: 2px solid var(--color-border-light);
    padding-bottom: 1rem;
    margin-bottom: 2rem;
    gap: 1rem;
}

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

.chapter-header-stats {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    text-align: right;
    white-space: nowrap;
    flex-shrink: 0;
}

.chapter-header-stats span {
    font-size: 0.9rem;
}

.chapter-number {
    margin-bottom: 0.25rem;
}

.chapter-time {
    color: var(--color-text-light);
}

/* Responsive: Stack on small screens */
@media (max-width: 768px) {
    .chapter-header {
        flex-direction: column;
        align-items: flex-start !important;
    }

    .chapter-header-stats {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        margin-top: 0.5rem;
    }

    .chapter-number {
        margin-bottom: 0;
    }
}


.reading-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: var(--gradient-progress);
    z-index: 1031;
    /* Above navbar */
    transition: width 0.1s ease-out, transform 0.3s ease-in-out;
    transform: translateY(57px);
    /* Position below navbar */
}

.reading-progress-bar.navbar-hidden {
    transform: translateY(0);
    /* Move up with navbar */
}