/* Modern CSS Design System for Razorpay Integration */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --primary: #0C2340;
  --primary-light: #163860;
  --accent: #0D6EFD;
  --accent-hover: #0b5ed7;
  --razorpay-blue: #0C2340;
  --razorpay-accent: #3395FF;
  --success: #10B981;
  --success-bg: #ECFDF5;
  --danger: #EF4444;
  --danger-bg: #FEF2F2;
  --warning: #F59E0B;
  --bg-gradient: linear-gradient(135deg, #0b132b 0%, #1c2541 50%, #3a506b 100%);
  --surface: #ffffff;
  --surface-secondary: #f8fafc;
  --border: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow-lg: 0 20px 40px -15px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
}

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

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-gradient);
  min-height: 100vh;
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
}

.mono {
  font-family: 'JetBrains Mono', monospace;
}

/* App Navbar */
.app-header {
  max-width: 1100px;
  width: 100%;
  margin: 0 auto 24px auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(255, 255, 255, 0.4);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--primary);
}

.brand-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #0C2340 0%, #3395FF 100%);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 20px;
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav-link {
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.2s ease;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
}

.nav-link:hover, .nav-link.active {
  color: var(--razorpay-accent);
  background: rgba(51, 149, 255, 0.08);
}

.badge-testmode {
  background: #fef3c7;
  color: #92400e;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid #fde68a;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.badge-testmode::before {
  content: '';
  width: 6px;
  height: 6px;
  background: #f59e0b;
  border-radius: 50%;
  display: inline-block;
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

/* Main Container */
.main-wrapper {
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  flex: 1;
}

/* Card Container */
.checkout-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 24px;
}

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

.glass-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  padding: 28px;
  position: relative;
}

/* Section Titles */
.section-header {
  margin-bottom: 22px;
}

.section-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 6px;
}

.section-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Product Cards */
.products-selector {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.product-option {
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  background: var(--surface-secondary);
  position: relative;
}

.product-option:hover {
  border-color: var(--razorpay-accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.product-option.selected {
  border-color: var(--razorpay-accent);
  background: #f0f7ff;
}

.product-option.selected::after {
  content: '✓';
  position: absolute;
  top: 10px;
  right: 10px;
  width: 20px;
  height: 20px;
  background: var(--razorpay-accent);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
}

.product-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-main);
  margin-bottom: 4px;
}

.product-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.product-price {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--primary);
}

/* Custom Amount Box */
.custom-amount-box {
  background: #f8fafc;
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.custom-amount-box input {
  font-size: 1.1rem;
  font-weight: 700;
}

/* Form Groups */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 12px 14px;
  font-size: 0.95rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  outline: none;
  transition: all 0.2s ease;
  background: #ffffff;
  color: var(--text-main);
  font-family: inherit;
}

.form-control:focus {
  border-color: var(--razorpay-accent);
  box-shadow: 0 0 0 4px rgba(51, 149, 255, 0.15);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

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

/* Order Summary Box */
.order-summary-box {
  background: var(--surface-secondary);
  border-radius: var(--radius-md);
  padding: 20px;
  border: 1px solid var(--border);
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 0.9rem;
  color: var(--text-muted);
}

.summary-row.total {
  border-bottom: none;
  padding-top: 16px;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--primary);
}

/* Primary Button */
.btn-pay {
  width: 100%;
  margin-top: 24px;
  padding: 15px 20px;
  background: linear-gradient(135deg, #0C2340 0%, #1e4a7d 100%);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 6px 18px rgba(12, 35, 64, 0.25);
}

.btn-pay:hover:not(:disabled) {
  background: linear-gradient(135deg, #163860 0%, #29609e 100%);
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(12, 35, 64, 0.35);
}

.btn-pay:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-secondary {
  padding: 10px 18px;
  background: #f1f5f9;
  color: var(--text-main);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: #e2e8f0;
}

/* Security notice */
.security-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 18px;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-align: center;
}

.security-badge svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* Alert notifications */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  font-size: 0.9rem;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.alert-warning {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
}

.alert-danger {
  background: var(--danger-bg);
  border: 1px solid #fecaca;
  color: #b91c1c;
}

.alert-success {
  background: var(--success-bg);
  border: 1px solid #a7f3d0;
  color: #065f46;
}

/* Receipt / Success Card */
.receipt-card {
  max-width: 620px;
  margin: 20px auto;
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.success-icon {
  width: 72px;
  height: 72px;
  background: #ecfdf5;
  color: #10b981;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

.success-icon svg {
  width: 40px;
  height: 40px;
}

.fail-icon {
  width: 72px;
  height: 72px;
  background: #fef2f2;
  color: #ef4444;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

.receipt-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 8px;
}

.receipt-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 28px;
}

.receipt-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  margin-bottom: 28px;
}

.receipt-table td {
  padding: 12px 8px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.92rem;
}

.receipt-table td:first-child {
  color: var(--text-muted);
  font-weight: 500;
}

.receipt-table td:last-child {
  text-align: right;
  font-weight: 700;
  color: var(--text-main);
}

.pill-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.pill-success {
  background: #dcfce7;
  color: #15803d;
}

.pill-failed {
  background: #fee2e2;
  color: #b91c1c;
}

.pill-pending {
  background: #fef9c3;
  color: #854d0e;
}

/* Transactions Table */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
}

.data-table th {
  background: #f8fafc;
  padding: 12px 14px;
  text-align: left;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  border-bottom: 1.5px solid var(--border);
}

.data-table td {
  padding: 14px;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}

.data-table tr:hover {
  background: #f8fafc;
}

/* Spinner */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

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

@media print {
  body {
    background: #fff;
    padding: 0;
  }
  .app-header, .no-print {
    display: none !important;
  }
  .receipt-card {
    box-shadow: none;
    border: 1px solid #ccc;
    max-width: 100%;
  }
}
