/* ============================= */
/* Global Reset                  */
/* ============================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background-color: #f9fafb;
    color: #333;
}

/* ============================= */
/* Header                        */
/* ============================= */

.header {
    position: fixed;
    top: 0;
    width: 100%;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo {
    width: 40px;
    height: 40px;
}

.logo-text {
    font-weight: bold;
    color: #8B0000;
}

.nav a {
    text-decoration: none;
    font-weight: bold;
    color: #8B0000;
}

/* ============================= */
/* Hero                          */
/* ============================= */

.hero {
    height: 70vh;
    background: url('../Pictures/PUP_BUILDING.png') center/cover no-repeat;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 80px;
    position: relative;
    color: white;
}

.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(139,0,0,0.7);
}

.hero-content {
    position: relative;
    text-align: center;
    z-index: 1;
}

/* Main library image link in hero */
.main-library-link {
    margin-top: 1rem;
    display: inline-block;
}

.main-library-link a {
    text-decoration: none;
    color: inherit;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
}

.main-library-img {
    width: 220px;
    max-width: 90vw;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.12);
    display: block;
}

.main-library-caption {
    margin-top: 8px;
    font-size: 0.95rem;
    color: #fff; /* visible over overlay */
    background: rgba(139,0,0,0.85);
    padding: 6px 10px;
    border-radius: 20px;
    font-weight: 600;
}

.hero h1 {
    font-size: 2.5rem;
}

.hero p {
    margin-top: 1rem;
    font-size: 1.2rem;
}

/* ============================= */
/* Layout Container              */
/* ============================= */

.container {
    max-width: 1200px;
    margin: auto;
}

/* ============================= */
/* Search Section                */
/* ============================= */

.features {
    padding: 4rem 2rem;
    text-align: center;
}

.features h2 {
    color: #8B0000;
    margin-bottom: 2rem;
}

.search-input-wrapper {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
}

#search-input {
    padding: 0.6rem 1rem;
    width: 320px;
    border-radius: 20px;
    border: 1px solid #ccc;
}

.search-input-wrapper button {
    padding: 0.6rem 1.5rem;
    border-radius: 20px;
    border: none;
    background-color: #8B0000;
    color: white;
    cursor: pointer;
}

/* Clear button (secondary) */
#clear-search-btn, .btn-clear {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    border: none;
    background-color: #6c757d; /* gray */
    color: white;
    cursor: pointer;
    /* allow server/JS to control visibility */
    display: inline-block;
}

/* When search is active reduce bottom spacing so results sit closer to the search box */
.features.search-active {
    padding-bottom: 0.5rem;
}

/* Book Results - center single/multiple cards beneath the search */
.book-results {
    padding: 2rem 1rem;
    margin-top: 0.5rem; /* pull results up closer to the search */
}

/* use flex so single item is centered and multiple wrap */
.book-results .container {
    display: flex;
    justify-content: center !important;
    gap: 2rem;
    flex-wrap: wrap;
    align-items: flex-start;
    max-width: 1000px;
    margin: 0 auto; /* center container inside page */
}

/* make card not stretch to full width of the container */
.book-card {
    width: auto;
    max-width: 260px;
    margin: 0;
}

/* ============================= */
/* Book Results                  */
/* ============================= */

.book-results {
    padding: 2rem 1rem;
    margin-top: 0.5rem; /* pull results up closer to the search */
}

.book-results .container {
    display: flex;
    justify-content: center !important;
    gap: 2rem;
    flex-wrap: wrap;
    align-items: flex-start;
    max-width: 1000px;
    margin: 0 auto; /* center container inside page */
}

.book-card {
    background: white;
    padding: 1rem;
    border-radius: 10px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
    text-align: center;
    transition: transform 0.3s ease;
}

.book-card:hover {
    transform: translateY(-5px);
}

.book-image {
    width: 100%;
    height: 260px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.book-card h3 {
    color: #8B0000;
    margin-bottom: 0.5rem;
}

.book-card p {
    font-size: 0.9rem;
    margin-bottom: 0.3rem;
}

.status.available {
    color: #28a745; /* green */
    font-weight: bold;
}

.status.not-available-to-borrow {
    color: #dc3545; /* bootstrap danger red */
    font-weight: bold;
}

/* show stock count within status */
.status .stock-number {
    color: #555;
    font-weight: normal;
    font-size: 0.9rem;
    margin-left: 0.4rem;
}

/* ============================= */
/* Footer                        */
/* ============================= */

.footer {
    background: #1f2937;
    color: white;
    padding: 2rem;
    text-align: center;
    margin-top: 4rem;
}

/* --- Consolidated Book Results styles (removed duplicates & grid override) --- */

/* hidden by default; PHP/JS will toggle visibility */
.book-results {
    display: none;
    margin-top: 1rem;          /* pull results closer to the search bar */
    padding: 0.5rem 1rem;
}

/* center single result directly under the search and allow wrapping for multiple */
.book-results .container {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 2rem;
    flex-wrap: wrap;
    max-width: 1000px;
    margin: 0 auto;            /* center the container on the page */
    padding-top: 0.5rem;
}

/* Book Card (consistent sizing, centered) */
.book-card {
    width: 260px;
    max-width: 100%;
    margin: 0;
    background: #ffffff;
    border-radius: 12px;
    padding: 1rem;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    transition: transform 0.25s ease;
}

/* Book image sizing used in the card */
.book-image {
    width: 160px;
    height: 220px;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 0.75rem;
}

/* Title */
.book-card h3 {
    color: #8B0000;
    margin-bottom: 0.3rem;
}

/* Text */
.book-card p {
    font-size: 0.85rem;
    margin: 0.2rem 0;
    color: #333;
}

/* Status */
.status.available {
    color: green;
    font-weight: bold;
}

.description {
    font-size: 0.8rem;
    color: #555;
    margin: 0.5rem 0;
    line-height: 1.4;
}
