/* ==========================================================================
   Design Tokens & Variables
   ========================================================================== */
:root {
  --primary-green: #388e3c; /* Forest emerald green matching the header */
  --primary-green-hover: #2e7d32;
  --primary-green-light: #e8f5e9;
  --accent-green: #4caf50;
  
  --dark-bg: #0c0e12;
  --light-bg: #f8fafc;
  --card-bg: #ffffff;
  
  --text-primary: #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  
  --error-color: #ef4444;
  --error-bg: #fef2f2;
  
  --border-color: #e2e8f0;
  --focus-ring: rgba(56, 142, 60, 0.15);
  
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   Reset & Base Styles
   ========================================================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--light-bg);
  color: var(--text-primary);
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

button, input {
  font-family: inherit;
  color: inherit;
}

/* ==========================================================================
   Header Styles
   ========================================================================== */
.app-header {
  background-color: var(--primary-green);
  color: #ffffff;
  padding: 1.25rem 2rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-title {
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.faq-nav-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #ffffff;
  padding: 0.5rem 1.25rem;
  font-weight: 600;
  font-size: 1rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.faq-nav-btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: #ffffff;
}

/* ==========================================================================
   Main Content Layout
   ========================================================================== */
.main-container {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 3rem 2rem;
}

.content-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 3.5rem;
  align-items: start;
}

@media (max-width: 968px) {
  .content-grid {
    grid-template-columns: 1fr;
    gap: 3rem;
  }
}

.section-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1rem;
  letter-spacing: -0.01em;
}

.info-text {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 2rem;
}

.info-text .highlight {
  color: var(--primary-green-hover);
  font-weight: 500;
}

/* ==========================================================================
   Form Styling
   ========================================================================== */
.card-form-container {
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 2.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02), 0 1px 3px rgba(0, 0, 0, 0.01);
}

.input-group {
  margin-bottom: 1.75rem;
  display: flex;
  flex-direction: column;
}

.input-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrapper input {
  width: 100%;
  padding: 1.25rem 1rem 0.5rem 1rem;
  font-size: 1.05rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  outline: none;
  background-color: #fff;
  transition: all var(--transition-fast);
  color: var(--text-primary);
  font-weight: 500;
}

/* Floating Label Logic */
.input-wrapper label {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1rem;
  pointer-events: none;
  transition: all var(--transition-fast);
  background-color: transparent;
}

/* Input states for placeholder transitions */
.input-wrapper input:focus ~ label,
.input-wrapper input:not(:placeholder-shown) ~ label {
  top: 0.65rem;
  font-size: 0.75rem;
  color: var(--primary-green);
  font-weight: 600;
}

.input-wrapper input:focus {
  border-color: var(--primary-green);
  box-shadow: 0 0 0 4px var(--focus-ring);
}

/* Icon placement inside input */
.input-icon {
  position: absolute;
  right: 1rem;
  color: var(--text-light);
  display: flex;
  align-items: center;
  pointer-events: none;
}

.input-wrapper input:focus ~ .input-icon {
  color: var(--primary-green);
}

/* Validation Errors */
.error-msg {
  color: var(--error-color);
  font-size: 0.8rem;
  font-weight: 500;
  margin-top: 0.35rem;
  display: none;
  animation: fadeIn 0.2s ease-out;
}

.input-group.has-error .error-msg {
  display: block;
}

.input-group.has-error input {
  border-color: var(--error-color);
  background-color: var(--error-bg);
}

.input-group.has-error input:focus {
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.15);
}

.input-group.has-error label {
  color: var(--error-color) !important;
}

.input-group.has-error .input-icon {
  color: var(--error-color);
}

/* Submit Button */
.submit-btn {
  width: 100%;
  padding: 1.1rem;
  background-color: #8bbd8e; /* Muted green shade from original screenshot */
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-top: 0.5rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.submit-btn:hover {
  background-color: var(--primary-green-hover);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
}

.submit-btn:active {
  transform: translateY(0);
}

/* ==========================================================================
   Interactive Gift Card Illustration (Back of Card)
   ========================================================================== */
.preview-section {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.interactive-card-wrapper {
  margin-top: 1rem;
  perspective: 1000px;
}

/* The structural card element styled exactly like back of the gift card */
.physical-card {
  width: 100%;
  max-width: 440px;
  aspect-ratio: 1.586 / 1;
  background-color: #ffffff;
  border-radius: 14px;
  position: relative;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(0, 0, 0, 0.04);
  border: 1px solid #d1d5db;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.card-back-side {
  width: 100%;
  height: 100%;
  padding: 3rem 1.25rem 0.5rem 1.25rem; /* Space top is large to clear magnetic strip */
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-sizing: border-box;
}

/* Magnetic strip */
.magnetic-strip {
  position: absolute;
  top: 0.75rem;
  left: 0;
  width: 100%;
  height: 1.85rem;
  background-color: #000000;
}

/* Card details (Printed numbers and dates) */
.card-legal-text {
  font-size: 0.44rem;
  line-height: 1.35;
  color: #334155;
  text-align: justify;
  margin-bottom: 0.35rem;
  font-family: inherit;
  letter-spacing: -0.01em;
}

/* Greenish highlight borders from original screenshot */
.card-highlight-border {
  border: 1px solid #7cb342;
  padding: 0 2px;
  border-radius: 2px;
  background-color: rgba(124, 179, 66, 0.05);
}

.card-numbers-row {
  display: grid;
  grid-template-columns: 1.6fr 0.8fr 1.2fr;
  align-items: center;
  margin-bottom: 0.4rem;
  gap: 0.25rem;
}

.detail-block {
  display: flex;
  align-items: center;
  font-family: 'Courier New', Courier, monospace;
  font-weight: 700;
  font-size: 0.65rem;
  color: #1e293b;
}

.detail-label {
  font-size: 0.55rem;
  color: #64748b;
  margin-right: 0.25rem;
  font-family: var(--font-family);
  font-weight: 600;
}

.detail-label.sm-label {
  font-size: 0.42rem;
  line-height: 1.1;
  text-align: right;
  margin-right: 0.35rem;
}

.detail-value {
  color: #000;
  padding: 1px 3px;
  border-radius: 2px;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
}

/* Activates when corresponding input is focused */
.detail-value.highlight-active {
  border: 1px solid #7cb342;
  background-color: rgba(124, 179, 66, 0.08);
}

.text-right {
  justify-content: flex-end;
}

/* Dynamic CSS Barcode rendering */
.barcode-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 0.25rem;
}

.barcode-graphics {
  display: flex;
  height: 1.15rem;
  width: 90%;
  align-items: stretch;
  background-color: transparent;
  justify-content: center;
}

.barcode-line {
  background-color: #000000;
  margin: 0 1px;
}

/* Dynamic widths for simulated barcode styling */
.w-1 { width: 1px; }
.w-2 { width: 2px; }
.w-3 { width: 3px; }
.w-4 { width: 4px; }

.barcode-numbers {
  display: flex;
  justify-content: space-between;
  width: 90%;
  font-family: monospace;
  font-size: 0.45rem;
  color: #475569;
  margin-top: 1px;
  letter-spacing: 0.08em;
}

/* Card footer text */
.card-bottom-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.45rem;
  color: #64748b;
  font-family: monospace;
  border-top: 1px solid #e2e8f0;
  padding-top: 2px;
  margin-top: 1px;
}

/* ==========================================================================
   Footer Styles
   ========================================================================== */
.app-footer {
  background-color: var(--dark-bg);
  color: #ffffff;
  padding: 3rem 2rem;
  font-size: 0.85rem;
}

.footer-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 2rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.25rem 2rem;
}

.footer-link, .footer-link-btn {
  color: #ffffff;
  text-decoration: none;
  font-weight: 700;
  font-size: 1rem;
  transition: color var(--transition-fast);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.footer-link:hover, .footer-link-btn:hover {
  color: var(--accent-green);
  text-decoration: underline;
}

.footer-disclaimers {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  color: #94a3b8;
  line-height: 1.6;
  max-width: 800px;
}

/* ==========================================================================
   Modals & Popups Layout
   ========================================================================== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.modal.is-open {
  opacity: 1;
  pointer-events: auto;
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal-container {
  background-color: var(--card-bg);
  border-radius: 16px;
  width: 90%;
  max-width: 580px;
  max-height: 90vh;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.95) translateY(10px);
  transition: transform var(--transition-normal);
}

.modal.is-open .modal-container {
  transform: scale(1) translateY(0);
}

.close-modal-btn {
  position: absolute;
  right: 1.5rem;
  top: 1.25rem;
  background: none;
  border: none;
  font-size: 1.75rem;
  cursor: pointer;
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

.close-modal-btn:hover {
  color: var(--text-primary);
}

.modal-header {
  padding: 2rem 2.5rem 1.25rem 2.5rem;
  border-bottom: 1px solid var(--border-color);
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-body {
  padding: 2rem 2.5rem;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 1.25rem 2.5rem;
  background-color: var(--light-bg);
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
}

/* Common Modal Buttons */
.btn {
  padding: 0.75rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-secondary {
  background-color: #e2e8f0;
  color: #334155;
  border: 1px solid #cbd5e1;
}

.btn-secondary:hover {
  background-color: #cbd5e1;
}

.btn-primary {
  background-color: var(--primary-green);
  color: #ffffff;
  border: 1px solid var(--primary-green);
}

.btn-primary:hover {
  background-color: var(--primary-green-hover);
}

/* FAQ Modal Accordion Specific Styles */
.faq-modal {
  max-width: 650px;
}

.faq-accordion-group {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.faq-item {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  background-color: var(--card-bg);
  transition: border-color var(--transition-fast);
}

.faq-item:hover {
  border-color: #cbd5e1;
}

.faq-question-btn {
  width: 100%;
  padding: 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: none;
  border: none;
  font-weight: 600;
  text-align: left;
  font-size: 1rem;
  cursor: pointer;
  transition: color var(--transition-fast);
}

.faq-item:has(.faq-answer-panel.show) {
  border-color: var(--primary-green);
}

.faq-question-btn:hover {
  color: var(--primary-green);
}

.faq-arrow-icon {
  font-size: 0.8rem;
  color: var(--text-muted);
  transition: transform var(--transition-fast);
}

.faq-question-btn[aria-expanded="true"] .faq-arrow-icon {
  transform: rotate(180deg);
  color: var(--primary-green);
}

.faq-answer-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition-normal) ease-out, padding var(--transition-normal);
  padding: 0 1.25rem;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.6;
}

.faq-answer-panel.show {
  padding: 0 1.25rem 1.25rem 1.25rem;
}

/* Balance Result Modal Specific Styles */
.success-checkmark {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  background-color: var(--primary-green-light);
  color: var(--primary-green);
  margin-bottom: 1rem;
}

.balance-modal .modal-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.balance-display-card {
  background: linear-gradient(135deg, #2e7d32, #43a047);
  color: #ffffff;
  border-radius: 12px;
  padding: 1.75rem;
  margin-bottom: 2rem;
  box-shadow: 0 10px 20px -5px rgba(46, 125, 50, 0.3);
  position: relative;
  overflow: hidden;
}

.balance-display-card::after {
  content: '';
  position: absolute;
  right: -50px;
  bottom: -50px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.05);
}

.balance-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.card-type-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  opacity: 0.85;
}

.status-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: 50px;
}

.active-status {
  background-color: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.balance-amount-wrapper {
  display: flex;
  align-items: flex-start;
  margin-bottom: 1.5rem;
}

.currency-symbol {
  font-size: 1.5rem;
  font-weight: 600;
  margin-top: 0.25rem;
  margin-right: 0.15rem;
}

.balance-value {
  font-size: 3rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
}

.balance-card-number {
  font-family: monospace;
  font-size: 1.1rem;
  letter-spacing: 0.05em;
  opacity: 0.9;
}

/* Table of transactions */
.transactions-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.transactions-title {
  font-size: 1.05rem;
  font-weight: 700;
}

.transactions-table-wrapper {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
}

.transactions-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.transactions-table th {
  background-color: var(--light-bg);
  padding: 0.85rem 1rem;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
}

.transactions-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
}

.transactions-table tr:last-child td {
  border-bottom: none;
}

.text-positive {
  color: var(--primary-green);
  font-weight: 600;
}

.text-negative {
  color: #0f172a;
  font-weight: 600;
}

/* ==========================================================================
   Loading Spinner
   ========================================================================== */
.loader-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 300;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
}

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

.loader-content {
  background-color: var(--card-bg);
  border-radius: 12px;
  padding: 2rem 3rem;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

.spinner {
  width: 2.75rem;
  height: 2.75rem;
  border: 3.5px solid var(--border-color);
  border-top-color: var(--primary-green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loader-text {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
}

/* ==========================================================================
   Animations
   ========================================================================== */
@keyframes spin {
  to { transform: rotate(360deg); }
}

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

/* ==========================================================================
   Thank You Modal & Redirect Progress
   ========================================================================== */
.thank-you-modal {
  max-width: 500px;
}

.text-center {
  text-align: center;
}

.thank-you-text {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.redirect-text {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.redirect-progress-container {
  width: 100%;
  height: 6px;
  background-color: var(--border-color);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.redirect-progress-bar {
  height: 100%;
  width: 0;
  background-color: var(--primary-green);
  border-radius: 3px;
}

.redirect-progress-bar.animate {
  animation: fillProgress 3s linear forwards;
}

@keyframes fillProgress {
  from { width: 0; }
  to { width: 100%; }
}

.justify-center {
  justify-content: center;
}
