/* ==========================================================================
   REA Pro - Design System (SPEC section 10)
   Warm low-saturation palette, no gradients, no external fonts.
   ========================================================================== */

:root {
  --bg:        #faf8f5;
  --surface:   #ffffff;
  --text:      #1f2937;
  --muted:     #6b7280;
  --primary:   #b45309;
  --primary-d: #92400e;
  --border:    #e7e2db;
  --success:   #15803d;
  --danger:    #b91c1c;
  --radius:    10px;
  --shadow:    0 1px 3px rgba(0, 0, 0, .06);
  --font:      system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono:      ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; font-weight: 700; }
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }
p  { margin: 0 0 1em; }

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-d); }

img { max-width: 100%; height: auto; }
code, pre, .mono { font-family: var(--mono); font-size: .9em; }

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
  width: 100%;
}

.site-main { flex: 1 0 auto; padding: 32px 0 56px; }

.muted { color: var(--muted); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.mt-1 { margin-top: 8px; }  .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }

/* ---------- Header / nav ---------- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.nav-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  gap: 16px;
}

.logo {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.02em;
}
.logo:hover { color: var(--primary); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 20px;
}
.nav-links a {
  color: var(--text);
  font-weight: 500;
  font-size: .95rem;
}
.nav-links a:hover { color: var(--primary); }
.nav-links a.btn { color: #fff; }
.nav-links a.btn:hover { color: #fff; }

/* Hamburger (mobile) */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 8px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
}
.nav-toggle span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--text);
  border-radius: 2px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  padding: 10px 22px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-family: inherit;
  font-size: .95rem;
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
  text-decoration: none;
}

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

.btn-outline {
  background: transparent;
  color: var(--primary);
  border-color: var(--primary);
}
.btn-outline:hover { background: var(--primary); color: #fff; }

.btn-danger {
  background: transparent;
  color: var(--danger);
  border-color: var(--danger);
}
.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-sm { padding: 6px 14px; font-size: .85rem; }
.btn-block { display: block; width: 100%; }
.btn[disabled], .btn.disabled { opacity: .55; pointer-events: none; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

.card + .card { margin-top: 20px; }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.card-header h2, .card-header h3 { margin: 0; }

/* ---------- Grid helpers ---------- */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ---------- Hero ---------- */
.hero {
  text-align: center;
  padding: 72px 0 56px;
}
.hero h1 {
  font-size: 2.6rem;
  letter-spacing: -.03em;
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
}
.hero .lead {
  font-size: 1.15rem;
  color: var(--muted);
  max-width: 640px;
  margin: 0 auto 28px;
}
.hero .hero-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ---------- Sections ---------- */
.section { padding: 48px 0; }
.section-title { text-align: center; margin-bottom: 8px; }
.section-sub { text-align: center; color: var(--muted); max-width: 560px; margin: 0 auto 32px; }

/* ---------- Pricing cards ---------- */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  align-items: stretch;
}

.pricing-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  display: flex;
  flex-direction: column;
}

.pricing-card.featured { border-color: var(--primary); box-shadow: 0 2px 10px rgba(180, 83, 9, .12); }

.pricing-card .plan-name { font-size: 1.15rem; font-weight: 700; margin: 0 0 4px; }
.pricing-card .plan-desc { color: var(--muted); font-size: .9rem; margin-bottom: 16px; }

.pricing-card .plan-price {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -.02em;
  margin-bottom: 2px;
}
.pricing-card .plan-price small { font-size: .95rem; font-weight: 500; color: var(--muted); }
.pricing-card .plan-price-alt { color: var(--muted); font-size: .85rem; margin-bottom: 16px; }

.pricing-card ul.features {
  list-style: none;
  margin: 0 0 24px;
  padding: 0;
  flex: 1;
}
.pricing-card ul.features li {
  padding: 6px 0 6px 26px;
  position: relative;
  font-size: .92rem;
}
.pricing-card ul.features li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 11px;
  width: 14px;
  height: 8px;
  border-left: 2px solid var(--success);
  border-bottom: 2px solid var(--success);
  transform: rotate(-45deg);
}

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }

.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: .92rem;
}
.table th, .table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table th {
  background: var(--bg);
  font-weight: 600;
  color: var(--muted);
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fdfbf8; }

/* ---------- Badges ---------- */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 600;
  line-height: 1.6;
  white-space: nowrap;
}

.badge-paid    { background: #dcfce7; color: var(--success); }
.badge-active  { background: #dcfce7; color: var(--success); }
.badge-pending { background: #fef3c7; color: var(--primary); }
.badge-failed  { background: #fee2e2; color: var(--danger); }
.badge-expired { background: #f3f4f6; color: var(--muted); }
.badge-cancelled { background: #f3f4f6; color: var(--muted); }
.badge-admin   { background: #fef3c7; color: var(--primary); }
.badge-user    { background: #f3f4f6; color: var(--muted); }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 16px; }

label {
  display: block;
  font-weight: 600;
  font-size: .9rem;
  margin-bottom: 6px;
}

input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="url"], input[type="tel"], input[type="datetime-local"],
select, textarea {
  display: block;
  width: 100%;
  padding: 10px 12px;
  font-family: inherit;
  font-size: .95rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: border-color .15s ease, box-shadow .15s ease;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(180, 83, 9, .12);
}

textarea { min-height: 110px; resize: vertical; }

.form-hint { font-size: .8rem; color: var(--muted); margin-top: 4px; }
.form-error { font-size: .85rem; color: var(--danger); margin-top: 4px; }

.checkbox { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.checkbox input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); }

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

/* ---------- Alerts / flash ---------- */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  margin-bottom: 16px;
  font-size: .92rem;
  transition: opacity .4s ease;
}
.alert.alert-fade { opacity: 0; }

.alert-success { background: #f0fdf4; border-color: #bbf7d0; color: var(--success); }
.alert-error   { background: #fef2f2; border-color: #fecaca; color: var(--danger); }
.alert-info    { background: #fffbeb; border-color: #fde68a; color: var(--primary); }

/* ---------- Auth card (login / register) ---------- */
.auth-wrap {
  display: flex;
  justify-content: center;
  padding: 40px 0;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px;
}
.auth-card h1 { font-size: 1.5rem; text-align: center; }
.auth-card .auth-sub { text-align: center; color: var(--muted); font-size: .9rem; margin-bottom: 24px; }
.auth-card .auth-alt { text-align: center; font-size: .9rem; color: var(--muted); margin: 16px 0 0; }

/* ---------- Dashboard ---------- */
.license-key {
  font-family: var(--mono);
  font-size: 1.05rem;
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.copy-btn {
  border: 0;
  background: transparent;
  color: var(--primary);
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 6px;
}
.copy-btn:hover { color: var(--primary-d); }

/* ---------- Checkout / gateway buttons ---------- */
.gateway-list { display: grid; gap: 14px; }

.gateway-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.gateway-btn:hover { border-color: var(--primary); color: var(--text); box-shadow: 0 2px 8px rgba(180, 83, 9, .12); }
.gateway-btn .gateway-name { display: flex; flex-direction: column; align-items: flex-start; }
.gateway-btn .gateway-name small { color: var(--muted); font-weight: 400; font-size: .82rem; }
.gateway-btn .gateway-price { font-weight: 800; color: var(--primary); white-space: nowrap; }
.gateway-btn.gateway-stripe  { border-left: 4px solid #635bff; }
.gateway-btn.gateway-razorpay { border-left: 4px solid #0b2545; }
.gateway-btn.gateway-upi     { border-left: 4px solid var(--primary); }

/* ---------- Admin layout ---------- */
.admin-body { background: var(--bg); }

.admin-layout {
  display: flex;
  min-height: 100vh;
}

.admin-sidebar {
  width: 230px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.admin-logo { display: block; padding: 4px 10px 18px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }

.admin-nav { display: flex; flex-direction: column; gap: 2px; }
.admin-nav a {
  display: block;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--text);
  font-size: .92rem;
  font-weight: 500;
}
.admin-nav a:hover { background: var(--bg); color: var(--primary); }
.admin-nav a.active { background: #fdf3e7; color: var(--primary); font-weight: 600; }

.admin-nav-bottom { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border); }

.admin-content { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.admin-topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
}
.admin-topbar h1 { font-size: 1.25rem; margin: 0; flex: 1; }
.admin-user { color: var(--muted); font-size: .9rem; }

.admin-main { padding: 24px; }

/* Stat cards (admin dashboard) */
.stat-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
}
.stat-card .stat-label { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.stat-card .stat-value { font-size: 1.6rem; font-weight: 800; letter-spacing: -.02em; margin-top: 4px; }

/* Expandable raw_response rows (transactions) */
.raw-response {
  font-family: var(--mono);
  font-size: .78rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 240px;
  overflow: auto;
}

/* ---------- Footer ---------- */
.site-footer {
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 24px 0;
  color: var(--muted);
  font-size: .9rem;
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.footer-links { display: flex; gap: 18px; }
.footer-links a { color: var(--muted); }
.footer-links a:hover { color: var(--primary); }

/* ---------- Pagination ---------- */
.pagination { display: flex; gap: 6px; margin-top: 20px; flex-wrap: wrap; }
.pagination a, .pagination span {
  display: inline-block;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: .88rem;
}
.pagination span.current { background: var(--primary); border-color: var(--primary); color: #fff; }
.pagination a:hover { border-color: var(--primary); color: var(--primary); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .pricing-grid { grid-template-columns: 1fr; max-width: 460px; margin: 0 auto; }
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .nav-toggle { display: flex; }

  .nav-links {
    display: none;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 8px 20px 16px;
    box-shadow: var(--shadow);
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 10px 0; border-bottom: 1px solid var(--border); }
  .nav-links a:last-child { border-bottom: 0; }
  .nav-links a.btn { margin-top: 10px; text-align: center; }

  /* Admin sidebar becomes a slide-down panel */
  .admin-layout { flex-direction: column; }
  .admin-sidebar {
    width: 100%;
    height: auto;
    position: static;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    display: none;
  }
  .admin-sidebar.open { display: flex; }
  .admin-topbar .nav-toggle { display: flex; }

  .hero { padding: 48px 0 36px; }
  .hero h1 { font-size: 2rem; }
  .form-row { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .grid-3, .grid-4, .stat-cards { grid-template-columns: 1fr; }
  .footer-inner { flex-direction: column; text-align: center; }
}
