/* --------------------------------------------------
 * Koha DNP OPAC Style Sheet
 * Brand Theme: Natural Green, Glassmorphism, Premium Aesthetics
 * -------------------------------------------------- */

:root {
    /* Color Palette */
    --color-primary: #688A29;          /* Accent Green */
    --color-primary-dark: #2D5016;     /* Primary Green */
    --color-primary-hover: #547421;    /* Slightly darker accent for hover */
    --color-secondary: #206C9D;        /* Secondary Ocean Blue */
    --color-border-light: #6EA57A;     /* Soft green outline */
    --color-cream: #FAF7F2;            /* Warm cream background */
    --color-text-dark: #3A3A3A;        /* General dark gray text */
    --color-text-muted: #666666;
    --color-white-glass: rgba(255, 255, 255, 0.45);

    /* Fonts */
    --font-th: 'Google Sans', sans-serif;
    --font-title-th: 'Google Sans', sans-serif;
    --font-btn: 'Google Sans', sans-serif;

    /* Shadows & Transitions */
    --shadow-premium: 0 8px 32px 0 rgba(29, 43, 25, 0.15);
    --shadow-hero: 0px 4px 73px 0px rgba(0, 0, 0, 0.35);
    --transition-smooth: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-th);
    color: var(--color-text-dark);
    line-height: 1.6;
    overflow-x: hidden;
    background-color: #E8EDE5; /* Fallback color */
    min-height: 100vh;
    position: relative;
    padding-top: 130px; /* Offset absolute header & prevent margin collapsing */
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition-smooth);
}

button {
    border: none;
    background: none;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition-smooth);
}

/* Full-screen Background Container */
.bg-container {
    position: absolute;
    top: -76px;
    left: 0;
    width: 100%;
    height: calc(100% + 76px);
    z-index: -10;
    overflow: hidden;
}

.bg-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    filter: brightness(0.95) contrast(1.02);
}

/* Header Section */
.main-header {
    width: 100%;
    height: 130px; /* Expanded height */
    background-color: rgba(29, 43, 25, 0.7); /* Increased opacity for header text contrast */
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: absolute;
    top: 0;
    left: 0;
    z-index: 100;
    display: flex;
    align-items: center;
}

.header-container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-img {
    height: 100px; /* Taller logo for taller header */
    max-height: 100px;
    object-fit: contain;
    transition: var(--transition-smooth);
}

.logo-img:hover {
    transform: scale(1.02);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #FFFFFF;
    font-family: var(--font-title-th);
    font-size: 16px;
    padding: 8px 16px;
    border-radius: 8px;
    transition: var(--transition-smooth);
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.12);
    transform: translateY(-2px);
}

.nav-icon {
    font-size: 16px;
}

.cart-icon-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* === BEGIN: Basket/Cart Badge Styles === */
#basketcount {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #ff4d4f; /* Modern premium red badge */
    color: #ffffff;
    font-size: 9px;
    font-weight: 700;
    border-radius: 50%;
    width: 13px;
    height: 13px;
    display: none; /* Hidden by default, toggled via JS */
    align-items: center;
    justify-content: center;
    line-height: 1;
    box-shadow: 0 1.5px 3px rgba(0,0,0,0.25);
}

#basketcount span {
    display: block;
}
/* === END: Basket/Cart Badge Styles === */

.nav-divider {
    width: 1px;
    height: 20px;
    background-color: rgba(255, 255, 255, 0.3);
}

.btn-login {
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-login:hover {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
    box-shadow: 0 4px 15px rgba(104, 138, 41, 0.4);
}

/* Page Layout Wrapper */
.content-wrapper {
    max-width: 1280px;
    margin: 0 auto; /* Align below header using body padding */
    padding: 60px 40px 100px;
    display: flex;
    flex-direction: column;
    gap: 100px;
}

/* Search Hero Section */
.search-hero-section {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin-top: 20px;
    gap: 35px;
}

.hero-title {
    font-family: var(--font-title-th);
    font-size: 44px;
    font-weight: 700;
    color: #0A3B3A;
    text-align: center;
    line-height: 1.3;
    text-shadow: 0px 4px 24px rgba(255, 255, 255, 0.55);
    margin: 95px 0 60px;
}

.glass-search-box {
    width: 100%;
    max-width: 720px;
    background: rgba(255, 255, 255, 0.45); /* Brighter white backing for text clarity */
    backdrop-filter: blur(5px) saturate(120%);
    -webkit-backdrop-filter: blur(5px) saturate(120%);
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: var(--shadow-hero);
    border-radius: 20px;
    padding: 30px;
    display: flex;
    flex-direction: column;
    gap: 25px;
}

/* Search Tabs */
.search-tabs {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid rgba(110, 165, 122, 0.25);
    padding-bottom: 2px;
}

.search-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    font-family: var(--font-title-th);
    font-size: 16px;
    color: var(--color-primary-dark);
    font-weight: 500;
    opacity: 0.75;
    position: relative;
    transition: var(--transition-smooth);
}

.search-tab i {
    display: none;
}

.search-tab span {
    display: inline-block;
    vertical-align: middle;
}

.search-tab:hover {
    opacity: 1;
    transform: translateY(-1px);
}

.search-tab.active {
    opacity: 1;
    color: var(--color-primary-dark);
    font-weight: 600;
}

.search-tab::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: var(--color-primary);
    transform: scaleX(0);
    transition: var(--transition-smooth);
    border-radius: 3px;
}

.search-tab.active::after {
    transform: scaleX(1);
}

/* Search Input & Form */
.search-form-wrapper {
    width: 100%;
}

.search-form {
    display: flex;
    gap: 15px;
}

.input-wrapper {
    position: relative;
    flex: 1;
}

#search-input {
    width: 100%;
    height: 48px;
    background-color: var(--color-cream);
    border: 1.5px solid var(--color-border-light);
    border-radius: 10px;
    padding: 0 20px 0 45px;
    font-family: var(--font-th);
    font-size: 15px;
    color: var(--color-text-dark);
    outline: none;
    transition: var(--transition-smooth);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

#search-input:focus {
    border-color: var(--color-primary-dark);
    box-shadow: 0 0 0 3px rgba(104, 138, 41, 0.15), inset 0 2px 4px rgba(0,0,0,0.02);
}

.input-search-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-border-light);
    font-size: 16px;
    pointer-events: none;
}

.btn-search {
    width: 120px;
    height: 48px;
    background-color: var(--color-primary);
    color: var(--color-cream);
    font-family: var(--font-title-th);
    font-size: 16px;
    font-weight: 500;
    border-radius: 10px;
    border: 1px solid var(--color-primary);
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 10px rgba(104, 138, 41, 0.25);
}

.btn-search:hover {
    background-color: var(--color-primary-dark);
    border-color: var(--color-primary-dark);
    box-shadow: 0 6px 15px rgba(28, 80, 22, 0.35);
    transform: translateY(-1px);
}

.search-links {
    display: flex;
    justify-content: center;
    gap: 30px;
    font-size: 15px; /* Slightly larger */
}

.search-link-item {
    font-family: var(--font-title-th);
    color: var(--color-primary-dark); /* High contrast dark green */
    font-weight: 600; /* Bold weight for legibility */
    border-bottom: 1.5px dashed rgba(45, 80, 22, 0.4); /* Underline to indicate clickability */
    padding-bottom: 2px;
    transition: var(--transition-smooth);
}

.search-link-item:hover {
    color: var(--color-secondary); /* Transition to brand secondary blue on hover */
    border-color: var(--color-secondary);
}

/* Glass Card Common Styles */
.glass-card-container {
    background: rgba(255, 255, 255, 0.45); /* Brighter white backing for text clarity */
    backdrop-filter: blur(4px) saturate(110%);
    -webkit-backdrop-filter: blur(4px) saturate(110%);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: var(--shadow-premium);
    padding: 35px;
    transition: var(--transition-smooth);
}

.glass-card-container:hover {
    background: rgba(255, 255, 255, 0.55); /* Brighter hover backing */
    border-color: rgba(255, 255, 255, 0.4);
}

/* Titles */
.section-title-wrapper {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.section-title-th {
    font-family: var(--font-th);
    font-weight: 700;
    font-size: 22px;
    color: var(--color-primary-dark);
    line-height: 1.2;
}

.section-title-en {
    font-family: var(--font-th);
    font-weight: 400;
    font-size: 16px;
    color: var(--color-primary-dark);
    opacity: 0.8;
}

/* Category Section */
.container-categories {
    border-radius: 30px;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 15px;
}

.category-card {
    background-color: rgba(104, 138, 41, 0.6);
    border: 1px solid var(--color-primary);
    border-radius: 10px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 86px;
    text-align: center;
}

.category-card:hover {
    background-color: var(--color-primary);
    border-color: var(--color-primary-dark);
    transform: translateY(-4px) scale(1.03);
    box-shadow: 0 8px 20px rgba(104, 138, 41, 0.35);
}

.category-card:hover .category-text {
    color: #FFFFFF;
}

.category-emoji {
    font-size: 32px;
    line-height: 1.2;
    transition: var(--transition-smooth);
}

.category-card:hover .category-emoji {
    transform: scale(1.15) rotate(3deg);
}

.category-text {
    font-family: var(--font-th);
    font-weight: 700;
    font-size: 13px;
    color: #3A3A3A;
    transition: var(--transition-smooth);
}

/* New Books Section */
.container-new-books {
    border-radius: 21px;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.section-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-view-more {
    font-family: var(--font-btn);
    font-size: 14px;
    font-weight: 700;
    color: var(--color-cream);
    background-color: var(--color-primary);
    border: 1px solid var(--color-primary-dark);
    border-radius: 8px;
    padding: 10px 24px;
    box-shadow: 0 4px 10px rgba(104, 138, 41, 0.2);
}

.btn-view-more:hover {
    background-color: var(--color-primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(28, 80, 22, 0.3);
}

.books-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 20px;
}

.book-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    cursor: pointer;
}

.book-cover-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 0.69; /* Book shape */
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    background-color: #E2E8F0;
    transition: var(--transition-smooth);
}

.book-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition-smooth);
}

.book-card:hover .book-cover-wrapper {
    transform: translateY(-6px) scale(1.02);
    box-shadow: 0 12px 25px rgba(28, 80, 22, 0.25);
}

.book-card:hover .book-cover {
    filter: brightness(1.02);
}

.book-title {
    font-family: var(--font-th);
    font-size: 13.5px;
    color: #484848;
    line-height: 1.35;
    font-weight: 500;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    height: 36px;
    transition: var(--transition-smooth);
}

.book-card:hover .book-title {
    color: var(--color-primary-dark);
}

/* Suggested Menu Section (Full Width Banner) */
.suggested-menu-section {
    width: 100vw;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    background: rgba(255, 255, 255, 0.25); /* Brighter suggested banner backing */
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(4px);
    padding: 45px 0;
    display: flex;
    justify-content: center;
    margin-bottom:100px; /* Space between Suggested Menu and Footer to match Figma */
}

.suggested-container {
    width: 100%;
    max-width: 1280px;
    padding: 0 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 30px;
}

.dark-theme-title .section-title-th,
.dark-theme-title .section-title-en {
    color: #FFFFFF;
    text-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.suggested-buttons-row {
    display: flex;
    gap: 15px;
    flex: 1;
    justify-content: flex-end;
}

.btn-suggested {
    background-color: rgba(255, 255, 255, 0.7); /* Brighter button backing for text clarity */
    border: 3px solid var(--color-secondary); /* Secondary Blue */
    border-radius: 13px;
    padding: 18px 24px;
    font-family: var(--font-th);
    font-size: 15px;
    font-weight: 600;
    color: #2B2B2B;
    text-align: center;
    min-width: 170px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.btn-suggested:hover {
    background-color: var(--color-secondary); /* Secondary Blue */
    color: #FFFFFF;
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(32, 108, 157, 0.35); /* Secondary shadow */
}

/* Footer Section */
.main-footer {
    width: 100vw;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    background: linear-gradient(180deg, rgba(32, 108, 157, 0.48) 0%, #012B46 83%); /* Secondary Blue base */
    color: #FAF7F2;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-top-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 50px 40px;
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    gap: 40px;
}

.footer-col-left, .footer-col-middle, .footer-col-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.footer-col-divider {
    width: 1px;
    background-color: rgba(255, 255, 255, 0.25);
}

.footer-office-title {
    font-family: var(--font-th);
    font-size: 20px;
    font-weight: 600;
    line-height: 1.3;
}

.footer-office-address {
    font-family: var(--font-th);
    font-weight: 300;
    font-size: 14.5px;
    opacity: 0.85;
}

.footer-phone-link {
    color: inherit;
    text-decoration: none;
    transition: var(--transition-smooth);
    display: inline-block;
    margin-top: 5px;
}

.footer-phone-link:hover {
    color: var(--color-primary);
    text-decoration: underline;
}

.footer-contact-title {
    font-family: var(--font-th);
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 5px;
}

.social-links-wrapper {
    display: flex;
    gap: 12px;
    margin-top: 5px;
}

.social-icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 16px;
    color: #FAF7F2;
    transition: var(--transition-smooth);
}

.social-icon-btn:hover {
    background-color: #FAF7F2;
    color: #012B46;
    transform: translateY(-3px);
}

/* Footer Bottom Bar */
.footer-bottom-bar {
    width: 100%;
    background-color: rgba(0, 16, 27, 0.45);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding: 18px 0;
}

.footer-bottom-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 40px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.copyright-text {
    font-family: var(--font-th);
    font-weight: 300;
    font-size: 13.5px;
    opacity: 0.75;
    text-align: center;
}

.security-icon {
    font-size: 16px;
    opacity: 0.6;
    transition: var(--transition-smooth);
}

.security-icon:hover {
    opacity: 0.95;
    transform: scale(1.1);
}

/* --- Logged-in User Dropdown --- */
.nav-dropdown {
    position: relative;
    display: inline-block;
}

.nav-dropdown .btn-login.dropdown-toggle {
    cursor: pointer;
    outline: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-dropdown .btn-login.dropdown-toggle::after {
    content: '\f107'; /* FontAwesome angle-down */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 12px;
    margin-left: 4px;
    transition: var(--transition-smooth);
}

.nav-dropdown.active .btn-login.dropdown-toggle::after {
    transform: rotate(180deg);
}

.user-dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 220px;
    background: rgba(29, 43, 25, 0.85); /* Dark green matching header with higher opacity */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    padding: 8px 0;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
}

.nav-dropdown.active .user-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: rgba(255, 255, 255, 0.9);
    font-family: var(--font-th);
    font-size: 14.5px;
    font-weight: 500;
    transition: var(--transition-smooth);
}

.dropdown-item-icon {
    font-size: 14px;
    width: 16px;
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    transition: var(--transition-smooth);
}

.dropdown-item:hover {
    background-color: rgba(255, 255, 255, 0.12);
    color: #FFFFFF;
}

.dropdown-item:hover .dropdown-item-icon {
    color: var(--color-primary);
    transform: scale(1.1);
}

.dropdown-item.logout-link:hover {
    background-color: rgba(255, 77, 79, 0.15);
    color: #ff7875;
}

.dropdown-item.logout-link:hover .dropdown-item-icon {
    color: #ff7875;
}

.dropdown-divider {
    height: 1px;
    background-color: rgba(255, 255, 255, 0.15);
    margin: 6px 0;
}
/* --- Logged-in User Dropdown --- */

/* --------------------------------------------------
 * Responsive Media Queries
 * -------------------------------------------------- */

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

    .suggested-container {
        flex-direction: column;
        align-items: flex-start;
    }

    .suggested-buttons-row {
        justify-content: flex-start;
        width: 100%;
    }
}

@media (max-width: 992px) {
    .footer-top-container {
        flex-direction: column;
        gap: 30px;
    }

    .footer-col-divider {
        display: none;
    }
}

@media (max-width: 768px) {
    .header-container {
        padding: 0 20px;
    }

    .logo-img {
        height: 70px;
    }

    .nav-text {
        display: none; /* Hide text, keep icons on small screens */
    }

    /* === BEGIN: Responsive Header Navigation Tweaks === */
    .header-right {
        gap: 6px;
    }

    .nav-item {
        padding: 8px 10px;
        gap: 0;
    }
    /* === END: Responsive Header Navigation Tweaks === */

    .nav-dropdown .btn-login.dropdown-toggle::after {
        display: none; /* Hide caret on mobile */
    }

    .nav-divider {
        display: none;
    }

    .content-wrapper {
        padding: 40px 20px 80px;
    }

    .search-tab {
        font-size: 14px;
        padding: 8px 12px;
    }

    .search-tab i {
        display: inline-block;
        font-size: 18px;
    }

    .search-tab span {
        display: none;
    }

    .search-tabs {
        gap: 10px;
    }

    .search-form {
        flex-direction: column;
    }

    .btn-search {
        width: 100%;
    }

    .categories-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .books-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .suggested-buttons-row {
        flex-wrap: wrap;
    }

    .btn-suggested {
        flex: 1 1 45%;
        padding: 12px 15px;
    }

    .footer-phone-link {
        text-decoration: underline;
    }
}

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

    .logo-img {
        height: 55px;
    }

    /* === BEGIN: Responsive Header Navigation Tweaks === */
    .header-right {
        gap: 4px;
    }

    .nav-item {
        padding: 6px 8px;
    }
    /* === END: Responsive Header Navigation Tweaks === */

    .categories-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .btn-suggested {
        flex: 1 1 100%;
    }
}
