/* ============ RESET & VARIABLES ============ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0b0f14;
  --bg-elev: #121821;
  --bg-elev-2: #1a222e;
  --border: #232d3b;
  --border-strong: #2f3b4d;

  --text: #e6edf3;
  --text-dim: #8b98a9;
  --text-mute: #5a6675;

  --primary: #22c55e;
  --primary-hover: #16a34a;
  --primary-dim: rgba(34, 197, 94, 0.12);

  --blue: #3b82f6;
  --blue-dim: rgba(59, 130, 246, 0.12);
  --yellow: #eab308;
  --yellow-dim: rgba(234, 179, 8, 0.12);
  --red: #ef4444;
  --red-dim: rgba(239, 68, 68, 0.12);
  --gray: #6b7280;
  --gray-dim: rgba(107, 114, 128, 0.12);

  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;

  --shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
}

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px 48px;
  background:
    radial-gradient(circle at 20% 0%, rgba(34, 197, 94, 0.06), transparent 40%),
    radial-gradient(circle at 80% 100%, rgba(59, 130, 246, 0.05), transparent 40%),
    var(--bg);
}

/* ============ LAYOUT ============ */
.container {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
}

.brand {
  text-align: center;
  margin-bottom: 24px;
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--primary), #059669);
  margin-bottom: 12px;
  box-shadow: 0 6px 24px rgba(34, 197, 94, 0.25);
}

.brand-logo svg {
  width: 30px;
  height: 30px;
  fill: #fff;
}

.brand h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.brand p {
  color: var(--text-dim);
  font-size: 14px;
  margin-top: 4px;
}

/* ============ CARD ============ */
.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.card-title {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 4px;
}

.card-subtitle {
  color: var(--text-dim);
  font-size: 13px;
  margin-bottom: 20px;
}

/* ============ FORM ============ */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-hint {
  font-size: 12px;
  color: var(--text-mute);
  margin-top: 6px;
}

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

.input-prefix {
  position: absolute;
  left: 14px;
  color: var(--text-dim);
  font-weight: 600;
  font-size: 15px;
  pointer-events: none;
}

.form-input {
  width: 100%;
  padding: 14px 14px 14px 42px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}

.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-dim);
}

.form-input.error {
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--red-dim);
}

.form-input::placeholder {
  color: var(--text-mute);
}

.form-error {
  color: var(--red);
  font-size: 13px;
  margin-top: 6px;
  min-height: 18px;
  display: none;
}

.form-error.show {
  display: block;
}

/* ============ BUTTON ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, transform 0.08s, opacity 0.15s;
  outline: none;
  text-decoration: none;
  user-select: none;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--primary);
  color: #06281a;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn-secondary {
  background: var(--bg-elev-2);
  color: var(--text);
  border: 1px solid var(--border-strong);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--border);
}

.btn-danger {
  background: var(--red-dim);
  color: var(--red);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.2);
}

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

.btn-sm {
  width: auto;
  padding: 10px 16px;
  font-size: 14px;
}

/* ============ SPINNER ============ */
.spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255, 255, 255, 0.25);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

.spinner-lg {
  width: 40px;
  height: 40px;
  border-width: 3.5px;
}

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

/* ============ STATUS BADGE ============ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  text-transform: capitalize;
}

.badge .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.badge-online    { background: var(--primary-dim); color: var(--primary); }
.badge-offline   { background: var(--gray-dim);    color: var(--gray); }
.badge-pairing   { background: var(--blue-dim);    color: var(--blue); }
.badge-pending   { background: var(--yellow-dim);  color: var(--yellow); }
.badge-error     { background: var(--red-dim);     color: var(--red); }
.badge-revoked   { background: var(--red-dim);     color: var(--red); }

/* ============ PAIRING CODE ============ */
.pairing-box {
  text-align: center;
  padding: 8px 0;
}

.pairing-code {
  display: inline-block;
  font-family: "SF Mono", "Consolas", "Monaco", monospace;
  font-size: clamp(38px, 12vw, 64px);
  font-weight: 700;
  letter-spacing: 6px;
  color: var(--text);
  padding: 20px 24px;
  background: var(--bg-elev-2);
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  margin: 16px 0;
  word-break: break-all;
  user-select: all;
}

/* ============ INFO ROW ============ */
.info-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.info-row:last-child {
  border-bottom: none;
}

.info-label {
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}

.info-value {
  color: var(--text);
  font-size: 14px;
  text-align: right;
  word-break: break-word;
  font-weight: 500;
}

.info-value.mono {
  font-family: "SF Mono", "Consolas", "Monaco", monospace;
  font-size: 12px;
}

/* ============ ALERTS ============ */
.alert {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 16px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  line-height: 1.45;
}

.alert-info    { background: var(--blue-dim);   color: #93c5fd; border: 1px solid rgba(59, 130, 246, 0.25); }
.alert-warn    { background: var(--yellow-dim); color: #fde68a; border: 1px solid rgba(234, 179, 8, 0.25); }
.alert-error   { background: var(--red-dim);    color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.25); }
.alert-success { background: var(--primary-dim);color: #86efac; border: 1px solid rgba(34, 197, 94, 0.25); }

.alert-icon {
  flex-shrink: 0;
  font-size: 16px;
  line-height: 1.3;
}

/* ============ TOAST ============ */
#toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: calc(100% - 32px);
  max-width: 420px;
  pointer-events: none;
}

.toast {
  background: var(--bg-elev-2);
  border: 1px solid var(--border-strong);
  border-left: 4px solid var(--primary);
  color: var(--text);
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  font-size: 14px;
  animation: toastIn 0.25s ease-out;
  pointer-events: auto;
}

.toast.toast-error { border-left-color: var(--red); }
.toast.toast-info  { border-left-color: var(--blue); }
.toast.toast-warn  { border-left-color: var(--yellow); }

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

/* ============ UTILITY ============ */
.text-center { text-align: center; }
.text-dim    { color: var(--text-dim); }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.hidden { display: none !important; }

.centered-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px 0;
  text-align: center;
  color: var(--text-dim);
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 420px) {
  body { padding: 16px 12px 40px; }
  .card { padding: 20px 16px; border-radius: var(--radius); }
  .brand h1 { font-size: 20px; }
  .pairing-code { font-size: clamp(32px, 13vw, 52px); letter-spacing: 4px; padding: 16px; }
}

/* ============ FOOTER ============ */
.footer {
  text-align: center;
  color: var(--text-mute);
  font-size: 12px;
  margin-top: 24px;
}
/* ============ VERSION BADGE (Gratis) ============ */
.version-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  padding: 5px 14px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.version-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gray);
  box-shadow: 0 0 0 3px var(--gray-dim);
}

/* ============ PREMIUM CARD ============ */
.premium-card {
  position: relative;
  background: linear-gradient(
    135deg,
    rgba(34, 197, 94, 0.08),
    rgba(59, 130, 246, 0.05)
  );
  border: 1px solid rgba(34, 197, 94, 0.25);
  overflow: hidden;
}

.premium-card::before {
  content: "";
  position: absolute;
  top: -50%;
  right: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(
    circle,
    rgba(34, 197, 94, 0.08),
    transparent 60%
  );
  pointer-events: none;
}

.premium-card > * {
  position: relative;
}

.premium-badge {
  display: inline-block;
  padding: 4px 12px;
  background: linear-gradient(135deg, var(--primary), #059669);
  color: #06281a;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  border-radius: 999px;
  margin-bottom: 12px;
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.35);
}

.premium-features {
  list-style: none;
  margin: 16px 0 20px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.premium-features li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text);
  line-height: 1.4;
}

.premium-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary-dim);
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
}

/* ============ TOMBOL WHATSAPP ============ */
.btn-whatsapp {
  background: linear-gradient(135deg, #25d366, #128c7e);
  color: #fff;
  font-weight: 700;
  padding: 15px 20px;
  box-shadow: 0 6px 20px rgba(37, 211, 102, 0.35);
  transition: transform 0.08s, box-shadow 0.2s, filter 0.15s;
}

.btn-whatsapp:hover:not(:disabled) {
  filter: brightness(1.08);
  box-shadow: 0 8px 26px rgba(37, 211, 102, 0.45);
}

.btn-whatsapp:active:not(:disabled) {
  transform: scale(0.98);
}

.wa-icon {
  width: 20px;
  height: 20px;
  fill: #fff;
  flex-shrink: 0;
}

.premium-note {
  margin-top: 12px;
  text-align: center;
  font-size: 12px;
  color: var(--text-mute);
}
