/* ==========================================================================
   TempMail Crafted Design System
   Aesthetic: Resend / Linear Industrial Minimalist (Obsidian & Crisp Zinc)
   Full-Width Responsive Grid with 2-Column Desktop Split-Pane
   Scrollable Mailbox Tabs & Seamless AdSense Containers
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  
  /* Dark Mode (Default) */
  --bg-canvas: #09090b;
  --bg-surface: #111115;
  --bg-surface-elevated: #18181d;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.15);
  --text-primary: #f4f4f5;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --terminal-bg: rgba(17, 17, 21, 0.88);
  --terminal-input-bg: rgba(9, 9, 11, 0.95);
  --header-bg: rgba(9, 9, 11, 0.85);
  --footer-bg: #09090b;
  --tooltip-bg: #18181b;
  --scrollbar-thumb: #27272a;
  --scrollbar-hover: #3f3f46;
  --gradient-glow: rgba(99, 102, 241, 0.15);
  --ad-bg: transparent;
  --ad-border: transparent;
}

/* ============ LIGHT THEME ============ */
html.light {
  --bg-canvas: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #f1f5f9;
  --border-subtle: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.16);
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --terminal-bg: #ffffff;
  --terminal-input-bg: #f8fafc;
  --header-bg: rgba(255, 255, 255, 0.9);
  --footer-bg: #f8fafc;
  --tooltip-bg: #0f172a;
  --scrollbar-thumb: #cbd5e1;
  --scrollbar-hover: #94a3b8;
  --gradient-glow: rgba(99, 102, 241, 0.06);
  --ad-bg: transparent;
  --ad-border: transparent;
}

/* Base Body */
body {
  font-family: var(--font-sans);
  background-color: var(--bg-canvas);
  background-image: 
    radial-gradient(ellipse 80% 50% at 50% -10%, var(--gradient-glow), transparent 65%),
    radial-gradient(circle at 100% 100%, rgba(24, 24, 27, 0.4), transparent 40%);
  background-attachment: fixed;
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.25s ease, color 0.25s ease;
}

html.light body {
  background-image: 
    radial-gradient(ellipse 80% 50% at 50% -10%, var(--gradient-glow), transparent 65%),
    radial-gradient(circle at 100% 100%, rgba(226, 232, 240, 0.6), transparent 40%);
}

.font-mono {
  font-family: var(--font-mono);
}

.tabular-nums {
  font-variant-numeric: tabular-nums;
  -moz-font-feature-settings: "tnum";
  -webkit-font-feature-settings: "tnum";
  font-feature-settings: "tnum";
}

/* Precision Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-hover);
}

/* Tactile Terminal Container */
.terminal-card {
  background: var(--terminal-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  box-shadow: 
    0 0 0 1px rgba(255, 255, 255, 0.03),
    0 20px 40px -15px rgba(0, 0, 0, 0.5);
  transition: background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

html.light .terminal-card {
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 20px 35px -10px rgba(0, 0, 0, 0.07);
}

/* Hero Address Glow Card */
.hero-address-card {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(17, 17, 21, 0.95) 100%);
  border: 1px solid rgba(99, 102, 241, 0.2);
  box-shadow: 0 10px 30px -10px rgba(99, 102, 241, 0.15);
}
html.light .hero-address-card {
  background: linear-gradient(135deg, rgba(238, 242, 255, 0.8) 0%, #ffffff 100%);
  border: 1px solid rgba(99, 102, 241, 0.25);
  box-shadow: 0 10px 30px -10px rgba(99, 102, 241, 0.1);
}

/* Sandboxed Email Container */
.email-iframe-container {
  width: 100%;
  min-height: 260px;
  border-radius: 0.75rem;
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  position: relative;
}

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

/* ============ SCROLLABLE MAILBOX TABS ============ */
.tabs-scroll-container {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
  padding: 4px 2px;
  scroll-behavior: smooth;
}
.tabs-scroll-container::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

.mailbox-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-secondary);
  transition: all 0.18s ease;
  flex-shrink: 0;
}

.mailbox-tab:hover {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  border-color: rgba(99, 102, 241, 0.35);
  transform: translateY(-1px);
}

.mailbox-tab.active {
  background: #4f46e5;
  color: #ffffff;
  border-color: #4f46e5;
  box-shadow: 0 2px 10px rgba(79, 70, 229, 0.35);
}

.mailbox-tab.active .tab-close {
  color: rgba(255, 255, 255, 0.7);
}
.mailbox-tab.active .tab-close:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.25);
}

.tab-badge {
  padding: 1px 6px;
  border-radius: 9999px;
  font-size: 10px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.15);
  color: inherit;
}
.mailbox-tab.active .tab-badge {
  background: rgba(255, 255, 255, 0.25);
}

.tab-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 9999px;
  font-size: 12px;
  line-height: 1;
  color: var(--text-muted);
  transition: all 0.15s ease;
  padding: 0;
  background: transparent;
  border: none;
  cursor: pointer;
}
.mailbox-tab:not(.active) .tab-close:hover {
  background: rgba(244, 63, 94, 0.15);
  color: #f43f5e;
}

/* ============ AD SLOTS & DEDICATED SIDE RAIL CONTAINERS ============ */
.ad-wrapper {
  background: rgba(17, 17, 21, 0.65);
  border: 1px solid var(--border-subtle);
  border-radius: 0.85rem;
  padding: 8px 10px;
  overflow: hidden;
  transition: all 0.2s ease;
  position: relative;
}
html.light .ad-wrapper {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.ad-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 6px;
  padding: 0 2px;
}

.ad-slot {
  display: block;
  width: 100%;
  text-align: center;
  overflow: hidden;
  border-radius: 0.5rem;
  background: rgba(0, 0, 0, 0.2);
  transition: all 0.25s ease;
  margin: 0 auto;
}

.ad-slot ins.adsbygoogle {
  display: block !important;
  width: 100% !important;
  margin: 0 auto;
}

html.light .ad-slot {
  background: rgba(0, 0, 0, 0.02);
}

.ad-leaderboard {
  max-width: 970px;
  width: 100%;
  min-height: 90px;
}

.ad-sidebar-rail {
  width: 100%;
  min-height: 600px;
  max-width: 300px;
  margin: 0 auto;
}

.ad-sidebar-rect {
  width: 100%;
  min-height: 250px;
  max-width: 300px;
  margin: 0 auto;
}

.ad-mid-banner {
  max-width: 728px;
  width: 100%;
  min-height: 90px;
  margin: 0 auto;
}

.ad-multiplex {
  width: 100%;
  min-height: 120px;
  margin: 0 auto;
}

/* ============ DOMAIN SELECTOR PILLS ============ */
.domain-pill {
  padding: 5px 12px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.01em;
  transition: all 0.18s ease;
  border: 1px solid transparent;
  cursor: pointer;
}

.domain-pill.active {
  background: #4f46e5;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.35);
}

.domain-pill:not(.active) {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  border-color: var(--border-subtle);
}

.domain-pill:not(.active):hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

html.light .domain-pill:not(.active) {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.08);
}
html.light .domain-pill:not(.active):hover {
  background: rgba(0, 0, 0, 0.08);
}

/* ============ EMAIL LIST ITEM ============ */
.email-item {
  transition: background-color 0.15s ease, border-color 0.15s ease;
  cursor: pointer;
}
.email-item:hover {
  background-color: rgba(99, 102, 241, 0.06);
}
.email-item.selected {
  background-color: rgba(99, 102, 241, 0.12);
  border-left: 3px solid #6366f1;
}
html.light .email-item.selected {
  background-color: rgba(79, 70, 229, 0.08);
  border-left: 3px solid #4f46e5;
}

@keyframes email-slide-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
.email-item-animated {
  animation: email-slide-in 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* OTP Glow Badge in email list */
.otp-chip-preview {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(168, 85, 247, 0.2));
  border: 1px solid rgba(99, 102, 241, 0.35);
  color: #a5b4fc;
}
html.light .otp-chip-preview {
  background: linear-gradient(135deg, #eef2ff, #faf5ff);
  border: 1px solid #c7d2fe;
  color: #4338ca;
}

/* ============ COUNTDOWN TIMER STATES ============ */
.timer-safe { color: #34d399 !important; }
.timer-warning { color: #fbbf24 !important; }
.timer-danger { color: #f87171 !important; animation: timer-pulse 1s ease-in-out infinite; }

@keyframes timer-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ============ TOAST SYSTEM ============ */
@keyframes toast-in {
  from { opacity: 0; transform: translateY(16px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toast-out {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(16px) scale(0.96); }
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-sans);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 8px 32px -8px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.06);
  animation: toast-in 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 380px;
}
.toast.toast-exit {
  animation: toast-out 0.2s ease forwards;
}
.toast-success {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #34d399;
}
.toast-error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
}
.toast-info {
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: #a5b4fc;
}
.toast-warning {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #fbbf24;
}

html.light .toast-success {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
}
html.light .toast-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}
html.light .toast-info {
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  color: #3730a3;
}
html.light .toast-warning {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
}

kbd {
  font-family: var(--font-mono);
  font-size: 11px;
}

/* ============ MONETIZATION & AD SPACES ============ */
.ad-wrapper {
  position: relative;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(226, 232, 240, 0.8);
  border-radius: 14px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  width: 100%;
}

html.dark .ad-wrapper {
  background: rgba(18, 18, 22, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.07);
  box-shadow: 0 4px 20px -4px rgba(0, 0, 0, 0.35);
}

.ad-wrapper:hover {
  border-color: rgba(99, 102, 241, 0.25);
}

.ad-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: #94a3b8;
  margin-bottom: 4px;
  width: 100%;
  text-align: center;
  user-select: none;
}

html.dark .ad-label {
  color: #71717a;
}

.ad-slot {
  width: 100%;
  display: block;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.ad-leaderboard {
  min-height: 90px;
  max-width: 728px;
  margin: 0 auto;
}

.ad-sidebar-rail {
  min-height: 600px;
  max-width: 300px;
  width: 100%;
  margin: 0 auto;
}

.ad-sidebar-rect {
  min-height: 250px;
  max-width: 300px;
  width: 100%;
  margin: 0 auto;
}

.ad-mid-banner {
  min-height: 90px;
  max-width: 728px;
  margin: 0 auto;
}

.ad-multiplex {
  min-height: 120px;
  width: 100%;
}

@media (max-width: 768px) {
  .ad-leaderboard {
    min-height: 50px;
  }
  .ad-mid-banner {
    min-height: 50px;
  }
}

/* ============ ASYMMETRICAL DESKTOP LAYOUT (Auto-Ads Side-Rail Gutter Optimization) ============ */
.layout-asym-container {
  width: 100%;
  padding-left: 1rem;
  padding-right: 1rem;
  margin-left: auto;
  margin-right: auto;
}

@media (min-width: 640px) {
  .layout-asym-container {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}

@media (min-width: 1024px) {
  .layout-asym-container {
    /* Widescreen Desktop: Hug right edge closely (~20-24px) so Google Auto-Ads cannot awkwardly
       inject a siderail right next to our dedicated 300x600 skyscraper ad.
       Shift the generous gutter (~12-15%+ viewport width) to the LEFT side so Auto-Ads comfortably renders there. */
    margin-left: auto;
    margin-right: 0;
    padding-left: max(12vw, 3.5rem);
    padding-right: 1.5rem;
    max-width: 1650px;
  }
}

@media (min-width: 1440px) {
  .layout-asym-container {
    padding-left: max(15vw, 5rem);
    padding-right: 1.75rem;
    max-width: 1750px;
  }
}

@media (min-width: 2100px) {
  /* Ultra-wide / 4K monitors (>2100px): Center gracefully with generous bilateral spacing */
  .layout-asym-container {
    margin-left: auto;
    margin-right: auto;
    padding-left: 4.5rem;
    padding-right: 4.5rem;
    max-width: 1850px;
  }
}

/* ============ INTERACTIVE RATING WIDGET ============ */
.star-btn {
  user-select: none;
  line-height: 1;
  padding: 2px 3px;
  cursor: pointer;
  transition: transform 0.15s ease, color 0.15s ease;
}
.star-btn:hover {
  transform: scale(1.25);
}
.star-btn:active {
  transform: scale(0.95);
}

.quick-star-btn {
  user-select: none;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.15s ease, color 0.15s ease;
}
.quick-star-btn:hover {
  transform: scale(1.3);
}
.quick-star-btn:active {
  transform: scale(0.9);
}

/* ============ IN-APP FLOATING EMAIL ARRIVAL CARD ============ */
.email-arrival-card {
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 20px 35px -8px rgba(0, 0, 0, 0.28), 0 0 0 1px rgba(99, 102, 241, 0.2);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
}

.card-progress-bar {
  animation: cardCountdown 8s linear forwards;
}

@keyframes cardCountdown {
  from {
    transform: scaleX(1);
  }
  to {
    transform: scaleX(0);
  }
}

/* Active Notification Badge */
.notify-active {
  background-color: rgba(16, 185, 129, 0.12) !important;
  border-color: rgba(16, 185, 129, 0.35) !important;
  color: #10b981 !important;
}

html.dark .notify-active {
  background-color: rgba(16, 185, 129, 0.15) !important;
  border-color: rgba(16, 185, 129, 0.4) !important;
  color: #34d399 !important;
}

/* ============ MAILBOX DROPDOWN SELECTOR ============ */
#mailbox-dropdown-menu {
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.dropdown-mailbox-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.75rem;
  border-radius: 0.75rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.dropdown-mailbox-item:hover {
  background: rgba(99, 102, 241, 0.08);
}

html.dark .dropdown-mailbox-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.dropdown-mailbox-item.active {
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.25);
}

html.dark .dropdown-mailbox-item.active {
  background: rgba(99, 102, 241, 0.2);
  border-color: rgba(99, 102, 241, 0.4);
}

/* ============ RICH 3-LINE EMAIL FEED CARD ============ */
.email-feed-card {
  position: relative;
  transition: background-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
  cursor: pointer;
}

.email-feed-card:hover {
  background-color: rgba(99, 102, 241, 0.04);
}

html.dark .email-feed-card:hover {
  background-color: rgba(255, 255, 255, 0.03);
}

.email-feed-card.selected {
  background-color: rgba(99, 102, 241, 0.08) !important;
  border-left: 3px solid #6366f1;
}

html.dark .email-feed-card.selected {
  background-color: rgba(99, 102, 241, 0.15) !important;
  border-left: 3px solid #818cf8;
}

.email-feed-card.unread {
  background-color: rgba(99, 102, 241, 0.03);
}

html.dark .email-feed-card.unread {
  background-color: rgba(99, 102, 241, 0.06);
}

/* 2-Line Recipient Target Badge */
.recipient-target-badge {
  display: inline-flex;
  flex-direction: column;
  line-height: 1.15;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.18);
}

html.dark .recipient-target-badge {
  background: rgba(99, 102, 241, 0.14);
  border-color: rgba(99, 102, 241, 0.25);
}

/* Direct Copyable Feed OTP Chip */
.feed-otp-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 8px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  color: #059669;
  font-size: 11px;
}

html.dark .feed-otp-chip {
  background: rgba(16, 185, 129, 0.14);
  border-color: rgba(16, 185, 129, 0.35);
  color: #34d399;
}

.btn-copy-feed-otp {
  padding: 1px 6px;
  border-radius: 4px;
  background: #10b981;
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  transition: all 0.15s ease;
  border: none;
  cursor: pointer;
}

.btn-copy-feed-otp:hover {
  background: #059669;
  transform: scale(1.05);
}

.btn-copy-feed-otp:active {
  transform: scale(0.95);
}

/* Quick Action Buttons on Feed Card */
.feed-action-btn {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 6px;
  transition: all 0.15s ease;
  border: 1px solid transparent;
  cursor: pointer;
}

.feed-action-btn:hover {
  background: rgba(0, 0, 0, 0.05);
}

html.dark .feed-action-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}



