/* ========================================
   PEAKLITERATURE - Main Styles
   Premium Dark Theme for Public Domain Library
======================================== */

/* ========== CSS VARIABLES ========== */
:root {
    /* Colors */
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: #1a1a24;
    --bg-card-hover: #222230;

    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --text-muted: #6a6a7a;

    --accent-primary: #e76f51;
    --accent-secondary: #f4a261;
    --accent-gradient: linear-gradient(135deg, #e76f51 0%, #f4a261 100%);

    --border-color: rgba(255, 255, 255, 0.08);
    --border-light: rgba(255, 255, 255, 0.12);

    /* Typography */
    --font-display: 'Playfair Display', serif;
    --font-body: 'Inter', sans-serif;

    /* Spacing */
    --section-padding: 100px;
    --container-max: 1200px;

    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-medium: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* ========== RESET ========== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

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

ul {
    list-style: none;
}

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

.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 24px;
}

/* ========== TYPOGRAPHY ========== */
h1,
h2,
h3,
h4 {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.2;
}

.gradient-text {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

.section-title {
    font-size: clamp(2rem, 5vw, 3rem);
    text-align: center;
    margin-bottom: 50px;
}

/* ========== NAVBAR ========== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 40px;
    background: rgba(10, 10, 15, 0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    transition: transform var(--transition-medium);
    margin-right: 40px;
    flex-shrink: 0;
}

.logo:hover {
    transform: scale(1.05);
}

.logo-icon {
    font-size: 1.8rem;
}

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

.logo-img {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.nav-links {
    display: flex;
    gap: 40px;
}

.nav-item {
    position: relative;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: color var(--transition-fast);
}

.nav-item:hover,
.nav-item.active {
    color: var(--accent-primary);
}

.nav-item::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent-gradient);
    transition: width var(--transition-medium);
}

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

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
}

.nav-toggle span {
    width: 25px;
    height: 2px;
    background: var(--text-primary);
    transition: var(--transition-fast);
}

/* ========== HERO ========== */
.hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 120px 20px 80px;
    overflow: hidden;
}

.hero-bg {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 30% 20%, rgba(231, 111, 81, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 80%, rgba(244, 162, 97, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

.hero-title {
    font-size: clamp(2.5rem, 8vw, 5rem);
    margin-bottom: 20px;
}

.hero-subtitle {
    font-size: clamp(1rem, 2vw, 1.3rem);
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 40px;
}

.hero-cta {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 50px;
}

/* ========== BUTTONS ========== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 16px 32px;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-medium);
    border: none;
    position: relative;
    overflow: hidden;
}

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

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(231, 111, 81, 0.4);
}

.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    border: 2px solid var(--border-light);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

/* ========== SEARCH BOX ========== */
.search-box {
    display: flex;
    max-width: 500px;
    margin: 0 auto;
    background: var(--bg-card);
    border-radius: 50px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: border-color var(--transition-medium);
}

.search-box:focus-within {
    border-color: var(--accent-primary);
}

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

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

.search-btn {
    padding: 18px 25px;
    background: var(--accent-gradient);
    border: none;
    color: white;
    cursor: pointer;
    transition: opacity var(--transition-fast);
}

.search-btn:hover {
    opacity: 0.9;
}

/* ========== FEATURED SECTION ========== */
.featured {
    padding: var(--section-padding) 0;
}

.book-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 30px;
}

/* ========== BOOK CARD ========== */
.book-card {
    position: relative;
    background: var(--bg-card);
    border-radius: 16px;
    overflow: hidden;
    transition: all var(--transition-medium);
    cursor: pointer;
}

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

.book-cover {
    width: 100%;
    aspect-ratio: 2/3;
    object-fit: cover;
    background: var(--bg-secondary);
}

.book-info {
    padding: 16px;
}

.book-title {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 5px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-author {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.book-type {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 5px 10px;
    background: rgba(10, 10, 15, 0.8);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    font-size: 0.75rem;
    color: var(--accent-primary);
}

.book-progress-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 5px 10px;
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.9), rgba(22, 163, 74, 0.9));
    backdrop-filter: blur(10px);
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    color: white;
    z-index: 2;
}

.book-actions {
    display: flex;
    gap: 10px;
    padding: 0 16px 16px;
}

.book-btn {
    flex: 1;
    padding: 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

/* ========== CATEGORIES ========== */
.categories {
    padding: var(--section-padding) 0;
    background: var(--bg-secondary);
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
}

.category-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    padding: 30px 20px;
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    transition: all var(--transition-medium);
}

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

.category-icon {
    font-size: 2.5rem;
}

.category-name {
    font-weight: 600;
    color: var(--text-primary);
}

/* ========== STATS ========== */
.stats {
    padding: 60px 0;
}

.stats-grid {
    display: flex;
    justify-content: center;
    gap: 80px;
    flex-wrap: wrap;
}

.stat-item {
    text-align: center;
}

.stat-number {
    display: block;
    font-family: var(--font-display);
    font-size: 3rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* ========== FOOTER ========== */
.footer {
    padding: 60px 0 40px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
}

.footer-content {
    text-align: center;
}

.footer-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 20px;
}

.footer-text {
    color: var(--text-muted);
    font-size: 0.9rem;
    max-width: 600px;
    margin: 0 auto 20px;
}

.footer-text a {
    color: var(--accent-primary);
    text-decoration: underline;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
    margin: 20px 0;
}

.footer-links a {
    color: var(--text-secondary);
    font-size: 0.9rem;
    padding: 8px 16px;
    border-radius: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    transition: all var(--transition-fast);
}

.footer-links a:hover {
    color: var(--accent-primary);
    border-color: var(--accent-primary);
    background: rgba(231, 111, 81, 0.1);
}

.footer-copyright {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ========== ANIMATIONS ========== */
.animate-fade-up {
    opacity: 0;
    transform: translateY(30px);
    animation: fadeUp 0.8s ease forwards;
}

.delay-1 {
    animation-delay: 0.2s;
}

.delay-2 {
    animation-delay: 0.4s;
}

.delay-3 {
    animation-delay: 0.6s;
}

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

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .navbar {
        padding: 16px 20px;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        background: rgba(10, 10, 15, 0.95);
        backdrop-filter: blur(20px);
        padding: 20px;
        gap: 20px;
    }

    .nav-links.active {
        display: flex;
    }

    .nav-toggle {
        display: flex;
    }

    .hero-cta {
        flex-direction: column;
        align-items: center;
    }

    .btn {
        width: 100%;
        max-width: 280px;
        justify-content: center;
    }

    .stats-grid {
        gap: 40px;
    }
}

/* ========== PAGE HEADER ========== */
.page-header {
    padding: 140px 0 60px;
    text-align: center;
    background: var(--bg-secondary);
}

.page-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    margin-bottom: 15px;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-bottom: 40px;
}

/* ========== FILTERS ========== */
.filters {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.filter-row {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

.filter-select {
    padding: 12px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.95rem;
    cursor: pointer;
    transition: border-color var(--transition-fast);
}

.filter-select:hover,
.filter-select:focus {
    border-color: var(--accent-primary);
    outline: none;
}

/* ========== CATALOG ========== */
.catalog {
    padding: 60px 0 100px;
}

.no-results {
    text-align: center;
    color: var(--text-muted);
    font-size: 1.1rem;
    padding: 60px 20px;
}

/* ========== FAVORITE BUTTON ACTIVE ========== */
.favorite-btn.active {
    background: rgba(244, 63, 94, 0.2);
    border-color: var(--accent-primary);
}

/* ========== AUTHENTICATION ========== */
.auth-container {
    display: flex;
    align-items: center;
    margin-left: auto;
    margin-right: 20px;
}

.btn-signin {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 50px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-medium);
}

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

.btn-signin svg {
    width: 18px;
    height: 18px;
}

.user-profile {
    position: relative;
    cursor: pointer;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--accent-primary);
    object-fit: cover;
    transition: transform var(--transition-fast);
}

.user-avatar:hover {
    transform: scale(1.1);
}

.user-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 200px;
    padding: 15px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    z-index: 1001;
}

.user-profile:hover .user-dropdown {
    display: block;
    animation: fadeIn 0.2s ease;
}

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

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

.user-name {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.user-email {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.user-dropdown hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 12px 0;
}

.dropdown-btn {
    width: 100%;
    padding: 10px 15px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.dropdown-btn:hover {
    background: rgba(231, 111, 81, 0.2);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

/* Auth container mobile adjustments */
@media (max-width: 768px) {
    .navbar {
        padding: 15px 20px;
    }

    .auth-container {
        margin-right: 5px;
        position: absolute;
        right: 60px;
        top: 50%;
        transform: translateY(-50%);
    }

    .btn-signin {
        padding: 8px 12px;
        font-size: 0.8rem;
    }

    .btn-signin span {
        display: none;
    }

    .user-avatar {
        width: 32px;
        height: 32px;
    }

    .user-dropdown {
        right: -10px;
        min-width: 180px;
    }

    .user-profile {
        position: static;
    }

    /* Player controls mobile */
    .player-controls {
        flex-direction: column;
    }

    .control-group {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }

    .timer-btn {
        min-width: 50px;
        padding: 10px 14px;
    }
}

/* ========== BADGE NOTIFICATIONS ========== */
.badge-notification {
    position: fixed;
    bottom: 30px;
    right: -400px;
    z-index: 2000;
    background: var(--accent-gradient);
    padding: 16px 24px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(231, 111, 81, 0.4);
    transition: right 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.badge-notification.show {
    right: 30px;
}

.badge-notification-content {
    display: flex;
    align-items: center;
    gap: 15px;
    color: white;
}

.badge-icon {
    font-size: 2.5rem;
}

.badge-info strong {
    display: block;
    font-size: 0.85rem;
    opacity: 0.9;
}

.badge-info span {
    font-size: 1.1rem;
    font-weight: 600;
}

/* ========== CONTINUE READING SECTION ========== */
.continue-section {
    padding: 40px 0;
    background: linear-gradient(135deg, rgba(231, 111, 81, 0.1) 0%, rgba(244, 162, 97, 0.05) 100%);
    border-bottom: 1px solid var(--border-color);
}

.continue-card {
    display: flex;
    align-items: center;
    gap: 30px;
    max-width: 800px;
    margin: 0 auto;
    background: var(--bg-card);
    padding: 25px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
}

.continue-card img {
    width: 80px;
    height: 120px;
    object-fit: cover;
    border-radius: 8px;
}

.continue-info {
    flex: 1;
}

.continue-info h3 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    margin-bottom: 5px;
}

.continue-info p {
    color: var(--text-muted);
    margin-bottom: 15px;
}

@media (max-width: 768px) {
    .continue-card {
        flex-direction: column;
        text-align: center;
    }
}

/* ========== STREAK DISPLAY ========== */
.streak-display {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #ff6b6b 0%, #ffa500 100%);
    border-radius: 50px;
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
}

.streak-display .streak-fire {
    font-size: 1.2rem;
}

/* ========== STATS CARDS ========== */
.stats-dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--bg-card);
    padding: 25px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    text-align: center;
}

.stat-card-icon {
    font-size: 2rem;
    margin-bottom: 10px;
}

.stat-card-value {
    font-size: 2.5rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-card-label {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ========== BADGE GRID ========== */
.badge-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 20px;
}

.badge-card {
    background: var(--bg-card);
    padding: 20px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    text-align: center;
    transition: all var(--transition-medium);
}

.badge-card:not(.earned) {
    opacity: 0.4;
    filter: grayscale(1);
}

.badge-card.earned {
    border-color: var(--accent-primary);
    box-shadow: 0 0 20px rgba(231, 111, 81, 0.2);
}

.badge-card-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.badge-card-name {
    font-weight: 600;
    margin-bottom: 5px;
}

.badge-card-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ========== NIGHT MODE TOGGLE ========== */
.night-mode-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 10px 12px;
    border-radius: 50%;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 1.2rem;
}

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