/* ==========================================================================
   SwiftMail Enterprise Pro Design System
   Modern SaaS Aesthetics (Linear / Resend / Stripe inspired)
   ========================================================================== */

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

:root {
  --primary-color: #3b82f6;
  --primary-hover: #2563eb;
  --primary-subtle: rgba(59, 130, 246, 0.08);
  --primary-glow: rgba(59, 130, 246, 0.25);
  
  --sidebar-width: 260px;
  --header-height: 64px;
  --card-radius: 14px;
  --transition-speed: 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  --font-family: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Light Theme Palette */
  --bg-main: #f8fafc;
  --card-bg: #ffffff;
  --card-border: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 14px -2px rgba(0, 0, 0, 0.06), 0 2px 6px -1px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 12px 28px -4px rgba(0, 0, 0, 0.08), 0 4px 10px -2px rgba(0, 0, 0, 0.03);
}

[data-bs-theme="dark"] {
  --primary-color: #3b82f6;
  --primary-hover: #60a5fa;
  --primary-subtle: rgba(59, 130, 246, 0.16);
  --primary-glow: rgba(59, 130, 246, 0.35);

  --bg-main: #090d16;
  --card-bg: #111827;
  --card-border: rgba(255, 255, 255, 0.08);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  
  --bs-body-bg: var(--bg-main);
  --bs-body-color: var(--text-main);
  --bs-border-color: var(--card-border);
  --bs-card-bg: var(--card-bg);
  --bs-tertiary-bg: #0d1322;
  
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 36px rgba(0, 0, 0, 0.6);
}

/* Base Reset & Typography */
body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  margin: 0;
  padding: 0;
  font-size: 0.925rem;
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

code, kbd, samp, pre {
  font-family: var(--font-mono);
}

/* Custom Sleek Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.3);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.5);
}

/* Layout */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* Sidebar (Pro Navigation) */
.app-sidebar {
  width: var(--sidebar-width);
  background: #090e1a;
  color: #94a3b8;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: transform var(--transition-speed), left var(--transition-speed);
  z-index: 1040;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-header {
  height: var(--header-height);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-brand {
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffffff;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  letter-spacing: -0.02em;
}

.sidebar-brand i {
  color: var(--primary-color);
  filter: drop-shadow(0 2px 8px var(--primary-glow));
}

.sidebar-menu {
  flex-grow: 1;
  padding: 1rem 0.75rem;
  overflow-y: auto;
}

.menu-section {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-weight: 700;
  color: #475569;
  padding: 0.85rem 0.75rem 0.35rem 0.75rem;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.85rem;
  color: #94a3b8;
  text-decoration: none;
  border-radius: 9px;
  font-weight: 500;
  font-size: 0.885rem;
  margin-bottom: 0.15rem;
  transition: all var(--transition-speed);
}

.menu-item:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: #ffffff;
  transform: translateX(2px);
}

.menu-item.active {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
  color: #ffffff;
  box-shadow: 0 4px 14px var(--primary-glow);
  font-weight: 600;
}

.menu-item i {
  font-size: 1.1rem;
}

.sidebar-footer {
  padding: 0.9rem 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.2);
}

/* Main Content Area */
.app-main {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Header Navbar */
.app-navbar {
  height: var(--header-height);
  padding: 0 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--card-bg);
  border-bottom: 1px solid var(--card-border);
  position: sticky;
  top: 0;
  z-index: 1020;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.content-body {
  flex-grow: 1;
  padding: 2rem 1.75rem;
}

/* Cards & Containers */
.card {
  border: 1px solid var(--card-border) !important;
  border-radius: var(--card-radius) !important;
  background: var(--card-bg) !important;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-speed), border-color var(--transition-speed);
}

/* Metric Cards */
.metric-card {
  border: 1px solid var(--card-border);
  border-radius: var(--card-radius);
  background: var(--card-bg);
  padding: 1.35rem 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-speed);
  position: relative;
  overflow: hidden;
}

.metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: transparent;
  transition: background var(--transition-speed);
}

.metric-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: rgba(59, 130, 246, 0.35);
}

.metric-card:hover::before {
  background: linear-gradient(90deg, var(--primary-color), #818cf8);
}

.metric-icon-box {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

.metric-value {
  font-size: 1.85rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.metric-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Form Controls & Inputs */
.form-control, .form-select {
  border-radius: 9px;
  padding: 0.6rem 0.85rem;
  font-size: 0.92rem;
  border-color: var(--card-border);
  transition: border-color var(--transition-speed), box-shadow var(--transition-speed);
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--primary-subtle);
}

/* Buttons */
.btn {
  border-radius: 8px;
  font-weight: 500;
  font-size: 0.895rem;
  padding: 0.55rem 1.05rem;
  transition: all var(--transition-speed);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
  border: none;
  box-shadow: 0 2px 8px var(--primary-glow);
}

.btn-primary:hover, .btn-primary:focus {
  background: linear-gradient(135deg, var(--primary-hover) 0%, #1e40af 100%);
  box-shadow: 0 4px 14px var(--primary-glow);
  transform: translateY(-1px);
}

/* Tables */
.table th {
  font-weight: 600;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--card-border);
  padding: 0.85rem 1rem;
}

.table td {
  vertical-align: middle;
  font-size: 0.895rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--card-border);
}

.table-hover tbody tr:hover {
  background-color: var(--primary-subtle);
}

/* Soft Badges */
.badge-soft-success {
  background-color: rgba(34, 197, 94, 0.12);
  color: #16a34a;
  border: 1px solid rgba(34, 197, 94, 0.25);
}
.badge-soft-danger {
  background-color: rgba(239, 68, 68, 0.12);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.25);
}
.badge-soft-warning {
  background-color: rgba(245, 158, 11, 0.12);
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.25);
}
.badge-soft-info {
  background-color: rgba(14, 165, 233, 0.12);
  color: #0284c7;
  border: 1px solid rgba(14, 165, 233, 0.25);
}
.badge-soft-secondary {
  background-color: rgba(148, 163, 184, 0.12);
  color: #64748b;
  border: 1px solid rgba(148, 163, 184, 0.25);
}

[data-bs-theme="dark"] .badge-soft-success {
  background-color: rgba(34, 197, 94, 0.18);
  color: #4ade80;
  border-color: rgba(34, 197, 94, 0.35);
}
[data-bs-theme="dark"] .badge-soft-danger {
  background-color: rgba(239, 68, 68, 0.18);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.35);
}
[data-bs-theme="dark"] .badge-soft-warning {
  background-color: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.35);
}
[data-bs-theme="dark"] .badge-soft-info {
  background-color: rgba(14, 165, 233, 0.18);
  color: #38bdf8;
  border-color: rgba(14, 165, 233, 0.35);
}
[data-bs-theme="dark"] .badge-soft-secondary {
  background-color: rgba(148, 163, 184, 0.18);
  color: #cbd5e1;
  border-color: rgba(148, 163, 184, 0.35);
}

/* Compose Email Box */
.composer-box {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-sm);
}

.composer-body {
  padding: 1.75rem;
}

.composer-field-label {
  width: 75px;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Attachments Dropzone */
.dropzone-box {
  border: 2px dashed rgba(148, 163, 184, 0.4);
  border-radius: 12px;
  padding: 1.5rem;
  text-align: center;
  background-color: var(--primary-subtle);
  cursor: pointer;
  transition: all var(--transition-speed);
}

.dropzone-box:hover, .dropzone-box.dragover {
  border-color: var(--primary-color);
  background-color: rgba(59, 130, 246, 0.12);
  transform: scale(1.005);
}

/* Responsive Resolution & Mobile Drawers */
@media (max-width: 991.98px) {
  .app-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: -260px;
    box-shadow: var(--shadow-lg);
  }
  .app-sidebar.show {
    left: 0;
  }
  .sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1030;
  }
  .sidebar-backdrop.show {
    display: block;
  }
  .content-body {
    padding: 1.25rem 1rem;
  }
  .app-navbar {
    padding: 0 1rem;
  }
}
