* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: Arial, sans-serif;
}

body {
    background: #f4f6f9;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background-color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.logo {
    display: flex;
    align-items: center;
    font-weight: bold;
    font-size: 1.2rem;

}

.logo img {
    height: 50px;
    margin-right: 10px;
}

.logout-btn {
    padding: 10px 30px;
    background-color: #f90;
    border: none;
    border-radius: 4px;
    color: white;
    cursor: pointer;
    border-radius: 50px;
    font-weight: 900;
}

.hero-text img {
    width: 100%;
    height: auto;
    overflow-x: auto;
    margin-bottom: 30px;
    display: flex;
}

.carousel {
    display: flex;
    overflow-x: auto;

    gap: 15px;

    margin-top: 10px;
    margin-bottom: 30px;
}



.carousel img {
    height: 200px;
    border-radius: 5px;
}

.layout {
    display: flex;
}

.sidebar {
    width: 15%;
    background-color: #ffffff;

    margin-bottom: auto;
    margin-top: 20px;
    border-radius: 20px;
    margin-left: 50px;
    text-align: center;
    display: grid;
}

.sidebar h3 {
    margin-bottom: 10px;
    font-size: 1.1rem;
    background-color: #1f7902;
    color: white;
    padding: 12px;
    text-align: center;
    border-top-right-radius: 20px;
    border-top-left-radius: 20px;
}


.sidebar button {
    display: block;
    width: 100%;
    margin-bottom: 10px;
    padding: 10px;
    border: none;
    border-radius: 5px;
    background: #ffffff;
    cursor: pointer;
    text-align: left;
}

.sidebar a {
    display: block;
    width: 100%;
    margin-bottom: 10px;
    padding: 10px;
    border: none;
    border-radius: 5px;
    background: #ffffff;
    cursor: pointer;
    text-align: left;
    color: #000;
    /* make text black */
    text-decoration: none;
}

.sidebar a:hover {
    background: #f0f0f0;
}

.sidebar a.active {
    background: #1f7902;
    color: #000;
    font-weight: bold;
}

.sidebar button.active {
    background: #f90;
    color: white;
}

.main-content {
    flex: 1;
    padding: 20px 50px 20px 20px;
    min-width: 0;
}

.filters {
    min-height: 90px;
    align-items: center;
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    box-shadow: 2px 4px 8px rgba(0, 0, 0, 0.2);
    padding: 20px;
    border-radius: 20px;
    background-color: white;
    overflow: hidden;
    margin-right: 0;
}

.filters select,
.filters input {
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #ccc;
}


.courses-list{
    max-height: 300px;   /* adjust height if needed */
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-right: 5px;
}

/* Optional nicer scrollbar */
.courses-list::-webkit-scrollbar{
    width: 6px;
}

.courses-list::-webkit-scrollbar-thumb{
    background: #888;
    border-radius: 10px;
}

.courses-list::-webkit-scrollbar-thumb:hover{
    background: #555;
}
#searchBar {

    width: 100%;
    max-width: 600px;
    margin-bottom: 20px;
    position: relative;
    border-radius: 30px;
    background-color: #edf0f7;
    height: auto;
    display: flex;
    flex-wrap: wrap;

}

.search form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.lahi {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.lahi select {
    flex: 1 1 200px;   /* responsive width */
    min-width: 0;      /* 🔥 IMPORTANT: allows shrinking */
    max-width: 100%;   /* prevents overflow */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#yearFilter {
    border-radius: 50px;
}

#courseInput {
    border-radius: 50px;
    background-color: #edf0f7;

}

#programInput {
    border-radius: 50px;
    background-color: #edf0f7;

}

#nab{
    color: #1f7902;
}

#cartButton {
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    font-weight: 500;
}
#cartButton:hover{
            color: #ffe202;
}

.book-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
    margin-right: 0;
}

.book-card {
    background: white;
    border-radius: 5px;
    padding: 10px;
    text-align: center;
    cursor: pointer;

}
.book-card p {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px; /* controls truncation length (~25 chars visually) */
    margin: 0 auto;
}

.book-card img {
    height: 180px;
    margin-bottom: 10px;
}

footer {
    padding: 10px;

    background: #05014a;
    color: white;
    text-align: center;
    margin-top: 40px;
}

.foter {

    align-items: center;

}


.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    z-index: 999;
}

.modal-content {
    background: white;
    padding: 25px;
    border-radius: 12px;
    width: 75%;
    max-width: 900px;
    display: flex;
    flex-direction: row;
    /* side-by-side */
    gap: 25px;
    position: relative;
}

.close {
    position: absolute;
    top: 12px;
    right: 12px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #333;
}



.close:hover {
    color: #000;
}


.close {
    float: right;
    cursor: pointer;
    font-size: 1.2rem;
}

@media (max-width: 991.98px) {
    .layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        max-width: 100%;
        margin-left: 0 !important;
        margin-right: 0;
        box-shadow: none;
        padding: 12px clamp(12px, 3vw, 20px);
    }

    .main-content {
        padding: 16px clamp(12px, 3vw, 24px) !important;
    }

    .book-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 12px;
    }

    .modal-content {
        width: 94% !important;
        max-width: 100% !important;
        flex-direction: column !important;
        padding: 16px !important;
        max-height: 90vh;
        overflow-y: auto;
    }

    .modal-wide,
    .cart-modal-clean {
        width: 94% !important;
        max-width: 100% !important;
        height: auto !important;
        max-height: 90vh !important;
        padding: 20px !important;
    }

    .modal-body-flex {
        flex-direction: column;
        align-items: center;
    }

    .modal-left img {
        width: 100%;
        max-width: 220px;
    }

    .filters .lahi {
        flex-direction: column;
        width: 100%;
    }

    .filters select,
    .filters input {
        width: 100%;
        max-width: 100%;
    }
}

@media (max-width: 768px) {
    h1#nab {
        margin-left: 0 !important;
        font-size: clamp(1.1rem, 5vw, 1.75rem);
        padding: 0 12px;
    }

    .carousel .arrow.left {
        left: 4px;
    }

    .carousel .arrow.right {
        right: 4px;
    }
}

.carousel-container {
    position: relative;
    width: 100%;

    margin: auto;
    overflow: hidden;



}

.carosel p {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;   /* adjust based on your card width */
    margin: 8px auto 0;
}

.carousel-track {
    display: flex;
    transition: transform 0.5s ease;
    gap: 10px;
}


.arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background-color: white;
    border: 1px solid #ccc;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.arrow.left {
    left: -15px;
}

.arrow.right {
    right: -15px;

}

.arrow svg {
    width: 30px;
    /* larger arrow */
    height: 30px;
    fill: black;
    color: blue;
}


.arrow:hover {
    background-color: #f8f8f8;
}

#e-book {
    text-align: center;
    background-color: #1f7902;
    border-radius: 40px;

    width: 200px;
    align-items: center;
    margin-left: 10px;
}

h1 {
    font-family: 'Rubik', sans-serif;
    font-size: 32px;
    font-weight: 600;
    margin-left: 35px;
}


footer {
    background-color: #05014a;
    width: 100%;
    height: 4rem;
    padding: 1rem;

}

.footer-img {
    max-width: 100%;
    height: 2rem;
}

.a51-footer {
    text-align: center;
}

.a51-footer h1 {
    font-family: 'Orbitron', sans-serif;
    font-weight: bold;
}

.modal-wide {
    width: 70%;
    max-width: 900px;
}

.modal-body-flex {
    display: flex;
    gap: 25px;
}

.modal-left img {
    width: 250px;
    height: auto;
    border-radius: 8px;
}

.modal-right {
    flex: 1;
}

.toast-custom {
    position: fixed;
    bottom: 40px;
    right: 40px;
    background: #333;
    color: #fff;
    padding: 12px 20px;
    border-radius: 8px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s ease;
    z-index: 9999;
    font-size: 14px;
}

.toast-custom.show {
    opacity: 1;
    transform: translateY(0);
}

.toast-success { background: #28a745; }
.toast-error { background: #dc3545; }

.cart-modal {
    width: 400px;
    max-width: 90%;
    padding: 20px;
    border-radius: 12px;
}

.cart-list {
    list-style: none;
    padding: 0;
    margin: 15px 0;
    max-height: 300px;
    overflow-y: auto;
}

.cart-list li {
    background: #f8f9fa;
    margin-bottom: 10px;
    padding: 10px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cart-list button {
    border: none;
    background: #dc3545;
    color: white;
    padding: 5px 10px;
    border-radius: 6px;
    cursor: pointer;
}

.cart-list button:hover {
    background: #b02a37;
}

.cart-footer {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.cart-modal-modern {
    width: 420px;
    max-width: 95%;
    border-radius: 16px;
    padding: 20px;
    background: #ffffff;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
}

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

.cart-header h4 {
    margin: 0;
    font-weight: 600;
}

.cart-header span {
    font-size: 13px;
    color: #888;
}

.cart-items {
    flex: 1;
    max-height: 300px;
    overflow-y: auto;
    padding-right: 5px;
}

/* ITEM CARD */
.cart-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f9fafb;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 12px;
    transition: all 0.25s ease;
}

.cart-item:hover {
    background: #f1f3f5;
    transform: translateY(-2px);
}

/* LEFT SIDE */
.cart-info {
    display: flex;
    flex-direction: column;
}

.cart-title {
    font-weight: 600;
    font-size: 14px;
}

.cart-author {
    font-size: 12px;
    color: #777;
}

/* REMOVE BUTTON */
.remove-btn {
    border: none;
    background: #ffe5e5;
    color: #d11a2a;
    padding: 6px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.2s;
}

.remove-btn:hover {
    background: #ffcccc;
}

/* FOOTER */
.cart-footer-modern {
    border-top: 1px solid #eee;
    padding-top: 12px;
    margin-top: 10px;
}

.cart-summary {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.cart-actions {
    display: flex;
    gap: 10px;
}

.cart-actions button {
    flex: 1;
    border-radius: 10px;
}

/* EMPTY STATE */
.empty-cart {
    text-align: center;
    padding: 40px 10px;
    color: #999;
}

.empty-cart i {
    font-size: 40px;
    margin-bottom: 10px;
}

.modal-content {
    animation: scaleIn 0.2s ease;
}

@keyframes scaleIn {
    from {
        transform: scale(0.95);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* OPAC borrow cart (aligned with pantas-library-system) */
.cart-modal-clean {
    width: 75%;
    max-width: 1100px;
    height: 80vh;
    border-radius: 24px;
    padding: 40px;
    display: flex;
    flex-direction: column;
}

.cart-modal-clean .cart-header {
    display: block;
    margin-bottom: 25px;
}

.cart-modal-clean .cart-header h2 {
    font-weight: 600;
    margin-bottom: 5px;
}

.cart-modal-clean .cart-header p {
    color: #888;
    margin: 0;
}

.cart-modal-clean .cart-body {
    flex: 1;
    overflow-y: auto;
    padding-right: 10px;
}

.cart-modal-clean .cart-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.cart-modal-clean .cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
    padding: 20px 25px;
    border-radius: 16px;
    margin-bottom: 20px;
    transition: 0.2s ease;
}

.cart-modal-clean .cart-item:hover {
    background: #e9ecef;
}

.cart-modal-clean .cart-footer {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.cart-modal-clean .cart-count {
    font-size: 18px;
}

.cart-modal-clean .empty-cart {
    text-align: center;
    color: #aaa;
    padding: 60px 0;
    font-size: 18px;
}

.toast-container {
    position: fixed;
    top: 30px;
    right: 30px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.toast-card.toast-success {
    border-left: 4px solid #198754;
}

.toast-card.toast-error {
    border-left: 4px solid #dc3545;
}

.toast-card.toast-info {
    border-left: 4px solid #0d6efd;
}

@keyframes slideIn {
    from {
        transform: translateX(30px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}