/* css/style.css */

:root {
    /* Primary brand colors */
    --primary-color: #1ABC9C; /* A fresh turquoise/teal */
    --secondary-color: #7f8c8d; /* A soft, warm gray */

    /* Alert/Action Colors (Modernized) */
    --success-color: #27AE60; /* Emerald Green */
    --danger-color: #E74C3C; /* Alizarin Red */
    --warning-color: #F39C12; /* Orange */
    --info-color: #3498DB; /* Peter River Blue */

    /* Backgrounds */
    --light-bg: #ecf0f1; /* Very light gray for main content background */
    --dark-bg: #2C3E50; /* Deep blue-gray for dark sections like navbar/footer */
    --card-bg: #ffffff; /* White Card Background - often kept white for readability */
    --auth-bg: #DDE6ED; /* Soft light blue-gray for auth pages */

    /* Text and Borders */
    --text-color: #34495E; /* Dark text for light backgrounds (Wet Asphalt) */
    --light-text-color: #ECF0F1; /* Very light text for dark backgrounds (Clouds) */
    --border-color: #bdc3c7; /* Lighter gray for borders */
    --input-border-focus: #1ABC9C; /* Matches primary color for input focus */

    /* Font and General Styling */
    --font-family: 'Poppins', sans-serif; /* Modern, readable font */
    --border-radius: 8px; /* Slightly larger radius for softer look */
    --box-shadow: 0 4px 10px rgba(0,0,0,0.08); /* Softened shadow */
    --transition-speed: 0.3s; /* For smooth transitions */
}

/* Import Google Font - Poppins */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

/* ... (the rest of your style.css content remains the same) ... */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--light-bg);
    -webkit-font-smoothing: antialiased; /* Smoother fonts */
    scroll-behavior: smooth; /* Smooth scrolling for anchor links */
}

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

main {
    min-height: calc(100vh - 120px); /* Adjust based on actual header/footer height */
    padding-top: 20px; /* Add some general padding below header */
    padding-bottom: 20px; /* Add some general padding above footer */
}

h1, h2, h3, h4, h5, h6 {
    margin-bottom: 0.5em;
    font-weight: 600;
    color: var(--dark-bg); /* Darker heading color */
}

p {
    margin-bottom: 1em;
}

a {
    text-decoration: none;
    color: var(--primary-color);
    transition: color var(--transition-speed) ease;
}

a:hover {
    color: #0056b3; /* Darker blue */
    text-decoration: underline;
}


ul {
    list-style: none;
}

/* --------------------------------------------------- */
/* 2. Buttons & Form Elements                          */
/* --------------------------------------------------- */

.btn {
    display: inline-block;
    padding: 12px 25px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    text-align: center;
    transition: background-color var(--transition-speed) ease, transform 0.1s ease;
    white-space: nowrap; /* Prevent button text from wrapping */
}

.btn:hover {
    transform: translateY(-2px);
    text-decoration: none; /* Remove underline on hover for buttons */
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--light-text-color);
}
.btn-primary:hover {
    background-color: #0056b3; /* Darker blue */
}

.btn-success {
    background-color: var(--success-color);
    color: var(--light-text-color);
}
.btn-success:hover {
    background-color: #218838; /* Darker green */
}

.btn-danger {
    background-color: var(--danger-color);
    color: var(--light-text-color);
}
.btn-danger:hover {
    background-color: #c82333; /* Darker red */
}

.btn-info {
    background-color: var(--info-color);
    color: var(--light-text-color);
}
.btn-info:hover {
    background-color: #138496; /* Darker cyan */
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: var(--light-text-color);
}
.btn-secondary:hover {
    background-color: #5a6268;
}

/* Small button variant */
.btn-sm {
    padding: 8px 15px;
    font-size: 0.85rem;
    border-radius: 5px;
}

/* Form Group & Inputs */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-color);
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group input[type="number"],
.form-group input[type="file"],
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    outline: none;
    transition: border-color var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25); /* Bootstrap-like focus glow */
}

.form-group textarea {
    resize: vertical; /* Allow vertical resizing */
    min-height: 100px;
}

/* --------------------------------------------------- */
/* 3. Navigation Bar (User & Admin Common)            */
/* --------------------------------------------------- */

.navbar {
    background-color: var(--dark-bg);
    color: var(--light-text-color);
    padding: 1rem 0;
    box-shadow: var(--box-shadow);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap; /* Allows wrapping for mobile */
}

.navbar .logo {
    color: var(--light-text-color);
    font-size: 1.8rem; /* Default size for larger screens */
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex; /* To align logo image and text */
    align-items: center;
    gap: 10px; /* Space between logo image and text */
}

.navbar .logo img {
    height: 40px; /* Adjust as needed for desktop */
    vertical-align: middle; /* Helps align with text */
}


.navbar .menu-toggle {
    display: none; /* Hidden on desktop */
    background: none;
    border: none;
    color: var(--light-text-color);
    font-size: 1.7rem;
    cursor: pointer;
    padding: 5px; /* Increase clickable area */
}

.navbar .nav-links {
    display: flex;
    gap: 25px;
}

.navbar .nav-links li a {
    color: var(--light-text-color);
    padding: 8px 15px;
    border-radius: var(--border-radius);
    transition: background-color var(--transition-speed) ease;
}

.navbar .nav-links li a:hover {
    background-color: rgba(255, 255, 255, 0.15); /* Lighter hover effect */
    text-decoration: none;
}

/* Specific button in navigation */
.admin-login-btn {
    background-color: var(--primary-color);
    padding: 8px 18px; /* Slightly larger padding */
    border-radius: var(--border-radius);
    transition: background-color var(--transition-speed) ease;
    font-weight: 500;
}
.admin-login-btn:hover {
    background-color: #0056b3;
    text-decoration: none;
    transform: translateY(-1px); /* Slight lift on hover */
}

/* --------------------------------------------------- */
/* 4. Hero Section (User Home Page)                    */
/* --------------------------------------------------- */

.hero {
    background: linear-gradient(rgba(0,0,0,0.6), rgba(0,0,0,0.6)), url('../uploads/hero-bg.jpg') no-repeat center center/cover;
    color: var(--light-text-color);
    text-align: center;
    padding: 100px 20px;
    min-height: 450px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative; /* For potential overlay effects */
}

.hero h1 {
    font-size: 3.5rem;
    margin-bottom: 25px;
    font-weight: 700;
    color: var(--light-text-color);
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.hero p {
    font-size: 1.3rem;
    margin-bottom: 40px;
    font-weight: 300;
    color: rgba(255,255,255,0.9);
}

.search-bar {
    display: flex;
    justify-content: center;
    max-width: 650px; /* Limit width for a cleaner look */
    margin: 0 auto; /* Center the search bar */
    border-radius: 50px; /* Fully rounded ends */
    overflow: hidden; /* Ensures contents respect border-radius */
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2); /* Deeper shadow for "floating" effect */
    background-color: #fff; /* White background for the bar */
    transition: box-shadow 0.3s ease;
}

.search-bar:focus-within {
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.3), 0 0 0 4px var(--primary-color-light); /* Highlight on focus */
}

.search-bar input[type="text"] {
    flex-grow: 1; /* Allows input to take up available space */
    border: none; /* Remove default border */
    padding: 15px 25px; /* Ample padding */
    font-size: 1.1rem; /* Readable font size */
    outline: none; /* Remove focus outline */
    background-color: transparent; /* Match parent background */
    color: #333;
}

.search-bar input[type="text"]::placeholder {
    color: #888; /* Softer placeholder text */
}

.search-bar button[type="submit"] {
    background-color: var(--primary-color); /* Use your theme's primary color */
    color: #fff;
    border: none;
    padding: 15px 30px; /* Match input padding, slightly more horizontal */
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.search-bar button[type="submit"]:hover {
    background-color: #0056b3;
    transform: scale(1.05); /* Slight grow effect */
}

.search-bar button[type="submit"] i {
    font-size: 1.3rem; /* Make the icon slightly larger */
}

/* --------------------------------------------------- */
/* 5. Book List Section (User Home Page)               */
/* --------------------------------------------------- */


.book-list-section {
    padding: 60px 0;
    background-color: var(--light-bg);
}

.book-list-section h2 {
    text-align: center;
    margin-bottom: 50px;
    font-size: 2.8rem;
    color: var(--primary-color);
    position: relative;
    padding-bottom: 10px;
}

.book-list-section h2::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background-color: var(--primary-color);
    border-radius: 2px;
}

.book-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); /* Slightly larger cards */
    gap: 35px; /* Increased gap */
}

.book-card {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    overflow: hidden;
    transition: transform var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
    text-align: center;
    display: flex;
    flex-direction: column;
}

.book-card:hover {
    transform: translateY(-7px); /* More pronounced lift */
    box-shadow: 0 8px 20px rgba(0,0,0,0.15); /* Stronger shadow on hover */
}

.book-card img {
    width: 100%;
    height: 350px; /* Fixed height for consistent look */
    object-fit: cover; /* Ensures image covers area without distortion */
    border-bottom: 1px solid var(--border-color);
    transition: transform 0.3s ease; /* Slight zoom on image hover */
}
.book-card:hover img {
    transform: scale(1.03);
}


.book-card-content {
    padding: 20px;
    flex-grow: 1; /* Allows content to push button to bottom */
    display: flex;
    flex-direction: column;
    justify-content: space-between; /* Distribute space */
}

.book-card-content h3 {
    font-size: 1.6rem;
    margin-bottom: 10px;
    color: var(--dark-bg);
    white-space: nowrap; /* Prevent title wrap */
    overflow: hidden;
    text-overflow: ellipsis; /* Add ellipsis for long titles */
}

.book-card-content p {
    color: var(--secondary-color);
    font-size: 0.95rem;
    margin-bottom: 12px;
}

.book-card-content .btn {
    width: 100%;
    margin-top: auto; /* Push button to the bottom */
}

.no-results {
    text-align: center;
    padding: 50px 20px;
    font-size: 1.3rem;
    color: var(--secondary-color);
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}


/* --------------------------------------------------- */
/* 6. Book Details Page (User View)                    */
/* --------------------------------------------------- */

.book-details {
    padding: 60px 0;
    background-color: var(--light-bg);
}

.book-detail-card {
    display: flex;
    flex-direction: row; /* Default to row on larger screens */
    gap: 40px; /* Increased gap */
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 40px; /* More internal padding */
    align-items: flex-start; /* Align items to the top */
}

.book-detail-card img {
    max-width: 350px; /* Larger image on details page */
    width: 100%;
    height: auto;
    border-radius: var(--border-radius);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    flex-shrink: 0; /* Prevent image from shrinking */
}

.book-info {
    flex-grow: 1;
}

.book-info h1 {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.book-info h2 {
    font-size: 2rem;
    color: var(--secondary-color);
    margin-bottom: 25px;
    font-weight: 400;
}

.book-info p {
    margin-bottom: 15px;
    line-height: 1.8;
    font-size: 1.05rem;
}

.book-info p strong {
    color: var(--dark-bg);
    font-weight: 600;
    margin-right: 5px;
}

.book-info h3 {
    font-size: 1.8rem;
    color: var(--primary-color);
    margin-top: 30px;
    margin-bottom: 15px;
}

/* --------------------------------------------------- */
/* 7. Authentication Pages (Login & Register)          */
/* --------------------------------------------------- */

.auth-header {
    background-color: var(--dark-bg);
    color: var(--light-text-color);
    padding: 1rem 0;
    box-shadow: var(--box-shadow);
    text-align: center;
}

.auth-header .logo {
    color: var(--light-text-color);
    font-size: 1.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-decoration: none;
}

.auth-main {
    min-height: calc(100vh - 120px); /* Adjust based on header/footer height */
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px 0; /* Add generous padding */
    background: var(--auth-bg); /* Specific background for auth pages */
}

.auth-form-section {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.auth-card {
    background-color: var(--card-bg);
    padding: 40px; /* More internal padding */
    border-radius: var(--border-radius);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15); /* More prominent shadow */
    width: 100%;
    max-width: 450px; /* Slightly wider for better layout */
    text-align: center;
    animation: fadeIn 0.8s ease-out; /* Simple fade-in animation */
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.auth-card h2 {
    margin-bottom: 25px;
    color: var(--primary-color);
    font-size: 2.2rem;
    font-weight: 700;
}

.auth-card p {
    margin-bottom: 25px;
    color: var(--secondary-color);
    font-size: 1.05rem;
}

.auth-card .btn {
    width: 100%;
    padding: 14px; /* Larger button */
    font-size: 1.15rem;
    margin-top: 20px; /* More spacing above button */
}

.auth-card .mt-3 {
    margin-top: 20px;
    font-size: 1rem;
    color: var(--secondary-color);
}

.auth-card .mt-3 a {
    font-weight: 600;
}

/* --------------------------------------------------- */
/* 8. Messages (Success/Danger)                        */
/* --------------------------------------------------- */

.message {
    margin-top: 20px; /* More space above message */
    padding: 12px 18px; /* More padding */
    border-radius: var(--border-radius);
    font-size: 0.95rem;
    text-align: center;
    border: 1px solid transparent; /* Default transparent border */
    animation: slideInFromTop 0.5s ease-out; /* Simple animation */
}

.message.success {
    background-color: #d4edda; /* Light green */
    color: #155724; /* Dark green */
    border-color: #c3e6cb;
}

.message.danger {
    background-color: #f8d7da; /* Light red */
    color: #721c24; /* Dark red */
    border-color: #f5c6cb;
}

@keyframes slideInFromTop {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --------------------------------------------------- */
/* 9. Footer                                           */
/* --------------------------------------------------- */

footer {
    background-color: var(--dark-bg);
    color: var(--light-text-color);
    padding: 30px 0;
    text-align: center;
    font-size: 0.95rem;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05); /* Subtle shadow on top */
}

footer .social-links {
    margin-top: 20px;
    margin-bottom: 10px;
}

footer .social-links a {
    color: var(--light-text-color);
    font-size: 1.6rem;
    margin: 0 12px;
    transition: color var(--transition-speed) ease, transform 0.1s ease;
}

footer .social-links a:hover {
    color: var(--primary-color);
    transform: translateY(-3px);
}

/* --------------------------------------------------- */
/* 10. Responsive Design (Media Queries)               */
/* --------------------------------------------------- */

@media (max-width: 992px) { /* Tablets and smaller desktops */
    .hero h1 {
        font-size: 2.8rem;
    }
    .hero p {
        font-size: 1.1rem;
    }
    .book-grid {
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
        gap: 25px;
    }
    .book-detail-card {
        flex-direction: column; /* Stack on smaller screens */
        align-items: center; /* Center items when stacked */
    }
    .book-detail-card img {
        max-width: 300px;
        margin-bottom: 20px;
    }
    .book-info h1 {
        font-size: 2.2rem;
    }
    .book-info h2 {
        font-size: 1.6rem;
    }
    /* Adjust arrow position for smaller screens if needed */
    .scroll-arrow {
        top: 85px; /* Adjust if image height changes in media queries */
    }
}

@media (max-width: 768px) { /* Larger smartphones and small tablets */
    .navbar .menu-toggle {
        display: block; /* Show toggle button */
    }

    .navbar .nav-links {
        display: none; /* Hide navigation links by default */
        flex-direction: column;
        width: 100%;
        background-color: var(--dark-bg);
        position: absolute;
        top: 70px; /* Adjust based on header height */
        left: 0;
        padding: 10px 20px;
        box-shadow: var(--box-shadow);
        z-index: 1000;
    }

    .navbar .nav-links.active {
        display: flex; /* Show when active */
    }

    .navbar .nav-links li {
        width: 100%;
        text-align: center;
        margin: 10px 0;
    }
    .navbar .nav-links li a {
        padding: 12px 15px;
    }

    .hero {
        padding: 80px 15px;
        min-height: 350px;
    }
    .hero h1 {
        font-size: 2.5rem;
    }
    .hero p {
        font-size: 1rem;
    }

    /* --- UPDATED SEARCH BAR FOR MOBILE --- */
    .search-container { /* Added this for search bar on category_books.php */
        margin-bottom: 25px;
        padding: 15px;
        background-color: var(--card-bg);
        border-radius: var(--border-radius);
        box-shadow: var(--box-shadow);
        display: flex; /* Ensure it's a flex container */
        justify-content: center; /* Center its content */
    }

    .search-form {
        display: flex;
        flex-wrap: nowrap; /* Prevent wrapping */
        max-width: 95%; /* Allow it to take up almost full width on mobile */
        margin: 0 auto; /* Center it */
        border-radius: 50px; /* Keep full rounding for the overall bar */
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
        padding: 0 5px; /* Small horizontal padding inside the bar for visual breathing room */
        background-color: #fff; /* White background for the bar */
    }
    
    .search-form input[type="text"] {
        flex-grow: 1; /* Allow input to take available space */
        flex-shrink: 1; /* Allow input to shrink if needed */
        min-width: 0; /* Very Important: Allows the input to shrink smaller than its content */
        padding: 12px 15px; /* Adjusted padding for mobile */
        font-size: 1rem; /* Adjusted font size for mobile */
        border-radius: 50px 0 0 50px; /* Round left side only for seamless look */
        border: none; /* Remove default border */
        outline: none; /* Remove focus outline */
        background-color: transparent; /* Match parent background */
        color: #333;
    }
    
    .search-form button {
        flex-shrink: 0; /* Important: Prevent the button from shrinking */
        padding: 12px 20px; /* Adjusted padding for mobile */
        font-size: 1rem; /* Adjusted font size for mobile */
        border-radius: 0 50px 50px 0; /* Round right side only for seamless look */
        border: none;
        background-color: var(--primary-color);
        color: var(--light-text-color);
        cursor: pointer;
        transition: background-color var(--transition-speed) ease, transform 0.2s ease;
    }
    .search-form button:hover {
        background-color: #0056b3;
        transform: scale(1.05);
    }
    .search-form .clear-search-button { /* Style for the clear button */
        background-color: var(--secondary-color);
        color: var(--light-text-color);
        border-radius: 50px; /* Full round for clear button */
        margin-left: 10px; /* Space from search button */
        padding: 12px 15px; /* Adjust padding */
    }
    .search-form .clear-search-button:hover {
        background-color: #5a6268;
        transform: scale(1.05);
    }
    /* --- END UPDATED SEARCH BAR --- */

    .book-list-section,
    .book-details,
    .auth-main {
        padding: 40px 0;
    }

    .book-list-section h2 {
        font-size: 2.2rem;
        margin-bottom: 30px;
    }

    .book-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); /* Smaller cards */
        gap: 20px;
    }
    .book-card img {
        height: 250px; /* Smaller height for mobile cards */
    }

    .book-detail-card {
        padding: 25px;
        gap: 25px;
    }
    .book-detail-card img {
        max-width: 250px;
    }
    .book-info h1 {
        font-size: 2rem;
    }
    .book-info h2 {
        font-size: 1.4rem;
    }
    .book-info h3 {
        font-size: 1.6rem;
        margin-top: 20px;
        margin-bottom: 10px;
    }

    .auth-card {
        padding: 30px;
        margin: 0 15px;
    }
    .auth-card h2 {
        font-size: 2rem;
    }
    .auth-card p {
        font-size: 0.95rem;
    }
    .auth-card .btn {
        padding: 12px;
        font-size: 1rem;
    }

    footer .social-links a {
        font-size: 1.4rem;
        margin: 0 8px;
    }

    .scroll-wrapper {
        padding: 0 30px;
    }
    .scroll-arrow {
        width: 35px;
        height: 35px;
        font-size: 1.4em;
        top: 85px;
    }
    .book-card-horizontal img {
        height: 200px;
    }
    .book-card-horizontal {
        height: auto;
        width: 150px;
    }
    /* --- NEW/ADJUSTED: Logo size for tablets/larger phones --- */
    .navbar .logo {
        font-size: 1.6rem; /* Slightly smaller for this breakpoint */
    }
    .navbar .logo img {
        height: 35px; /* Adjust logo image height for tablets/larger phones */
    }
}

@media (max-width: 480px) { /* Smaller smartphones */
    .container {
        padding: 0 15px;
    }
    /* --- NEW/ADJUSTED: Logo size for smaller phones --- */
    .navbar .logo {
        font-size: 1.3rem; /* Even smaller to ensure it fits well */
    }
    .navbar .logo img {
        height: 30px; /* Adjust logo image height for smaller phones */
    }

    .hero h1 {
        font-size: 2rem;
    }
    .hero p {
        font-size: 0.9rem;
    }

    .book-list-section h2 {
        font-size: 1.8rem;
    }

    .book-grid {
        grid-template-columns: 1fr;
    }
    .book-card img {
        height: 280px;
    }

    .book-info h1 {
        font-size: 1.8rem;
    }
    .book-info h2 {
        font-size: 1.2rem;
    }

    .auth-card h2 {
        font-size: 1.8rem;
    }
    .auth-card p {
        font-size: 0.95rem;
    }
    .auth-card .btn {
        padding: 12px;
        font-size: 1rem;
    }

    footer .social-links a {
        font-size: 1.4rem;
        margin: 0 8px;
    }

    .scroll-wrapper {
        padding: 0 15px;
    }
    .scroll-arrow {
        width: 30px;
        height: 30px;
        font-size: 1.2em;
        top: 70px;
    }
    .book-card-horizontal {
        width: 120px;
    }
    .book-card-horizontal img {
        height: 160px;
    }

    /* FURTHER ADJUSTMENTS FOR VERY SMALL SCREENS (480px) */
    .search-bar input[type="text"] {
        padding: 10px 12px;
        font-size: 0.85rem;
    }
    .search-bar button {
        padding: 10px 15px;
        font-size: 0.85rem;
    }
    .search-bar button i {
        font-size: 1rem;
    }
}

/* Styles for success/error messages */
.alert {
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid transparent;
    border-radius: 4px;
    font-weight: bold;
}

.alert-success {
    color: #3c763d;
    background-color: #dff0d8;
    border-color: #d6e9c6;
}

.alert-danger {
    color: #a94442;
    background-color: #f2dede;
    border-color: #ebccd1;
}

.alert-warning { /* Optional, if you use 'warning' status as in add_book.php */
    color: #8a6d3b;
    background-color: #fcf8e3;
    border-color: #faebcc;
}

/* For center alignment */
.text-center {
    text-align: center;
}

/* Styles for book cover thumbnails in the table */
.book-cover-thumbnail {
    width: 50px; /* Adjust as needed */
    height: auto; /* Maintain aspect ratio */
    display: block; /* Ensures it takes its own line */
    margin: 0 auto; /* Center the image in its cell */
    border: 1px solid #ddd; /* Optional: Add a subtle border */
    border-radius: 3px; /* Optional: Slightly rounded corners */
}

/* Adjust table cell padding for images if needed */
.data-table td {
    vertical-align: middle; /* Align content vertically in the middle */
}

/* Custom Popup Styles */
.custom-popup-overlay {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 1000; /* Sit on top */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed */
    background-color: rgba(0,0,0,0.6); /* Black w/ opacity */
    justify-content: center; /* Center horizontally */
    align-items: center; /* Center vertically */
    backdrop-filter: blur(5px); /* Optional blur effect */
    -webkit-backdrop-filter: blur(5px); /* Safari support */
}

.custom-popup-content {
    background-color: #fefefe;
    margin: auto;
    padding: 30px;
    border: 1px solid #888;
    width: 80%; /* Could be max-width for responsiveness */
    max-width: 400px; /* Max width for desktop */
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    position: relative;
    text-align: center;
    animation: fadeInScale 0.3s ease-out; /* Simple animation */
}

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


.custom-popup-close-btn {
    color: #aaa;
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.custom-popup-close-btn:hover,
.custom-popup-close-btn:focus {
    color: #000;
    text-decoration: none;
    cursor: pointer;
}

.custom-popup-message {
    margin-bottom: 20px;
    font-size: 1.1em;
    line-height: 1.5;
}

.custom-popup-message.success {
    color: var(--success-color, #28a745); /* Green */
}

.custom-popup-message.danger {
    color: var(--danger-color, #dc3545); /* Red */
}

.custom-popup-message.info {
    color: var(--info-color, #17a2b8); /* Blue */
}

.custom-popup-ok-btn {
    background-color: var(--primary-color, #007bff); /* Blue, adjust as per your theme */
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.2s ease;
}

.custom-popup-ok-btn:hover {
    background-color: #0056b3;
}

/* Optional: Make it responsive for smaller screens */
@media (max-width: 600px) {
    .custom-popup-content {
        width: 95%;
        padding: 20px;
    }
}

/* --------------------------------------------------- */
/* UPDATED: Horizontal Scroll & Arrow Styles           */
/* --------------------------------------------------- */

.category-section {
    margin-bottom: 40px; /* Space between different category rows */
}

.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-right: 40px; /* Align with scroll-wrapper padding */
    padding-left: 40px; /* Align with scroll-wrapper padding */
    flex-wrap: nowrap; /* IMPORTANT: Ensures title and button stay on one line */
    min-height: 40px; /* Provide a minimum height for consistent header layout */
}

.category-header h3 {
    font-size: 1.8em;
    color: var(--dark-bg);
    margin: 0; /* Reset margin */
    white-space: nowrap; /* Prevent title from wrapping */
    overflow: hidden;
    text-overflow: ellipsis; /* Add ellipsis for long titles */
    padding-right: 15px; /* Space between title and button */
}

.category-header .btn {
    flex-shrink: 0; /* Prevent the button from shrinking */
}

/* Wrapper for scrollable content and arrows */
.scroll-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden; /* Hide overflowing content from arrows */
    padding: 0 40px; /* Padding to make space for arrows outside scroll area */
    box-sizing: border-box; /* Ensure padding is included in the width */
}

/* Horizontal Scroll Container */
.book-scroll-container {
    display: flex;
    overflow-x: auto; /* Enable horizontal scrolling */
    white-space: nowrap; /* Keep items in a single line */
    scroll-behavior: smooth; /* Smooth scrolling effect */
    -webkit-overflow-scrolling: touch; /* For smoother scrolling on iOS devices */
    scrollbar-width: none; /* Hide scrollbar for Firefox */
    -ms-overflow-style: none;  /* Hide scrollbar for IE and Edge */
    padding-bottom: 10px; /* Space for potential scrollbar if not hidden or for bottom shadow */
    gap: 15px; /* Spacing between horizontal book cards */
}

/* Hide scrollbar for WebKit browsers (Chrome, Safari) */
.book-scroll-container::-webkit-scrollbar {
    display: none;
}

/* Style for each book card within the horizontal scroll */
.book-card-horizontal {
    flex: 0 0 auto; /* Prevent items from shrinking, allow them to grow */
    width: 180px; /* Fixed width for consistent card size */
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease-in-out;
    text-align: center;
    display: flex; /* Use flex to arrange image and content vertically */
    flex-direction: column;
    text-decoration: none; /* Remove underline from the <a> tag */
    color: var(--text-color); /* Default text color */
    overflow: hidden; /* Ensure content doesn't overflow rounded corners */
}

.book-card-horizontal:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.book-card-horizontal a {
    display: flex; /* Make the anchor tag a flex container */
    flex-direction: column;
    height: 100%; /* Ensure the anchor fills the card */
    text-decoration: none;
    color: inherit;
}

.book-card-horizontal img {
    width: 100%;
    height: 250px; /* Fixed height for cover images to ensure uniformity */
    object-fit: cover; /* Cover the area, cropping if necessary */
    border-bottom: 1px solid var(--border-color); /* Separator between image and text */
    transition: transform 0.3s ease; /* Slight zoom on image hover */
    border-top-left-radius: var(--border-radius); /* Apply radius to image top */
    border-top-right-radius: var(--border-radius);
}

.book-card-horizontal:hover img {
    transform: scale(1.03);
}

.book-card-horizontal-content {
    padding: 10px;
    flex-grow: 1; /* Allows content area to expand and push author down */
    display: flex;
    flex-direction: column;
    justify-content: space-between; /* Push author to the bottom if needed */
    width: 100%; /* Ensure content takes full width */
    white-space: normal; /* Allow text to wrap within content box */
}

.book-card-horizontal-content h4 {
    font-size: 1.1em;
    margin-top: 0;
    margin-bottom: 5px;
    color: var(--dark-bg);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* Limit title to 2 lines */
    -webkit-box-orient: vertical;
}

.book-card-horizontal-content .book-author {
    font-size: 0.9em;
    color: var(--secondary-color);
    margin-bottom: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 1; /* Limit author to 1 line */
    -webkit-box-orient: vertical;
}

/* Styles for the scroll arrows */
.scroll-arrow {
    position: absolute;
    /* Calculated to center on the 250px image height: (250px / 2) - (arrow_height / 2) = 125 - (45px / 2) = 102.5px */
    top: 102.5px;
    background-color: rgba(0, 0, 0, 0.7); /* Slightly darker, more prominent */
    color: white;
    border: none;
    cursor: pointer;
    z-index: 10; /* Ensure arrows are above book cards */
    font-size: 1.8em; /* Slightly larger icon */
    border-radius: 50%; /* Make them round */
    width: 45px; /* Fixed width and height for round shape */
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease, opacity 0.3s ease, transform 0.2s ease; /* Add transform to transition */
    opacity: 1; /* Default visible */
    box-shadow: 0 4px 10px rgba(0,0,0,0.3); /* Prominent shadow for depth */
}

.scroll-arrow:hover {
    background-color: rgba(0, 0, 0, 0.9); /* Darker on hover */
    transform: scale(1.05); /* Slight scale effect on hover */
}

.scroll-arrow:focus {
    outline: 2px solid var(--primary-color); /* Accessibility focus outline */
    outline-offset: 2px;
}

.scroll-arrow.left-arrow {
    left: 0; /* Position left arrow */
}

.scroll-arrow.right-arrow {
    right: 0; /* Position right arrow */
}

/* Hide arrows when content doesn't overflow or at scroll limits (controlled by JS) */
.scroll-arrow[style*="opacity: 0"] {
    cursor: default;
    pointer-events: none; /* Disable clicks when fully transparent */
}

/* Style for the "See All" card at the end of the horizontal scroll */
.book-card-horizontal.see-all-card {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f8f8f8;
    border: 1px dashed #ccc;
    font-weight: bold;
    color: #555;
    min-width: 180px; /* Match other cards */
    max-width: 220px;
    /* Height should match the calculated height of a regular book-card-horizontal */
    /* Image height (250px) + content padding (20px top/bottom) + text content (~40-60px) */
    /* Let's keep it auto for flexibility or set a value close to actual content height */
    height: auto; /* This allows it to stretch with content, or set a fixed max-height: 330px; */
    min-height: 330px; /* Example min-height to match typical book card if content is short */
    flex-direction: column; /* Keep column for vertical centering of button */
    text-align: center;
    box-shadow: none;
    transition: background-color 0.2s ease;
}

.book-card-horizontal.see-all-card:hover {
    background-color: #eee;
    transform: none; /* No translateY for this card */
    box-shadow: none;
}

.book-card-horizontal.see-all-card .btn {
    width: 90%; /* Button takes most of the width */
    margin: 0; /* Reset margin from previous book-card-content rules */
}

/* Ensure the main book-grid (for genre_books.php or overall index search results) still works */
.book-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    padding: 20px 0;
}

/* If you want the search results to appear below the genres on index.php: */
#book-list {
    margin-top: 40px;
    border-top: 1px solid #eee;
    padding-top: 20px;
}

/* Basic styling for the new genre page hero */
.genre-page-hero {
    background-color: var(--secondary-color);
    color: #fff;
    padding: 40px 0;
    text-align: center;
    margin-bottom: 30px;
}

.genre-page-hero h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

.genre-page-hero p {
    font-size: 1.1em;
    opacity: 0.9;
}

/* --- Core Book Detail Card Styling --- */
#book-detail-content {
    display: flex;
    flex-direction: column; /* Default for smaller screens */
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    padding: 25px; /* Added padding for content and button spacing */
    position: relative; /* THIS IS CRUCIAL: Makes it a positioning context for children */
    overflow: hidden; /* Ensures absolutely positioned elements don't overflow unexpectedly */
}

/* Adjust for larger screens */
@media (min-width: 768px) {
    #book-detail-content {
        flex-direction: row;
        align-items: flex-start;
    }

    #book-detail-content img {
        flex-shrink: 0;
        width: 250px; /* Adjust as needed */
        height: auto;
        border-radius: 8px;
        margin-right: 30px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }
}


/* --- Styles for the Modern Close/Back Button on Book Details Page --- */
.close-button-container {
    /* Position the button absolutely within the #book-detail-content card */
    position: absolute;
    top: 20px;   /* Distance from the top edge of the card */
    right: 20px; /* Distance from the right edge of the card */
    z-index: 10; /* Ensure it stays above other content */
}

.modern-close-btn {
    background-color: #e9ecef; /* Lighter grey for a modern feel */
    color: #495057; /* Dark grey text */
    border: 1px solid #ced4da; /* Subtle border */
    padding: 8px 15px;
    border-radius: 5px; /* Slightly rounded corners */
    cursor: pointer;
    font-size: 0.95rem; /* Slightly smaller text */
    font-weight: 500;
    display: inline-flex; /* Align icon and text */
    align-items: center;
    gap: 8px; /* Space between icon and text */
    transition: all 0.2s ease-in-out; /* Smooth transitions */
    text-decoration: none; /* Ensure it looks like a button even if it were an <a> */
    box-shadow: 0 2px 5px rgba(0,0,0,0.05); /* Subtle shadow for depth */
}

.modern-close-btn:hover,
.modern-close-btn:focus {
    background-color: #dee2e6; /* Darker on hover */
    border-color: #adb5bd;
    color: #212529; /* Darker text on hover */
    box-shadow: 0 4px 8px rgba(0,0,0,0.1); /* Slightly more prominent shadow on hover */
    transform: translateY(-1px); /* Slight lift effect */
}

/* Optional: If you prefer a circular 'X' button */
/*
.modern-close-btn.close-x-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
    font-size: 1.2rem;
    background-color: #f8d7da; /* Light red for close */
    color: #721c24; /* Dark red text */
    border-color: #f5c6cb;
}
.modern-close-btn.close-x-btn:hover {
    background-color: #f5c6cb;
    border-color: #f1b0b7;
    color: #721c24;
}
*/

/* --- Other existing styles that might need adjustment for spacing if the button pushes content --- */
/* You might need to adjust padding-top on book-info or image if the button overlaps */
#book-detail-content img + .book-info {
    margin-top: 0; /* Reset potential default margins if flexbox handles spacing */
    padding-top: 10px; /* Add some top padding to book-info to clear the button if needed */
}

/* Ensure adequate padding for the card content itself so button doesn't sit too close */
#book-detail-content {
    padding: 25px; /* Already set above, but double check */
}

/* Adjust padding for smaller screens if the button overlaps header */
@media (max-width: 767px) {
    #book-detail-content {
        padding-top: 60px; /* Give space for the absolutely positioned button */
    }
    .close-button-container {
        top: 15px;
        right: 15px;
    }
}

/* Existing hero section styles (if any) */
.hero {
    background: url('https://twinstar.exlonline.com/library/uploads/bg.jpg') no-repeat center center/cover; /* Add a nice background image */
    color: #fff;
    text-align: center;
    padding: 80px 20px; /* Adjust padding as needed */
    min-height: 400px; /* Ensure sufficient height */
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative; /* For overlay if you add one */
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4); /* Dark overlay for text readability */
    z-index: 1;
}

.hero .container {
    z-index: 2; /* Ensure content is above the overlay */
    position: relative;
}

.hero h1 {
    font-size: 3.2rem; /* Larger, more impactful heading */
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5); /* Subtle text shadow */
}

.hero p {
    font-size: 1.3rem; /* Slightly larger paragraph */
    margin-bottom: 30px;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
}

/* Modern Search Bar Styling */
.search-bar {
    display: flex; /* Makes input and button align horizontally */
    max-width: 600px; /* Limit width for a cleaner look */
    margin: 0 auto; /* Center the search bar */
    border-radius: 50px; /* Fully rounded ends */
    overflow: hidden; /* Ensures contents respect border-radius */
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2); /* Deeper shadow for "floating" effect */
    background-color: #fff; /* White background for the bar */
    transition: box-shadow 0.3s ease;
}

.search-bar:focus-within {
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.3), 0 0 0 4px var(--primary-color-light); /* Highlight on focus */
}

.search-bar input[type="text"] {
    flex-grow: 1; /* Allows input to take up available space */
    border: none; /* Remove default border */
    padding: 15px 25px; /* Ample padding */
    font-size: 1.1rem; /* Readable font size */
    outline: none; /* Remove focus outline */
    background-color: transparent; /* Match parent background */
    color: #333;
}

.search-bar input[type="text"]::placeholder {
    color: #888; /* Softer placeholder text */
}

.search-bar button[type="submit"] {
    background-color: var(--primary-color); /* Use your theme's primary color */
    color: #fff;
    border: none;
    padding: 15px 30px; /* Match input padding, slightly more horizontal */
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.search-bar button[type="submit"]:hover {
    background-color: #0056b3;
    transform: scale(1.05); /* Slight grow effect */
}

.search-bar button[type="submit"] i {
    font-size: 1.3rem; /* Make the icon slightly larger */
}

/* ... (existing styles) ... */

@media (max-width: 768px) { /* Larger smartphones and small tablets */
    /* ... (existing rules for .navbar .logo and .navbar .logo img) ... */

    .navbar .logo .logo-text {
        display: none; /* Hide the text portion of the logo */
    }

    /* ... (rest of your 768px media query rules) ... */
}

/* You might want to remove the font-size adjustments for .navbar .logo in mobile breakpoints,
   as the text will now be hidden. The logo image size adjustments will still apply to the image. */
@media (max-width: 768px) {
    /* ... other rules ... */
    /* Remove or comment out these lines if you no longer need them to change text size */
    /* .navbar .logo {
        font-size: 1.6rem;
    } */
    .navbar .logo img {
        height: 35px; /* Keep this to size the image */
    }
    /* ... rest of your rules ... */
}

@media (max-width: 480px) { /* Smaller smartphones */
    /* ... other rules ... */
    /* Remove or comment out these lines if you no longer need them to change text size */
    /* .navbar .logo {
        font-size: 1.3rem;
    } */
    .navbar .logo img {
        height: 30px; /* Keep this to size the image */
    }
    /* ... rest of your rules ... */
}

/* Make sure the image is centered or looks good when text is hidden */
@media (max-width: 768px) {
    .navbar .logo {
        gap: 0; /* Remove gap when text is hidden */
        justify-content: center; /* Center the logo image if it's the only element */
        width: auto; /* Allow it to shrink to content size */
    }
}
