/* ===== RESET & BASE ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --red: #c8102e;
  --dark: #1a1a1a;
  --light: #f9f7f4;
  --grey: #666;
  --white: #ffffff;
  --shadow: 0 4px 20px rgba(0,0,0,.12);
  --transition: .3s ease;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  background: var(--light);
  color: var(--dark);
  line-height: 1.6;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
ul { list-style: none; }

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ===== HEADER ===== */
header {
  background: var(--white);
  box-shadow: 0 2px 10px rgba(0,0,0,.08);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.header-top {
  display: flex;
  align-items: center;
  padding: 0;
}

.logo {
  flex-shrink: 0;
  padding: 8px 20px 8px 0;
}

.logo img {
  height: 44px;
  width: auto;
}

.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}

.hamburger span {
  display: block;
  width: 26px;
  height: 3px;
  background: var(--dark);
  margin: 5px 0;
  border-radius: 2px;
  transition: var(--transition);
}

/* ===== NAVIGATION ===== */
nav {
  flex: 1;
}

nav ul {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
}

nav > ul > li {
  position: relative;
}

nav > ul > li > a {
  display: block;
  padding: 14px 20px;
  color: var(--dark);
  font-size: .9rem;
  font-weight: 500;
  letter-spacing: .5px;
  text-transform: uppercase;
  transition: var(--transition);
}

nav > ul > li > a:hover,
nav > ul > li > a.active {
  color: var(--red);
}

/* Dropdown */
.dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 240px;
  background: var(--white);
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: var(--transition);
  z-index: 100;
}

nav > ul > li:hover .dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown a {
  display: block;
  padding: 10px 20px;
  font-size: .88rem;
  color: var(--dark);
  border-bottom: 1px solid #eee;
  transition: var(--transition);
}

.dropdown a:last-child { border-bottom: none; }

.dropdown a:hover {
  background: var(--red);
  color: var(--white);
  padding-left: 26px;
}

/* ===== HERO ===== */
.hero {
  background: linear-gradient(135deg, var(--dark) 0%, #2d1a1a 100%);
  color: var(--white);
  text-align: center;
  padding: 70px 20px;
}

.hero-logo {
  max-width: 400px;
  width: 100%;
  height: auto;
  margin: 0 auto;
}

/* ===== SECTIONS ===== */
section {
  padding: 60px 0;
}

section:nth-child(even) {
  background: var(--white);
}

.section-title {
  text-align: center;
  margin-bottom: 40px;
}

.section-title h2 {
  font-size: 1.8rem;
  color: var(--dark);
  position: relative;
  display: inline-block;
  padding-bottom: 12px;
}

.section-title h2::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 3px;
  background: var(--red);
}

/* ===== BOOK GRID ===== */
.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 30px;
  padding: 0 20px;
}

.book-card {
  background: var(--white);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: var(--transition);
  cursor: pointer;
}

.book-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 30px rgba(0,0,0,.18);
}

.book-card img {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
}

.book-card .book-info {
  padding: 12px 14px;
}

.book-card .book-title {
  font-size: .88rem;
  font-weight: 600;
  margin-bottom: 4px;
  line-height: 1.3;
}

.book-card .book-author {
  font-size: .8rem;
  color: var(--grey);
}

/* ===== BOOK PRICE ===== */
.book-card .book-price {
  font-size: .85rem;
  font-weight: 600;
  color: var(--red);
  margin-top: 4px;
}

/* ===== ADD TO CART BUTTON ===== */
.book-card .cart-add-btn {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 7px 0;
  background: var(--red);
  color: var(--white);
  border: none;
  border-radius: 4px;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s, transform .15s;
}

.book-card .cart-add-btn:hover {
  background: #a00d24;
}

.book-card .cart-add-btn.added {
  background: #2a7d2a;
}

/* ===== LIBRARI NOTE ===== */
.librari-note {
  text-align: center;
  margin-bottom: 30px;
  padding: 14px 20px;
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 6px;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}

.librari-note p {
  font-size: .95rem;
  color: #664d03;
  margin: 0;
}

/* ===== ORDER MODAL ===== */
#order-modal {
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.order-modal-content {
  background: linear-gradient(145deg, #ffffff 0%, var(--light) 100%);
  border-radius: 16px;
  padding: 36px 32px 32px;
  width: 92%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.25), 0 0 0 1px rgba(255,255,255,.1);
  animation: modalSlideIn .3s ease;
}

@keyframes modalSlideIn {
  from { opacity: 0; transform: translateY(20px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.order-modal-content h3 {
  font-size: 1.05rem;
  color: var(--white);
  background: var(--dark);
  margin: -36px -32px 24px;
  padding: 18px 24px;
  border-radius: 16px 16px 0 0;
  text-align: center;
  letter-spacing: .3px;
  line-height: 1.4;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: .78rem;
  font-weight: 600;
  color: var(--grey);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: .6px;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 11px 14px;
  border: 2px solid #e0ddd8;
  border-radius: 8px;
  font-size: .92rem;
  font-family: inherit;
  background: var(--white);
  color: var(--dark);
  transition: border-color .2s, box-shadow .2s;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(200,16,46,.12);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: #bbb;
}

.form-group textarea {
  resize: vertical;
}

.submit-btn {
  display: block;
  width: 100%;
  padding: 13px;
  background: var(--red);
  color: var(--white);
  border: none;
  border-radius: 10px;
  font-size: .95rem;
  font-weight: 700;
  letter-spacing: .5px;
  cursor: pointer;
  margin-top: 20px;
  transition: background .2s, transform .15s, box-shadow .2s;
  box-shadow: 0 4px 14px rgba(200,16,46,.3);
}

.submit-btn:hover {
  background: #a00d24;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(200,16,46,.4);
}

.submit-btn:active {
  transform: translateY(0);
}

/* ===== AUTHOR SECTION ===== */
.author-filter {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-bottom: 40px;
}

.author-filter button {
  padding: 8px 18px;
  border: 2px solid var(--dark);
  background: transparent;
  color: var(--dark);
  font-size: .85rem;
  border-radius: 25px;
  cursor: pointer;
  transition: var(--transition);
  font-weight: 500;
}

.author-filter button:hover,
.author-filter button.active {
  background: var(--red);
  border-color: var(--red);
  color: var(--white);
}

/* ===== ABOUT ===== */
.about-content {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 20px;
}

.about-content p {
  font-size: 1.05rem;
  margin-bottom: 20px;
  line-height: 1.8;
  color: #444;
}

.about-content ul {
  list-style: none;
  padding-left: 0;
}

.about-content ul li {
  padding: 8px 0 8px 28px;
  position: relative;
  font-size: 1rem;
  color: #444;
}

.about-content ul li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 16px;
  width: 12px;
  height: 2px;
  background: var(--red);
}

/* ===== CONTACT ===== */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 20px;
}

.contact-info h3 {
  font-size: 1.2rem;
  margin-bottom: 20px;
  color: var(--dark);
}

.contact-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 18px;
}

.contact-item .icon {
  width: 40px;
  height: 40px;
  background: var(--red);
  color: var(--white);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1rem;
}

.contact-item .text {
  font-size: .95rem;
  color: #444;
  line-height: 1.5;
}

.contact-item .text a {
  color: var(--red);
}

.contact-item .text a:hover {
  text-decoration: underline;
}

/* ===== FOOTER ===== */
footer {
  background: var(--dark);
  color: #aaa;
  text-align: center;
  padding: 30px 20px;
  font-size: .85rem;
}

footer a {
  color: var(--red);
}

/* ===== MODAL / LIGHTBOX ===== */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,.85);
  z-index: 2000;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active {
  display: flex;
}

.modal-overlay img {
  max-height: 90vh;
  max-width: 90vw;
  border-radius: 6px;
  box-shadow: 0 0 40px rgba(0,0,0,.5);
}

.modal-close {
  position: absolute;
  top: 20px;
  right: 30px;
  font-size: 2.5rem;
  color: var(--white);
  cursor: pointer;
  line-height: 1;
  z-index: 2001;
}

/* ===== FLOATING CART BUTTON ===== */
.floating-cart-btn {
  position: fixed;
  bottom: 28px;
  right: 28px;
  background: var(--red);
  color: var(--white);
  border: none;
  border-radius: 50px;
  padding: 18px 32px;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  z-index: 1100;
  box-shadow: 0 6px 24px rgba(200,16,46,.45);
  transition: background .2s, transform .15s, box-shadow .2s;
  letter-spacing: .3px;
}

.floating-cart-btn:hover {
  background: #a00d24;
  transform: translateY(-2px);
  box-shadow: 0 10px 34px rgba(200,16,46,.55);
}

.floating-cart-btn:active {
  transform: translateY(0);
}

.cart-badge {
  display: none;
  position: absolute;
  top: -6px;
  right: -6px;
  background: var(--dark);
  color: var(--white);
  font-size: .75rem;
  font-weight: 700;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  line-height: 24px;
  text-align: center;
}

/* ===== CART PANEL ===== */
.cart-panel {
  display: none;
  position: fixed;
  bottom: 90px;
  right: 28px;
  width: 380px;
  max-height: 70vh;
  background: var(--white);
  border-radius: 16px;
  box-shadow: 0 12px 48px rgba(0,0,0,.2);
  z-index: 1100;
  flex-direction: column;
  animation: cartSlideUp .25s ease;
}

.cart-panel.open {
  display: flex;
}

@keyframes cartSlideUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.cart-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--dark);
  color: var(--white);
  border-radius: 16px 16px 0 0;
}

.cart-panel-header h3 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
}

.cart-panel-close {
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  opacity: .7;
  transition: opacity .2s;
}

.cart-panel-close:hover { opacity: 1; }

.cart-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}

.cart-empty {
  text-align: center;
  color: var(--grey);
  padding: 20px 0;
  font-size: .92rem;
}

.cart-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid #eee;
}

.cart-item:last-child { border-bottom: none; }

.cart-item-info {
  flex: 1;
  min-width: 0;
}

.cart-item-title {
  display: block;
  font-size: .85rem;
  font-weight: 600;
  color: var(--dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cart-item-qty {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  font-size: .82rem;
  color: var(--grey);
}

.qty-btn {
  width: 24px;
  height: 24px;
  border: 1px solid #ddd;
  background: var(--light);
  border-radius: 4px;
  font-size: .85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}

.qty-btn:hover { background: #e0ddd8; }

.cart-item-remove {
  background: none;
  border: none;
  font-size: 1.3rem;
  color: #bbb;
  cursor: pointer;
  padding: 0 0 0 10px;
  transition: color .15s;
}

.cart-item-remove:hover { color: var(--red); }

/* Custom title add row */
.cart-add-custom {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 2px solid #eee;
}

.cart-add-custom label {
  display: block;
  font-size: .78rem;
  font-weight: 600;
  color: var(--grey);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 6px;
}

.cart-add-row {
  display: flex;
  gap: 8px;
}

.cart-add-row input {
  flex: 1;
  padding: 9px 12px;
  border: 2px solid #e0ddd8;
  border-radius: 8px;
  font-size: .88rem;
  font-family: inherit;
  background: var(--white);
  transition: border-color .2s;
}

.cart-add-row input:focus {
  outline: none;
  border-color: var(--red);
}

.cart-add-row button {
  padding: 9px 16px;
  background: var(--red);
  color: var(--white);
  border: none;
  border-radius: 8px;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .2s;
}

.cart-add-row button:hover { background: #a00d24; }

.cart-panel-footer {
  padding: 14px 20px;
  border-top: 1px solid #eee;
}

.cart-checkout-btn {
  display: block;
  width: 100%;
  padding: 13px;
  background: var(--red);
  color: var(--white);
  border: none;
  border-radius: 10px;
  font-size: .95rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .2s, box-shadow .2s;
  box-shadow: 0 4px 14px rgba(200,16,46,.3);
}

.cart-checkout-btn:hover:not(:disabled) {
  background: #a00d24;
}

.cart-checkout-btn:disabled {
  background: #ccc;
  box-shadow: none;
  cursor: default;
}

/* Order book list in checkout modal */
.order-book-list {
  margin-bottom: 16px;
}

.order-book-item {
  padding: 8px 12px;
  background: var(--light);
  border-radius: 6px;
  margin-bottom: 6px;
  font-size: .88rem;
  color: var(--dark);
  font-weight: 500;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .contact-grid { grid-template-columns: 1fr; }
  .book-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 20px; }
}

@media (max-width: 768px) {
  .header-top {
    flex-wrap: wrap;
    justify-content: space-between;
  }

  .hamburger { display: block; }

  nav {
    width: 100%;
    max-height: 0;
    overflow: hidden;
    transition: max-height .4s ease;
  }

  nav.open {
    max-height: 800px;
  }

  nav ul {
    flex-direction: column;
  }

  nav > ul > li > a {
    padding: 12px 20px;
    border-bottom: 1px solid rgba(0,0,0,.06);
  }

  .dropdown {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    display: none;
    background: #f2f2f2;
  }

  .dropdown.open { display: block; }

  .dropdown a {
    color: var(--dark);
    border-bottom-color: rgba(0,0,0,.06);
    padding-left: 40px;
  }

  .dropdown a:hover {
    padding-left: 46px;
  }

  .hero-logo { max-width: 280px; }

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

  .section-title h2 { font-size: 1.4rem; }

  .floating-cart-btn {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    border-radius: 0;
    padding: 16px 20px;
    font-size: 1.05rem;
    text-align: center;
    box-shadow: 0 -4px 20px rgba(0,0,0,.15);
  }

  .cart-badge {
    position: static;
    display: inline-block;
    margin-left: 8px;
    vertical-align: middle;
  }

  .cart-panel {
    bottom: 60px;
    right: 0;
    left: 0;
    width: 100%;
    max-height: 65vh;
    border-radius: 16px 16px 0 0;
  }
}
