/**
 * SounnyForms — Clean Light Mode Design System (v5.5)
 * Ultra-Crisp White (#ffffff) + Soft Zinc (#f8fafc) + Vibrant Flame Orange (#ff4d00)
 * Stripe/Apple-grade developer UI, zero dark containers, smooth micro-interactions.
 */

:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-tertiary: #f1f5f9;
  --bg-card: #ffffff;
  --bg-card-hover: #fbfcfe;
  
  --border-subtle: #f1f5f9;
  --border-card: #e2e8f0;
  --border-input: #cbd5e1;
  --border-focus: #ff4d00;

  --accent-fire: #ff4d00;
  --accent-fire-light: #ff661a;
  --accent-fire-hover: #e04400;
  --accent-fire-glow: rgba(255, 77, 0, 0.2);
  --accent-fire-subtle: rgba(255, 77, 0, 0.08);

  --accent-emerald: #059669;
  --accent-emerald-subtle: rgba(5, 150, 105, 0.1);
  --accent-amber: #d97706;
  --accent-rose: #e11d48;
  --accent-blue: #0284c7;
  --accent-purple: #7c3aed;

  --text-main: #0f172a;
  --text-muted: #334155;
  --text-dim: #64748b;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.07);
  --shadow-xl: 0 24px 48px rgba(0, 0, 0, 0.09);

  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

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

html {
  scroll-behavior: smooth;
  background-color: #ffffff;
}

body {
  background-color: #ffffff;
  background-image: 
    radial-gradient(circle at 50% -12%, rgba(255, 77, 0, 0.07) 0px, transparent 65%),
    linear-gradient(to right, rgba(0, 0, 0, 0.025) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0, 0, 0, 0.025) 1px, transparent 1px);
  background-size: 100% 100%, 48px 48px, 48px 48px;
  color: var(--text-main);
  font-family: var(--font-sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  line-height: 1.6;
}

/* Header */
.app-header {
  height: 72px;
  border-bottom: 1px solid var(--border-card);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(20px);
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 36px;
  box-shadow: var(--shadow-xs);
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.logo-flame {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #ff661a 0%, #ff3700 100%);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 19px;
  box-shadow: 0 3px 12px var(--accent-fire-glow);
}

.logo-title {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-main);
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 32px;
}

.header-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  transition: color 0.15s ease;
}

.header-nav a:hover {
  color: var(--accent-fire);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.badge-live {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--accent-emerald-subtle);
  border: 1px solid rgba(5, 150, 105, 0.25);
  color: var(--accent-emerald);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  font-family: var(--font-mono);
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-emerald);
  box-shadow: 0 0 6px var(--accent-emerald);
  animation: livePulse 1.8s infinite ease-in-out;
}

@keyframes livePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.3; transform: scale(0.8); }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: inherit;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, #ff5c1a 0%, #ff3b00 100%);
  color: #ffffff;
  border: none;
  box-shadow: 0 3px 14px var(--accent-fire-glow);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #ff6b2b 0%, #ff4d00 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 22px rgba(255, 77, 0, 0.3);
}

.btn-secondary {
  background: #ffffff;
  color: var(--text-main);
  border: 1px solid var(--border-card);
  box-shadow: var(--shadow-xs);
}

.btn-secondary:hover {
  background: var(--bg-secondary);
  border-color: #cbd5e1;
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-card);
}

.btn-ghost:hover {
  background: var(--bg-secondary);
  color: var(--text-main);
}

.btn-sm {
  padding: 7px 14px;
  font-size: 12px;
}

/* Landing Container */
#landing-view {
  display: block;
}

.landing-container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 70px 24px 130px;
}

/* Hero */
.hero-section {
  text-align: center;
  max-width: 900px;
  margin: 0 auto 90px;
}

.pill-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent-fire-subtle);
  border: 1px solid rgba(255, 77, 0, 0.25);
  color: var(--accent-fire);
  padding: 6px 18px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 24px;
  font-family: var(--font-mono);
}

.hero-title {
  font-size: 56px;
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.12;
  margin-bottom: 22px;
  color: var(--text-main);
}

.hero-title .gradient-text {
  background: linear-gradient(135deg, var(--text-main) 0%, #ff5c1a 60%, #ff3b00 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: 19px;
  color: var(--text-muted);
  line-height: 1.65;
  margin-bottom: 38px;
  max-width: 740px;
  margin-left: auto;
  margin-right: auto;
}

.hero-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 54px;
}

.stats-ribbon {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 32px;
  background: #ffffff;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

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

.stat-item .num {
  font-size: 28px;
  font-weight: 800;
  color: var(--accent-fire);
  letter-spacing: -0.02em;
  font-family: var(--font-mono);
}

.stat-item .lbl {
  font-size: 13px;
  color: var(--text-dim);
  font-weight: 600;
  margin-top: 2px;
}

/* Sections */
.section-title-wrap {
  text-align: center;
  margin-bottom: 48px;
}

.section-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-fire);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 8px;
  font-family: var(--font-mono);
}

.section-title {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.025em;
  margin-bottom: 12px;
  color: var(--text-main);
}

.section-desc {
  font-size: 16px;
  color: var(--text-muted);
  max-width: 640px;
  margin: 0 auto;
}

/* Interactive Playground */
.sandbox-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  margin-bottom: 110px;
}

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

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

.card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.card-heading h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
}

.form-tag {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: var(--radius-sm);
  background: var(--accent-fire-subtle);
  color: var(--accent-fire);
  border: 1px solid rgba(255, 77, 0, 0.25);
  font-family: var(--font-mono);
}

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

label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 6px;
}

input, select, textarea {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  color: var(--text-main);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: all 0.18s ease;
}

input:focus, select:focus, textarea:focus {
  background: #ffffff;
  border-color: var(--accent-fire);
  box-shadow: 0 0 0 3px var(--accent-fire-glow);
}

/* Light Protocol Inspector Code Box */
pre, code {
  font-family: var(--font-mono);
  font-size: 12px;
}

pre {
  background: #f8fafc;
  padding: 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-card);
  color: #1e293b;
  overflow-x: auto;
  line-height: 1.6;
}

/* ==========================================================================
   PRICING MATRIX
   ========================================================================== */

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 26px;
  margin-bottom: 110px;
  align-items: stretch;
}

.pricing-card {
  background: #ffffff;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-xl);
  padding: 38px 30px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  position: relative;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.pricing-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
}

.pricing-card.featured {
  border: 2px solid var(--accent-fire);
  box-shadow: var(--shadow-lg), 0 0 30px var(--accent-fire-glow);
}

.popular-badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #ff661a 0%, #ff3700 100%);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 14px;
  border-radius: var(--radius-full);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-family: var(--font-mono);
  box-shadow: 0 4px 12px var(--accent-fire-glow);
}

.plan-name {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 6px;
  color: var(--text-main);
}

.plan-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 22px;
  min-height: 40px;
}

.plan-price-wrap {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.plan-price {
  font-size: 46px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.03em;
  font-family: var(--font-mono);
}

.plan-period {
  font-size: 14px;
  color: var(--text-dim);
  font-weight: 600;
}

.plan-features-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 13px;
  margin-bottom: 32px;
  flex: 1;
}

.plan-feature-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-main);
}

.plan-feature-item .check {
  color: var(--accent-emerald);
  font-weight: 800;
  font-size: 15px;
}

.plan-feature-item.muted {
  color: var(--text-dim);
}

.plan-feature-item.muted .cross {
  color: var(--text-dim);
  opacity: 0.5;
}

/* Feature Grid */
.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
  margin-bottom: 110px;
}

.feature-box {
  background: #ffffff;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 30px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-sm);
}

.feature-box:hover {
  border-color: rgba(255, 77, 0, 0.4);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.feature-icon {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-sm);
  background: var(--accent-fire-subtle);
  border: 1px solid rgba(255, 77, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin-bottom: 18px;
  color: var(--accent-fire);
}

.feature-title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-main);
}

.feature-desc {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.65;
}

/* Code Snippet Box */
.code-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.tab-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border-card);
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font-mono);
}

.tab-btn.active {
  background: var(--accent-fire-subtle);
  border-color: var(--accent-fire);
  color: var(--accent-fire);
}

/* FAQ Accordion */
.faq-wrap {
  max-width: 820px;
  margin: 0 auto 110px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.faq-item {
  background: #ffffff;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
  transition: border-color 0.15s ease;
}

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

.faq-question {
  padding: 20px 24px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-main);
  user-select: none;
}

.faq-answer {
  padding: 0 24px 20px;
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.65;
  display: none;
}

.faq-item.open .faq-answer {
  display: block;
}

.faq-item.open .faq-toggle-icon {
  transform: rotate(180deg);
}

.faq-toggle-icon {
  transition: transform 0.2s ease;
  font-size: 12px;
  color: var(--text-dim);
}

/* Footer */
.app-footer {
  border-top: 1px solid var(--border-card);
  background: var(--bg-secondary);
  padding: 48px 36px 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  text-align: center;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 24px;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
}

.footer-links a:hover {
  color: var(--accent-fire);
}

.footer-copy {
  font-size: 12px;
  color: var(--text-dim);
}

/* ==========================================================================
   AUTHENTICATED ADMIN PORTAL
   ========================================================================== */

#admin-portal-view {
  display: none;
}

.app-container {
  display: flex;
  flex: 1;
  height: calc(100vh - 72px);
  overflow: hidden;
}

.sidebar {
  width: 280px;
  border-right: 1px solid var(--border-card);
  background: #ffffff;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow-y: auto;
}

.section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-bottom: 8px;
  padding: 0 8px;
  font-family: var(--font-mono);
}

.nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 24px;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.nav-item:hover {
  background: var(--bg-secondary);
  color: var(--text-main);
}

.nav-item.active {
  background: var(--accent-fire-subtle);
  color: var(--accent-fire);
  border: 1px solid rgba(255, 77, 0, 0.25);
}

.nav-item .count-badge {
  background: var(--bg-tertiary);
  color: var(--text-muted);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
}

.nav-item.active .count-badge {
  background: rgba(255, 77, 0, 0.2);
  color: var(--accent-fire);
}

.main-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 28px 36px;
  background: var(--bg-secondary);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 26px;
}

.stat-card {
  background: #ffffff;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 18px 22px;
  box-shadow: var(--shadow-sm);
}

.stat-title {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 6px;
}

.stat-value {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
  font-family: var(--font-mono);
}

.feed-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.feed-title {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text-main);
}

.submissions-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.submission-row {
  background: #ffffff;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: var(--shadow-sm);
}

.submission-row:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-fire);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.submission-row.unread {
  border-left: 4px solid var(--accent-fire);
}

.sub-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 0;
}

.star-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-dim);
  font-size: 17px;
  transition: color 0.15s;
}

.star-btn.starred {
  color: var(--accent-amber);
}

.sub-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.sub-sender {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.sub-preview {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 500px;
}

.sub-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.sub-time {
  font-size: 12px;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

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

.modal-card {
  background: #ffffff;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 680px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-xl);
  transform: scale(0.96);
  transition: transform 0.2s ease;
}

.modal-backdrop.open .modal-card {
  transform: scale(1);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.detail-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
}

.detail-table td {
  padding: 10px 12px;
  font-size: 13px;
  border-bottom: 1px solid var(--border-subtle);
}

.detail-table td.label {
  width: 30%;
  color: var(--text-dim);
  font-weight: 600;
  text-transform: capitalize;
}

.detail-table td.val {
  color: var(--text-main);
  word-break: break-word;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
}

@media (max-width: 960px) {
  .hero-title { font-size: 36px; }
  .sandbox-grid, .features-grid, .stats-grid, .pricing-grid { grid-template-columns: 1fr; }
  .header-nav { display: none; }
}
