/* Design System Tokens */
:root {
  --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  
  /* HSL Color Palette */
  --bg-color: hsl(222, 47%, 6%);
  --card-bg: hsla(222, 40%, 12%, 0.7);
  --card-border: hsla(217, 30%, 20%, 0.6);
  --text-primary: hsl(210, 40%, 98%);
  --text-secondary: hsl(215, 20%, 65%);
  --primary: hsl(263, 90%, 51%);
  --primary-hover: hsl(263, 95%, 60%);
  --primary-glow: hsla(263, 90%, 51%, 0.35);
  --accent: hsl(190, 90%, 50%);
  --success: hsl(142, 70%, 45%);
  --success-glow: hsla(142, 70%, 45%, 0.3);
  --danger: hsl(350, 80%, 55%);
  
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 8px;
  
  --shadow-glow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  background-color: var(--bg-color);
  color: var(--text-primary);
  font-family: var(--font-family);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  position: relative;
}

/* Star Background Effect */
.stars-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
  background-image: 
    radial-gradient(white, rgba(255,255,255,.2) 2px, transparent 40px),
    radial-gradient(white, rgba(255,255,255,.15) 1px, transparent 30px),
    radial-gradient(white, rgba(255,255,255,.1) 2px, transparent 40px);
  background-size: 550px 550px, 350px 350px, 250px 250px;
  background-position: 0 0, 40px 60px, 130px 270px;
  opacity: 0.15;
}

/* Cosmic Glowing Backgrounds */
.glow-effect {
  position: absolute;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  filter: blur(120px);
  z-index: -1;
  opacity: 0.25;
  pointer-events: none;
}
.glow-effect.top-left {
  top: -100px;
  left: -100px;
  background: var(--primary);
}
.glow-effect.bottom-right {
  bottom: -100px;
  right: -100px;
  background: var(--accent);
}

/* Header */
.app-header {
  padding: 24px 5%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--card-border);
  backdrop-filter: blur(8px);
  background-color: rgba(6, 11, 25, 0.5);
  position: sticky;
  top: 0;
  z-index: 10;
}

.logo {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 2px;
}

.logo-accent {
  color: var(--accent);
  background: linear-gradient(135deg, var(--accent), var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-right: 4px;
}

.badge {
  background-color: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 6px 14px;
  border-radius: 50px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--accent);
  box-shadow: 0 0 10px var(--accent);
  animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
  0% { transform: scale(0.95); opacity: 0.5; }
  50% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.5; }
}

/* Container & Grid Layout */
.container {
  max-width: 1200px;
  width: 90%;
  margin: 40px auto;
  flex: 1;
}

.grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 32px;
  align-items: start;
}

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

/* Premium Card Design (Glassmorphism) */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-glow);
  backdrop-filter: blur(16px) saturate(120%);
  overflow: hidden;
  transition: var(--transition);
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.5);
  transform: translateY(-2px);
}

/* Product Card Column */
.product-card {
  display: flex;
  flex-direction: column;
}

.image-wrapper {
  position: relative;
  width: 100%;
  height: 380px;
  background-color: rgba(255, 255, 255, 0.02);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#product-image {
  max-width: 100%;
  max-height: 100%;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: var(--transition);
}

.product-card:hover #product-image {
  transform: scale(1.03);
}

.image-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(0deg, var(--bg-color) -10%, transparent 60%);
  pointer-events: none;
}

.product-info {
  padding: 32px;
}

.product-category {
  color: var(--accent);
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1.5px;
  display: inline-block;
  margin-bottom: 12px;
}

.product-info h1 {
  font-size: 32px;
  font-weight: 800;
  margin-bottom: 16px;
  line-height: 1.2;
}

.product-description {
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 24px;
  font-size: 15px;
}

.features {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.feature-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-primary);
}

.feature-icon {
  font-size: 16px;
}

/* Checkout Card Column */
.checkout-card {
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.checkout-card h2 {
  font-size: 22px;
  font-weight: 600;
}

.item-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.item-name {
  font-size: 16px;
  font-weight: 600;
  display: block;
  margin-bottom: 4px;
}

.item-price-unit {
  color: var(--text-secondary);
  font-size: 13px;
}

/* Quantity Selector */
.quantity-selector {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.btn-qty {
  background: transparent;
  border: none;
  color: var(--text-primary);
  width: 36px;
  height: 36px;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.btn-qty:hover {
  background: rgba(255, 255, 255, 0.1);
}

.qty-value {
  padding: 0 12px;
  font-weight: 600;
  font-size: 15px;
  min-width: 24px;
  text-align: center;
}

/* Pricing Calculations */
.price-calculations {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.calc-row {
  display: flex;
  justify-content: space-between;
  color: var(--text-secondary);
  font-size: 14px;
}

.free-shipping {
  color: var(--accent);
  font-weight: 600;
}

.tax-row {
  font-size: 12px;
  font-style: italic;
}

.total-row {
  color: var(--text-primary);
  font-size: 20px;
  font-weight: 800;
}

/* Dividers */
.divider {
  border: 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
}

.divider.dashed {
  background: transparent;
  border-top: 1px dashed rgba(255, 255, 255, 0.15);
}

/* Payment Buttons & Integrations */
.payment-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 8px;
}

.payment-message {
  font-size: 14px;
  color: var(--text-secondary);
  text-align: center;
}

.gpay-wrapper {
  min-height: 48px;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
}

/* Google Pay Default Button is rendered inside here. We override standard loader style */
.loader-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  border-top-color: var(--accent);
  animation: spin 1s linear infinite;
}

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

/* Standard Premium Buttons */
.btn {
  font-family: var(--font-family);
  font-size: 15px;
  font-weight: 600;
  padding: 14px 28px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  border: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: var(--text-primary);
  box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-primary:hover {
  box-shadow: 0 6px 20px var(--primary-glow);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.security-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 12px;
  margin-top: 12px;
}

/* Modals & Dialogs */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(4, 7, 15, 0.85);
  backdrop-filter: blur(12px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease-out;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: linear-gradient(180deg, hsl(222, 40%, 15%) 0%, hsl(222, 45%, 9%) 100%);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  padding: 40px;
  max-width: 480px;
  width: 90%;
  text-align: center;
  transform: scale(0.9) translateY(20px);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.modal-overlay.active .modal-card {
  transform: scale(1) translateY(0);
}

/* Modal Checkmark Animation */
.success-icon-wrapper {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--success-glow);
  border: 2px solid var(--success);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  box-shadow: 0 0 20px var(--success-glow);
  animation: pulse-success 2s infinite;
}

.success-icon {
  font-size: 40px;
  color: var(--success);
  font-weight: bold;
}

@keyframes pulse-success {
  0% { box-shadow: 0 0 0 0 var(--success-glow); }
  70% { box-shadow: 0 0 0 15px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

.modal-card h2 {
  font-size: 26px;
  font-weight: 800;
  margin-bottom: 8px;
}

.success-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 28px;
}

/* Receipt Details Inside Modal */
.receipt-card {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  padding: 20px;
  width: 100%;
  margin-bottom: 24px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.receipt-card h3 {
  font-size: 13px;
  text-transform: uppercase;
  color: var(--accent);
  letter-spacing: 1px;
  margin-bottom: 6px;
}

.receipt-row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
}

.receipt-row span:first-child {
  color: var(--text-secondary);
}

.highlight-val {
  color: var(--accent);
  font-weight: 800;
}

.receipt-code {
  font-family: monospace;
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
}

.info-note {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  background: rgba(190, 90, 50, 0.08);
  border-left: 2px solid var(--accent);
  padding: 10px 14px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 32px;
  text-align: left;
  width: 100%;
}

/* Confetti Canvas */
#confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 101;
}

/* Mock Google Pay Fallback Modal */
.gpay-mock-card {
  max-width: 440px;
  background: #1e1e1e;
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0;
  border-radius: 12px;
  color: #fff;
  display: flex;
  flex-direction: column;
}

.gpay-mock-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  width: 100%;
}

.gpay-mock-logo {
  font-size: 18px;
  font-weight: 600;
  background: linear-gradient(135deg, #4285f4, #ea4335, #fbbc05, #34a853);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.btn-close-x {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
}

.btn-close-x:hover {
  color: #fff;
}

.gpay-mock-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.gpay-mock-merchant {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 4px;
}

.gpay-mock-amount {
  font-size: 32px;
  font-weight: 800;
  margin-bottom: 24px;
}

.gpay-mock-card-select {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  margin-bottom: 20px;
  text-align: left;
}

.mock-card-icon {
  font-size: 28px;
}

.mock-card-info {
  display: flex;
  flex-direction: column;
}

.mock-card-title {
  font-size: 14px;
  font-weight: 600;
}

.mock-card-subtitle {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
}

.gpay-mock-warning {
  background: rgba(235, 175, 40, 0.08);
  border-left: 3px solid #fbbc05;
  padding: 12px 16px;
  border-radius: 0 6px 6px 0;
  font-size: 12px;
  line-height: 1.5;
  text-align: left;
  margin-bottom: 24px;
  color: rgba(255, 255, 255, 0.85);
}

.btn-gpay-mock {
  background: #1a73e8 !important;
  color: #fff !important;
  box-shadow: none !important;
  border-radius: 24px !important;
  font-weight: 600;
}

.btn-gpay-mock:hover {
  background: #1557b0 !important;
}

