/* ==========================================================================
   TempMail Modern High-End Multi-User Stylesheet
   ========================================================================== */

:root {
  --bg-app: #080b10;
  --bg-surface: #0f141c;
  --bg-card: #151c27;
  --bg-card-hover: #1c2635;
  --bg-input: #0b0f15;
  --line-subtle: #1e2634;
  --line-focus: #4f46e5;
  
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-soft: rgba(99, 102, 241, 0.12);
  --primary-border: rgba(99, 102, 241, 0.3);

  --accent-cyan: #06b6d4;
  --accent-gold: #f59e0b;
  
  --emerald: #10b981;
  --emerald-soft: rgba(16, 185, 129, 0.12);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.12);

  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

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

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 14px 0 rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 30px -4px rgba(0, 0, 0, 0.6);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-main);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--line-subtle);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-dim);
}

/* ==========================================================================
   PAGE 1: AUTH & LANDING VIEW
   ========================================================================== */
.auth-view {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: radial-gradient(circle at 50% 10%, #171e2e 0%, #080b10 65%);
  overflow-y: auto;
}

.auth-topbar {
  height: 70px;
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(30, 38, 52, 0.6);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.logo-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary) 0%, #a855f7 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.35);
}
.logo-icon svg {
  width: 22px;
  height: 22px;
}
.brand-text {
  display: flex;
  flex-direction: column;
}
.brand-title {
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -0.02em;
  color: #fff;
}
.brand-tag {
  font-size: 11.5px;
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  font-weight: 500;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px;
  border-radius: 999px;
  background: var(--emerald-soft);
  border: 1px solid rgba(16, 185, 129, 0.25);
  font-size: 12px;
  font-weight: 600;
  color: var(--emerald);
}
.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 8px var(--emerald);
  animation: pulse-ring 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
@keyframes pulse-ring {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.auth-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.auth-hero {
  max-width: 580px;
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 16px;
  border-radius: 999px;
  background: var(--primary-soft);
  border: 1px solid var(--primary-border);
  color: #a5b4fc;
  font-size: 12.5px;
  font-weight: 600;
}

.auth-hero h1 {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(180deg, #ffffff 40%, #94a3b8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.25;
}

.hero-desc {
  font-size: 14.5px;
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 500px;
}

.quick-action-card {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-xl);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
  box-shadow: 0 10px 30px rgba(99, 102, 241, 0.15);
}

.btn-hero {
  width: 100%;
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 700;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary) 0%, #4338ca 100%);
  color: #fff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
  transition: all 0.2s ease;
}
.btn-hero:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.55);
}
.card-hint {
  font-size: 12px;
  color: var(--text-dim);
}

.divider-text {
  position: relative;
  width: 100%;
  text-align: center;
  margin: 12px 0 6px;
}
.divider-text::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--line-subtle);
}
.divider-text span {
  position: relative;
  background: var(--bg-app);
  padding: 0 14px;
  font-size: 12px;
  color: var(--text-dim);
}

.auth-card {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.auth-tabs {
  display: flex;
  border-bottom: 1px solid var(--line-subtle);
  background: var(--bg-card);
}
.auth-tab {
  flex: 1;
  padding: 12px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
}
.auth-tab.active {
  color: #fff;
  background: var(--bg-surface);
  border-bottom: 2px solid var(--primary);
}

.auth-form {
  padding: 24px;
  display: none;
  flex-direction: column;
  gap: 16px;
  text-align: right;
}
.auth-form.active {
  display: flex;
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}
.form-group input {
  background: var(--bg-input);
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius-md);
  padding: 11px 14px;
  color: #fff;
  font-family: inherit;
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.15s;
}
.form-group input:focus {
  border-color: var(--primary);
}
.input-addon-group {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.input-addon-group input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 11px 14px;
}
.addon-text {
  padding: 0 14px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-dim);
  background: var(--bg-card);
  border-left: 1px solid var(--line-subtle);
  line-height: 42px;
}

.btn-block {
  width: 100%;
  padding: 12px;
  font-size: 14px;
  margin-top: 4px;
}


/* ==========================================================================
   PAGE 2: INBOX DASHBOARD VIEW (Logged-in workspace)
   ========================================================================= */
.inbox-view {
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-app);
}

.topbar {
  height: 64px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--line-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  flex-shrink: 0;
  z-index: 20;
}

.user-pill-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius-md);
  padding: 6px 14px;
}
.pill-info {
  display: flex;
  align-items: center;
  gap: 6px;
}
.pill-label {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 600;
  text-transform: uppercase;
}
.pill-email {
  font-family: var(--font-mono);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--accent-cyan);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 2-Column Inbox Layout */
.inbox-layout {
  flex: 1;
  display: grid;
  grid-template-columns: 400px 1fr;
  min-height: 0;
}

/* Left: Messages Pane */
.messages-pane {
  background: var(--bg-surface);
  border-right: 1px solid var(--line-subtle);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.pane-header {
  padding: 16px;
  border-bottom: 1px solid var(--line-subtle);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pane-headline {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.pane-headline h3 {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
}
.sync-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--emerald);
  font-weight: 600;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}
.search-box svg {
  position: absolute;
  left: 12px;
  width: 14px;
  height: 14px;
  color: var(--text-dim);
}
.search-box input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius-md);
  padding: 8px 12px 8px 34px;
  color: #fff;
  font-size: 12.5px;
  outline: none;
}
.search-box input:focus {
  border-color: var(--primary);
}

.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
}
.messages-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.message-item {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--line-subtle);
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
  overflow: hidden;
}
.message-item:hover {
  background: var(--bg-card-hover);
  border-color: var(--text-dim);
}
.message-item.active {
  background: var(--primary-soft);
  border-color: var(--primary);
}
.message-item.unseen::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--primary);
}
.msg-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 5px;
}
.msg-sender-pill {
  display: flex;
  align-items: center;
  gap: 8px;
}
.sender-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
}
.msg-sender-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  max-width: 210px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.msg-time {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 500;
}
.msg-title {
  font-size: 13px;
  font-weight: 500;
  color: #e2e8f0;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.message-item.unseen .msg-title {
  font-weight: 700;
  color: #fff;
}
.msg-snippet {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Right: Reader Pane */
.reader-pane {
  background: var(--bg-surface);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  min-height: 0;
}

.reader-empty {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  text-align: center;
}
.empty-illustration {
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.mail-envelope-art {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--line-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.mail-envelope-art svg {
  width: 36px;
  height: 36px;
}
.empty-illustration h3 {
  font-size: 17px;
  font-weight: 700;
  color: #fff;
}
.empty-illustration p {
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.5;
}

.reader-header {
  padding: 24px;
  border-bottom: 1px solid var(--line-subtle);
  background: rgba(15, 20, 28, 0.6);
  backdrop-filter: blur(8px);
}
.reader-headline {
  font-size: 21px;
  font-weight: 700;
  color: #fff;
  line-height: 1.35;
  margin-bottom: 16px;
}
.reader-meta-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 16px;
  font-size: 13px;
  color: var(--text-muted);
  background: var(--bg-card);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line-subtle);
}
.meta-label {
  color: var(--text-dim);
  font-weight: 600;
}
.meta-val {
  color: var(--text-main);
  word-break: break-all;
}

.reader-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  flex-wrap: wrap;
  gap: 10px;
}
.view-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-input);
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-subtle);
}
.v-tab {
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: 4px;
  cursor: pointer;
  border: none;
  background: transparent;
  transition: all 0.15s;
}
.v-tab.active {
  background: var(--bg-card-hover);
  color: #fff;
}
.reader-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.attachments-panel {
  padding: 14px 24px;
  border-bottom: 1px solid var(--line-subtle);
  background: var(--bg-card);
}
.attachments-panel h4 {
  font-size: 11.5px;
  text-transform: uppercase;
  color: var(--text-dim);
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}
.attach-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.attach-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius-md);
  font-size: 12.5px;
  color: var(--text-main);
  text-decoration: none;
  transition: all 0.15s;
}
.attach-chip:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: #fff;
}
.attach-chip .file-size {
  color: var(--text-dim);
  font-size: 11px;
}

.reader-content {
  flex: 1;
  padding: 24px;
}
.reader-content pre {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  color: #cbd5e1;
}
.reader-content iframe {
  width: 100%;
  min-height: 560px;
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius-md);
  background: #ffffff;
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.18s ease-in-out;
  text-decoration: none;
  white-space: nowrap;
}
.btn svg {
  width: 15px;
  height: 15px;
}
.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}
.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-muted);
  border: 1px solid var(--line-subtle);
}
.btn-icon:hover {
  color: #fff;
  border-color: var(--text-dim);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}
.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}
.btn-primary-soft {
  background: var(--primary-soft);
  color: #818cf8;
  border: 1px solid var(--primary-border);
}
.btn-primary-soft:hover {
  background: rgba(99, 102, 241, 0.2);
  color: #fff;
}
.btn-secondary {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--line-subtle);
}
.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--text-dim);
}
.btn-outline {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--line-subtle);
}
.btn-outline:hover {
  color: #fff;
  border-color: var(--primary);
}
.btn-accent {
  background: #2563eb;
  color: #fff;
}
.btn-accent:hover {
  background: #1d4ed8;
}
.btn-danger-ghost {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
}
.btn-danger-ghost:hover {
  background: var(--danger-soft);
  border-color: var(--danger);
}

/* ==========================================================================
   Modals
   ========================================================================== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
}
.modal-card {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: modal-pop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes modal-pop {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line-subtle);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}
.modal-title {
  display: flex;
  align-items: center;
  gap: 12px;
}
.modal-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: var(--primary-soft);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.modal-icon.gold {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-gold);
}
.modal-title h3 {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
}
.modal-title .muted {
  font-size: 12px;
  color: var(--text-dim);
}
.btn-close {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
}
.btn-close:hover {
  color: #fff;
}
.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.modal-actions {
  padding: 14px 20px;
  border-top: 1px solid var(--line-subtle);
  background: var(--bg-surface);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Credential Display Box */
.cred-display-box {
  background: var(--bg-card);
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.cred-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.cred-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
}
.cred-val-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.cred-code {
  font-family: var(--font-mono);
  font-size: 13.5px;
  color: #38bdf8;
  background: var(--bg-input);
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--line-subtle);
}
.cred-code.highlight {
  color: #facc15;
}

.alert-box {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  line-height: 1.5;
}
.alert-box.tip {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #6ee7b7;
}

/* Toast */
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1e293b;
  color: #fff;
  border: 1px solid var(--primary);
  padding: 10px 22px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 10px 25px -5px rgba(0,0,0,0.6);
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 200;
}
#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.empty-hint {
  text-align: center;
  padding: 40px 16px;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.empty-icon {
  font-size: 28px;
}
.empty-hint p {
  font-size: 13.5px;
  color: var(--text-muted);
  font-weight: 600;
}
.empty-hint small {
  font-size: 12px;
}

.spin-icon.spinning {
  animation: spin 0.75s linear infinite;
}
@keyframes spin {
  100% { transform: rotate(360deg); }
}

.hidden {
  display: none !important;
}

@media (max-width: 900px) {
  .inbox-layout {
    grid-template-columns: 1fr;
    grid-template-rows: 320px 1fr;
  }
}
