/* ═══════════════════════════════════════════
   TEMP MAIL — Premium Design System
   ═══════════════════════════════════════════ */

:root {
  /* Primary */
  --primary: #0056D2;
  --primary-dark: #003DA5;
  --primary-light: #3B82F6;
  
  /* Accents */
  --green: #10B981;
  --green-dark: #059669;
  --gold: #F59E0B;
  --gold-dark: #D97706;
  --indigo: #4F46E5;
  --indigo-dark: #4338CA;
  --red: #EF4444;
  --red-dark: #DC2626;
  
  /* Neutrals */
  --gray-50: #F8FAFC;
  --gray-100: #F1F5F9;
  --gray-200: #E2E8F0;
  --gray-300: #CBD5E1;
  --gray-400: #94A3B8;
  --gray-500: #64748B;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1E293B;
  --gray-900: #0F172A;
  
  /* Layout */
  --max-width: 720px;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  
  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,.1);
  --shadow-lg: 0 10px 40px rgba(0,0,0,.15);
  --shadow-xl: 0 20px 60px rgba(0,0,0,.2);
}

/* ─── Reset ─── */
*, *::before, *::after {
  margin: 0; padding: 0; box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--gray-100);
  color: var(--gray-800);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
  width: 100%;
}

/* ═══════════════════════════
   HERO SECTION
   ═══════════════════════════ */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 50%, #002B7F 100%);
  padding: 48px 0 56px;
  position: relative;
  overflow: hidden;
}

.hero-bg-shapes {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.shape {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.04);
}

.shape-1 {
  width: 400px; height: 400px;
  top: -120px; right: -100px;
  animation: float 20s ease-in-out infinite;
}

.shape-2 {
  width: 250px; height: 250px;
  bottom: -60px; left: -80px;
  animation: float 15s ease-in-out infinite reverse;
}

.shape-3 {
  width: 150px; height: 150px;
  top: 40%; left: 60%;
  animation: float 25s ease-in-out infinite 5s;
}

@keyframes float {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-30px) scale(1.05); }
}

.hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
}

/* Logo */
.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 8px;
}

.logo-icon {
  width: 36px; height: 36px;
  color: white;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.2));
}

.logo-text {
  font-size: 28px;
  font-weight: 800;
  color: white;
  letter-spacing: -0.5px;
}

.logo-text span {
  color: rgba(255,255,255,0.7);
  font-weight: 600;
}

.hero-subtitle {
  color: rgba(255,255,255,0.65);
  font-size: 14px;
  margin-bottom: 32px;
  font-weight: 400;
}

/* ─── Email Card ─── */
.email-card {
  background: rgba(255,255,255,0.12);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 24px;
  position: relative;
  transition: all .3s ease;
}

.email-card:hover {
  background: rgba(255,255,255,0.16);
  border-color: rgba(255,255,255,0.25);
}

.email-display {
  display: flex;
  align-items: center;
  gap: 14px;
}

.email-icon-wrap {
  flex-shrink: 0;
  width: 42px; height: 42px;
  background: rgba(255,255,255,0.15);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.email-icon-wrap svg {
  width: 22px; height: 22px;
  color: white;
}

.email-address {
  flex: 1;
  font-size: 18px;
  font-weight: 700;
  color: white;
  letter-spacing: -0.2px;
  word-break: break-all;
  text-align: left;
  user-select: all;
}

.email-dropdown-btn {
  flex-shrink: 0;
  background: rgba(255,255,255,0.1);
  border: none;
  color: white;
  width: 34px; height: 34px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s;
}

.email-dropdown-btn:hover {
  background: rgba(255,255,255,0.2);
}

.email-dropdown-btn svg {
  width: 18px; height: 18px;
  transition: transform .2s;
}

.email-dropdown-btn.open svg {
  transform: rotate(180deg);
}

/* Dropdown */
.dropdown-menu {
  display: none;
  margin-top: 14px;
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 12px;
}

.dropdown-menu.open {
  display: block;
  animation: slideDown .2s ease;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: rgba(255,255,255,0.8);
  font-size: 14px;
  font-weight: 500;
  transition: all .15s;
}

.dropdown-item:hover {
  background: rgba(255,255,255,0.1);
  color: white;
}

.dropdown-item.active {
  background: rgba(255,255,255,0.15);
  color: white;
}

.dropdown-item svg {
  width: 16px; height: 16px; flex-shrink: 0;
}

/* ─── Action Buttons ─── */
.action-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s ease;
  color: white;
  position: relative;
  overflow: hidden;
}

.btn svg {
  width: 16px; height: 16px; flex-shrink: 0;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,.12) 0%, transparent 100%);
  pointer-events: none;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,.25);
}

.btn:active {
  transform: translateY(0);
}

.btn-copy { background: var(--green); }
.btn-copy:hover { background: var(--green-dark); }

.btn-qr { background: var(--gold); }
.btn-qr:hover { background: var(--gold-dark); }

.btn-refresh { background: rgba(255,255,255,0.15); backdrop-filter: blur(10px); }
.btn-refresh:hover { background: rgba(255,255,255,0.25); }

.btn-new { background: var(--indigo); }
.btn-new:hover { background: var(--indigo-dark); }

.btn-delete { background: var(--red); }
.btn-delete:hover { background: var(--red-dark); }

.btn-refresh.spinning svg {
  animation: spin .6s linear;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ═══════════════════════════
   INBOX SECTION
   ═══════════════════════════ */
.inbox-section {
  flex: 1;
  padding: 40px 0;
}

.inbox-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.inbox-header h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--gray-800);
}

.inbox-count {
  font-size: 13px;
  color: var(--gray-400);
  font-weight: 500;
  background: var(--gray-200);
  padding: 5px 14px;
  border-radius: 20px;
}

.inbox-container {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--gray-200);
  min-height: 300px;
  overflow: hidden;
}

/* Empty state */
.inbox-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  text-align: center;
}

.inbox-empty.hidden { display: none; }

.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 20px;
}

.empty-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--gray-500);
  margin-bottom: 6px;
}

.empty-subtitle {
  font-size: 14px;
  color: var(--gray-400);
}

/* Email List */
.email-list { display: none; }
.email-list.active { display: block; }

.email-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--gray-100);
  cursor: pointer;
  transition: all .15s;
  position: relative;
}

.email-item:last-child { border-bottom: none; }

.email-item:hover {
  background: var(--gray-50);
}

.email-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--primary);
  transform: scaleY(0);
  transition: transform .15s;
}

.email-item:hover::before {
  transform: scaleY(1);
}

.email-item.unread {
  background: #EFF6FF;
}

.email-avatar {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary-light), var(--indigo));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: white;
  font-weight: 700;
  font-size: 16px;
  text-transform: uppercase;
}

.email-info {
  flex: 1;
  min-width: 0;
}

.email-from {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.email-subject {
  font-size: 13px;
  color: var(--gray-500);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.email-time {
  flex-shrink: 0;
  font-size: 12px;
  color: var(--gray-400);
  font-weight: 500;
}

/* ═══════════════════════════
   MODALS
   ═══════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-overlay.open {
  display: flex;
  animation: fadeIn .2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 560px;
  animation: modalIn .25s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(16px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 24px 24px 16px;
  border-bottom: 1px solid var(--gray-100);
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--gray-800);
}

.modal-close {
  background: none;
  border: none;
  color: var(--gray-400);
  cursor: pointer;
  padding: 4px;
  border-radius: 8px;
  transition: all .15s;
}

.modal-close:hover {
  background: var(--gray-100);
  color: var(--gray-600);
}

.modal-close svg { width: 20px; height: 20px; }

/* Email Viewer Modal */
.email-viewer-modal {
  max-width: 700px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

.email-viewer-meta { flex: 1; }

.email-viewer-subject {
  font-size: 18px;
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: 6px;
}

.email-viewer-from {
  font-size: 13px;
  color: var(--gray-500);
  margin-bottom: 2px;
}

.email-viewer-date {
  font-size: 12px;
  color: var(--gray-400);
}

.email-viewer-body {
  padding: 0 24px 24px;
  overflow-y: auto;
  flex: 1;
}

.email-viewer-body iframe {
  width: 100%;
  min-height: 300px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--gray-50);
}

.email-viewer-body .text-content {
  white-space: pre-wrap;
  font-size: 14px;
  color: var(--gray-700);
  line-height: 1.7;
  padding: 20px;
  background: var(--gray-50);
  border-radius: var(--radius-sm);
}

.email-viewer-attachments {
  padding: 0 24px 24px;
}

.attachment-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-xs);
  font-size: 13px;
  color: var(--gray-600);
  margin: 4px;
  cursor: pointer;
  transition: all .15s;
}

.attachment-item:hover {
  background: var(--gray-100);
  border-color: var(--gray-300);
}

.attachment-icon { font-size: 16px; }

/* New Mailbox Modal */
.new-mailbox-form {
  padding: 24px;
}

.input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
}

.input-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  background: var(--gray-50);
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 0 4px 0 0;
  transition: border-color .2s;
}

.input-wrap:focus-within {
  border-color: var(--primary);
}

.input-wrap input {
  flex: 1;
  border: none;
  background: none;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-800);
  outline: none;
}

.input-wrap input::placeholder {
  color: var(--gray-400);
  font-weight: 400;
}

.btn-shuffle {
  flex-shrink: 0;
  width: 36px; height: 36px;
  border: none;
  background: var(--gold);
  color: white;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s;
}

.btn-shuffle:hover {
  background: var(--gold-dark);
  transform: rotate(90deg);
}

.btn-shuffle svg { width: 16px; height: 16px; }

.at-symbol {
  font-size: 18px;
  font-weight: 700;
  color: var(--gray-400);
}

.domain-select {
  padding: 12px 14px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-700);
  background: var(--gray-50);
  cursor: pointer;
  outline: none;
  transition: border-color .2s;
  min-width: 140px;
}

.domain-select:focus {
  border-color: var(--primary);
}

.btn-create {
  width: 100%;
  justify-content: center;
  background: var(--indigo);
  padding: 14px 24px;
  font-size: 15px;
}

.btn-create:hover {
  background: var(--indigo-dark);
}

/* QR Modal */
.qr-modal { max-width: 340px; }

.qr-body {
  padding: 32px 24px;
  text-align: center;
}

.qr-body img {
  width: 200px; height: 200px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}

.qr-address {
  font-size: 13px;
  color: var(--gray-500);
  word-break: break-all;
  font-weight: 500;
}

/* ═══════════════════════════
   TOAST
   ═══════════════════════════ */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--gray-800);
  color: white;
  padding: 14px 24px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  transition: transform .3s cubic-bezier(.34,1.56,.64,1);
  z-index: 2000;
}

.toast svg {
  width: 18px; height: 18px;
  color: var(--green);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

/* ═══════════════════════════
   FOOTER
   ═══════════════════════════ */
.footer {
  background: var(--gray-800);
  color: var(--gray-400);
  padding: 24px 0;
  text-align: center;
  font-size: 13px;
}

/* ═══════════════════════════
   RESPONSIVE
   ═══════════════════════════ */
@media (max-width: 640px) {
  .hero { padding: 32px 0 40px; }
  .logo-text { font-size: 22px; }

  .email-address { font-size: 14px; }

  .action-buttons { gap: 6px; }
  .btn { padding: 10px 14px; font-size: 12px; }
  .btn span { display: none; }

  .email-item { padding: 14px 16px; gap: 12px; }
  .email-avatar { width: 38px; height: 38px; font-size: 14px; }

  .input-row { flex-wrap: wrap; }
  .input-wrap { width: 100%; }
  .domain-select { width: 100%; }
  .at-symbol { display: none; }

  .modal { margin: 10px; }
}
