/* ==========================================================================
   dlyyn TempMail - Modern Stylesheet (Light & Dark Themes)
   ========================================================================== */

:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-heading: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Accent Colors */
  --primary: #8B5CF6;
  --primary-hover: #7C3AED;
  --primary-dark: #6D28D9;
  --primary-light: #DDD6FE;
  --primary-glow: rgba(139, 92, 246, 0.25);
  --accent: #A855F7;
  --accent-gradient: linear-gradient(135deg, #8B5CF6 0%, #6366F1 50%, #EC4899 100%);
  --accent-subtle: rgba(139, 92, 246, 0.08);

  /* Semantic Colors */
  --success: #10B981;
  --success-bg: rgba(16, 185, 129, 0.12);
  --warning: #F59E0B;
  --warning-bg: rgba(245, 158, 11, 0.12);
  --danger: #EF4444;
  --danger-bg: rgba(239, 68, 68, 0.12);
  --info: #3B82F6;
  --info-bg: rgba(59, 130, 246, 0.12);

  /* Radius & Transitions */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 9999px;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light Theme */
[data-theme="light"] {
  --bg-page: #F8FAFC;
  --bg-card: #FFFFFF;
  --bg-card-hover: #F1F5F9;
  --bg-surface: #F1F5F9;
  --bg-input: #FFFFFF;
  --border-color: #E2E8F0;
  --border-focus: #8B5CF6;
  --text-main: #0F172A;
  --text-muted: #64748B;
  --text-subtle: #94A3B8;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-glow: 0 0 25px rgba(139, 92, 246, 0.18);
  --modal-overlay: rgba(15, 23, 42, 0.5);
}

/* Dark Theme (Default) */
[data-theme="dark"], :root:not([data-theme="light"]) {
  --bg-page: #0B0F19;
  --bg-card: #131A2A;
  --bg-card-hover: #1A2438;
  --bg-surface: #1E293B;
  --bg-input: #0F172A;
  --border-color: #273449;
  --border-focus: #8B5CF6;
  --text-main: #F8FAFC;
  --text-muted: #94A3B8;
  --text-subtle: #64748B;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -2px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.6), 0 4px 6px -4px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 35px rgba(139, 92, 246, 0.22);
  --modal-overlay: rgba(0, 0, 0, 0.75);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.3s ease, color 0.3s ease;
}

a {
  color: inherit;
  text-decoration: none;
}

button, input, select {
  font: inherit;
}

/* Utilities */
.gradient-text {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
}

/* Navbar */
.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 68px;
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  backdrop-filter: blur(12px);
  transition: border-color 0.2s ease;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.brand-icon span {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.35rem;
  color: #FFFFFF;
}

.brand-title {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-tag {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-left: 4px;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  position: relative;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.55rem 1.15rem;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent-gradient);
  color: #FFFFFF;
  box-shadow: 0 2px 8px var(--primary-glow);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px var(--primary-glow);
  opacity: 0.95;
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-main);
  border-color: var(--border-color);
}
.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--primary);
  color: var(--primary);
}

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.3);
}
.btn-danger:hover {
  background: var(--danger);
  color: #FFFFFF;
}

.btn-icon {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.btn-icon:hover {
  background: var(--bg-card-hover);
  border-color: var(--primary);
  color: var(--primary);
}

/* Plan Badge */
.plan-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.plan-badge.plus {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(236, 72, 153, 0.2));
  color: #C084FC;
  border: 1px solid rgba(192, 132, 252, 0.4);
}

.plan-badge.free {
  background: var(--bg-surface);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

/* App Switcher Dropdown */
.btn-app-switcher {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 8px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.btn-app-switcher:hover {
  color: var(--text-main);
  background: var(--bg-surface);
}

.app-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 290px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1rem;
  box-shadow: var(--shadow-lg);
  z-index: 100;
  display: none;
}
.app-dropdown.show {
  display: block;
  animation: fadeInDown 0.15s ease-out;
}

.app-dropdown-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.app-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}

.app-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.85rem 0.5rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  transition: var(--transition);
  text-align: center;
}
.app-tile:hover {
  background: var(--bg-surface);
  border-color: var(--border-color);
}

.app-tile-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  margin-bottom: 0.4rem;
}
.app-tile-name {
  font-size: 0.82rem;
  font-weight: 600;
}
.app-tile-status {
  font-size: 0.68rem;
  font-weight: 500;
}

/* Main Container */
.main-wrapper {
  flex: 1;
  max-width: 1080px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* Hero Box (Active Email Display) */
.tempmail-hero {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 2.25rem 2rem;
  box-shadow: var(--shadow-glow);
  text-align: center;
  margin-bottom: 1.75rem;
  position: relative;
  overflow: hidden;
}

.tempmail-hero::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--accent-gradient);
}

.hero-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 1.15rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--success);
  background: var(--success-bg);
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
}
.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
  animation: pulseDot 1.5s infinite;
}

/* Email Input Box & Actions */
.email-display-card {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  max-width: 680px;
  margin: 0 auto 1.25rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 0.45rem 0.6rem;
  transition: var(--transition);
}
.email-display-card:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.email-address-text {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-main);
  background: transparent;
  border: none;
  outline: none;
  text-align: center;
  padding: 0.35rem 0.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hero-actions-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  margin-top: 1rem;
}

/* Mailbox Tabs (For Plus & Multi-Mailbox) */
.mailbox-tabs-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 0.5rem 0.25rem 1rem;
  margin-bottom: 1.25rem;
  scrollbar-width: thin;
}

.mailbox-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.95rem;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.mailbox-tab:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
  border-color: var(--primary);
}
.mailbox-tab.active {
  background: var(--accent-subtle);
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: 0 2px 8px var(--primary-glow);
}

.tab-badge {
  background: var(--primary);
  color: #FFFFFF;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-full);
}

.btn-add-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius-md);
  background: transparent;
  border: 1px dashed var(--border-color);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.btn-add-tab:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--accent-subtle);
}

/* Plus Promo Banner */
.plus-banner {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.12), rgba(236, 72, 153, 0.08));
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: var(--radius-lg);
  padding: 0.95rem 1.25rem;
  margin-bottom: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.plus-banner-content {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}
.plus-banner-icon {
  font-size: 1.5rem;
}
.plus-banner-text h4 {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.15rem;
}
.plus-banner-text p {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* Inbox Section */
.inbox-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.inbox-header {
  padding: 1.15rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
}

.inbox-title-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.inbox-title {
  font-size: 1.15rem;
  font-weight: 700;
}
.inbox-counter {
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--bg-surface);
  color: var(--text-muted);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
}

.inbox-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Empty State */
.empty-inbox-state {
  padding: 4.5rem 1.5rem;
  text-align: center;
}
.empty-icon-radar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--accent-subtle);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin-bottom: 1.25rem;
  position: relative;
}
.empty-icon-radar::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px dashed var(--primary);
  opacity: 0.4;
  animation: spinSlow 12s linear infinite;
}
.empty-inbox-state h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}
.empty-inbox-state p {
  font-size: 0.88rem;
  color: var(--text-muted);
  max-width: 440px;
  margin: 0 auto;
}

/* Messages List */
.messages-list {
  display: flex;
  flex-direction: column;
}

.message-item {
  display: flex;
  align-items: center;
  gap: 1.15rem;
  padding: 1.15rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: var(--transition);
}
.message-item:last-child {
  border-bottom: none;
}
.message-item:hover {
  background: var(--bg-surface);
}
.message-item.unread {
  background: rgba(139, 92, 246, 0.04);
}
.message-item.unread .msg-subject {
  font-weight: 700;
  color: var(--text-main);
}

.msg-avatar {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: var(--accent-gradient);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.msg-content {
  flex: 1;
  min-width: 0;
}

.msg-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.msg-sender {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.msg-time {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.msg-subject {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.msg-snippet {
  font-size: 0.8rem;
  color: var(--text-subtle);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--modal-overlay);
  backdrop-filter: blur(6px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease-out;
}
.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  transform: scale(0.95);
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}
.modal-overlay.open .modal-card {
  transform: scale(1);
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  background: var(--bg-surface);
}

/* Email Viewer Modal */
.email-viewer-meta {
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1.25rem;
  font-size: 0.85rem;
}
.meta-row {
  display: flex;
  margin-bottom: 0.35rem;
}
.meta-row:last-child {
  margin-bottom: 0;
}
.meta-label {
  width: 70px;
  font-weight: 600;
  color: var(--text-muted);
}
.meta-value {
  color: var(--text-main);
  word-break: break-all;
}

.email-body-frame {
  width: 100%;
  min-height: 380px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: #FFFFFF;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 0.85rem 1.15rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.88rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  animation: slideInRight 0.25s ease-out;
}
.toast.success {
  border-left: 4px solid var(--success);
}
.toast.error {
  border-left: 4px solid var(--danger);
}

/* Footer */
.footer {
  margin-top: auto;
  border-top: 1px solid var(--border-color);
  background: var(--bg-card);
  padding: 1.5rem;
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-muted);
}
.footer a {
  color: var(--primary);
  font-weight: 600;
}

/* Animations */
@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

@keyframes spinSlow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Responsive */
@media (max-width: 640px) {
  .email-display-card {
    flex-direction: column;
  }
  .email-address-text {
    font-size: 1.1rem;
  }
  .plus-banner {
    flex-direction: column;
    text-align: center;
  }
  .plus-banner-content {
    flex-direction: column;
  }
  .hero-actions-bar {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}
