/* ===== IMPROVED COLOR SCHEME WITH DARK MODE ===== */
:root {
    /* Light Theme */
    --primary-bg: #F8F9FA;
    --secondary-bg: #FFFFFF;
    --primary-text: #2D3748;
    --secondary-text: #4A5568;
    --accent-primary: #667EEA;
    --accent-secondary: #764BA2;
    --accent-muted: #A0AEC0;
    --accent-pastel: #CBD5E0;
    --success: #48BB78;
    --warning: #ED8936;
    --error: #F56565;
    --border: #E2E8F0;
    --shadow: rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
    /* Dark Theme */
    --primary-bg: #1A202C;
    --secondary-bg: #2D3748;
    --primary-text: #F7FAFC;
    --secondary-text: #E2E8F0;
    --accent-primary: #7F9CF5;
    --accent-secondary: #9F7AEA;
    --accent-muted: #718096;
    --accent-pastel: #4A5568;
    --success: #68D391;
    --warning: #F6AD55;
    --error: #FC8181;
    --border: #4A5568;
    --shadow: rgba(0, 0, 0, 0.3);
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--primary-bg);
    color: var(--primary-text);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ===== THEME TOGGLE BUTTON ===== */
.theme-toggle {
    background: none;
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 8px 16px;
    border-radius: 25px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    font-weight: 500;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.theme-toggle .icon {
    font-size: 1.1rem;
}

/* ===== NAVBAR STYLES ===== */
.navbar {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    box-shadow: 0 4px 20px var(--shadow);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar.admin-nav {
    background: linear-gradient(135deg, var(--primary-text) 0%, var(--secondary-text) 100%);
}

.navbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo {
    height: 45px;
    width: auto;
    border-radius: 10px;
    object-fit: cover;
    border: 3px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 15px var(--shadow);
}

.brand-text {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(135deg, #FFFFFF 0%, #F7FAFC 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

[data-theme="dark"] .brand-text {
    background: linear-gradient(135deg, #FFFFFF 0%, #CBD5E0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-link {
    padding: 10px 20px;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
    border-radius: 25px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-link:hover,
.nav-link.active {
    color: #FFFFFF;
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

/* Dropdown Navigation */
.nav-dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--secondary-bg);
    box-shadow: 0 10px 25px var(--shadow);
    border-radius: 12px;
    padding: 8px 0;
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1001;
    border: 1px solid var(--border);
}

.nav-dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    text-decoration: none;
    color: var(--primary-text);
    transition: all 0.3s ease;
    font-size: 0.95rem;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
}

.dropdown-link:hover {
    background: rgba(102, 126, 234, 0.1);
    color: var(--accent-primary);
}

.nav-user-photo {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

/* ===== HERO SECTION ===== */
.hero {
    background: linear-gradient(135deg, var(--secondary-bg) 0%, var(--accent-pastel) 100%);
    padding: 100px 0;
    text-align: center;
    margin-bottom: 60px;
    border-bottom: 3px solid var(--accent-primary);
}

.hero-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
}

.hero-title {
    font-size: 3.5rem;
    margin-bottom: 1.5rem;
    color: var(--primary-text);
    font-weight: 700;
}

.hero-subtitle {
    font-size: 1.3rem;
    color: var(--secondary-text);
    margin-bottom: 3rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
}

.search-form {
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    gap: 12px;
}

.search-input {
    flex: 1;
    padding: 18px 25px;
    border: 2px solid var(--border);
    border-radius: 50px;
    font-size: 1.1rem;
    background: var(--secondary-bg);
    box-shadow: 0 4px 15px var(--shadow);
    color: var(--primary-text);
    transition: all 0.3s ease;
}

.search-input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    outline: none;
}

.search-btn {
    padding: 18px 35px;
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(102, 126, 234, 0.5);
}

/* ===== SECTIONS ===== */
.section {
    margin-bottom: 4rem;
}

.section-title {
    font-size: 2.5rem;
    margin-bottom: 2rem;
    color: var(--primary-text);
    border-bottom: 3px solid var(--accent-primary);
    padding-bottom: 0.8rem;
    text-align: center;
    font-weight: 700;
}

/* ===== BOOKS GRID ===== */
.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
}

.book-card {
    background: var(--secondary-bg);
    border-radius: 16px;
    padding: 1.8rem;
    box-shadow: 0 5px 20px var(--shadow);
    transition: all 0.3s ease;
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.book-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
}

.book-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 40px var(--shadow);
    border-color: var(--accent-primary);
}

.book-cover-container {
    text-align: center;
    margin-bottom: 1.5rem;
    height: 250px;
    overflow: hidden;
    border-radius: 12px;
}

.book-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: 0 8px 20px var(--shadow);
    transition: transform 0.3s ease;
}

.book-card:hover .book-cover {
    transform: scale(1.05);
}

.book-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.book-title {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    color: var(--primary-text);
    font-weight: 700;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-author {
    color: var(--secondary-text);
    margin-bottom: 1rem;
    font-weight: 500;
}

.book-meta {
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.book-genre {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    color: white;
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-block;
}

.book-rating {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.8rem;
    flex-wrap: wrap;
}

.star {
    color: var(--accent-muted);
    font-size: 1.2rem;
}

.star.filled {
    color: #FFD700;
}

.rating-text {
    color: var(--secondary-text);
    font-weight: 600;
    font-size: 0.9rem;
}

.book-reviews {
    color: var(--secondary-text);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: var(--secondary-text);
    color: white;
}

.btn-secondary:hover {
    background: var(--primary-text);
    transform: translateY(-2px);
}

.btn-danger {
    background: var(--error);
    color: white;
}

.btn-danger:hover {
    background: #E53E3E;
    transform: translateY(-2px);
}

/* ===== FORMS ===== */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--primary-text);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: var(--secondary-bg);
    color: var(--primary-text);
}

.form-control:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    outline: none;
}

/* ===== FOOTER ===== */
.footer {
    background: linear-gradient(135deg, var(--primary-text) 0%, var(--secondary-text) 100%);
    color: white;
    padding: 3rem 0 1rem;
    margin-top: 6rem;
    border-top: 4px solid var(--accent-primary);
}

.footer-content {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 2.5rem;
    margin-bottom: 2rem;
}

.footer-section .footer-brand {
    margin-bottom: 1rem;
}

.footer-section .brand-text {
    font-size: 1.8rem;
    font-weight: bold;
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.footer-description {
    line-height: 1.6;
    margin-bottom: 1.5rem;
    color: #ddd;
    max-width: 300px;
}

.footer-title {
    color: var(--accent-primary);
    font-size: 1.2rem;
    margin-bottom: 1.2rem;
    font-weight: 600;
}

.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links li {
    margin-bottom: 0.7rem;
}

.footer-link {
    color: #ddd;
    text-decoration: none;
    transition: color 0.3s;
}

.footer-link:hover {
    color: var(--accent-primary);
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid var(--accent-muted);
}

.copyright {
    color: var(--accent-muted);
    font-size: 0.9rem;
}

/* ===== EMPTY STATES ===== */
.empty-state {
    text-align: center;
    padding: 3rem;
    background: var(--secondary-bg);
    border: 3px dashed var(--accent-pastel);
    border-radius: 20px;
}

.empty-state h3 {
    color: var(--primary-text);
    margin-bottom: 1rem;
}

.empty-state p {
    color: var(--secondary-text);
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

.no-books {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    background: var(--secondary-bg);
    border-radius: 20px;
    box-shadow: 0 8px 25px var(--shadow);
}

.no-books h3 {
    margin-bottom: 15px;
    color: var(--primary-text);
    font-size: 1.8rem;
    font-weight: 600;
}

.no-books p {
    font-size: 1.1rem;
    margin-bottom: 25px;
    color: var(--secondary-text);
}

/* ===== ALERTS ===== */
.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border: 2px solid transparent;
}

.alert-success {
    background: color-mix(in srgb, var(--success) 10%, transparent);
    color: var(--success);
    border-color: var(--success);
}

.alert-error {
    background: color-mix(in srgb, var(--error) 10%, transparent);
    color: var(--error);
    border-color: var(--error);
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }
    
    .navbar .container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .nav-menu {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }
    
    .nav-link {
        padding: 8px 16px;
        font-size: 0.9rem;
    }
    
    .hero-title {
        font-size: 2.5rem;
    }
    
    .hero-subtitle {
        font-size: 1.1rem;
    }
    
    .search-form {
        flex-direction: column;
    }
    
    .books-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1.5rem;
    }
    
    .section-title {
        font-size: 2rem;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }
    
    .footer-description {
        max-width: none;
        margin-left: auto;
        margin-right: auto;
    }
    
    .brand-text {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 2rem;
    }
    
    .books-grid {
        grid-template-columns: 1fr;
    }
    
    .book-card {
        padding: 1.5rem;
    }
    
    .logo {
        height: 40px;
    }
}

/* ===== UTILITY CLASSES ===== */
.text-muted {
    color: var(--secondary-text);
}

.text-center {
    text-align: center;
}

.mt-4 {
    margin-top: 2rem;
}

.mb-4 {
    margin-bottom: 2rem;
}

/* Smooth theme transition */
.theme-transition * {
    transition: background-color 0.3s ease, 
                color 0.3s ease, 
                border-color 0.3s ease, 
                box-shadow 0.3s ease;
}