/* Theme Variables */
:root {
    /* Light Theme (default) */
    --primary: #2c3e50;
    --secondary: #3498db;
    --accent: #e74c3c;
    --background: #f9f9f9;
    --foreground: #2c3e50;
    --card-bg: #ffffff;
    --sidebar-bg: #ffffff;
    --search-bg: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    --search-text: #ffffff;
    --border-color: rgba(0, 0, 0, 0.1);
    --shadow-color: rgba(0, 0, 0, 0.1);
    --input-bg: #ffffff;
    --input-text: #2c3e50;
    --option-bg: rgba(255, 255, 255, 0.2);
    --option-hover: rgba(255, 255, 255, 0.3);
    --option-active-bg: #ffffff;
    --option-active-text: #2c3e50;
    --filter-bg: rgba(255, 255, 255, 0.1);
    --filter-text: #ffffff;
    --sidebar-width: 250px;
    --header-height: 70px;
    --header-bg: #ffffff;
}

/* Dark Theme */
html[data-theme="dark"] {
    --primary: #ecf0f1;
    --secondary: #3498db;
    --accent: #e74c3c;
    --background: #1a1a2e;
    --foreground: #ecf0f1;
    --card-bg: #16213e;
    --sidebar-bg: #0f3460;
    --search-bg: linear-gradient(135deg, #0f3460 0%, #1a1a2e 100%);
    --search-text: #ecf0f1;
    --border-color: rgba(255, 255, 255, 0.1);
    --shadow-color: rgba(0, 0, 0, 0.3);
    --input-bg: #16213e;
    --input-text: #ecf0f1;
    --option-bg: rgba(22, 33, 62, 0.5);
    --option-hover: rgba(22, 33, 62, 0.7);
    --option-active-bg: #16213e;
    --option-active-text: #ecf0f1;
    --filter-bg: rgba(22, 33, 62, 0.3);
    --filter-text: #ecf0f1;
    --header-bg: #0f3460;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--background);
    color: var(--foreground);
    line-height: 1.6;
    display: flex;
    min-height: 100vh;
    transition: background-color 0.3s, color 0.3s;
    overflow-x: hidden;
    width: 100%;
}

/* Sidebar Styles */
.sidebar {
    width: 80%;
    max-width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    box-shadow: 2px 0 10px var(--shadow-color);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    overflow-y: auto;
    z-index: 100;
    padding: 20px 0;
    transition: transform 0.3s ease, background-color 0.3s;
}

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

.sidebar-logo {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-logo-icon {
    color: var(--accent);
}

.mobile-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--foreground);
    padding: 10px;
    z-index: 101;
}

.nav-section {
    margin-bottom: 30px;
    padding: 0 20px;
}

.nav-title {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--foreground);
    opacity: 0.6;
    margin-bottom: 15px;
    padding-left: 10px;
}

.nav-menu {
    list-style: none;
}

.nav-item {
    margin-bottom: 5px;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    text-decoration: none;
    color: var(--foreground);
    border-radius: 6px;
    transition: all 0.2s;
    font-weight: 500;
    margin-bottom: 5px;
}

.nav-link:hover {
    background-color: rgba(52, 152, 219, 0.1);
    color: var(--secondary);
}

.nav-link.active {
    background-color: var(--secondary);
    color: white;
}

.nav-icon {
    margin-right: 10px;
    font-size: 18px;
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.user-menu:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.user-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background-color: var(--secondary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.user-info {
    flex: 1;
}

.user-name {
    font-weight: 600;
    font-size: 14px;
}

.user-role {
    font-size: 12px;
    opacity: 0.7;
}

/* Main Content Styles */
.main-content {
    flex: 1;
    margin-left: 0;
    width: 100%;
    transition: margin-left 0.3s;
}

.header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    background-color: var(--header-bg);
    box-shadow: 0 2px 10px var(--shadow-color);
    position: sticky;
    top: 0;
    z-index: 90;
    transition: background-color 0.3s;
}

/* Top Logo */
.top-logo {
    height: 40px;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

/* Theme Toggle in Header */
.theme-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 15px;
    background-color: var(--option-bg);
    border-radius: 20px;
    cursor: pointer;
    transition: background-color 0.2s;
    border: 1px solid var(--border-color);
}

.theme-toggle:hover {
    background-color: var(--option-hover);
}

.theme-icon {
    font-size: 18px;
}

.search-section {
    padding: 30px 20px;
    background: var(--search-bg);
    color: var(--search-text);
    text-align: center;
    position: relative;
}

.main-logo {
    height: 60px;
    width: 150px;
    background-color: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-weight: bold;
    color: var(--search-text);
    font-size: 20px;
    margin: 0 auto 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.search-title {
    font-size: 1.8rem;
    margin-bottom: 15px;
}

.search-subtitle {
    font-size: 1rem;
    max-width: 600px;
    margin: 0 auto 20px;
    opacity: 0.9;
}

.search-container {
    max-width: 100%;
    margin: 0 auto;
    position: relative;
}

.search-bar {
    width: 100%;
    padding: 15px 20px;
    border-radius: 50px;
    border: none;
    font-size: 1rem;
    box-shadow: 0 5px 15px var(--shadow-color);
    background-color: var(--input-bg);
    color: var(--input-text);
}

.search-bar::placeholder {
    color: var(--input-text);
    opacity: 0.7;
}

.search-btn {
    position: absolute;
    right: 5px;
    top: 5px;
    background-color: var(--accent);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 10px 20px;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.3s;
}

.search-btn:hover {
    background-color: #c0392b;
}

.search-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

.search-option {
    background-color: var(--option-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 8px 15px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.search-option:hover {
    background-color: var(--option-hover);
}

.search-option.active {
    background-color: var(--option-active-bg);
    color: var(--option-active-text);
}

.advanced-filters {
    max-width: 100%;
    margin: 20px auto 0;
    background-color: var(--filter-bg);
    border-radius: 10px;
    padding: 20px;
}

.filter-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

.filter-group {
    text-align: left;
}

.filter-label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    opacity: 0.9;
}

.filter-select {
    width: 100%;
    padding: 10px;
    border-radius: 5px;
    border: 1px solid var(--border-color);
    background-color: var(--option-bg);
    color: var(--search-text);
}

.filter-select option {
    background-color: var(--input-bg);
    color: var(--input-text);
}

.content-area {
    padding: 20px;
    transition: background-color 0.3s;
}

.section-title {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: var(--foreground);
}

.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 20px;
}

.book-card {
    background-color: var(--card-bg);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 5px 15px var(--shadow-color);
    transition: transform 0.3s, background-color 0.3s;
}

.book-card:hover {
    transform: translateY(-5px);
}

.book-cover {
    height: 200px;
    background-color: rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--foreground);
    font-size: 3rem;
}

.book-info {
    padding: 15px;
}

.book-title {
    font-weight: 600;
    margin-bottom: 5px;
    font-size: 0.95rem;
}

.book-author {
    opacity: 0.7;
    font-size: 0.85rem;
    margin-bottom: 8px;
}

.book-rating {
    color: #f39c12;
    font-size: 0.85rem;
}

/* Overlay for closing sidebar */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 99;
    display: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* Responsive Styles */
@media (min-width: 993px) {
    .sidebar {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: var(--sidebar-width);
        width: calc(100% - var(--sidebar-width));
    }
}

@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        width: 100%;
    }
    
    .mobile-toggle {
        display: block;
    }
    
    .top-logo {
        height: 40px;
    }
    
    .filter-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .search-title {
        font-size: 1.5rem;
    }
    
    .search-subtitle {
        font-size: 0.9rem;
    }
    
    .search-bar {
        padding: 12px 15px;
    }
    
    .search-btn {
        padding: 8px 15px;
    }
    
    .main-logo {
        height: 50px;
        width: 120px;
        font-size: 16px;
    }
    
    .top-logo {
        height: 30px;
    }
    
    .theme-toggle {
        padding: 6px 10px;
    }
    
    .theme-toggle span {
        display: none;
    }
    
    .content-area {
        padding: 15px;
    }
    
    .books-grid {
        gap: 15px;
    }
}

@media (max-width: 480px) {
    .search-title {
        font-size: 1.3rem;
    }
    
    .search-subtitle {
        font-size: 0.85rem;
        margin-bottom: 15px;
    }
    
    .search-bar {
        padding: 10px 15px;
        font-size: 0.9rem;
    }
    
    .search-btn {
        padding: 6px 12px;
        font-size: 0.9rem;
    }
    
    .search-options {
        flex-wrap: nowrap;
        overflow-x: auto;
        justify-content: flex-start;
        padding-bottom: 10px;
    }
    
    .search-option {
        flex: 0 0 auto;
        white-space: nowrap;
    }
    
    .book-cover {
        height: 160px;
    }
    
    .book-title {
        font-size: 0.85rem;
    }
    
    .book-author {
        font-size: 0.75rem;
    }
    
    .section-title {
        font-size: 1.3rem;
    }
    
    .header {
        height: 60px;
    }
}