/* ==========================================================================
   APEXPAY GATEWAY - PROFESSIONAL DESIGN SYSTEM & CSS STYLESHEET
   ========================================================================== */

:root {
  --bg-main: #090d16;
  --bg-card: rgba(18, 24, 38, 0.75);
  --bg-card-hover: rgba(26, 35, 54, 0.85);
  --bg-glass: rgba(255, 255, 255, 0.03);
  --bg-input: #131b2e;
  
  --border-color: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(99, 102, 241, 0.3);
  
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.4);
  
  --accent-cyan: #06b6d4;
  --accent-purple: #a855f7;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-sub: #64748b;
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.35);
  --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.25);
  
  --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-main);
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(99, 102, 241, 0.12) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(168, 85, 247, 0.1) 0%, transparent 45%),
    radial-gradient(circle at 50% 50%, rgba(6, 182, 212, 0.05) 0%, transparent 60%);
  background-attachment: fixed;
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
  line-height: 1.5;
}

/* App Header */
.navbar {
  width: 100%;
  max-width: 1200px;
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(9, 13, 22, 0.8);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-main);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  box-shadow: 0 0 12px var(--primary-glow);
}

.brand-tag {
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--primary), var(--accent-purple));
  color: #fff;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.nav-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-btn {
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition);
  text-decoration: none;
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--primary);
  transform: translateY(-1px);
}

/* Main Layout Container */
.app-container {
  width: 100%;
  max-width: 1200px;
  padding: 2rem 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Glass View Container */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 2.25rem;
  width: 100%;
  max-width: 520px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.glass-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-cyan), var(--primary), var(--accent-purple));
}

/* Hidden views */
.view {
  display: none;
  width: 100%;
  animation: fadeIn 0.3s ease-in-out forwards;
}

.view.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Typography & Headings */
.page-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.35rem;
  letter-spacing: -0.02em;
}

.page-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1.75rem;
}

/* Form Controls */
.form-group {
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}

.form-control {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  outline: none;
  transition: var(--transition);
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-control::placeholder {
  color: var(--text-sub);
}

/* Quick Amount Buttons */
.amount-presets {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}

.preset-btn {
  flex: 1;
  min-width: 65px;
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.45rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.825rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: var(--transition);
}

.preset-btn:hover, .preset-btn.active {
  background: var(--primary-hover);
  border-color: var(--primary);
  color: #fff;
}

/* Buttons */
.btn {
  width: 100%;
  padding: 0.9rem 1.5rem;
  border-radius: var(--radius-sm);
  border: none;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  transition: var(--transition);
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--accent-purple));
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  opacity: 0.94;
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.btn-secondary {
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--text-muted);
}

.btn-success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
}

.btn-success:hover {
  opacity: 0.94;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
}

/* UPI CUSTOMER PAYMENT VIEW */
.upi-pay-card {
  max-width: 460px;
  margin: 0 auto;
  text-align: center;
}

.merchant-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  padding: 0.4rem 1rem;
  border-radius: 30px;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.amount-display {
  margin: 1.25rem 0;
}

.amount-val {
  font-size: 2.8rem;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, #fff 40%, var(--accent-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.1;
}

.amount-note {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

.qr-section {
  background: #ffffff;
  padding: 1.5rem;
  border-radius: var(--radius-md);
  margin: 1.5rem 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  position: relative;
}

.qr-caption {
  font-size: 0.825rem;
  color: #475569;
  font-weight: 600;
  margin-top: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* UPI Direct Intent App Grid */
.upi-apps-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-top: 1.25rem;
  margin-bottom: 1.5rem;
}

.upi-app-btn {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.5rem;
  color: var(--text-main);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  transition: var(--transition);
}

.upi-app-btn:hover {
  border-color: var(--primary);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}

.upi-app-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 800;
  color: #fff;
}

.icon-gpay { background: #4285F4; }
.icon-phonepe { background: #5f259f; }
.icon-paytm { background: #00baf2; }
.icon-bhim { background: #ff7e00; }
.icon-cred { background: #111111; border: 1px solid #333; }
.icon-generic { background: linear-gradient(135deg, var(--primary), var(--accent-cyan)); }

.full-width-btn {
  grid-column: span 2;
}

/* Timer Badge */
.timer-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--accent-amber);
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.2);
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
  margin-bottom: 1rem;
}

/* Toast Notifications */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #1e293b;
  border: 1px solid var(--border-color);
  color: #fff;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  font-size: 0.9rem;
  font-weight: 500;
  z-index: 1000;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* History & Stats Table */
.history-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  font-size: 0.875rem;
}

.history-table th {
  text-align: left;
  padding: 0.75rem 0.5rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  font-weight: 600;
}

.history-table td {
  padding: 0.85rem 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.badge-status {
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-pending { background: rgba(99, 102, 241, 0.15); color: #818cf8; }
.badge-paid { background: rgba(16, 185, 129, 0.15); color: #34d399; }

/* Modal overlay */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition);
  padding: 1rem;
}

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

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-md);
  position: relative;
}

.close-modal {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
}

/* Footer */
footer {
  margin-top: auto;
  padding: 1.5rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-sub);
}

footer a {
  color: var(--text-muted);
  text-decoration: none;
}

/* Responsive adjustments */
@media (max-width: 640px) {
  .glass-card {
    padding: 1.5rem;
  }
  .amount-val {
    font-size: 2.2rem;
  }
  .upi-apps-grid {
    grid-template-columns: 1fr;
  }
  .full-width-btn {
    grid-column: span 1;
  }
}
