/* ISCCM Hyderabad – Payment Gateway App Styles
   Supports Web + Mobile browsers. No framework dependencies.
*/

/* ── Reset & Base ────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue-dark:    #0d2b52;
  --blue-mid:     #1a4a8a;
  --blue-light:   #2563eb;
  --gold:         #c9920a;
  --gold-light:   #f5c842;
  --green:        #15803d;
  --green-light:  #dcfce7;
  --green-border: #86efac;
  --red:          #b91c1c;
  --red-light:    #fee2e2;
  --red-border:   #fca5a5;
  --gray-50:      #f9fafb;
  --gray-100:     #f3f4f6;
  --gray-200:     #e5e7eb;
  --gray-400:     #9ca3af;
  --gray-600:     #4b5563;
  --gray-800:     #1f2937;
  --white:        #ffffff;
  --shadow-sm:    0 1px 3px rgba(0,0,0,.12);
  --shadow-md:    0 4px 16px rgba(0,0,0,.12);
  --shadow-lg:    0 8px 32px rgba(0,0,0,.16);
  --radius:       10px;
  --radius-sm:    6px;
  --transition:   all .2s ease;
}

/* This app has one light-only design — no dark variant exists. Without this,
   a browser/OS in dark mode auto-darkens native form chrome (checkboxes, date
   pickers, number-input spinners, scrollbars) that our CSS below doesn't
   otherwise touch, clashing with the explicitly light cards/backgrounds. */
html { font-size: 16px; scroll-behavior: smooth; color-scheme: light; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  min-height: 100vh;
  line-height: 1.6;
}

/* ── Header / Banner ─────────────────────────────────────────────────────── */
.site-header {
  position: relative;
  background: linear-gradient(135deg, var(--blue-dark) 0%, var(--blue-mid) 100%);
  color: var(--white);
  padding: 20px 24px;
  text-align: center;
  box-shadow: var(--shadow-md);
}

.header-inner {
  max-width: 680px;
  margin: 0 auto;
}

/* Back-to-home link — top-left, doesn't disturb the centered title */
.back-home {
  position: absolute;
  top: 14px;
  left: 16px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: .8rem;
  font-weight: 600;
  color: var(--white);
  background: rgba(255, 255, 255, .14);
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 999px;
  text-decoration: none;
  line-height: 1;
  transition: background .15s ease;
}

.back-home:hover,
.back-home:focus {
  background: rgba(255, 255, 255, .26);
}

.back-home .back-home-arrow {
  font-size: 1em;
}

@media (max-width: 520px) {
  .site-header {
    padding-top: 52px;
  }
  .back-home {
    top: 12px;
    padding: 5px 10px;
    font-size: .72rem;
  }
}

.org-name {
  font-size: .8rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--gold-light);
  margin-bottom: 6px;
  font-weight: 600;
}

.conference-name {
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 4px;
}

.conference-meta {
  font-size: .85rem;
  opacity: .85;
  margin-top: 4px;
}

.conference-meta span + span::before { content: ' · '; }

/* ── GST note ─────────────────────────────────────────────────────────────── */
.gst-note {
  font-size: .75rem;
  color: var(--gray-400);
  margin-top: 10px;
}

/* ── Main layout ─────────────────────────────────────────────────────────── */
.page-wrapper {
  max-width: 680px;
  margin: 32px auto;
  padding: 0 16px;
}

/* ── Card ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 28px 32px;
  margin-bottom: 20px;
}

@media (max-width: 480px) {
  .card { padding: 20px 16px; }
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--blue-dark);
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--blue-light);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title .icon { font-size: 1.1em; }

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

label {
  display: block;
  font-size: .875rem;
  font-weight: 500;
  color: var(--gray-600);
  margin-bottom: 6px;
}

label .required { color: var(--red); margin-left: 2px; }

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="date"],
select {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: .95rem;
  color: var(--gray-800);
  background: var(--white);
  transition: var(--transition);
  outline: none;
}

input[type="text"],
input[type="email"],
input[type="tel"],
select {
  -webkit-appearance: none;
  appearance: none;
}

input[type="checkbox"] {
  accent-color: var(--blue-light);
}

input:focus, select:focus {
  border-color: var(--blue-light);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

input.error, select.error { border-color: var(--red); }

.field-error {
  font-size: .8rem;
  color: var(--red);
  margin-top: 4px;
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 40px;
}

/* ── Category tiles ──────────────────────────────────────────────────────── */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 4px;
}

.category-tile {
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.category-tile:hover { border-color: var(--blue-light); background: var(--gray-50); }

.category-tile.selected {
  border-color: var(--blue-light);
  background: #eff6ff;
}

.category-tile input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.tile-label {
  font-weight: 600;
  font-size: .95rem;
  color: var(--gray-800);
  margin-bottom: 2px;
}

.tile-amount {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--blue-light);
}

.tile-desc {
  font-size: .78rem;
  color: var(--gray-400);
  margin-top: 2px;
}

/* ── Coupon code ─────────────────────────────────────────────────────────── */
.coupon-row {
  display: flex;
  gap: 8px;
  margin-top: 20px;
}

.coupon-row input[type="text"] {
  flex: 1;
  text-transform: uppercase;
}

.coupon-apply {
  padding: 0 18px;
  border: 1.5px solid var(--blue-light);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--blue-light);
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.coupon-apply:hover:not(:disabled) { background: #eff6ff; }
.coupon-apply:disabled { opacity: .6; cursor: not-allowed; }

.coupon-msg {
  font-size: .8rem;
  margin-top: 6px;
  min-height: 1em;
}

.coupon-msg.ok  { color: var(--green); }
.coupon-msg.err { color: var(--red); }

/* ── Amount summary ──────────────────────────────────────────────────────── */
.amount-summary {
  background: var(--gray-50);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 20px;
}

.amount-label { font-size: .875rem; color: var(--gray-600); }

.amount-original {
  font-size: .85rem;
  color: var(--gray-400);
  text-decoration: line-through;
  margin-right: 8px;
}

.amount-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--blue-dark);
}

/* ── Pay button ──────────────────────────────────────────────────────────── */
.btn-pay {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--blue-mid), var(--blue-light));
  color: var(--white);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  margin-top: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  letter-spacing: .02em;
}

.btn-pay:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--blue-dark), var(--blue-mid));
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn-pay:disabled { opacity: .65; cursor: not-allowed; transform: none; }

/* ── Spinner ─────────────────────────────────────────────────────────────── */
.spinner {
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(255,255,255,.4);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

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

/* ── Alerts ──────────────────────────────────────────────────────────────── */
.alert {
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: .875rem;
  margin-top: 16px;
  display: none;
}

.alert.show { display: block; }

.alert-error { background: var(--red-light); border: 1px solid var(--red-border); color: var(--red); }
.alert-success { background: var(--green-light); border: 1px solid var(--green-border); color: var(--green); }

/* ── Status page ─────────────────────────────────────────────────────────── */
.status-card {
  text-align: center;
  padding: 40px 32px;
}

.status-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin: 0 auto 20px;
}

.status-icon.success { background: var(--green-light); color: var(--green); }
.status-icon.failure { background: var(--red-light); color: var(--red); }
.status-icon.pending { background: #fef3c7; color: #d97706; }

.status-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.status-title.success { color: var(--green); }
.status-title.failure { color: var(--red); }
.status-title.pending { color: #d97706; }

.status-subtitle { color: var(--gray-600); font-size: .95rem; margin-bottom: 24px; }

/* ── Detail table ────────────────────────────────────────────────────────── */
.detail-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  margin-top: 20px;
  table-layout: fixed; /* respect column widths so long values wrap, not overflow */
}

.detail-table tr { border-bottom: 1px solid var(--gray-100); }
.detail-table tr:last-child { border-bottom: none; }
.detail-table td {
  padding: 10px 12px;
  font-size: .9rem;
  vertical-align: top;
  /* break long unbroken strings (PhonePe Txn ID, order ID) instead of clipping */
  overflow-wrap: anywhere;
  word-break: break-word;
}
.detail-table td:first-child { color: var(--gray-600); width: 38%; }
.detail-table td:last-child { font-weight: 500; }

/* ── Action buttons on status page ──────────────────────────────────────── */
.action-group {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 28px;
}

.btn-outline {
  padding: 10px 22px;
  border: 2px solid var(--blue-light);
  color: var(--blue-light);
  background: transparent;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-outline:hover { background: var(--blue-light); color: var(--white); }

/* ── Loading overlay ─────────────────────────────────────────────────────── */
.loading-overlay {
  text-align: center;
  padding: 48px 24px;
}

.loading-overlay .spinner {
  border-color: rgba(37, 99, 235, .2);
  border-top-color: var(--blue-light);
  width: 40px;
  height: 40px;
  margin: 0 auto 16px;
}

.loading-text { color: var(--gray-600); font-size: .95rem; }

/* ── Skeleton loader ─────────────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 4px;
}

@keyframes shimmer { to { background-position: -200% 0; } }

/* ── Footer ──────────────────────────────────────────────────────────────── */
.site-footer {
  text-align: center;
  padding: 20px;
  color: var(--gray-400);
  font-size: .8rem;
  margin-top: 8px;
}

.site-footer a { color: var(--gray-400); text-decoration: underline; }

/* ── Secure badge ────────────────────────────────────────────────────────── */
.secure-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: .78rem;
  color: var(--gray-400);
  margin-top: 12px;
}

/* ── Error page ──────────────────────────────────────────────────────────── */
.error-page {
  text-align: center;
  padding: 60px 24px;
}

.error-page h2 { font-size: 1.2rem; color: var(--gray-800); margin-bottom: 8px; }
.error-page p  { color: var(--gray-600); font-size: .9rem; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .conference-name { font-size: 1.2rem; }
  .category-grid { grid-template-columns: 1fr 1fr; }
  .action-group { flex-direction: column; }
  .btn-outline { justify-content: center; }
  .detail-table td:first-child { width: 40%; }
  .detail-table td { padding: 9px 8px; font-size: .85rem; }
  /* Reduce nested padding on mobile (status-container > status-card > inner card) */
  .status-card { padding: 28px 14px; }
}
