/* ------------------------------------------------------------
   cart.css — OuterCMS 2025 Minimal + Clean Version
   ------------------------------------------------------------ */

:root {
  --cart-accent: #ff7f00;
  --cart-bg: #1b1b1b;
  --cart-surface: #242424;
  --cart-border: #333;
  --cart-text: #eaeaea;
  --cart-muted: #aaa;
  --cart-radius: 10px;
  --cart-spacing: 12px;
  font-family: 'Inter', sans-serif;
}

/* ==========================
   CART CONTAINER & LAYOUT
   ========================== */
.cart {
  max-width: 850px;
  margin: 60px auto;
  background: var(--cart-surface);
  border-radius: var(--cart-radius);
  box-shadow: 0 0 25px rgba(0,0,0,0.3);
  padding: 20px 30px;
  color: var(--cart-text);
  animation: fadeIn 0.3s ease-in-out;
}

.cart h2 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--cart-border);
  padding-bottom: 0.5rem;
}

.cart .empty {
  text-align: center;
  padding: 50px;
  color: var(--cart-muted);
  background: #111;
  border-radius: 8px;
}

/* ==========================
   TABLE STYLES
   ========================== */
.cart-table {
  width: 100%;
  border-collapse: collapse;
}

.cart-table th {
  font-size: 0.85rem;
  color: var(--cart-muted);
  text-align: left;
  border-bottom: 1px solid var(--cart-border);
  padding-bottom: 6px;
  text-transform: uppercase;
  font-weight: 600;
}

.cart-table td {
  padding: 12px 8px;
  border-bottom: 1px solid #222;
  vertical-align: middle;
}

.cart-table tr:hover {
  background: #1c1c1c;
}

/* Item Column */
.cart-table td.name {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cart-table td.name img {
  width: 48px;
  height: auto;
  border-radius: 6px;
  object-fit: contain;
  background: #111;
  padding: 4px;
}

/* Price Column */
.price {
  text-align: right;
  font-weight: 600;
  color: var(--cart-text);
}

.price strong {
  color: var(--cart-accent);
}

/* ==========================
   QUANTITY + REMOVE
   ========================== */
.qty {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: center;
}

.qty button {
  background: #333;
  border: none;
  color: #eee;
  font-size: 1rem;
  width: 26px;
  height: 26px;
  line-height: 1;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
}
.qty button:hover { background: #444; }

.qty-input {
  width: 44px;
  text-align: center;
  background: #111;
  color: #fff;
  border: 1px solid #444;
  border-radius: 4px;
  padding: 3px;
}

.remove {
  background: transparent;
  border: none;
  color: #999;
  font-size: 1.2rem;
  cursor: pointer;
  transition: color 0.2s;
}
.remove:hover { color: #ff3333; }

/* ==========================
   PREVIEW BUTTON
   ========================== */
.preview-btn {
  display: inline-block;
  color: var(--cart-accent);
  font-size: 0.8rem;
  cursor: pointer;
  margin-top: 2px;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.preview-btn:hover { color: #ffa74f; }

/* ==========================
   ACTION BAR
   ========================== */
.action-bar {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 25px;
}

.btn {
  padding: 10px 18px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background 0.2s;
}

.btn.primary {
  background: var(--cart-accent);
  color: #fff;
}
.btn.primary:hover { background: #ffa733; }

.btn.secondary {
  background: #333;
  color: #ddd;
}
.btn.secondary:hover { background: #444; }

/* ==========================
   RESPONSIVE
   ========================== */
@media (max-width: 700px) {
  .cart-table {
    display: block;
    overflow-x: auto;
  }
  .cart {
    padding: 15px;
  }
  .action-bar {
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
  }
  .btn { width: 100%; text-align: center; }
}

/* ==========================
   AUTO-SIZING PREVIEW MODAL
   ========================== */

#previewModal {
  position: fixed;
  inset: 0;
  display: none;
  justify-content: center;
  align-items: center;
  background: rgba(0, 0, 0, 0.9);
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.25s ease;
}

#previewModal.active {
  display: flex;
  opacity: 1;
}

/* The content box now adapts to the image itself */
#previewModal .preview-content {
  position: relative;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  padding: 0;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.6);
  max-width: 95vw;
  max-height: 95vh;
}

/* Image defines modal size */
#previewModalImg {
  display: block;
  height: auto;
  width: auto;
  max-width: 95vw;
  max-height: 95vh;
  object-fit: contain;
  background: transparent;
  border: none;
}

/* ==========================
   CLOSE BUTTON FOR MODAL
   ========================== */
.close-modal {
  position: absolute;
  top: 10px;
  right: 12px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  border: none;
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 4px;
  padding: 4px 10px;
  z-index: 10;
  transition: background 0.2s ease;
}

.close-modal:hover {
  background: rgba(255, 127, 0, 0.8);
  color: #fff;
}

/* ==========================
   ANIMATIONS
   ========================== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
