*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  overflow-x: hidden;
}

:root {
  --primary: #2563eb;
  --accent: #f59e0b;
  --success: #10b981;
  --dark: #1f2937;
}

body.cart-open {
  overflow: hidden;
}

body {
  margin: 0;
  font-family: "Segoe UI", sans-serif;
  background: #f4f6f9;
  color: #333;
}

/* NAVBAR */

.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 40px;
  background: var(--dark);
  color: white;
}

.cart-btn {
  background: var(--accent);
  border: none;
  padding: 10px 15px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
  transition: transform 0.2s ease;
}

.cart-btn:hover {
  transform: scale(1.05);
}

/* HERO */

.hero {
  display: flex;
  gap: 60px;
  padding: 60px;
  flex-wrap: wrap;
  align-items: center;
}

.book-cover img {
  width: 280px;
  border-radius: 12px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
  transition: transform 0.3s ease;
}

.book-cover img:hover {
  transform: scale(1.05);
}

.price {
  font-size: 26px;
  font-weight: bold;
  margin: 20px 0;
}

/* ESTRELLAS */

.stars {
  color: var(--accent);
  font-size: 20px;
  margin-bottom: 10px;
}

/* FORMATO */

.format-select {
  margin: 15px 0;
}

.format-select select {
  padding: 8px;
  border-radius: 6px;
}

/* BOTONES */

.primary-btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.primary-btn:hover {
  background: #1e40af;
  transform: translateY(-2px);
}

.secondary-btn {
  display: inline-block;
  /* importante */
  text-decoration: none;
  padding: 12px 20px;
  border: 2px solid var(--primary);
  border-radius: 8px;
  color: var(--primary);
  margin-left: 10px;
  transition: all 0.3s ease;
  text-align: center;
  white-space: nowrap;
  /* evita que se parta */
}

.secondary-btn:hover {
  background: var(--primary);
  color: white;
}

/* RESUMEN */

.summary {
  background: white;
  padding: 50px 60px;
}

/* CARRITO */

.cart-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 320px;
  height: 100%;
  background: white;
  box-shadow: -5px 0 20px rgba(0, 0, 0, 0.2);
  padding: 20px;
  overflow-y: auto;

  transform: translateX(100%);
  transition: transform 0.35s ease;
}

.cart-panel.active {
  transform: translateX(0);
}

.cart-item {
  border-bottom: 1px solid #ddd;
  padding: 10px 0;
}

.cart-item button {
  background: none;
  border: none;
  color: red;
  cursor: pointer;
}

.total {
  font-weight: bold;
  margin-top: 20px;
}

.checkout-btn {
  width: 100%;
  padding: 12px;
  background: var(--success);
  border: none;
  color: white;
  border-radius: 8px;
  cursor: pointer;
  margin-top: 15px;
}

/* FEEDBACK */

.toast {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: var(--success);
  color: white;
  padding: 15px 20px;
  border-radius: 8px;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.cart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.close-cart {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  font-weight: bold;
}

/* QR RESPONSIVO */

.cart-panel img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 15px auto 0 auto;
}

/* MEJORAS RESPONSIVE */

@media (max-width: 768px) {
  .primary-btn,
  .secondary-btn {
    display: block;
    /* clave */
    width: 100%;
    margin: 10px 0;
  }

  .cart-panel {
    width: 100%;
  }
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  visibility: hidden;
  transition: 0.3s ease;
}

.overlay.active {
  opacity: 1;
  visibility: visible;
}

input,
textarea {
  padding: 0.8rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-family: inherit;
}

form {
  display: grid;
  gap: 1rem;
  max-width: 600px;
  margin: auto;
}

.checkout-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}