/* --- 0. GLOBAL FIXES (MUST BE AT TOP) --- */
* {
    box-sizing: border-box; /* Fixes width calculations */
}

html, body {
    max-width: 100%;
    overflow-x: hidden; /* Prevents horizontal scrolling */
}

/* --- 1. GLOBAL & HELPER STYLES --- */
body {
    font-family: Arial, sans-serif; /* System Default Font */
    margin: 0;
    background-color: #f4f7f6; /* Slightly softer gray */
    padding-top: 80px; /* Increased to prevent header overlapping content */
    line-height: 1.6;
    color: #333;
}

main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px; /* Adds breathing room on sides */
    width: 100%;
    min-height: 80vh; /* Ensures footer stays at bottom on empty pages */
}

h1, h2, h3 {
    color: #2c3e50;
    margin-top: 0;
}

h2 {
    text-align: center;
    margin-bottom: 30px;
    font-size: 2rem;
}

/* --- 2. HEADER & NAVIGATION --- */
header {
    background-color: #004a99;
    color: white;
    padding: 0 20px;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 70px;
    z-index: 1000;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

nav {
    display: flex;
    justify-content: space-between; /* Logo Left, Links Right */
    align-items: center;
    width: 100%;
    max-width: 1200px;
    height: 100%;
}

.logo a {
    color: white;
    text-decoration: none;
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.nav-links {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    align-items: center;
    gap: 25px;
}

.nav-links a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    transition: color 0.3s;
}

.nav-links a:hover {
    color: #ffcc00;
}

/* --- 3. SEARCH FORM (Desktop) --- */
.search-form {
    display: flex;
}

.search-form input[type="text"] {
    border: none;
    padding: 8px 15px;
    border-radius: 20px 0 0 20px;
    font-size: 0.95rem;
    outline: none;
    width: 200px;
}

.search-form button {
    padding: 8px 15px;
    border: none;
    background-color: #003366;
    color: white;
    font-weight: bold;
    cursor: pointer;
    border-radius: 0 20px 20px 0;
    font-size: 0.95rem;
    transition: background-color 0.2s;
}

.search-form button:hover {
    background-color: #002244;
}

.mobile-search { display: none; }

/* --- 4. MOBILE MENU (Hamburger) --- */
.hamburger {
    display: none;
    cursor: pointer;
    flex-direction: column;
    gap: 6px;
}

.hamburger div {
    width: 28px;
    height: 3px;
    background-color: white;
    transition: all 0.3s ease;
    border-radius: 2px;
}

@media (max-width: 900px) { /* Tablet Breakpoint */
    header { padding: 0 15px; }
    
    .hamburger { display: flex; }
    .desktop-search { display: none; }

    .nav-links {
        position: fixed;
        left: -100%;
        top: 70px;
        background-color: #004a99;
        flex-direction: column;
        width: 100%;
        height: calc(100vh - 70px);
        text-align: center;
        transition: left 0.3s ease;
        justify-content: flex-start;
        padding-top: 40px;
        gap: 20px;
    }

    .nav-links.active { left: 0; }

    .mobile-search {
        display: flex;
        width: 80%;
        margin: 0 auto 20px auto;
    }
    
    .mobile-search input { width: 100%; padding: 12px; border-radius: 5px 0 0 5px; }
    .mobile-search button { width: auto; border-radius: 0 5px 5px 0; padding: 12px 20px; }

    /* Animation */
    .hamburger.toggle div:nth-child(1) { transform: rotate(-45deg) translate(-6px, 7px); }
    .hamburger.toggle div:nth-child(2) { opacity: 0; }
    .hamburger.toggle div:nth-child(3) { transform: rotate(45deg) translate(-6px, -7px); }
}

/* --- 5. BREADCRUMBS --- */
.breadcrumbs {
    margin: 0 0 30px 0;
    padding: 10px 15px;
    background-color: white;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #333; /* Made darker for better readability */
    box-shadow: 0 2px 5px rgba(0,0,0,0.03);
}
.breadcrumbs a {
    color: #004a99;
    text-decoration: none;
    font-weight: 600;
}
.breadcrumbs span {
    margin: 0 8px;
    color: #666; /* Made darker so separator is visible */
}

/* --- 6. STANDARD PAGE (Filter & Grid) --- */
.filter-container {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 40px;
}

.filter-btn {
    background-color: #e9ecef;
    border: none;
    border-radius: 50px;
    padding: 10px 25px;
    font-size: 1rem;
    font-weight: 600;
    color: #555;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-btn:hover {
    background-color: #dde2e6;
    transform: translateY(-2px);
}

.filter-btn.active {
    background-color: #004a99;
    color: white;
    box-shadow: 0 4px 10px rgba(0,74,153,0.3);
}

.book-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 30px;
}

.book-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    text-decoration: none;
    color: #333;
    transition: transform 0.3s, box-shadow 0.3s;
    display: flex;
    flex-direction: column;
    border: 1px solid #eee;
}

.book-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    border-color: #004a99;
}

.book-card img {
    width: 100%;
    height: 280px;
    object-fit: cover; /* Ensures image fills box without stretching */
    background-color: #f0f0f0;
}

.book-card-content {
    padding: 15px;
    text-align: center;
}

.book-card h4 {
    margin: 5px 0;
    font-size: 1.1rem;
    font-weight: 700;
}

.book-card p {
    margin: 0;
    color: #777;
    font-size: 0.9rem;
}

/* --- 7. BOOK DETAIL PAGE --- */
.book-container {
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
    padding: 40px;
    margin-bottom: 40px;
}

.book-details-container {
    display: flex;
    gap: 50px;
    margin-top: 30px;
}

.book-cover {
    flex: 0 0 350px;
}

.book-cover img {
    width: 100%;
    border-radius: 8px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

.book-info {
    flex: 1;
}

.book-info h3 {
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.book-info ul {
    list-style: none;
    padding: 0;
    margin-bottom: 40px;
}

.book-info li {
    padding: 12px 0;
    border-bottom: 1px solid #eee;
    color: #555;
    display: flex;
    justify-content: space-between;
}

.book-info li strong {
    color: #2c3e50;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.book-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 30px;
    font-size: 1rem;
    font-weight: bold;
    text-decoration: none !important;
    border-radius: 8px;
    color: #ffffff !important;
    border: none;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.book-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

.btn-read { background-color: #28a745; }
.btn-read:hover { background-color: #218838; }

.btn-download { background-color: #007bff; }
.btn-download:hover { background-color: #0069d9; }

@media (max-width: 768px) {
    .book-details-container { flex-direction: column; align-items: center; }
    .book-cover { width: 100%; max-width: 250px; }
    .book-btn { width: 100%; }
}

/* --- 8. SEO CONTENT BOXES --- */
.seo-description-box {
    background-color: white;
    padding: 30px;
    border-radius: 12px;
    border: 1px solid #eee;
    margin-bottom: 40px;
    color: #444;
    font-size: 1rem;
    line-height: 1.8;
}

.seo-description-box h3 {
    margin-top: 1.5rem;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 0.5rem;
    color: #004a99;
}

/* --- 9. INTERLINKING (Book Page) --- */
.interlink-section {
    background-color: white;
    padding: 30px;
    border-radius: 12px;
    border: 1px solid #eee;
    text-align: center;
    margin-bottom: 40px;
}

.std-tags {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin-top: 20px;
}

.std-tag {
    background-color: #f0f4f8;
    color: #004a99;
    padding: 10px 20px;
    border-radius: 30px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s;
    border: 1px solid #dbe2e8;
}

.std-tag:hover {
    background-color: #004a99;
    color: white;
    transform: translateY(-2px);
}

/* --- 10. FOOTER & REQUEST BANNER --- */
.request-banner {
    background-color: white;
    border-top: 4px solid #007bff;
    padding: 50px 20px;
    margin-top: 30px; /* Reduced from 60px to 30px */
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 20px;
    box-shadow: 0 -5px 20px rgba(0,0,0,0.03);
}

.request-content h3 { font-size: 1.8rem; margin-bottom: 10px; }
.request-content p { color: #666; max-width: 600px; margin: 0; }

.btn-request {
    background-color: #007bff;
    color: white !important;
    padding: 15px 40px;
    font-size: 1.1rem;
    font-weight: bold;
    text-decoration: none !important;
    border-radius: 50px;
    transition: all 0.3s;
    box-shadow: 0 5px 15px rgba(0,123,255,0.3);
}

.btn-request:hover {
    background-color: #0056b3;
    transform: translateY(-3px);
}

footer {
    background-color: #2c3e50;
    color: #ddd;
    padding: 20px 10px; /* Reduced height padding */
    margin-top: 0;
    text-align: center; /* Centered Text */
}

/* --- 11. HOME PAGE SPECIFIC --- */
.seo-content-top { 
    text-align: center; 
    margin: 20px 0 30px 0; /* Reduced space around heading */
}
.seo-content-top h1 { font-size: 2.8rem; color: #2c3e50; margin-bottom: 20px; }
.seo-content-top p { font-size: 1.2rem; color: #666; max-width: 800px; margin: 0 auto; }

.std-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
}

.std-card {
    background: white;
    padding: 40px 20px;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.05);
    text-decoration: none;
    color: #333;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: transform 0.3s;
    border: 1px solid #f0f0f0;
}

.std-card:hover {
    transform: translateY(-10px);
    border-color: #007bff;
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
}

.std-number {
    font-size: 3.5rem;
    font-weight: 800;
    color: #007bff;
    line-height: 1;
    margin-bottom: 15px;
}

/* --- 12. MOBILE OPTIMIZATIONS (Compact View) --- */
@media (max-width: 600px) {
    
    /* Home Page: 3 Columns Compact */
    .std-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 10px !important;
    }
    .std-card { padding: 15px 5px !important; border-radius: 8px; }
    .std-number { font-size: 1.8rem !important; margin-bottom: 5px !important; }
    .std-card h3 { font-size: 0.8rem !important; text-align: center; }

    /* Book Grid: 2 Columns Compact */
    .book-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }
    .book-card img { height: 160px !important; }
    .book-card-content { padding: 10px !important; }
    .book-card h4 { font-size: 0.9rem !important; margin-bottom: 4px; }
    .book-card p { font-size: 0.75rem !important; }

    /* Filter Buttons */
    .filter-container { gap: 8px !important; margin-bottom: 20px !important; }
    .filter-btn { padding: 8px 16px !important; font-size: 0.85rem !important; }

    /* General */
    h1 { font-size: 1.8rem !important; }
    h2 { font-size: 1.5rem !important; }
    .book-container { padding: 20px; }
}