* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background:
    radial-gradient(circle at top left, #ede9fe, transparent 30%),
    radial-gradient(circle at bottom right, #fed7aa, transparent 30%),
    #f8fafc;
  color: #0f172a;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* 🔥 THEME TOGGLE */
.theme-toggle {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 999;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 999px;
  background: white;
  color: #0f172a;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.15);
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0;
}

/* 🔥 BRAND / LOGO */
.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 10px;
  font-size: 22px;
  font-weight: bold;
}

.logo {
  width: 42px;
  height: 42px;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.container {
  width: 700px;
  max-width: 92%;
  margin: 40px auto;
  text-align: center;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #dcfce7;
  color: #166534;
  padding: 7px 15px;
  border-radius: 999px;
  font-weight: bold;
  font-size: 10px;
  margin: 0 auto 12px auto; /* 🔥 biar tetap di tengah */
  width: fit-content;       /* 🔥 penting: jangan full lebar */
}

.badge::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  background: #22c55e;
  border-radius: 50%;
  margin-right: 8px;
  position: relative;
  top: 0;
  animation: pulse 1.5s infinite, blink 2s infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(34, 197, 94, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
  }
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

h1 {
  margin: 5px 0;
  font-size: 34px;
}

.subtitle {
  margin-top: 0;
  color: #64748b;
  font-size: 14px;
}

.card {
  background: rgba(255, 255, 255, 0.9);
  padding: 22px;
  border-radius: 24px;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.12);
  backdrop-filter: blur(10px);
  margin-top: 20px;
  text-align: left;
}

label {
  font-size: 13px;
  font-weight: bold;
  color: #475569;
}

.email-box {
  margin-top: 8px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 12px;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  align-items: center;
}

#emailText {
  font-weight: bold;
  word-break: break-all;
}

.email-box button {
  border: none;
  background: white;
  border-radius: 12px;
  padding: 9px 12px;
  cursor: pointer;
}

.custom-box {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  margin-top: 14px;
}

.custom-box input,
.custom-box select {
  border: 1px solid #e2e8f0;
  padding: 11px;
  border-radius: 14px;
  outline: none;
}

.custom-box button {
  border: none;
  background: #0f172a;
  color: white;
  padding: 11px 14px;
  border-radius: 14px;
  cursor: pointer;
}

.buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.btn {
  border: none;
  color: white;
  padding: 13px;
  border-radius: 16px;
  cursor: pointer;
  font-weight: bold;
}

.random {
  background: linear-gradient(135deg, #7c3aed, #ec4899);
}

.refresh {
  background: linear-gradient(135deg, #f97316, #facc15);
  color: #431407;
}

.status {
  margin-top: 14px;
  text-align: center;
  color: #64748b;
  font-size: 14px;
}

.loading::after {
  content: "";
  animation: dots 1.2s infinite;
}

@keyframes dots {
  0% { content: ""; }
  33% { content: "."; }
  66% { content: ".."; }
  100% { content: "..."; }
}

.inbox-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 26px;
}

.inbox-header button {
  border: none;
  background: #fee2e2;
  color: #991b1b;
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
}

.inbox {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.empty {
  background: white;
  color: #94a3b8;
  padding: 18px;
  border-radius: 18px;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
}

.message {
  background: white;
  border-radius: 18px;
  padding: 16px;
  text-align: left;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
}

.message-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.message-title {
  font-weight: bold;
}

.message-time {
  color: #94a3b8;
  font-size: 12px;
}

.otp-row {
  margin-top: 12px;
  background: #f8fafc;
  border-radius: 14px;
  padding: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.otp-code {
  font-size: 24px;
  font-weight: bold;
  letter-spacing: 2px;
  color: #16a34a;
}

.copy-otp {
  border: none;
  background: #dcfce7;
  color: #166534;
  padding: 8px 12px;
  border-radius: 12px;
  cursor: pointer;
}

.message-email {
  font-size: 13px;
  color: #64748b;
  margin-top: 2px;
}

/* 🔥 HTML EMAIL */
.html-email {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  padding: 12px;
  border-radius: 12px;
  margin-top: 12px;
  overflow-x: auto;
}

.html-email img {
  max-width: 100%;
  height: auto;
}

.html-email table {
  max-width: 100%;
}

.html-email a {
  color: #2563eb;
  text-decoration: none;
}

.html-email a:hover {
  text-decoration: underline;
}

/* 🔥 FOOTER */
.footer {
  text-align: center;
  font-size: 12px;
  color: #94a3b8;
  margin-top: auto;
  padding-bottom: 30px;
}

/* 🔥 DARK MODE */
body.dark {
  background:
    radial-gradient(circle at top left, rgba(124, 58, 237, 0.25), transparent 30%),
    radial-gradient(circle at bottom right, rgba(249, 115, 22, 0.18), transparent 30%),
    #020617;
  color: #e2e8f0;
}

body.dark .theme-toggle {
  background: #1e293b;
  color: #f8fafc;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
}

body.dark .subtitle,
body.dark .status,
body.dark .message-email,
body.dark .message-time,
body.dark .footer {
  color: #94a3b8;
}

body.dark .card,
body.dark .message,
body.dark .empty {
  background: rgba(15, 23, 42, 0.92);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
}

body.dark label {
  color: #cbd5e1;
}

body.dark #emailText {
  color: #e2e8f0;
}

body.dark .email-box,
body.dark .otp-row {
  background: #0f172a;
  border-color: #334155;
}

body.dark .email-box button {
  background: #1e293b;
  color: #e2e8f0;
}

body.dark .custom-box input,
body.dark .custom-box select {
  background: #0f172a;
  color: #e2e8f0;
  border-color: #334155;
}

body.dark .custom-box button {
  background: #e2e8f0;
  color: #020617;
}

body.dark .html-email {
  background: #ffffff;
  color: #0f172a;
  border-color: #334155;
}

@media (max-width: 520px) {
  .container {
    margin: 25px auto;
  }

  h1 {
    font-size: 28px;
  }

  .custom-box {
    grid-template-columns: 1fr;
  }

  .buttons {
    grid-template-columns: 1fr;
  }
}