*{
    margin:0;
    padding:0;
    box-sizing:border-box;
}

body{
    font-family:Arial, Helvetica, sans-serif;
    background:#f5f5f5;
    color:#222;
}

/* HEADER */

header{
    display:flex;
    justify-content:space-between;
    align-items:center;
    background:#222;
    color:white;
    padding:15px 30px;
    position:sticky;
    top:0;
    z-index:100;
}

.logo-section{
    display:flex;
    align-items:center;
    gap:12px;
}

.logo-section img{
    width:50px;
    height:50px;
    object-fit:contain;
}

.logo-section h2{
    font-size:26px;
}

#cartButton{
    background:#ff9800;
    border:none;
    color:white;
    padding:12px 20px;
    border-radius:8px;
    cursor:pointer;
    font-size:16px;
    transition:.3s;
}

#cartButton:hover{
    background:#e68900;
}

/* HERO */

.hero{
    text-align:center;
    padding:35px 20px;
}

.hero h1{
    font-size:38px;
    margin-bottom:25px;
}

#searchBox{
    width:min(500px,90%);
    padding:14px;
    font-size:18px;
    border-radius:10px;
    border:1px solid #ccc;
    outline:none;
}

/* BOOK GRID */

.books{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(280px,1fr));
    gap:30px;
    padding:30px;
}

/* BOOK CARD */

.book{
    background:white;
    border-radius:12px;
    box-shadow:0 3px 10px rgba(0,0,0,.15);
    padding:20px;
    display:flex;
    flex-direction:column;
    transition:.3s;
}

.book:hover{
    transform:translateY(-5px);
}

.book-image{
    width:100%;
    height:380px;
    object-fit:contain;
    cursor:pointer;
    background:#fafafa;
    border-radius:8px;
}

.book-title{
    margin-top:15px;
    text-align:center;
    font-size:22px;
    min-height:70px;
}

.details{
    margin-top:15px;
}

.details p{
    margin:8px 0;
    font-size:16px;
    line-height:1.5;
}

/* Quantity */

.qty-box{
    display:flex;
    justify-content:center;
    align-items:center;
    gap:10px;
    margin-top:18px;
}

.qty-box button{
    width:35px;
    height:35px;
    border:none;
    background:#ddd;
    border-radius:6px;
    font-size:22px;
    cursor:pointer;
}

.qty-box input{
    width:65px;
    text-align:center;
    font-size:18px;
    padding:5px;
}

/* Cart button */

.cart-btn{
    margin-top:20px;
    background:#4CAF50;
    color:white;
    border:none;
    padding:12px;
    font-size:16px;
    border-radius:8px;
    cursor:pointer;
    transition:.3s;
}

.cart-btn:hover{
    background:#3b9840;
}

/* CART PANEL */

#cartPanel{
    display:none;
    position:fixed;
    right:20px;
    top:90px;
    width:360px;
    max-height:70vh;
    overflow:auto;
    background:white;
    border-radius:10px;
    box-shadow:0 0 20px rgba(0,0,0,.2);
    padding:20px;
    z-index:999;
}

.cart-header{
    margin-bottom:15px;
}

#cartItems{
    line-height:2;
}

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

.removeBtn{
    background:#e53935;
    color:white;
    border:none;
    padding:5px 10px;
    border-radius:5px;
    cursor:pointer;
}

.checkoutBtn{
    width:100%;
    margin-top:20px;
    background:#25D366;
    color:white;
    border:none;
    padding:14px;
    border-radius:8px;
    cursor:pointer;
    font-size:17px;
}

/* MODAL */

.modal{
    display:none;
    position:fixed;
    inset:0;
    background:rgba(0,0,0,.5);
    justify-content:center;
    align-items:center;
    z-index:2000;
}

.modal-content{
    width:min(450px,90%);
    background:white;
    border-radius:12px;
    padding:25px;
}

.modal-content h2{
    text-align:center;
    margin-bottom:20px;
}

.modal-content input,
.modal-content textarea{
    width:100%;
    margin-bottom:15px;
    padding:12px;
    border:1px solid #bbb;
    border-radius:8px;
    font-size:16px;
}

.modal-buttons{
    display:flex;
    justify-content:flex-end;
    gap:10px;
}

.cancelBtn{
    background:#999;
    color:white;
    border:none;
    padding:10px 18px;
    border-radius:6px;
    cursor:pointer;
}

.confirmBtn{
    background:#25D366;
    color:white;
    border:none;
    padding:10px 18px;
    border-radius:6px;
    cursor:pointer;
}

/* Image Preview */

.preview{
    position:fixed;
    inset:0;
    background:rgba(0,0,0,.8);
    display:flex;
    justify-content:center;
    align-items:center;
    z-index:5000;
}

.preview img{
    max-width:90%;
    max-height:90%;
    border-radius:10px;
    background:white;
}

/* Mobile */

@media(max-width:768px){

header{
    flex-direction:column;
    gap:15px;
}

.hero h1{
    font-size:28px;
}

.books{
    grid-template-columns:1fr;
    padding:20px;
}

.book-image{
    height:330px;
}

#cartPanel{
    width:95%;
    left:2.5%;
    right:2.5%;
    top:100px;
}

}