/* ==========================================================================
   NITRADAS MAIL - EXACT AESTHETIC STYLING
   Matches user reference screenshot: Split showcase + clean dark login
   ========================================================================== */

:root {
  --bg-dark: #07080d;
  --bg-side: #080a11;
  --bg-input: #111420;
  --bg-hover: rgba(255, 255, 255, 0.04);
  
  --primary-blue: #5568e8;
  --primary-blue-hover: #4658dc;
  --primary-glow: rgba(85, 104, 232, 0.25);
  
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-focus: #5568e8;
  
  --text-main: #ffffff;
  --text-muted: #7f889e;
  --text-dim: #555e73;
  --text-footnote: #434c60;
  
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', Consolas, monospace;
}

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

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-sans);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ==========================================================================
   LOGIN PAGE (EXACT SPLIT LAYOUT)
   ========================================================================== */
.login-page {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* Left Showcase Canvas (~70% width) */
.showcase {
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 44px 64px;
  background: radial-gradient(circle at 45% 42%, #141a2e 0%, #07090f 72%);
  position: relative;
  overflow: hidden;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: #ffffff;
}

.brand-icon {
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #818cf8;
}

.brand-name {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #ffffff;
}

/* Vertically Centered Big Headline */
.hero {
  margin: auto 0;
}

.hero h1 {
  font-size: 52px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #ffffff;
  line-height: 1.1;
  margin: 0;
}

/* Bottom Left Server Indicator */
.hero-footer {
  display: flex;
  align-items: center;
}

.server-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #8892a4;
}

.status-dot {
  width: 6px;
  height: 6px;
  background-color: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 8px #10b981;
}

/* Right Login Column (~30% width) */
.login-side {
  width: 440px;
  flex-shrink: 0;
  min-height: 100vh;
  background: var(--bg-side);
  border-left: 1px solid rgba(255, 255, 255, 0.035);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 40px;
}

.login-card {
  width: 100%;
  max-width: 330px;
}

.login-card h2 {
  font-size: 26px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.login-card p {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 26px;
  line-height: 1.4;
}

.field {
  margin-bottom: 18px;
}

.field label {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: 0.08em;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.field input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 13.5px;
  color: #ffffff;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.field input::placeholder {
  color: #3b4256;
}

.field input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(85, 104, 232, 0.18);
}

.password-wrap {
  position: relative;
}

.reveal {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px;
  display: grid;
  place-items: center;
  transition: color 0.15s;
}

.reveal:hover {
  color: #a5b4fc;
}

.error-msg {
  color: #f87171;
  font-size: 12.5px;
  margin-bottom: 14px;
  line-height: 1.4;
}

.login-submit {
  width: 100%;
  height: 44px;
  background: var(--primary-blue);
  border: none;
  border-radius: 8px;
  color: #ffffff;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
  box-shadow: 0 4px 14px var(--primary-glow);
  transition: background-color 0.2s, transform 0.1s, box-shadow 0.2s;
}

.login-submit:hover {
  background: var(--primary-blue-hover);
  box-shadow: 0 6px 20px rgba(85, 104, 232, 0.35);
}

.login-submit:active {
  transform: scale(0.99);
}

.login-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.secure {
  text-align: center;
  font-size: 11px;
  color: var(--text-footnote);
  margin-top: 24px;
  letter-spacing: 0.02em;
}

/* ==========================================================================
   INBOX PAGE (WHEN LOGGED IN)
   ========================================================================== */
.inbox-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: #07090f;
}

.inbox-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 36px;
  background: var(--bg-side);
  border-bottom: 1px solid var(--border-subtle);
}

.inbox-brand-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
}

.active-address-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(85, 104, 232, 0.12);
  border: 1px solid rgba(85, 104, 232, 0.25);
  border-radius: 999px;
  padding: 4px 12px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: #c7d2fe;
}

.copy-badge-btn {
  background: none;
  border: none;
  color: #818cf8;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 2px;
  transition: transform 0.15s, color 0.15s;
}

.copy-badge-btn:hover {
  color: #ffffff;
  transform: scale(1.15);
}

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

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 15px;
  border-radius: 7px;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s ease;
}

.action-btn.primary {
  background: var(--primary-blue);
  border: none;
  color: #ffffff;
}

.action-btn.primary:hover {
  background: var(--primary-blue-hover);
}

.action-btn.secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: #94a3b8;
}

.action-btn.secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.btn-refresh-icon.spin {
  display: inline-block;
  animation: spin 0.8s linear infinite;
}

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

/* Mail Toolbar */
.mail-toolbar {
  padding: 12px 36px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  background: rgba(0, 0, 0, 0.2);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: #8892a4;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mail-icon {
  color: #818cf8;
}

.count-badge {
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  color: #ffffff;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
}

.radar-dot {
  width: 6px;
  height: 6px;
  background-color: #818cf8;
  border-radius: 50%;
  box-shadow: 0 0 6px #818cf8;
  animation: pulse 2s infinite;
}

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

/* OTP Detected Banner */
.otp-banner {
  margin: 16px 36px 0;
  padding: 12px 18px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.12) 0%, rgba(6, 182, 212, 0.08) 100%);
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.otp-banner-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.otp-icon {
  font-size: 18px;
}

.otp-info {
  display: flex;
  flex-direction: column;
}

.otp-info strong {
  font-size: 12px;
  font-weight: 700;
  color: #34d399;
  letter-spacing: 0.04em;
}

.otp-sub {
  font-size: 12px;
  color: #94a3b8;
}

.otp-banner-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.otp-val {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
  color: #34d399;
  letter-spacing: 0.1em;
  background: rgba(0, 0, 0, 0.35);
  padding: 3px 10px;
  border-radius: 6px;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.btn-copy-otp {
  background: #10b981;
  color: #022c22;
  border: none;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-copy-otp:hover {
  background: #34d399;
}

.inbox-error {
  margin: 16px 36px 0;
}

/* Mail Layout (Split List + Reader) */
.mail-layout {
  display: flex;
  flex: 1;
  padding: 24px 36px;
  gap: 20px;
  align-items: stretch;
}

.mail-list {
  width: 400px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  max-height: calc(100vh - 220px);
}

.mail-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
}

.mail-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.12);
}

.mail-item.selected {
  background: rgba(85, 104, 232, 0.12);
  border-color: rgba(85, 104, 232, 0.4);
}

.mail-item .from {
  font-size: 13px;
  font-weight: 600;
  color: #ffffff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mail-item strong {
  font-size: 13.5px;
  font-weight: 600;
  color: #e2e8f0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mail-item .preview {
  font-size: 12.5px;
  color: #7f889e;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mail-item time {
  font-size: 11.5px;
  color: #555e73;
  margin-top: 2px;
}

.mail-item .code-tag {
  display: inline-block;
  align-self: flex-start;
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: #34d399;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 2px 6px;
  border-radius: 4px;
}

.empty-list {
  padding: 40px 20px;
  text-align: center;
  color: #64748b;
  font-size: 13.5px;
  line-height: 1.5;
}

/* Reader Article */
.reader {
  flex: 1;
  background: var(--bg-side);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 480px;
}

.reader-empty {
  margin: auto;
  text-align: center;
  padding: 60px 20px;
  color: #64748b;
}

.empty-icon-wrap {
  width: 60px;
  height: 60px;
  margin: 0 auto 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: #555e73;
}

.reader-empty h2 {
  font-size: 16px;
  font-weight: 600;
  color: #94a3b8;
  margin-bottom: 6px;
}

.reader-empty p {
  font-size: 13px;
}

.reader-content {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.reader-top {
  padding: 20px 24px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.reader-back {
  display: none;
  background: none;
  border: none;
  color: #818cf8;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 10px;
}

.reader-subject {
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 8px;
}

.reader-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  color: #8892a4;
}

.btn-del-msg {
  background: rgba(244, 63, 94, 0.08);
  border: 1px solid rgba(244, 63, 94, 0.2);
  color: #f87171;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
}

.btn-del-msg:hover {
  background: rgba(244, 63, 94, 0.2);
}

.reader-tabs {
  display: flex;
  gap: 6px;
  padding: 10px 24px;
  background: rgba(0, 0, 0, 0.15);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.reader-tab {
  background: transparent;
  border: none;
  color: #7f889e;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
}

.reader-tab.active {
  background: rgba(85, 104, 232, 0.15);
  color: #c7d2fe;
}

.reader-body {
  flex: 1;
  position: relative;
  background: #ffffff;
  overflow: hidden;
}

.reader-frame {
  width: 100%;
  height: 100%;
  min-height: 400px;
  border: none;
  background: #ffffff;
}

.reader-text {
  width: 100%;
  height: 100%;
  min-height: 400px;
  padding: 24px;
  background: #0d101b;
  color: #e2e8f0;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-y: auto;
}

.inbox-footer {
  padding: 16px 36px;
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--border-subtle);
  font-size: 12px;
  color: var(--text-dim);
}

/* Corner Admin Access button */
.admin-corner-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 50;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #475066;
  font-size: 14px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.2s;
}

.admin-corner-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

/* Admin Login Dialog */
.admin-login-dialog {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  background: #111420;
  color: #ffffff;
  padding: 32px;
  width: min(400px, calc(100% - 32px));
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.8);
  margin: auto;
}

.admin-login-dialog::backdrop {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
}

.dialog-close {
  position: absolute;
  right: 14px;
  top: 12px;
  color: #7f889e;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
}

.mini-label {
  font-size: 10px;
  font-weight: 700;
  color: #818cf8;
  letter-spacing: 0.08em;
}

.admin-login-dialog h2 {
  font-size: 22px;
  font-weight: 700;
  margin: 6px 0 6px;
}

.admin-login-dialog p {
  font-size: 13px;
  color: #7f889e;
  margin-bottom: 20px;
}

/* Toast */
.toast-popup {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #10b981;
  color: #022c22;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */
@media (max-width: 860px) {
  .login-page {
    flex-direction: column;
  }
  .showcase {
    min-height: auto;
    padding: 32px 24px;
  }
  .hero {
    margin: 40px 0;
  }
  .hero h1 {
    font-size: 38px;
  }
  .login-side {
    width: 100%;
    min-height: auto;
    border-left: none;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    padding: 40px 24px;
  }
  .inbox-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 20px;
  }
  .mail-toolbar, .inbox-footer, .mail-layout {
    padding-left: 20px;
    padding-right: 20px;
  }
  .mail-layout {
    flex-direction: column;
  }
  .mail-list {
    width: 100%;
    max-height: 300px;
  }
  .mail-layout.reading .mail-list {
    display: none;
  }
  .mail-layout.reading .reader {
    display: flex;
  }
  .reader-back {
    display: inline-block;
  }
}
