:root {
    --bg-color: #0E0C0D;
    --secondary-bg: #1a1a1a;
    --card-bg: #262626;
    --text-primary: #f0f0f0;
    --text-secondary: #b3b3b3;
    --accent-color: #e91e63;
    --accent-hover: #c2185b;
    --gold: #d4af37;
    --font-ui: 'Poppins', sans-serif;
    --font-serif: 'Playfair Display', serif;
    --reader-bg: #1A1416;
    --reader-text: #e0e0e0;
}

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

body {
    font-family: var(--font-ui);
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    touch-action: manipulation;
    /* Disables double-tap zoom */
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.3s;
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
    color: inherit;
    transition: all 0.2s;
}

/* Header */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background-color: rgba(13, 13, 13, 0.95);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.logo {
    display: flex;
    align-items: center;
    font-family: var(--font-serif);
    font-size: 1.5rem;
    color: var(--text-primary);
}

.logo-icon {
    margin-right: 0.5rem;
    color: var(--accent-color);
}

.highlight {
    color: var(--accent-color);
}

.search-bar {
    flex-grow: 1;
    max-width: 500px;
    margin: 0 2rem;
    position: relative;
}

.search-bar input {
    width: 100%;
    padding: 0.8rem 1rem 0.8rem 2.8rem;
    border-radius: 25px;
    border: 1px solid #333;
    background-color: var(--secondary-bg);
    color: var(--text-primary);
    font-size: 0.95rem;
}

.search-bar input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(233, 30, 99, 0.2);
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

.user-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.icon-btn {
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.avatar {
    width: 36px;
    height: 36px;
    background-color: var(--accent-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
}

/* Categories Nav */
.categories-nav {
    display: flex;
    gap: 1rem;
    padding: 1rem 2rem;
    overflow-x: auto;
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE and Edge */
}

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

.category-pill {
    padding: 0.6rem 1.2rem;
    border-radius: 20px;
    background-color: var(--secondary-bg);
    color: var(--text-secondary);
    font-size: 0.9rem;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid transparent;
}

.category-pill.active,
.category-pill:hover {
    background-color: #0E0C0D;
    color: var(--accent-color);
    border-color: var(--accent-color);
}

/* Hero Section */
.hero-banner {
    position: relative;
    padding: 4rem 2rem;
    margin: 1rem 2rem;
    border-radius: 16px;
    overflow: hidden;
    min-height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0d0d0d, #1a1a1a);
}

.hero-background-blur {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('assets/images/cover.png');
    background-size: cover;
    background-position: center;
    filter: blur(60px) brightness(0.3);
    z-index: 0;
}

.hero-content {
    position: relative;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 1200px;
    gap: 4rem;
}

.hero-text {
    flex: 1;
    max-width: 600px;
}

.hero-image-container {
    flex: 0 0 300px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
    border-radius: 8px;
    overflow: hidden;
    transform: rotate(3deg);
    transition: transform 0.3s;
}

.hero-image-container:hover {
    transform: rotate(0deg) scale(1.02);
}

.hero-cover {
    width: 100%;
    height: auto;
    display: block;
}

.badge {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    background-color: var(--accent-color);
    color: white;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 1rem;
    letter-spacing: 1px;
}

.book-title-hero {
    font-family: var(--font-serif);
    font-size: 3.5rem;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    background: linear-gradient(to right, #fff, #b3b3b3);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.book-synopsis {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    max-width: 90%;
}

.hero-actions {
    display: flex;
    gap: 1rem;
}

.btn-primary,
.btn-secondary {
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background-color: var(--accent-color);
    color: white;
    box-shadow: 0 4px 15px rgba(233, 30, 99, 0.4);
}

.btn-primary:hover {
    background-color: var(--accent-hover);
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Book Rows */
.book-row {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.row-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.row-header h3 {
    font-size: 1.5rem;
    font-weight: 600;
}

.view-all {
    color: var(--accent-color);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    font-weight: 600;
}

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

.book-card {
    background-color: var(--secondary-bg);
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
}

.book-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.book-cover-placeholder {
    width: 100%;
    height: auto;
    background-color: #262626;
    position: relative;
    overflow: hidden;
}

.book-cover-placeholder img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
}

.book-info {
    padding: 1rem;
    display: none;
}

.book-info h4 {
    font-size: 1rem;
    margin-bottom: 0.3rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.book-info .genre {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Reader Modal */
.reader-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--reader-bg);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    transition: opacity 0.3s, visibility 0.3s;
    opacity: 1;
    visibility: visible;
}

.reader-modal.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.reader-header {
    padding: 1rem 2rem;
    background-color: rgba(18, 18, 18, 0.98);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-secondary);
}

.reader-title-container {
    text-align: center;
}

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

.reader-title-container span {
    font-size: 0.85rem;
    color: var(--accent-color);
}

.reader-content-scroll {
    flex-grow: 1;
    overflow-y: auto;
    padding: 2rem;
    scroll-behavior: smooth;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.reader-text-container {
    max-width: 800px;
    width: 100%;
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    /* Increased weight */
    font-size: 1.4rem;
    line-height: 1.8;
    color: var(--reader-text);
    padding-bottom: 4rem;
    text-align: left;
}

.reader-text-container h2 {
    font-family: var(--font-serif);
    font-size: 2.2rem;
    margin-bottom: 2rem;
    color: var(--gold);
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 1rem;
}

.reader-text-container p {
    margin-bottom: 1.5rem;
    text-align: left;
}

/* Chapter Badge Style */
.chapter-indicator-badge {
    background-color: var(--card-bg);
    color: var(--gold);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    border: 1px solid var(--border-color);
    white-space: nowrap;
}

.chapter-navigation {
    display: flex;
    justify-content: space-between;
    width: 100%;
    max-width: 800px;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-btn {
    padding: 0.8rem 1.5rem;
    background-color: var(--secondary-bg);
    color: var(--text-primary);
    border-radius: 8px;
    font-weight: 600;
}

.nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.nav-btn:not(:disabled):hover {
    background-color: var(--accent-color);
}

/* Footer */
footer {
    padding: 2rem;
    text-align: center;
    color: var(--text-secondary);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    margin-top: 4rem;
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    .hero-content {
        flex-direction: column-reverse;
        text-align: center;
        gap: 2rem;
    }

    .hero-image-container {
        width: 150px;
        transform: rotate(0deg);
        margin: 0 auto;
    }

    .book-title-hero {
        font-size: 2rem;
    }

    .hero-actions {
        flex-direction: column;
        justify-content: center;
        width: 100%;
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
        justify-content: center;
    }

    .search-bar {
        display: none;
    }

    /* Horizontal Scroll Books (Netflix Style) */
    .books-container {
        display: flex;
        overflow-x: auto;
        padding-bottom: 1rem;
        gap: 1rem;
        scroll-snap-type: x mandatory;

        /* Hide Scrollbar */
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .books-container::-webkit-scrollbar {
        display: none;
    }

    .book-card {
        flex: 0 0 120px;
        width: 120px;
        scroll-snap-align: start;
        margin-right: 0.5rem;
    }

    .book-info {
        padding: 0.8rem 0.5rem;
    }

    .book-info h4 {
        font-size: 0.85rem;
        white-space: normal;
        line-height: 1.2;
        max-height: 2.4em;
        /* Limit to 2 lines */
        overflow: hidden;
    }

    /* Force Grid View when filtering (added via JS) */
    .books-container.grid-view {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        /* 2 columns = bigger covers */
        overflow-x: visible;
        padding-bottom: 2rem;
        gap: 1rem;
        scroll-snap-type: none;
    }

    .books-container.grid-view .book-card {
        flex: none;
        width: auto;
        margin-right: 0;
    }

    /* Mobile Header & UI Fixes */
    header {
        padding: 0.5rem 1rem;
    }

    .logo h1 {
        font-size: 1.2rem;
    }

    .user-actions {
        gap: 0.8rem;
    }

    .user-avatar img {
        width: 35px;
        height: 35px;
    }

    .notification-icon {
        font-size: 1.3rem;
    }
}

/* Detalhes do Livro (Modal de Preview) */
.book-details-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 600px;
    padding-bottom: 2rem;
    animation: fadeIn 0.5s ease;
}

.details-cover-container {
    width: 180px;
    height: auto;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    margin-bottom: 1.5rem;
    margin-top: 1rem;
}

.details-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.details-title {
    font-family: var(--font-serif);
    font-size: 2rem;
    text-align: center;
    margin-bottom: 0.5rem;
    line-height: 1.2;
    background: linear-gradient(to right, #fff, #b3b3b3);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.details-meta {
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.details-synopsis-container {
    background-color: var(--card-bg);
    padding: 1.5rem;
    border-radius: 12px;
    width: 100%;
    margin-bottom: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.details-synopsis-container h3 {
    font-size: 0.9rem;
    text-transform: uppercase;
    color: var(--gold);
    margin-bottom: 0.8rem;
    letter-spacing: 1px;
}

.details-synopsis-container p {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--reader-text);
    text-align: justify;
}

.btn-read-now {
    width: 100%;
    justify-content: center;
    padding: 1rem;
    font-size: 1.1rem;
    /* Verde solicitado */
    background-color: #00C853;
    box-shadow: 0 4px 15px rgba(0, 200, 83, 0.4);
    margin-top: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
}

.btn-read-now:hover {
    background-color: #00E676;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 230, 118, 0.5);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}