/* Global Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Utility Classes */
.hidden {
  display: none !important;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background-color: #f5f5f5;
  color: #333;
  line-height: 1.6;
}

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

/* Header */
header {
  background: #fff;
  padding: 20px 0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 100;
}

header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

header h1 {
  font-size: 1.5rem;
  color: #2563eb;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 15px;
}

.currency-selector {
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
}

.cart-btn {
  position: relative;
  background: #2563eb;
  color: white;
  border: none;
  padding: 10px 15px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 18px;
  transition: background 0.2s;
}

.cart-btn:hover {
  background: #1d4ed8;
}

.cart-count {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #ef4444;
  color: white;
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 50%;
  min-width: 18px;
  text-align: center;
}

/* Products Grid */
main h2 {
  margin: 30px 0 20px;
  font-size: 1.8rem;
}

.routing-info {
  margin-bottom: 20px;
  padding: 12px 16px;
  background: #eff6ff;
  border-left: 4px solid #2563eb;
  border-radius: 6px;
  color: #1e3a5f;
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 25px;
  margin-bottom: 50px;
}

.product-card {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  transition: transform 0.2s, box-shadow 0.2s;
}

.product-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

.product-image {
  width: 100%;
  height: 180px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 60px;
}

.product-info {
  padding: 20px;
}

.product-name {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.product-description {
  color: #666;
  font-size: 0.9rem;
  margin-bottom: 15px;
}

.product-price {
  font-size: 1.3rem;
  font-weight: 700;
  color: #2563eb;
  margin-bottom: 15px;
}

.add-to-cart-btn {
  width: 100%;
  background: #2563eb;
  color: white;
  border: none;
  padding: 12px;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s;
}

.add-to-cart-btn:hover {
  background: #1d4ed8;
}

.add-to-cart-btn.added {
  background: #22c55e;
}

/* Cart Sidebar */
.cart-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: 400px;
  max-width: 100%;
  height: 100vh;
  background: #fff;
  box-shadow: -5px 0 20px rgba(0, 0, 0, 0.15);
  z-index: 200;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s ease;
}

.cart-sidebar.open {
  transform: translateX(0);
}

.cart-sidebar.hidden {
  transform: translateX(100%);
}

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

.cart-header h3 {
  font-size: 1.2rem;
}

.close-btn {
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: #666;
}

.cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.cart-item {
  display: flex;
  align-items: center;
  padding: 15px 0;
  border-bottom: 1px solid #eee;
}

.cart-item-image {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-right: 15px;
}

.cart-item-info {
  flex: 1;
}

.cart-item-name {
  font-weight: 600;
  margin-bottom: 5px;
}

.cart-item-price {
  color: #2563eb;
  font-weight: 600;
}

.cart-item-quantity {
  display: flex;
  align-items: center;
  gap: 10px;
}

.qty-btn {
  background: #e5e7eb;
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
}

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

.cart-total {
  display: flex;
  justify-content: space-between;
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 15px;
}

.checkout-btn {
  width: 100%;
  background: #22c55e;
  color: white;
  border: none;
  padding: 15px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.checkout-btn:hover:not(:disabled) {
  background: #16a34a;
}

.checkout-btn:disabled {
  background: #94a3b8;
  cursor: not-allowed;
}

.cart-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 150;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.cart-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.cart-overlay.hidden {
  display: none;
}

/* Checkout Page */
.checkout-container {
  padding: 30px 20px;
}

.checkout-layout {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 30px;
}

@media (max-width: 768px) {
  .checkout-layout {
    grid-template-columns: 1fr;
  }
}

/* Left Column - Order Summary + Test Card */
.left-column {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.order-summary {
  background: #fff;
  border-radius: 12px;
  padding: 25px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  height: fit-content;
}

.order-summary h2 {
  margin-top: 0;
  margin-bottom: 20px;
  font-size: 1.3rem;
}

.order-item {
  display: flex;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #eee;
}

.order-item-image {
  width: 50px;
  height: 50px;
  border-radius: 8px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-right: 12px;
}

.order-item-info {
  flex: 1;
}

.order-item-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.order-item-qty {
  color: #666;
  font-size: 0.85rem;
}

.order-item-price {
  font-weight: 600;
  color: #2563eb;
}

.order-total {
  display: flex;
  justify-content: space-between;
  font-size: 1.3rem;
  font-weight: 700;
  margin-top: 20px;
  padding-top: 15px;
  border-top: 2px solid #eee;
}

/* Payment Section */
.payment-section {
  background: #fff;
  border-radius: 12px;
  padding: 25px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.payment-section h2 {
  margin-top: 0;
  margin-bottom: 20px;
  font-size: 1.3rem;
}

.connector-info {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 20px;
  font-size: 0.9rem;
}

/* Test Card Section */
.test-card-section {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  border: 2px dashed #f59e0b;
}

.test-card-section.hidden {
  display: none;
}

.test-card-header {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

.test-card-badge {
  background: #f59e0b;
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 20px;
  letter-spacing: 1px;
}

.test-card-details {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.test-card-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  background: #fef3c7;
  border-radius: 8px;
  border: 1px solid #fcd34d;
}

.test-card-label {
  color: #92400e;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.test-card-value-group {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.test-card-value {
  font-family: 'Courier New', monospace;
  font-size: 1.1rem;
  font-weight: 700;
  color: #1f2937;
  letter-spacing: 1px;
}

.copy-field-btn {
  background: white;
  border: 1px solid #f59e0b;
  color: #f59e0b;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 4px;
}

.copy-field-btn:hover {
  background: #f59e0b;
  color: white;
}

.copy-field-btn.copied {
  background: #22c55e;
  border-color: #22c55e;
  color: white;
}

.test-card-value {
  color: #1f2937;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.5px;
}

.loading {
  text-align: center;
  padding: 40px;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #e5e7eb;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 15px;
}

.spinner-small {
  width: 20px;
  height: 20px;
  border: 2px solid #fff;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  display: inline-block;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.payment-form-container {
  margin-top: 20px;
}

.payment-form-container.hidden {
  display: none;
}

#card-element {
  padding: 15px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fafafa;
  margin-bottom: 15px;
}

.card-errors {
  color: #ef4444;
  font-size: 0.9rem;
  margin-bottom: 15px;
  min-height: 20px;
}

.submit-btn {
  width: 100%;
  background: #2563eb;
  color: white;
  border: none;
  padding: 15px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.submit-btn:hover:not(:disabled) {
  background: #1d4ed8;
}

.submit-btn:disabled {
  background: #94a3b8;
  cursor: not-allowed;
}

.btn-spinner.hidden {
  display: none;
}

/* Payment Result */
.payment-result {
  text-align: center;
  padding: 40px 20px;
}

.payment-result.hidden {
  display: none;
}

#result-icon {
  font-size: 60px;
  margin-bottom: 20px;
}

#result-title {
  font-size: 1.5rem;
  margin-bottom: 10px;
}

#result-message {
  color: #666;
  margin-bottom: 25px;
}

.txn-id {
  color: #6b7280;
  font-size: 0.9rem;
  margin-bottom: 40px;
}

.result-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}

.refund-btn {
  background: #f59e0b;
  color: white;
  border: none;
  padding: 12px 25px;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s;
}

.refund-btn:hover {
  background: #d97706;
}

.continue-btn {
  display: inline-block;
  background: #2563eb;
  color: white;
  padding: 10px 20px;
  border-radius: 6px;
  text-decoration: none;
  transition: background 0.2s;
  font-size: 0.9rem;
}

.continue-btn:hover {
  background: #1d4ed8;
}

.back-link {
  color: #2563eb;
  text-decoration: none;
  font-size: 0.9rem;
}

.back-link:hover {
  text-decoration: underline;
}

/* Empty cart */
.empty-cart {
  text-align: center;
  padding: 40px 20px;
  color: #666;
}

.empty-cart-icon {
  font-size: 50px;
  margin-bottom: 15px;
}
