/* ==========================================================================
   SSC CPO 2025 Result Checker - Compact Modern Light Design
   Optimized specifically for small iframe embeds (350px - 420px width)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@500;600;700&display=swap');

:root {
  --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Clean Modern Light Palette */
  --bg-main: #f8fafc;
  --bg-gradient: radial-gradient(circle at 50% 0%, #eef2ff 0%, #f8fafc 85%);
  --card-bg: #ffffff;
  --card-border: #e2e8f0;

  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-glow: rgba(79, 70, 229, 0.14);

  --accent-emerald: #10b981;
  --emerald-bg: #ecfdf5;
  --emerald-border: #a7f3d0;
  --emerald-text: #065f46;
  --emerald-sub: #047857;

  --accent-rose: #f43f5e;
  --rose-bg: #fff1f2;
  --rose-border: #fecdd3;
  --rose-text: #9f1239;

  --amber-bg: #fffbeb;
  --amber-border: #fde68a;
  --amber-text: #92400e;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;

  --input-bg: #ffffff;
  --input-border: #cbd5e1;
  --input-focus-border: #4f46e5;

  --radius-sm: 6px;
  --radius-md: 9px;
  --radius-lg: 14px;
  --radius-full: 9999px;

  --shadow-card: 0 4px 16px -2px rgba(15, 23, 42, 0.06), 0 0 0 1px #e2e8f0;
  --shadow-btn: 0 3px 10px 0 rgba(79, 70, 229, 0.25);
}

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

body {
  font-family: var(--font-main);
  background: var(--bg-main);
  background-image: var(--bg-gradient);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.4;
  overflow-x: hidden;
}

/* Background Accents */
.ambient-glow {
  position: fixed;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(80px);
  z-index: 0;
  opacity: 0.35;
}
.ambient-glow.top {
  top: -60px;
  left: 50%;
  transform: translateX(-50%);
  background: #c7d2fe;
}
.ambient-glow.bottom {
  bottom: -40px;
  right: 10%;
  background: #bae6fd;
}

/* Confetti Canvas */
#confettiCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 999;
}

/* Compact Widget Container */
.widget-wrapper {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 400px;
  margin: auto;
}

/* Compact Card */
.widget-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

/* Header Section */
.widget-header {
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--card-border);
  text-align: center;
  background: #ffffff;
  position: relative;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.official-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  color: #4338ca;
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.official-badge .flag-icon {
  font-size: 0.75rem;
}

.settings-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}
.settings-btn:hover {
  color: var(--text-primary);
  background: #f1f5f9;
}
.settings-btn svg {
  width: 16px;
  height: 16px;
}

.title {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #0f172a;
  margin-bottom: 2px;
}

.subtitle {
  font-size: 0.73rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

/* Live Stats Pills */
.stats-pills {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  flex-wrap: wrap;
}

.stat-pill {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.stat-pill.all {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #e2e8f0;
}
.stat-pill.female {
  background: #fff1f2;
  color: #be123c;
  border: 1px solid #fecdd3;
}
.stat-pill.male {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

/* Body / Form Section */
.widget-body {
  padding: 12px 14px;
  background: #ffffff;
}

.form-group {
  margin-bottom: 9px;
}

.form-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 3px;
}

.label-hint {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 500;
}

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

.input-icon {
  position: absolute;
  left: 10px;
  color: #94a3b8;
  pointer-events: none;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
}
.input-icon svg {
  width: 14px;
  height: 14px;
}

.form-input {
  width: 100%;
  height: 38px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  padding: 0 10px 0 34px;
  font-family: var(--font-main);
  font-size: 0.86rem;
  color: #0f172a;
  outline: none;
  transition: all 0.2s ease;
}

.form-input:hover {
  border-color: #94a3b8;
}

.form-input:focus {
  border-color: var(--input-focus-border);
  box-shadow: 0 0 0 2.5px var(--primary-glow);
  background: #ffffff;
}

.form-input.mono {
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  font-size: 0.92rem;
}

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

.phone-prefix {
  position: absolute;
  left: 10px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  color: #4f46e5;
  padding-right: 6px;
  border-right: 1px solid var(--input-border);
  line-height: 1;
}

.form-input.phone-input {
  padding-left: 50px;
}

.field-error {
  font-size: 0.68rem;
  color: #e11d48;
  margin-top: 3px;
  display: none;
  align-items: center;
  gap: 3px;
  font-weight: 600;
}

.field-error.visible {
  display: flex;
}

/* Submit Button */
.btn-submit {
  width: 100%;
  height: 40px;
  background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-main);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  box-shadow: var(--shadow-btn);
  transition: all 0.2s ease;
  margin-top: 6px;
}

.btn-submit:hover:not(:disabled) {
  transform: translateY(-1px);
  background: linear-gradient(135deg, #4338ca 0%, #4f46e5 100%);
}

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

.btn-submit:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: none;
}

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

.btn-submit.loading .spinner {
  display: inline-block;
}
.btn-submit.loading .btn-text,
.btn-submit.loading .btn-icon {
  display: none;
}

/* Compact Disclaimer Box */
.disclaimer-box {
  margin-top: 10px;
  padding: 6px 10px;
  background: var(--amber-bg);
  border: 1px solid var(--amber-border);
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  color: var(--amber-text);
  line-height: 1.35;
  display: flex;
  align-items: flex-start;
  gap: 6px;
  text-align: left;
}

.disclaimer-icon {
  font-size: 0.85rem;
  line-height: 1.1;
}

.disclaimer-box a {
  color: #b45309;
  font-weight: 700;
  text-decoration: underline;
}

/* Footer note */
.widget-footer {
  padding: 8px 12px;
  text-align: center;
  font-size: 0.67rem;
  color: var(--text-muted);
  border-top: 1px solid var(--card-border);
  background: #f8fafc;
}

.widget-footer a {
  color: var(--primary);
  text-decoration: underline;
  font-weight: 600;
}

/* Result Screens */
.result-view {
  display: none;
  animation: fadeIn 0.25s ease forwards;
}

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

/* ==========================================================================
   Qualified Result Card (Compact)
   ========================================================================== */
.card-qualified {
  background: var(--emerald-bg);
  border: 1.5px solid var(--emerald-border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 10px;
  position: relative;
  overflow: hidden;
}

.card-qualified::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #10b981, #059669);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #d1fae5;
  border: 1px solid #6ee7b7;
  color: #065f46;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  margin-bottom: 6px;
}

.qualified-heading {
  font-size: 1.15rem;
  font-weight: 800;
  color: #064e3b;
  margin-bottom: 2px;
}

.qualified-sub {
  font-size: 0.74rem;
  color: var(--emerald-sub);
  margin-bottom: 10px;
}

/* Details Grid */
.details-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  background: #ffffff;
  border: 1px solid #d1fae5;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.detail-item {
  display: flex;
  flex-direction: column;
}
.detail-item.full-width {
  grid-column: span 2;
}

.detail-key {
  font-size: 0.64rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 1px;
}

.detail-val {
  font-size: 0.85rem;
  font-weight: 700;
  color: #0f172a;
  word-break: break-word;
}

.detail-val.mono {
  font-family: var(--font-mono);
  color: #1e40af;
}

.detail-val.highlight {
  color: #047857;
  font-size: 0.95rem;
}

/* ==========================================================================
   Not Qualified Result Card (Compact)
   ========================================================================== */
.card-not-qualified {
  background: var(--rose-bg);
  border: 1.5px solid var(--rose-border);
  border-radius: var(--radius-md);
  padding: 14px;
  text-align: center;
  margin-bottom: 10px;
  position: relative;
}

.card-not-qualified::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #f43f5e, #e11d48);
}

.status-badge.not-qual {
  background: #ffe4e6;
  border-color: #fecdd3;
  color: #9f1239;
}

.nq-icon {
  font-size: 1.6rem;
  margin-bottom: 2px;
}

.nq-heading {
  font-size: 1.05rem;
  font-weight: 800;
  color: #881337;
  margin-bottom: 4px;
}

.nq-sub {
  font-size: 0.76rem;
  color: #4c0519;
  margin-bottom: 8px;
}

.nq-tips {
  background: #ffffff;
  border: 1px solid var(--rose-border);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  text-align: left;
  font-size: 0.72rem;
  color: #334155;
  line-height: 1.35;
}

/* Action Buttons */
.action-buttons {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.btn-row {
  display: flex;
  gap: 6px;
}
.btn-row .btn-secondary {
  flex: 1;
}

.btn-secondary {
  width: 100%;
  height: 36px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-md);
  color: #1e293b;
  font-family: var(--font-main);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: #e2e8f0;
}

.btn-whatsapp {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #065f46;
}
.btn-whatsapp:hover {
  background: #d1fae5;
}

/* Settings Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(3px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 12px;
}

.modal-overlay.active {
  display: flex;
}

.modal-box {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 18px;
  max-width: 380px;
  width: 100%;
  box-shadow: 0 15px 25px -5px rgba(0, 0, 0, 0.1);
}

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

.modal-title {
  font-size: 1rem;
  font-weight: 800;
  color: #0f172a;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 2px;
  line-height: 1;
}

.modal-desc {
  font-size: 0.76rem;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 12px;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.74rem;
  margin-bottom: 10px;
  font-weight: 600;
}
.status-indicator.connected {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
}
.status-indicator.not-connected {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
}

/* Print Styles */
@media print {
  body {
    background: #ffffff !important;
    padding: 0 !important;
  }
  .ambient-glow, #confettiCanvas, .top-bar, .action-buttons, .settings-btn {
    display: none !important;
  }
  .widget-card {
    border: 1px solid #cbd5e1 !important;
    box-shadow: none !important;
  }
}
