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

:root {
    --bg-gradient-start: #e0f2fe;
    --bg-gradient-mid: #ffffff;
    --bg-gradient-end: #fae8ff;
    --header-bg: #ffffff;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-tertiary: #9ca3af;
    --card-bg: #ffffff;
    --input-border: #e5e7eb;
    --input-focus: #2563eb;
    --filter-bg: #ffffff;
    --filter-border: #e5e7eb;
    --filter-hover: #f3f4f6;
    --info-bg: #dbeafe;
    --info-border: #bfdbfe;
    --footer-bg: #111827;
    --shadow-color: rgba(0, 0, 0, 0.1);
}

body.dark-mode {
    --bg-gradient-start: #1e293b;
    --bg-gradient-mid: #0f172a;
    --bg-gradient-end: #1e1b4b;
    --header-bg: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-tertiary: #94a3b8;
    --card-bg: #334155;
    --input-border: #475569;
    --input-focus: #3b82f6;
    --filter-bg: #475569;
    --filter-border: #64748b;
    --filter-hover: #64748b;
    --info-bg: #1e3a5f;
    --info-border: #2563eb;
    --footer-bg: #0f172a;
    --shadow-color: rgba(0, 0, 0, 0.5);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-mid) 50%, var(--bg-gradient-end) 100%);
    min-height: 100vh;
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1rem;
}

.header {
    background: var(--header-bg);
    box-shadow: 0 4px 6px -1px var(--shadow-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: all 0.3s ease;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 0;
    flex-wrap: wrap;
    gap: 1rem;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    width: 2rem;
    height: 2rem;
    color: #2563eb;
}

.logo-section h1 {
    font-size: 1.875rem;
    font-weight: bold;
    color: var(--text-primary);
}

.subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-contact {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
}

.phone-icon {
    width: 1.25rem;
    height: 1.25rem;
}

.header-contact span {
    font-size: 0.875rem;
}

.main-content {
    padding: 2rem 0;
}

.search-filter-section {
    margin-bottom: 2rem;
}

.search-container {
    position: relative;
    margin-bottom: 1rem;
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1.25rem;
    height: 1.25rem;
    color: var(--text-tertiary);
}

.search-input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 3rem;
    border: 2px solid var(--input-border);
    border-radius: 0.5rem;
    font-size: 1rem;
    background: var(--card-bg);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--input-focus);
}

.filter-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.filter-icon {
    width: 1.25rem;
    height: 1.25rem;
    color: var(--text-secondary);
}

.filter-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.filter-buttons {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--filter-bg);
    color: var(--text-primary);
    border: 1px solid var(--filter-border);
}

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

.filter-btn.active {
    background: #2563eb;
    color: white;
    border-color: #2563eb;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.3);
}

.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.book-card {
    background: var(--card-bg);
    border-radius: 0.75rem;
    box-shadow: 0 10px 15px -3px var(--shadow-color);
    overflow: hidden;
    transition: all 0.3s ease;
}

.book-card:hover {
    box-shadow: 0 20px 25px -5px var(--shadow-color);
}

.book-image-container {
    position: relative;
    height: 16rem;
    overflow: hidden;
    background: #f3f4f6;
}

.book-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
    cursor: pointer;
}

.book-card:hover .book-image {
    transform: scale(1.05);
}

.book-subject-badge {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: #2563eb;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.book-details {
    padding: 1.25rem;
}

.book-title {
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-author {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
}

.book-condition-section {
    margin-bottom: 1rem;
}

.condition-label {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    display: block;
    margin-bottom: 0.25rem;
}

.condition-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.book-pricing {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.selling-price {
    font-size: 1.5rem;
    font-weight: bold;
    color: #16a34a;
}

.original-price {
    font-size: 0.875rem;
    color: var(--text-tertiary);
    text-decoration: line-through;
}

.discount-badge {
    font-size: 0.75rem;
    background: #dcfce7;
    color: #15803d;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-weight: 600;
}

.whatsapp-btn {
    width: 100%;
    background: #22c55e;
    color: white;
    font-weight: 600;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 1rem;
}

.whatsapp-btn:hover {
    background: #16a34a;
}

.whatsapp-icon {
    width: 1.25rem;
    height: 1.25rem;
}

.no-results {
    text-align: center;
    padding: 4rem 1rem;
}

.no-results-icon {
    width: 4rem;
    height: 4rem;
    color: var(--text-tertiary);
    margin: 0 auto 1rem;
}

.no-results p {
    color: var(--text-secondary);
    font-size: 1.125rem;
}

.info-section {
    background: var(--info-bg);
    border-radius: 0.75rem;
    padding: 1.5rem;
    border: 1px solid var(--info-border);
    margin-top: 3rem;
    transition: all 0.3s ease;
}

.info-section h2 {
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.steps-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.steps-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    color: var(--text-secondary);
}

.step-number {
    font-weight: bold;
    color: #2563eb;
}

.footer {
    background: var(--footer-bg);
    color: white;
    margin-top: 4rem;
    padding: 2rem 0;
    text-align: center;
    transition: all 0.3s ease;
}

.footer p {
    color: #9ca3af;
    margin-bottom: 0.5rem;
}

.footer-copyright {
    font-size: 0.875rem;
    color: #6b7280;
}

.lightbox {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    overflow: auto;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.lightbox-content {
    margin: auto;
    display: block;
    max-width: 90%;
    max-height: 85vh;
    object-fit: contain;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: zoomIn 0.3s;
}

@keyframes zoomIn {
    from { transform: translate(-50%, -50%) scale(0.8); }
    to { transform: translate(-50%, -50%) scale(1); }
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
    z-index: 10000;
}

.lightbox-close:hover,
.lightbox-close:focus {
    color: #bbb;
}

.lightbox-caption {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    color: #f1f1f1;
    padding: 10px 20px;
    background-color: rgba(0, 0, 0, 0.7);
    border-radius: 8px;
    font-size: 1rem;
    max-width: 80%;
}

.dark-mode-toggle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid var(--filter-border);
    background: var(--filter-bg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
}

.dark-mode-toggle:hover {
    background: var(--filter-hover);
    transform: scale(1.05);
}

.dark-mode-toggle svg {
    width: 20px;
    height: 20px;
    color: var(--text-primary);
    position: absolute;
    transition: all 0.3s ease;
}

.sun-icon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

.moon-icon {
    opacity: 0;
    transform: rotate(90deg) scale(0);
}

body.dark-mode .sun-icon {
    opacity: 0;
    transform: rotate(90deg) scale(0);
}

body.dark-mode .moon-icon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

@media (max-width: 768px) {
    .header-contact span {
        display: none;
    }
    
    .logo-section h1 {
        font-size: 1.5rem;
    }
    
    .books-grid {
        grid-template-columns: 1fr;
    }
    
    .filter-container {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .lightbox-content {
        max-width: 95%;
        max-height: 80vh;
    }
    
    .lightbox-close {
        top: 10px;
        right: 15px;
        font-size: 35px;
    }
    
    .lightbox-caption {
        bottom: 20px;
        font-size: 0.875rem;
        max-width: 90%;
    }
}

@media (min-width: 640px) and (max-width: 1024px) {
    .books-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

