/* Base styles */
body {
  font-family: 'Segoe UI', sans-serif;
  margin: 0;
  background: #f4f4f4;
  color: #222;
  overflow-x: hidden;
}

header {
  background: #000;
  color: #fff;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
}

header img {
  width: 50px;
  margin-right: 15px;
  flex-shrink: 0;
}

header h1 {
  font-size: 1.5rem;
  margin: 0;
  flex-grow: 1;
  text-align: center;
}

#cart-total-nav {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  background: #222;
  color: #fff;
  padding: 8px 14px;
  border-radius: 20px;
  font-weight: bold;
}

.grid-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
  padding: 20px;
  max-height: 480px;
  overflow-y: auto;
}

.product {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  width: 240px;
  overflow: hidden;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.product img {
  width: 100%;
  height: auto;
}

.product h3 {
  margin: 10px 0 5px;
}

.product p {
  margin: 5px 0;
  font-weight: bold;
}

.btn {
  margin: 10px;
  padding: 10px;
  background: #000;
  color: #fff;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.btn:hover {
  background: #444;
}

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

.qty-controls button {
  background: #000;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
}

.qty-controls button:hover {
  background: #333;
}

#checkout-modal {
  display: none;
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  width: 100%;
  height: 120%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

#checkout-modal.show {
  display: block;
  opacity: 1;
  pointer-events: auto;
}

#checkout {
  background: #fff;
  padding: 30px;
  width: 90%;
  max-width: 800px;
  margin: 50px auto;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  position: relative;
  max-height: 80vh;
  overflow-y: auto;
}

#checkout-close {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 28px;
  font-weight: bold;
  color: #666;
  cursor: pointer;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
}

th, td {
  padding: 10px;
  border-bottom: 1px solid #ccc;
}

input[type="text"],
input[type="email"],
input[type="file"] {
  width: 100%;
  padding: 10px;
  margin: 8px 0 15px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

/* Payment method */
.payment-options {
  display: flex;
  gap: 20px;
  margin: 15px 0;
  font-weight: bold;
}

.payment-options input[type="radio"] {
  margin-right: 8px;
}

.btc-area {
  text-align: center;
  background: #f9f9f9;
  padding: 20px;
  border-radius: 6px;
  margin-top: 15px;
}

.qr {
  width: 160px;
  height: 160px;
  margin: 0 auto 10px;
  /* Remove background-image or borders if set before */
}

#btc-addr {
  user-select: all;
  font-family: monospace;
  background: #eaeaea;
  padding: 6px 8px;
  border-radius: 4px;
  display: inline-block;
  max-width: 100%;
  overflow-wrap: break-word;
  margin-right: 10px;
}

#copy-btn {
  background: #007bff;
  color: #fff;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
}

#copy-btn:hover {
  background: #0056b3;
}

.confirm-btn {
  width: 100%;
  padding: 14px;
  background: #28a745;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 16px;
  cursor: pointer;
}

.confirm-btn:hover {
  background: #218838;
}

/* View Orders */
.view-orders {
  background: #007bff;
  color: #fff;
  border: none;
  padding: 10px;
  margin: 20px auto;
  display: block;
  border-radius: 5px;
  cursor: pointer;
  max-width: 200px;
}

#orders {
  background: #fff;
  padding: 30px;
  max-width: 800px;
  margin: 30px auto;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Bottom bar */
#bottom-checkout-bar {
  position: bottom;
  bottom: 0;
  left: 0;
  right: 0;
  background: #222;
  color: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 12px 20px;
  font-weight: bold;
  z-index: 10000;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.3);
  flex-wrap: wrap;
  gap: 10px;
}

#bottom-checkout-bar button {
  background: #28a745;
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 4px;
  cursor: pointer;
}

/* BTC success popup */
.modal-content {
  border-radius: 12px;
  background-color: #f0fff0;
}

.modal-content h4 {
  color: #218838;
}

/* Share Popup */
#share-popup .modal-content {
  background-color: #f4faff;
  border-radius: 12px;
}

#share-popup .btn {
  padding: 12px;
  font-size: 16px;
}

/* Loader */
#loader-overlay {
  display: none;
  position: fixed;
  background: rgba(255, 255, 255, 0.85);
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10001;
  font-size: 20px;
  font-weight: bold;
  color: #333;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Responsive */
@media (max-width: 768px) {
  header {
    justify-content: space-between;
    padding: 15px 10px;
  }

  header h1 {
    font-size: 1.25rem;
    flex-grow: 1;
    margin: 0 10px;
    text-align: left;
  }

  #cart-total-nav {
    position: static;
    transform: none;
    margin-top: 10px;
    border-radius: 6px;
    padding: 6px 12px;
  }

  .grid-container {
    max-height: none;
    padding: 10px;
    gap: 15px;
  }

  .product {
    width: 45vw;
  }

  #checkout {
    margin: 10px auto;
    padding: 20px;
    max-height: 85vh;
    width: 95%;
  }

  #bottom-checkout-bar {
    flex-direction: column;
    gap: 10px;
  }

  #bottom-checkout-bar button {
    margin-left: 0;
    width: 100%;
    max-width: 300px;
  }
}

@media (max-width: 400px) {
  .product {
    width: 90vw;
  }
}
