/* ═══════════════════════════════════════════════
   CRUZE MAIL — Clean Modern Tech Theme
   ═══════════════════════════════════════════════ */

/* ── Reset & Base ── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-primary: #000000;
  --bg-secondary: #0a0a0a;
  --bg-card: #111111;
  --bg-card-hover: #1a1a1a;
  --border: #222222;
  --border-hover: #333333;
  --text-primary: #ededed;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --accent: #ffffff;
  --success: #10b981;
  --error: #ef4444;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --transition: 0.15s ease-in-out;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── UI Elements ── */
.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 24px rgba(0,0,0,0.4);
}

/* ── Header ── */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

.logo-text {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.2px;
  color: var(--text-primary);
}

.logo-accent {
  color: var(--text-secondary);
}

.header-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  background: #111;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

.pulse-dot {
  width: 6px;
  height: 6px;
  background: var(--success);
  border-radius: 50%;
}

/* ── Main ── */
.main {
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 24px;
}

/* ── Welcome Section ── */
.welcome-section {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 50vh;
}

.welcome-card {
  text-align: center;
  padding: 64px 48px;
  max-width: 520px;
  width: 100%;
}

.welcome-icon {
  margin-bottom: 24px;
  color: var(--text-secondary);
  display: inline-flex;
  padding: 16px;
  background: #0a0a0a;
  border: 1px solid var(--border);
  border-radius: 16px;
}

.welcome-title {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.welcome-desc {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 32px;
}

.generate-group {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.domain-select {
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 14px;
  outline: none;
  cursor: pointer;
  transition: border-color var(--transition);
}

.domain-select:hover,
.domain-select:focus {
  border-color: var(--border-hover);
}

.welcome-features {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.feature {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
}

.feature-icon {
  font-size: 14px;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-primary {
  background: var(--accent);
  color: #000;
}

.btn-primary:hover {
  background: #e5e5e5;
  transform: translateY(-1px);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: #111;
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: #1a1a1a;
  border-color: var(--border-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid transparent;
}

.btn-ghost:hover {
  color: var(--text-primary);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 13px;
}

.btn-icon {
  font-size: 16px;
}

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(0,0,0,0.2);
  border-top-color: #000;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* ── Email Display Card ── */
.email-display-card {
  padding: 32px;
  margin-bottom: 24px;
  background: var(--bg-card);
}

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

.label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}

.timer-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

.email-display {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: #000;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 24px;
}

.email-address {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  word-break: break-all;
  user-select: all;
}

.copy-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}

.copy-btn:hover {
  background: #111;
  border-color: var(--border-hover);
  color: var(--text-primary);
}

.copy-btn.copied {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.3);
  color: var(--success);
}

.email-display-actions {
  display: flex;
  gap: 12px;
}

/* ── Inbox Card ── */
.inbox-card {
  padding: 0;
  overflow: hidden;
}

.inbox-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: #0a0a0a;
}

.inbox-title {
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
}

.inbox-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: #222;
  color: var(--text-primary);
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
}

/* ── Empty State ── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 24px;
  text-align: center;
  background: var(--bg-card);
}

.empty-icon {
  margin-bottom: 16px;
  color: #333;
}

.empty-text {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.empty-subtext {
  font-size: 13px;
  color: var(--text-secondary);
  max-width: 300px;
  line-height: 1.5;
}

/* ── Email List ── */
.email-list {
  display: flex;
  flex-direction: column;
}

.email-row {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
  cursor: pointer;
  transition: background var(--transition);
}

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

.email-row:hover {
  background: var(--bg-card-hover);
}

.email-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: white;
  flex-shrink: 0;
}

.email-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.email-sender {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.email-subject {
  font-size: 14px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.email-preview {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.email-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

.email-time {
  font-size: 12px;
  color: var(--text-muted);
}

.email-badge {
  padding: 2px 6px;
  background: var(--text-primary);
  color: #000;
  font-size: 9px;
  font-weight: 700;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

/* ── Email Viewer ── */
.viewer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
}

.viewer-overlay.active {
  opacity: 1;
  visibility: visible;
}

.email-viewer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(600px, 100vw);
  height: 100vh;
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  z-index: 201;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: -10px 0 30px rgba(0,0,0,0.5);
}

.email-viewer.active {
  transform: translateX(0);
}

.viewer-header {
  padding: 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 16px;
  align-items: flex-start;
  background: var(--bg-secondary);
}

.viewer-close {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition);
}

.viewer-close:hover {
  background: #1a1a1a;
  color: var(--text-primary);
}

.viewer-meta {
  flex: 1;
  min-width: 0;
}

.viewer-subject {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
  line-height: 1.4;
}

.viewer-info {
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.viewer-dot {
  color: #333;
}

.viewer-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  background: var(--bg-card);
}

.email-iframe {
  width: 100%;
  min-height: 400px;
  border: none;
  background: transparent;
}

.email-text {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-word;
}

/* ── Skeleton Loading ── */
.skeleton-row {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}

.skeleton-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #222;
}

.skeleton-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 4px;
}

.skeleton-line {
  height: 10px;
  border-radius: 4px;
  background: #222;
}

.skeleton-line.short { width: 30%; }
.skeleton-line.medium { width: 50%; }
.skeleton-line.long { width: 80%; }

.shimmer {
  position: relative;
  overflow: hidden;
}

.shimmer::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.03), transparent);
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ── Toast Notifications ── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: #1a1a1a;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  transform: translateY(10px);
  opacity: 0;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast-success .toast-icon { color: var(--success); }
.toast-error .toast-icon { color: var(--error); }
.toast-info .toast-icon { color: var(--text-primary); }

/* ── Footer ── */
.footer {
  text-align: center;
  padding: 40px 24px;
  color: var(--text-muted);
  font-size: 12px;
}

.footer-domain {
  margin-top: 6px;
  font-family: var(--font-mono);
}

/* ── Responsive ── */
@media (max-width: 640px) {
  .header-inner {
    padding: 12px 16px;
  }

  .main {
    padding: 24px 16px;
  }

  .welcome-card {
    padding: 40px 24px;
  }

  .welcome-features {
    flex-direction: column;
    align-items: center;
    gap: 16px;
  }

  .email-display-card {
    padding: 24px;
  }

  .email-display-actions {
    flex-direction: column;
  }

  .email-row {
    padding: 16px;
  }

  .email-viewer {
    width: 100vw;
  }

  #toast-container {
    right: 16px;
    left: 16px;
    bottom: 16px;
  }

  .toast {
    width: 100%;
    justify-content: center;
  }
}
