/* ============================================================
   TEMPMAIL — Design System
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  --bg-primary:    #0a0e1a;
  --bg-secondary:  #111827;
  --bg-card:       #161f35;
  --bg-hover:      #1e2d4a;
  --border:        #1e3a5f;
  --border-light:  #2a4a7f;
  --accent:        #3b82f6;
  --accent-hover:  #2563eb;
  --accent-green:  #22c55e;
  --accent-green-h:#16a34a;
  --text-primary:  #f0f6ff;
  --text-secondary:#94a3b8;
  --text-muted:    #4b6a8a;
  --unread:        #dbeafe;
  --shadow-glow:   0 0 40px rgba(59,130,246,0.15);
  --radius:        12px;
  --radius-sm:     8px;
  --transition:    all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
}

/* ─── Scrollbar ─────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ─── Buttons ───────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #1d4ed8);
  color: white;
  box-shadow: 0 4px 20px rgba(59,130,246,0.4);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--accent-hover), #1e40af);
  box-shadow: 0 6px 28px rgba(59,130,246,0.55);
  transform: translateY(-1px);
}

.btn-green {
  background: linear-gradient(135deg, var(--accent-green), #15803d);
  color: white;
  box-shadow: 0 4px 20px rgba(34,197,94,0.35);
}
.btn-green:hover {
  background: linear-gradient(135deg, var(--accent-green-h), #166534);
  box-shadow: 0 6px 28px rgba(34,197,94,0.5);
  transform: translateY(-1px);
}

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

.btn-danger {
  background: rgba(239,68,68,0.15);
  color: #f87171;
  border: 1px solid rgba(239,68,68,0.3);
}
.btn-danger:hover {
  background: rgba(239,68,68,0.25);
  border-color: rgba(239,68,68,0.5);
}

/* ─── Navbar ────────────────────────────────────────────── */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  height: 64px;
  background: rgba(10, 14, 26, 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.navbar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: -0.5px;
}
.navbar-logo .logo-icon {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}

.navbar-links {
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
}
.navbar-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}
.navbar-links a:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

/* ─── HOME PAGE ─────────────────────────────────────────── */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: 80px 40px 40px;
  position: relative;
  overflow: hidden;
}

/* Background orbs */
.hero::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(59,130,246,0.12) 0%, transparent 70%);
  top: -100px; right: -100px;
  pointer-events: none;
}
.hero::after {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(139,92,246,0.08) 0%, transparent 70%);
  bottom: 50px; left: 20%;
  pointer-events: none;
}

.hero-content {
  max-width: 600px;
  z-index: 1;
  animation: fadeInLeft 0.8s ease;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(59,130,246,0.12);
  border: 1px solid rgba(59,130,246,0.3);
  color: #93c5fd;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 24px;
}
.hero-badge span { font-size: 10px; }

.hero h1 {
  font-size: clamp(36px, 5vw, 56px);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -1.5px;
  margin-bottom: 20px;
}
.hero h1 .gradient-text {
  background: linear-gradient(135deg, #60a5fa, #a78bfa, #34d399);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 17px;
  color: var(--text-secondary);
  margin-bottom: 40px;
  line-height: 1.7;
}

/* Email input form */
.email-form {
  display: flex;
  gap: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px;
  box-shadow: var(--shadow-glow);
  transition: var(--transition);
  max-width: 520px;
}
.email-form:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.2), var(--shadow-glow);
}

.email-input-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
}
.email-input-wrapper input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  padding: 10px 14px;
}
.email-input-wrapper input::placeholder { color: var(--text-muted); }
.email-domain-label {
  color: var(--text-muted);
  font-size: 14px;
  padding-right: 10px;
  white-space: nowrap;
}

.email-form .btn {
  padding: 10px 24px;
  border-radius: 6px;
  font-size: 13px;
}

.hero-features {
  display: flex;
  gap: 24px;
  margin-top: 32px;
  flex-wrap: wrap;
}
.feature-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  font-size: 13px;
}
.feature-pill svg { color: var(--accent-green); }

/* Hero illustration */
.hero-visual {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  animation: fadeInRight 0.8s ease 0.2s both;
}

.server-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  width: 320px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4), var(--shadow-glow);
  position: relative;
}
.server-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}
.server-dots { display: flex; gap: 6px; }
.server-dots span {
  width: 10px; height: 10px; border-radius: 50%;
  display: block;
}
.dot-red { background: #ef4444; }
.dot-yellow { background: #f59e0b; }
.dot-green { background: #22c55e; animation: pulse-dot 2s infinite; }
.server-title { color: var(--text-muted); font-size: 12px; }

.server-log {
  font-family: 'Courier New', monospace;
  font-size: 11px;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.log-line {
  display: flex;
  gap: 8px;
  animation: fadeInUp 0.4s ease both;
}
.log-time { color: var(--text-muted); flex-shrink: 0; }
.log-event-smtp { color: #60a5fa; }
.log-event-ok { color: #34d399; }
.log-event-info { color: #a78bfa; }
.log-text { color: var(--text-secondary); }

/* Floating badge */
.floating-badge {
  position: absolute;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  animation: float 3s ease-in-out infinite;
}
.floating-badge.badge-top {
  top: -20px; right: -20px;
  animation-delay: 0s;
}
.floating-badge.badge-bottom {
  bottom: -20px; left: -20px;
  animation-delay: 1.5s;
}
.badge-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent-green); }

/* ─── Features Section ─────────────────────────────────── */
.features-section {
  padding: 80px 40px;
  text-align: center;
}
.features-section h2 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 48px;
  color: var(--text-secondary);
}
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  max-width: 900px;
  margin: 0 auto;
}
.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 20px;
  transition: var(--transition);
}
.feature-card:hover {
  border-color: var(--border-light);
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.3);
}
.feature-card .icon {
  font-size: 32px;
  margin-bottom: 12px;
}
.feature-card h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 8px;
}
.feature-card p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ─── INBOX PAGE ────────────────────────────────────────── */
.inbox-layout {
  display: flex;
  height: 100vh;
  padding-top: 64px;
}

/* Sidebar */
.inbox-sidebar {
  width: 360px;
  min-width: 280px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.current-email {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}
.email-avatar {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
  flex-shrink: 0;
}
.email-address-text {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.copy-btn {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: var(--transition);
  flex-shrink: 0;
}
.copy-btn:hover { color: var(--accent); background: rgba(59,130,246,0.1); }

.sidebar-actions {
  display: flex;
  gap: 8px;
}
.sidebar-actions .btn { flex: 1; justify-content: center; font-size: 12px; padding: 8px 12px; }

.inbox-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px 10px;
}
.inbox-label span:first-child {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
}
.badge-count {
  background: var(--accent);
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
}

.email-list {
  flex: 1;
  overflow-y: auto;
}

.email-item {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
  border-left: 3px solid transparent;
}
.email-item:hover { background: var(--bg-hover); }
.email-item.active {
  background: var(--bg-hover);
  border-left-color: var(--accent);
}
.email-item.unread .email-item-subject { color: var(--unread); font-weight: 600; }

.email-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 4px;
  gap: 8px;
}
.email-item-from {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.email-item-time {
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.email-item-subject {
  font-size: 13px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 2px;
}
.unread-dot {
  display: inline-block;
  width: 6px; height: 6px;
  background: var(--accent);
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}

.empty-inbox {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 200px;
  gap: 12px;
  color: var(--text-muted);
}
.empty-inbox .icon { font-size: 40px; opacity: 0.4; }
.empty-inbox p { font-size: 14px; text-align: center; }
.refresh-tip { font-size: 12px; color: var(--text-muted); opacity: 0.7; }

/* Auto-refresh indicator */
.refresh-bar {
  padding: 8px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}
.refresh-spinner {
  width: 12px; height: 12px;
  border: 2px solid var(--border-light);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  flex-shrink: 0;
}
.refresh-bar.active .refresh-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent-green);
  animation: pulse-dot 1.5s infinite;
}

/* Content area */
.inbox-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-primary);
}

.content-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--text-muted);
}
.content-empty .icon { font-size: 64px; opacity: 0.2; }
.content-empty h3 { font-size: 18px; font-weight: 600; color: var(--text-secondary); }
.content-empty p { font-size: 14px; }

.email-view {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.email-view-header {
  padding: 24px 32px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.email-view-subject {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 16px;
  line-height: 1.3;
}
.email-view-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 13px;
  color: var(--text-secondary);
}
.meta-item { display: flex; gap: 6px; }
.meta-label { color: var(--text-muted); }
.meta-value { color: var(--text-secondary); }

.email-view-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px 32px;
}
.email-body-html iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: white;
  border-radius: var(--radius-sm);
  min-height: 400px;
}
.email-body-text {
  font-family: 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.8;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-word;
}

.email-view-actions {
  padding: 16px 32px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

/* ─── Toast notification ────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px; right: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  z-index: 999;
  animation: slideIn 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}
.toast.success { border-color: rgba(34,197,94,0.4); }
.toast.error { border-color: rgba(239,68,68,0.4); }
.toast.hidden { display: none; }

/* ─── Loading state ─────────────────────────────────────── */
.loading-spinner {
  display: inline-block;
  width: 20px; height: 20px;
  border: 2px solid var(--border-light);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ─── Error message ─────────────────────────────────────── */
.error-msg {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  color: #f87171;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin: 12px 20px;
}

/* ─── Animations ────────────────────────────────────────── */
@keyframes fadeInLeft {
  from { opacity: 0; transform: translateX(-30px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes fadeInRight {
  from { opacity: 0; transform: translateX(30px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-8px); }
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes slideIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── Responsive ────────────────────────────────────────── */
@media (max-width: 900px) {
  .hero { flex-direction: column; padding: 100px 24px 40px; }
  .hero-visual { margin-top: 40px; }
  .navbar { padding: 0 20px; }
}
@media (max-width: 640px) {
  .inbox-sidebar { width: 100%; }
  .inbox-content { display: none; }
  .inbox-content.show-mobile { display: flex; position: fixed; inset: 64px 0 0 0; z-index: 50; }
}
