:root {
    --primary-color: #f37944;
    --bg-color: #f7f6f0;
    --card-bg: #fff;
    --text-color: #333;
    --text-secondary: #666;
    --text-tertiary: #888;
    --shadow: rgba(0, 0, 0, 0.1);
    --shadow-hover: rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] {
    --primary-color: #dd44f3;
    --bg-color: #121c2a;
    --card-bg: #1a2332;
    --text-color: #e0e0e0;
    --text-secondary: #b0b0b0;
    --text-tertiary: #808080;
    --shadow: rgba(0, 0, 0, 0.3);
    --shadow-hover: rgba(0, 0, 0, 0.5);
}

/* Preloader */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#preloader.hidden {
    opacity: 0;
    visibility: hidden;
}

#preloader img {
    width: 150px;
    height: 150px;
    object-fit: contain;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.05);
    }
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
    padding-bottom: 80px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

header {
    background-color: var(--card-bg);
    box-shadow: 0 2px 8px var(--shadow);
    padding: 20px 0;
    margin-bottom: 40px;
    transition: background-color 0.3s ease;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 2.5rem;
    color: var(--primary-color);
    font-weight: 700;
    margin-bottom: 5px;
}

.tagline {
    color: var(--text-secondary);
    font-size: 1rem;
}

.theme-toggle {
    background: var(--card-bg);
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    background: var(--primary-color);
    color: #fff;
}

.books-section {
    padding: 20px 0;
}

.section-title {
    font-size: 1.8rem;
    margin-bottom: 30px;
    color: var(--text-color);
}

.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 25px;
    margin-bottom: 50px;
}

.book-card {
    background-color: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
}

.book-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 20px var(--shadow-hover);
}

.book-cover {
    width: 100%;
    height: 300px;
    background: linear-gradient(135deg, #f37944, #f7931e);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background-size: cover;
    background-position: center;
}

.book-cover-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    text-align: center;
    padding: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    background: rgba(0, 0, 0, 0.2);
    width: 100%;
}

.book-info {
    padding: 20px;
    flex: 1;
}

.book-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-color);
}

.book-description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 12px;
}

.book-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-tertiary);
}

/* Mobile Navigation */
.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border-top: 3px solid;
    border-image: linear-gradient(to right, #f37944, #c022ea) 1;
    box-shadow: 0 -2px 10px var(--shadow);
    z-index: 1000;
}

.mobile-nav-items {
    display: flex;
    justify-content: space-around;
    padding: 10px 0;
}

.mobile-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.3s ease;
    cursor: pointer;
    background: none;
    border: none;
    font-size: 0.8rem;
}

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

.mobile-nav-item svg {
    width: 24px;
    height: 24px;
    margin-bottom: 4px;
}

/* Slide-out Menu */
.slide-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 80%;
    max-width: 350px;
    height: 100vh;
    background: var(--card-bg);
    box-shadow: -2px 0 10px var(--shadow);
    transition: right 0.3s ease;
    z-index: 2000;
    overflow-y: auto;
    border-left: 3px solid;
    border-image: linear-gradient(to bottom, #f37944, #c022ea) 1;
}

.slide-menu.active {
    right: 0;
}

.slide-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 1999;
}

.slide-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

.slide-menu-header {
    padding: 20px;
    border-bottom: 1px solid var(--text-tertiary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.slide-menu-title {
    font-size: 1.5rem;
    color: var(--primary-color);
    font-weight: 700;
}

.close-menu {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 2rem;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
}

.slide-menu-content {
    padding: 20px;
}

.menu-section {
    margin-bottom: 30px;
}

.menu-section-title {
    font-size: 1.1rem;
    color: var(--primary-color);
    margin-bottom: 15px;
    font-weight: 600;
}

.menu-category {
    padding: 12px 15px;
    background: var(--bg-color);
    border-radius: 8px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.menu-category:hover {
    background: var(--primary-color);
    color: #fff;
}

.category-books {
    margin-top: 10px;
    padding-left: 15px;
    display: none;
}

.category-books.active {
    display: block;
}

.category-book-item {
    padding: 8px 12px;
    background: var(--card-bg);
    border-left: 3px solid var(--primary-color);
    margin-bottom: 8px;
    border-radius: 4px;
    text-decoration: none;
    color: var(--text-color);
    display: block;
    transition: all 0.3s ease;
}

.category-book-item:hover {
    transform: translateX(5px);
    background: var(--bg-color);
}

.settings-option {
    padding: 15px;
    background: var(--bg-color);
    border-radius: 8px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

footer {
    background-color: var(--card-bg);
    padding: 30px 0;
    margin-top: 60px;
    text-align: center;
    box-shadow: 0 -2px 8px var(--shadow);
    transition: background-color 0.3s ease;
}

footer p {
    color: var(--text-secondary);
}

@media (max-width: 768px) {
    body {
        padding-bottom: 80px;
    }

    header {
        margin-bottom: 20px;
    }

    .theme-toggle {
        display: none;
    }

    .logo {
        font-size: 2rem;
    }

    .books-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .book-cover {
        height: 250px;
    }

    .mobile-nav {
        display: block;
    }
}
