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

:root {
    --primary: #2c3e50;
    --secondary: #34495e;
    --accent: #3498db;
    --text: #1a1a1a;
    --light-bg: #ecf0f1;
    --white: #ffffff;
    --border: #bdc3c7;
    --shadow: rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Noto Sans Devanagari', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--light-bg);
    color: var(--text);
    line-height: 1.7;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

main {
    flex: 1;
}

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

header {
    background: var(--primary);
    color: var(--white);
    padding: 20px 0;
    box-shadow: 0 2px 5px var(--shadow);
}

@media (max-width: 600px) {
    header {
        padding: 12px 0;
    }
}

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

.header-content > div {
    flex: 1;
    text-align: center;
}

.header-nav {
    display: flex;
    gap: 20px;
}

.header-nav a {
    color: var(--white);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    padding: 8px 15px;
    border-radius: 5px;
    transition: background 0.3s;
    white-space: nowrap;
}

.header-nav a:hover {
    background: rgba(255, 255, 255, 0.1);
}

.logo-link {
    display: block;
    transition: transform 0.2s;
}

.logo-link:hover {
    transform: scale(1.05);
}

.header-icon {
    width: 60px;
    height: 60px;
    object-fit: contain;
    display: block;
}

.site-title-link {
    text-decoration: none;
    color: inherit;
    transition: opacity 0.2s;
}

.site-title-link:hover {
    opacity: 0.9;
}

.site-title-link h1 {
    cursor: pointer;
}

h1 {
    font-size: 1.8rem;
    margin-bottom: 5px;
    font-weight: 600;
}

.subtitle {
    font-size: 0.95rem;
    opacity: 0.9;
}

@media (max-width: 600px) {
    h1 {
        font-size: 1rem;
        margin-bottom: 3px;
        line-height: 1.3;
    }
    
    .subtitle {
        font-size: 0.75rem;
    }
}

.stats-dashboard {
    display: flex;
    justify-content: center;
    margin: 20px auto 15px;
}

.stat-card {
    background: var(--white);
    padding: 15px 40px;
    border-radius: 8px;
    box-shadow: 0 2px 8px var(--shadow);
    text-align: center;
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-3px);
}

.stat-number {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--secondary);
    font-weight: 500;
}

.search-section {
    background: var(--white);
    padding: 30px 20px;
    margin: 20px auto 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px var(--shadow);
}

.search-box {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.search-input-wrapper {
    flex: 1;
    min-width: 250px;
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 15px;
    color: var(--secondary);
    pointer-events: none;
}

#searchInput {
    width: 100%;
    padding: 12px 15px 12px 45px;
    border: 2px solid var(--border);
    border-radius: 5px;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text);
}

#searchInput:focus {
    outline: none;
    border-color: var(--accent);
}

.btn {
    padding: 12px 25px;
    background: var(--accent);
    color: var(--white);
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s;
}

.btn:hover {
    background: #2980b9;
}

.filters {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.filter-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--secondary);
}

.filters select {
    padding: 10px 12px;
    border: 2px solid var(--border);
    border-radius: 5px;
    background: var(--white);
    min-width: 200px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text);
}

.filters select:focus {
    outline: none;
    border-color: var(--accent);
}

.filter-count {
    padding: 10px 15px;
    background: var(--accent);
    color: var(--white);
    border-radius: 5px;
    font-size: 0.9rem;
    font-weight: 600;
    display: none;
}

.filter-count.active {
    display: block;
}

.stats {
    text-align: center;
    margin: 20px 0;
    color: var(--secondary);
    font-size: 0.95rem;
}

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

.book-card {
    background: var(--white);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.book-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 15px var(--shadow);
}

.book-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.5;
}

.book-title-en {
    font-size: 0.95rem;
    color: #7f8c8d;
    font-style: italic;
    margin-top: -5px;
}

.book-author {
    font-size: 0.95rem;
    color: #2c3e50;
    font-weight: 500;
    margin-top: 5px;
}

.book-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-maithili {
    background: #d5f4e6;
    color: #27ae60;
}

.badge-nepali {
    background: #e8f4f8;
    color: #2980b9;
}

.badge-language {
    background: #f4ecf7;
    color: #8e44ad;
}

.badge-location {
    background: #ecf0f1;
    color: #5d6d7e;
}

.acc-no {
    position: absolute;
    bottom: 15px;
    right: 20px;
    font-size: 0.75rem;
    color: #95a5a6;
    font-weight: 500;
    background: #f8f9fa;
    padding: 4px 10px;
    border-radius: 12px;
}

.no-results {
    text-align: center;
    padding: 80px 20px;
    color: var(--secondary);
    grid-column: 1 / -1;
}

.no-results h3 {
    font-size: 1.5rem;
    color: var(--primary);
    margin-bottom: 10px;
}

.no-results p {
    font-size: 1rem;
    line-height: 1.6;
}

.pagination-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.page-numbers {
    display: flex;
    gap: 5px;
    align-items: center;
}

.btn-page {
    padding: 10px 20px;
    background: var(--accent);
    color: var(--white);
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: background 0.3s;
}

.btn-page:hover {
    background: #2980b9;
}

.btn-page-num {
    padding: 8px 12px;
    background: var(--white);
    color: var(--text);
    border: 2px solid var(--border);
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s;
    min-width: 40px;
}

.btn-page-num:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.btn-page-num.active {
    background: var(--accent);
    color: var(--white);
    border-color: var(--accent);
}

.page-dots {
    padding: 0 5px;
    color: var(--secondary);
}

.loading-spinner {
    text-align: center;
    padding: 60px 20px;
    color: var(--secondary);
}

.spinner {
    border: 4px solid var(--light-bg);
    border-top: 4px solid var(--accent);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

.error-message {
    background: #fee;
    border: 2px solid #fcc;
    color: #c33;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
    text-align: center;
    font-weight: 500;
}

.scroll-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--accent);
    color: var(--white);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px var(--shadow);
    transition: all 0.3s;
    z-index: 1000;
}

.scroll-to-top:hover {
    background: #2980b9;
    transform: translateY(-3px);
}

.scroll-to-top.show {
    display: flex;
}

.breadcrumb {
    padding: 18px 0 12px;
    font-size: 0.88rem;
    color: var(--secondary);
}

.breadcrumb a {
    color: var(--accent);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.contact-section {
    max-width: 1400px;
    margin: 30px auto;
    padding: 0;
}

.contact-section h2 {
    text-align: center;
    color: var(--primary);
    margin-bottom: 40px;
    font-size: 2rem;
    font-weight: 700;
    padding: 0 20px;
}

.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    background: var(--white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.contact-info {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    padding: 50px 40px;
    color: var(--white);
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.info-card {
    padding: 0;
    border: none;
    background: transparent;
    transition: all 0.3s;
}

.info-card:hover {
    transform: translateX(5px);
}

.info-card svg {
    color: #3498db;
    margin-bottom: 12px;
    width: 28px;
    height: 28px;
}

.info-card h3 {
    color: var(--white);
    margin-bottom: 10px;
    font-size: 1.15rem;
    font-weight: 600;
}

.info-card p {
    color: rgba(255,255,255,0.9);
    line-height: 1.7;
    font-size: 0.95rem;
}

.info-card a {
    color: #3498db;
    text-decoration: none;
    font-weight: 500;
}

.info-card a:hover {
    color: #5dade2;
    text-decoration: underline;
}

.contact-form-wrapper {
    padding: 50px 40px;
    background: var(--white);
}

.contact-form-wrapper h3 {
    color: var(--primary);
    margin-bottom: 25px;
    font-size: 1.4rem;
    font-weight: 600;
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 600;
    color: var(--secondary);
    font-size: 0.9rem;
}

.form-group input,
.form-group textarea {
    padding: 11px 13px;
    border: 2px solid var(--border);
    border-radius: 5px;
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--text);
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.form-message {
    padding: 15px;
    border-radius: 5px;
    margin-top: 15px;
    text-align: center;
    display: none;
}

.form-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.form-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

footer {
    background: var(--primary);
    color: var(--white);
    text-align: center;
    padding: 20px;
    margin-top: auto;
}

.footer-content {
    font-size: 0.9rem;
    line-height: 1.8;
}

@media (min-width: 1200px) {
    .books-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

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

@media (max-width: 768px) {
    .header-icon {
        width: 45px;
        height: 45px;
    }
    
    .header-nav a {
        font-size: 0.85rem;
        padding: 6px 10px;
    }
}

@media (max-width: 600px) {
    .header-content {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .header-icon {
        width: 35px;
        height: 35px;
    }
    
    .header-nav {
        width: 100%;
        justify-content: center;
        margin-top: 2px;
        gap: 8px;
    }
    
    .header-nav a {
        font-size: 0.8rem;
        padding: 5px 10px;
    }
}

@media (max-width: 768px) {
    
    h1 {
        font-size: 1.3rem;
    }
    
    .subtitle {
        font-size: 0.85rem;
    }
    
    .search-box {
        flex-direction: column;
    }
    
    .search-input-wrapper {
        min-width: 100%;
    }
    
    .btn {
        width: 100%;
    }
    
    .books-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .filters {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .filter-label {
        font-size: 0.8rem;
        margin-bottom: 3px;
    }
    
    .filters select {
        width: 100%;
        min-width: 100%;
        padding: 8px 10px;
        font-size: 0.85rem;
    }
    
    .filter-count {
        text-align: center;
    }
    
    .pagination-wrapper {
        flex-direction: column;
        gap: 10px;
    }
    
    .btn-page {
        width: 100%;
    }
    
    .stats-dashboard {
        grid-template-columns: 1fr;
    }
    
    .stat-number {
        font-size: 2rem;
    }
    
    .scroll-to-top {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
    }
    
    .contact-section {
        margin: 0;
        max-width: 100%;
    }
    
    .contact-section .container {
        padding: 0;
    }
    
    .contact-grid {
        border-radius: 0;
    }
    
    .contact-section h2 {
        font-size: 1.4rem;
        margin-bottom: 25px;
        padding: 0 10px;
    }
    
    .contact-grid {
        grid-template-columns: 1fr;
        border-radius: 8px;
    }
    
    .contact-info {
        padding: 35px 25px;
        gap: 20px;
    }
    
    .info-card svg {
        width: 24px;
        height: 24px;
    }
    
    .info-card h3 {
        font-size: 1rem;
        margin-bottom: 8px;
    }
    
    .info-card p {
        font-size: 0.9rem;
        line-height: 1.6;
    }
    
    .contact-form-wrapper {
        padding: 35px 25px;
    }
    
    .contact-form-wrapper h3 {
        font-size: 1.15rem;
        margin-bottom: 20px;
    }
    
    .contact-form {
        gap: 14px;
    }
    
    .form-group {
        gap: 6px;
    }
    
    .form-group label {
        font-size: 0.83rem;
    }
    
    .form-group input,
    .form-group textarea {
        padding: 9px 11px;
        font-size: 0.88rem;
    }
    
    .btn {
        padding: 11px 20px;
        font-size: 0.9rem;
    }
    
    .breadcrumb {
        padding: 12px 0 8px;
        font-size: 0.82rem;
    }
    
    .footer-content {
        font-size: 0.85rem;
        line-height: 1.6;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }
    
    .search-section {
        padding: 15px 12px;
        margin: 15px auto;
    }
    
    .search-box {
        margin-bottom: 15px;
    }
    
    h1 {
        font-size: 1.2rem;
    }
    
    .book-card {
        padding: 15px;
        padding-bottom: 35px;
    }
    
    .acc-no {
        bottom: 10px;
        right: 15px;
    }
}
