/* ===== BookNest - Online Bookstore Styles ===== */

/* CSS Reset & Base */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Colors */
    --primary: #2563EB;
    --primary-dark: #1D4ED8;
    --primary-light: #3B82F6;
    --secondary: #F59E0B;
    --secondary-dark: #D97706;
    
    --bg-primary: #FAFAFA;
    --bg-card: #FFFFFF;
    --bg-hover: #F3F4F6;
    
    --text-primary: #111827;
    --text-secondary: #6B7280;
    --text-light: #9CA3AF;
    
    --success: #10B981;
    --error: #EF4444;
    --warning: #F59E0B;
    --info: #3B82F6;
    
    /* Typography */
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-display: 'Playfair Display', Georgia, serif;
    
    /* Spacing */
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    
    /* Shadows */
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.15);
    
    /* Transitions */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

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

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
    transition: var(--transition);
}

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

/* ===== Header ===== */
.header {
    background: var(--bg-card);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-top {
    background: var(--primary);
    color: white;
    padding: 8px 0;
    text-align: center;
    font-size: 14px;
}

.header-main {
    padding: 16px 0;
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    gap: 32px;
}

.logo {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-icon {
    font-size: 32px;
}

.search-bar {
    flex: 1;
    max-width: 600px;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 12px 48px 12px 16px;
    border: 2px solid #E5E7EB;
    border-radius: var(--radius);
    font-size: 15px;
    transition: var(--transition);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.search-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    padding: 8px 12px;
    background: var(--primary);
    color: white;
    border-radius: var(--radius-sm);
}

.search-btn:hover {
    background: var(--primary-dark);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 500;
    transition: var(--transition);
}

.header-btn:hover {
    background: var(--bg-hover);
}

.cart-icon {
    position: relative;
}

#cart-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--error);
    color: white;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
    display: none;
}

/* ===== Navigation ===== */
.nav {
    background: var(--bg-card);
    border-top: 1px solid #E5E7EB;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    gap: 32px;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 8px;
}

.nav-link {
    padding: 16px 20px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition);
}

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

/* ===== Hero Section ===== */
.hero {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 80px 24px;
    text-align: center;
}

.hero-content {
    max-width: 800px;
    margin: 0 auto;
}

.hero h1 {
    font-family: var(--font-display);
    font-size: 56px;
    font-weight: 700;
    margin-bottom: 16px;
    line-height: 1.2;
}

.hero p {
    font-size: 20px;
    margin-bottom: 32px;
    opacity: 0.95;
}

.hero-cta {
    display: inline-flex;
    gap: 16px;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 600;
    transition: var(--transition);
    cursor: pointer;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

.btn-secondary:hover {
    background: var(--primary);
    color: white;
}

.btn-outline {
    background: transparent;
    color: white;
    border: 2px solid white;
}

.btn-outline:hover {
    background: white;
    color: var(--primary);
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 14px;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 17px;
}

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

/* ===== Categories ===== */
.categories {
    padding: 48px 24px;
    background: white;
}

.section-title {
    font-family: var(--font-display);
    font-size: 32px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 32px;
    color: var(--text-primary);
}

.categories-scroll {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 8px 0;
    scrollbar-width: thin;
}

.category-chip {
    padding: 12px 24px;
    background: var(--bg-hover);
    border-radius: 24px;
    font-weight: 500;
    white-space: nowrap;
    transition: var(--transition);
    cursor: pointer;
}

.category-chip:hover,
.category-chip.active {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
}

/* ===== Book Grid ===== */
.books-section {
    padding: 64px 24px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

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

.book-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    cursor: pointer;
}

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

.book-cover {
    width: 100%;
    height: 350px;
    object-fit: cover;
    background: var(--bg-hover);
}

.book-info {
    padding: 20px;
}

.book-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-author {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

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

.book-price {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
}

.add-to-cart-btn {
    padding: 8px 16px;
    background: var(--primary);
    color: white;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
}

.add-to-cart-btn:hover {
    background: var(--primary-dark);
}

/* ===== Filters Sidebar ===== */
.browse-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 32px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 32px 24px;
}

.filters-sidebar {
    background: var(--bg-card);
    padding: 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    height: fit-content;
    position: sticky;
    top: 100px;
}

.filter-group {
    margin-bottom: 32px;
}

.filter-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.filter-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.filter-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.filter-checkbox input {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.price-range {
    display: flex;
    gap: 12px;
    align-items: center;
}

.price-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #E5E7EB;
    border-radius: var(--radius-sm);
    font-size: 14px;
}

/* ===== Loading States ===== */
.loading {
    text-align: center;
    padding: 64px 24px;
    color: var(--text-secondary);
}

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ===== Entrance Animations ===== */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* Apply animations to elements */
.hero-content {
    animation: slideInUp 0.8s ease forwards;
}

.hero-image {
    animation: slideInRight 0.8s ease 0.2s forwards;
    opacity: 0;
}

.book-card {
    animation: scaleIn 0.4s ease forwards;
}

.section-title {
    animation: slideInUp 0.5s ease forwards;
}

.category-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.category-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.book-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
}

.btn {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.btn:hover::before {
    left: 100%;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(37, 99, 235, 0.3);
}

.btn:active {
    transform: translateY(0);
}

/* Form animations */
.form-group input,
.form-group select,
.form-group textarea {
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    outline: none;
}

/* Loading spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: inline-block;
    vertical-align: middle;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== Cart Notification ===== */
.cart-notification {
    position: fixed;
    top: 100px;
    right: 24px;
    background: var(--success);
    color: white;
    padding: 16px 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    transform: translateX(400px);
    transition: transform 0.3s ease;
    z-index: 2000;
}

.cart-notification.show {
    transform: translateX(0);
}

/* ===== Account Menu ===== */
.account-menu {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 8px;
    min-width: 200px;
    z-index: 2000;
}

.account-menu-item {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.account-menu-item:hover {
    background: var(--bg-hover);
}

/* ===== Footer ===== */
.footer {
    background: var(--text-primary);
    color: white;
    padding: 64px 24px 24px;
    margin-top: 64px;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 48px;
    margin-bottom: 48px;
}

.footer-section h3 {
    font-size: 18px;
    margin-bottom: 16px;
}

.footer-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.7);
    transition: var(--transition);
}

.footer-links a:hover {
    color: white;
}

.footer-bottom {
    text-align: center;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
}

/* ===== Responsive Design ===== */
@media (max-width: 1024px) {
    .browse-layout {
        grid-template-columns: 1fr;
    }
    
    .filters-sidebar {
        position: static;
    }
    
    .books-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

@media (max-width: 768px) {
    .header-container {
        flex-wrap: wrap;
        gap: 16px;
    }
    
    .search-bar {
        order: 3;
        flex-basis: 100%;
    }
    
    .hero h1 {
        font-size: 36px;
    }
    
    .hero p {
        font-size: 16px;
    }
    
    .books-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 16px;
    }
    
    .nav-links {
        overflow-x: auto;
    }
}

@media (max-width: 480px) {
    .hero-cta {
        flex-direction: column;
        width: 100%;
    }
    
    .btn {
        width: 100%;
    }
}
