/* --- Theme tokens ---------------------------------------------------- */
:root {
  --bg: #f6f2ea; /* page background */
  --paper: #fffdf8; /* cards / panels */
  --ink: #1d1c1a; /* primary text */
  --muted-ink: #6b655f;
  --brand: #c89b3c; /* gold */
  --brand-ink: #3f2f0a;
  --line: #e8e0d3; /* borders */
  --accent: #e7d8be; /* soft highlight */
  --success: #3a7e4b; /* green */
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  --radius-xl: 22px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 10px;
  --container: 1180px;
}

/* --- Resets ---------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}
img {
  display: block;
  max-width: 100%;
  height: auto;
}
a {
  color: inherit;
  text-decoration: none;
}
button {
  font: inherit;
  cursor: pointer;
}
input {
  font: inherit;
}

body {
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto,
    "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji";
  color: var(--ink);
  background: radial-gradient(1000px 500px at -10% -10%, #fff 0%, var(--bg) 60%),
    var(--bg);
}

.container {
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: 20px;
}

/* --- Header ---------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: saturate(140%) blur(6px);
  background: color-mix(in oklab, var(--bg) 85%, #fff 15%);
  border-bottom: 1px solid var(--line);
}
.nav {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 0;
}
.brand {
  font-family: "Playfair Display", serif;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 0.3px;
}

.nav-links {
  display: flex;
  gap: 18px;
  color: var(--muted-ink);
}

.nav-links2 {
  display: flex;
  gap: 18px;
  margin-right: 10px;
  margin-left: 10px;
  color: var(--muted-ink);
}

.nav-links a {
  padding: 8px 10px;
  border-radius: 10px;
}
.nav-links a:hover {
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow);
}
.nav-spacer {
  flex: 1;
}
.search {
  position: relative;
  display: flex;
  align-items: center;
  margin-right: 25rem;
}

.search input {
  width: 400px;
  max-width: 55vw;
  padding: 10px 36px 10px 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  outline: none;
}

.search svg {
  position: absolute;
  right: 10px;
}

.actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.hamburger {
  display: none;
}

.cart-count {
  background: #c89b3c;
  color: #fff;
  font-size: 12px;
  font-weight: bold;
  border-radius: 50%;
  padding: 2px 6px;
  position: absolute;
  top: 6px;
  right: 6px;
}

/* Badge */
.cart-badge {
  background: red;
  color: #fff;
  font-size: 12px;
  font-weight: bold;
  border-radius: 50%;
  padding: 2px 6px;
  position: absolute;
  top: -6px;
  right: -6px;
}

/* Position inside cart button */
.icon-btn {
  position: relative;
}

/* --- Hero ------------------------------------------------------------ */
.hero {
  position: relative;
}
.hero-inner {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  align-items: center;
  gap: 40px;
  padding-block: 56px;
}
.eyebrow {
  color: var(--brand-ink);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 12px;
}
.hero h1 {
  font-family: "Playfair Display", serif;
  font-weight: 700;
  font-size: clamp(36px, 6vw, 60px);
  line-height: 1.05;
  letter-spacing: 0.2px;
  margin: 10px 0 12px;
}
.hero p {
  color: var(--muted-ink);
  font-size: 16px;
  line-height: 1.7;
  max-width: 56ch;
}
.cta {
  margin-top: 22px;
  display: flex;
  gap: 12px;
}
.btn {
  padding: 12px 18px;
  border-radius: 999px;
  border: 1px solid var(--brand);
  background: linear-gradient(
    180deg,
    color-mix(in oklab, var(--brand) 85%, #fff 15%),
    color-mix(in oklab, var(--brand) 70%, #000 10%)
  );
  color: #1b1406;
  font-weight: 700;
  box-shadow: 0 8px 16px rgba(200, 155, 60, 0.25);
}
.btn.secondary {
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.hero-art {
  position: relative;
  width: 100%;
}
.blob {
  position: absolute;
  inset: auto 0 0 auto;
  width: 70%;
  height: 70%;
  background: radial-gradient(
    60% 60% at 60% 40%,
    #fff 0,
    var(--accent) 60%,
    rgba(0, 0, 0, 0) 61%
  );
  filter: blur(16px);
  z-index: -1;
  border-radius: 50%;
  transform: translate(10%, 8%);
}
.stack {
  aspect-ratio: 1/1;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  display: grid;
  place-items: center;
  padding: 30px;
}

/* --- Features -------------------------------------------------------- */
    .features{
         padding-block: 26px 10px;
         }
    .feature-row{ 
        display:grid; grid-template-columns: repeat(3, 1fr); gap:18px; 
    }
    .feature{ 
        background: var(--paper); 
        border:1px solid var(--line); 
        border-radius: var(--radius-lg); 
        padding: 18px 20px; 
        display:flex; align-items:center; gap:14px; box-shadow: var(--shadow); 
    }
    .feature .badge{
         width:42px; 
         height:42px; 
         display:grid; 
         place-items:center;
         border-radius: 14px; 
         background: #FFF8E8; 
         border:1px dashed var(--brand); 
    }
    .feature h4{ 
        margin:0; 
        font-size:15px; 
    }
    .feature p{ 
        margin:3px 0 0; 
        font-size:13px; 
        color:var(--muted-ink); 
    }

/* --- Category or Filter ---------------------------------------------------*/
/* Layout wrapper for sidebar + books */
.content-wrapper {
  display: flex;
  gap: 24px; /* fixed from gap: px; */
  margin-top: 20px;
  align-items: flex-start;
}

/* Sidebar styles */
.sidebar {
  width: 240px;
  padding: 18px 20px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  flex-shrink: 0;
}

.sidebar h3 {
  margin-bottom: 14px;
  font-size: 18px;
  font-weight: 600;
  color: var(--brand-ink);
}

.sidebar label {
  display: block;
  margin-bottom: 10px;
  cursor: pointer;
  font-size: 14px;
  color: var(--ink);
}

.sidebar input[type="radio"] {
  margin-right: 8px;
}
/* Price Range */
.price-range {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.price-range label {
  font-size: 14px;
  color: var(--ink);
  display: flex;
  justify-content: space-between;
}

.price-range input[type="range"] {
  width: 100%;
  cursor: pointer;
}


/* Main content */
.main-content {
  flex: 1;
}


.items {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
}


/* --- Popular Books --------------------------------------------------- */
/* Header row with title + search */
.popular-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

/* Make heading not shrink */
.popular-header h2 {
  font-family: "Playfair Display", serif;
  flex-shrink: 0;
  margin: 0;
}

/* Search beside title */
.popular-header .search {
  flex: 1;
  max-width: 400px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-top: 42px;
  margin-bottom: 14px;
}
.section-head h2 {
  font-family: "Playfair Display", serif;
  font-size: 28px;
  margin: 0;
}
.see-all {
  display: flex;
  color: var(--brand-ink);
  font-weight: 600;
}

.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}
.cover {
  aspect-ratio: 3/4;
  background: #eee;
  object-fit: cover;
}
.card-body {
  padding: 14px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.title {
  font-weight: 700;
  font-size: 16px;
  line-height: 1.2;
}
.byline {
  font-size: 12.5px;
  color: var(--muted-ink);
}
.rating {
  font-size: 14px;
  color: #d4a72a;
  letter-spacing: 1px;
}
.price-row {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.price {
  font-weight: 800;
}
.pill {
  font-size: 12px;
  background: #fcf2d8;
  color: #5a4b13;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid #e8d7a6;
}
.actions-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.btn.small {
  padding: 10px 14px;
  font-weight: 700;
}
.btn.icon {
  padding: 0;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
}

/* --- Footer ---------------------------------------------------------- */
footer {
  margin-top: 60px;
  padding: 40px 0 60px;
  border-top: 1px solid var(--line);
  color: var(--muted-ink);
  background-color: #222222;
}

.welcomeMessage {
  color: #000;
  text-decoration: underline;
  font-weight: bold;
}

.btn.icon.secondary {
  background-color: transparent;
  border: none;
  padding: 0.4em;
  border-radius: 50%;
  transition: background-color 0.3s ease;
}

.btn.icon.secondary.active {
  background-color: #f3f2d3; /* black background */
}

.btn.icon.secondary svg path {
  transition: fill 0.3s ease;
}

.dropdown {
  position: relative;
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}

.dropbtn {
  background-color: transparent;
  border: none;
  font-size: 16px;
  cursor: pointer;
  color: #333;
  padding: 10px;
}

.dropdown-trigger {
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}

.dropdown-arrow {
  transition: transform 0.3s ease;
  width: 30px;
}

.dropdown-trigger.active .dropdown-arrow {
  transform: rotate(180deg);
}

.dropdown-content {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  background-color: #fff;
  min-width: 160px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  z-index: 1;
}

.dropdown-content.show {
  display: block;
}

.dropdown-content a {
  color: black;
  padding: 10px 14px;
  text-decoration: none;
  display: block;
}

/* Modal (reuse your style, but ensure for cart too) */
#cartModal {
  display: none; /* hidden by default */
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  justify-content: center;
  align-items: center;
  z-index: 9999;
}
#cartModal .modal-content {
  background: #fff;
  padding: 20px;
  border-radius: 12px;
  max-width: 800px;
  width: 90%;
  max-height: 600px;   /* fixed modal height */
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);

}
#cartItems,
#wishlistItems {
  flex: 1;
  overflow-y: auto; /* items area scrolls */
  list-style: none;
  padding: 0;
  margin: 0 -20px; /* extend to edges */
  padding: 0 20px; /* restore padding inside */
  min-height: 100px; /* minimum height to show scrollbar */
  max-height: calc(80vh - 200px); /* leaves room for header/footer */
}
#cartItems li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #f0f0f0;
}



/* Cart item style */
.cart-item {
  display: flex;
  align-items: center;
  border-bottom: 1px solid #ddd;
  padding: 12px 0;
}

#cartItems img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 8px;
}

#cartTotal {
  margin-top: 20px;
  margin-bottom: 20px;
  font-weight: bold;
  text-align: right;
}



.cart-item-details {
  flex: 1;
}

.cart-item-details h4 {
  font-size: 15px;
  margin: 0;
  color: #333;
}

.cart-item-details p {
  font-size: 13px;
  margin: 4px 0;
  color: #777;
}

.cart-item-price {
  font-weight: bold;
  margin-right: 12px;
}

.cart-qty {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cart-qty button {
  border: 1px solid #aaa;
  background: #f7f7f7;
  width: 35px;
  height: 35px;
  font-size: 18px;
  cursor: pointer;
  border-radius: 4px;
}

.cart-qty input {
  width: 40px;
  text-align: center;
  border: 1px solid #ccc;
  height: 28px;
}

.cart-remove {
  cursor: pointer;
  color: red;
  font-size: 18px;
  margin-left: 10px;
}

.cart-footer {
  margin-top: 12px;
  text-align: right;
  font-size: 16px;
}

/* Modal background */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  inset: 0; /* shorthand for top/right/bottom/left: 0 */
  background-color: rgba(0, 0, 0, 0.6);
  padding: 20px;
  overflow-y: auto;
  display: none; /* initial state */
}

/* Modal box */
.modal-content {
  background: #fff;
  padding: 20px;
  width: 420px;
  max-width: 100%;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  animation: fadeIn 0.3s ease;
  margin: 40px auto; /* centers horizontally and adds some top/bottom space */
  max-height: calc(100vh - 80px); /* full height minus top/bottom margin */
  overflow-y: auto; /* enable scrolling for tall content */
  display: flex;
  flex-direction: column;
}

#profile-modal {
  display: none; /* hidden by default */
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  justify-content: center;
  align-items: center;
  justify-content: center;
}

#profile-modal .modal-content {
 width: 400px;
  max-width: 90%;
  background: #fff;
  padding: 20px;
  border-radius: 10px;
  box-shadow: var(--shadow);
  margin: auto; /* centers it */
  max-height: 90vh; 
  overflow-y: auto; /* scroll only if content is long */
}


/* Close button */
.close-btn {
  float: right;
  font-size: 22px;
  font-weight: bold;
  cursor: pointer;
}

/* Form styles inside edit modal */
.modal-content form {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.modal-content label {
  font-weight: bold;
}

.modal-content input {
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 14px;
}

.modal-content button {
  padding: 10px;
  background: #5a4b13;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.3s;
}

.modal-content button:hover {
  background: #806a1b;
}

/* Smooth fade animation */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ----------------- Responsive Layouts ----------------- */
@media (max-width: 1024px) {
  .container { padding-inline: 16px; }
  .hero-inner { grid-template-columns: 1fr; text-align: center; }
  .hero p { margin-inline: auto; }
  /* Ensure text first, image below */
  .hero-copy { order: 1; }
  .hero-art { order: 2; }

  .feature-row { grid-template-columns: 1fr 1fr; }
  .popular-header { flex-direction: column; align-items: stretch; gap: 12px; }
  .popular-header .search { max-width: 100%; }
}

@media (max-width: 768px) {
  /* Header adjustments */
  .nav-links { display: none; }
  .hamburger { display: grid; }
  .search { margin-right: 0; }
  .search input { width: 100%; max-width: 100%; }

  /* Sidebar stacks on top */
  .content-wrapper { flex-direction: column; }
  .sidebar { width: 100%; }

  /* Grid columns reduce */
  .grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .brand { font-size: 20px; }
  .icon-btn { width: 36px; height: 36px; }
  .btn { padding: 10px 14px; }
  .hero-inner { gap: 20px; padding-block: 32px; }
  .feature-row { grid-template-columns: 1fr; }
  .grid { grid-template-columns: 1fr; }
  .sidebar { padding: 14px; }
  .price-range label { font-size: 13px; }
}

/* Small animation */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- Responsive ------------------------------------------------------ */
@media (max-width: 980px) {
  .hero-inner {
    grid-template-columns: 1fr;
    padding-block: 36px;
  }
  .feature-row {
    grid-template-columns: 1fr;
  }
  .grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .nav-links {
    display: none;
  }
  .hamburger {
    display: grid;
  }

  .search {
    position: relative;
    display: flex;
    align-items: center;
    margin-right: 0rem;
    display: flex;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    width: 100%;
    max-width: 400px;
    background: #fff;
    margin-bottom: 20px;
  }
  .search input {
    width: 300px;
    max-width: 55vw;
    padding: 10px 36px 10px 14px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 999px;
    outline: none;
    flex: 1;
    border: none;
    outline: none;
    font-size: 14px;
  }
}
@media (max-width: 855px) {
  .grid {
    grid-template-columns: 1fr;
  }
}




/* 🔹 Animation */
@keyframes fadeInUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}



