/* ==============================================================================
   Network-Pro MailSync · Design System
   Sleek Dark Theme aligned with Network-Pro Ecosystem
   ============================================================================== */

:root {
  color-scheme: dark;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Code", "Fira Code", Consolas, monospace;

  /* Surfaces & Canvas */
  --bg: #0b1120;
  --bg-muted: #0e1628;
  --surface: #111a2e;
  --surface-2: #1a2438;
  --surface-3: #243049;

  /* Borders */
  --border: rgba(148, 163, 184, 0.16);
  --border-strong: rgba(148, 163, 184, 0.3);

  /* Typography */
  --text: #e5eaf2;
  --text-muted: #a3b1c6;
  --text-subtle: #8595ad;

  /* MailSync Sky Blue Accent */
  --accent: #38bdf8;
  --accent-hover: #0ea5e9;
  --accent-soft: rgba(56, 189, 248, 0.12);
  --accent-line: rgba(56, 189, 248, 0.35);
  --accent-glow: 0 0 24px -4px rgba(56, 189, 248, 0.35);

  /* Semantic Alerts */
  --success: #34d399;
  --success-soft: rgba(52, 211, 153, 0.15);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.15);
  --warning: #fbbf24;
  --warning-soft: rgba(251, 191, 36, 0.15);

  /* Elevation */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 10px 30px -14px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 20px 40px -15px rgba(0, 0, 0, 0.7);

  /* Geometry */
  --radius-sm: 6px;
  --radius: 12px;
  --radius-lg: 18px;
}

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

html, body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* Subtle background radial glow */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 1000px;
  height: 400px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.08) 0%, rgba(11, 17, 32, 0) 70%);
  pointer-events: none;
  z-index: 0;
}

/* -----------------------------------------------------------------------------
   Navigation Header
   ----------------------------------------------------------------------------- */
header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(17, 26, 46, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  box-shadow: var(--shadow-sm);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text);
}

.logo-badge {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #0284c7 0%, #38bdf8 100%);
  color: #0b1120;
  font-weight: 800;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 12px -2px rgba(56, 189, 248, 0.4);
}

.brand h1 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #ffffff;
}

.user-status {
  display: flex;
  align-items: center;
  gap: 12px;
}

.badge-email {
  background: var(--surface-2);
  color: var(--accent);
  border: 1px solid var(--border);
  padding: 4px 12px;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 500;
}

.badge-admin {
  background: rgba(251, 191, 36, 0.15);
  color: var(--warning);
  border: 1px solid rgba(251, 191, 36, 0.3);
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  margin-left: 6px;
}

/* -----------------------------------------------------------------------------
   Layout & Container
   ----------------------------------------------------------------------------- */
#app-container {
  max-width: 1200px;
  margin: 28px auto 60px auto;
  padding: 0 20px;
  position: relative;
  z-index: 1;
}

/* Centered Authentication Card */
.auth-wrapper {
  min-height: calc(100vh - 140px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  box-shadow: var(--shadow-lg);
  text-align: center;
  position: relative;
}

.auth-card .logo-badge {
  width: 52px;
  height: 52px;
  font-size: 26px;
  margin: 0 auto 18px auto;
}

.auth-card h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
  color: #ffffff;
}

.auth-card p {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 24px;
}

/* -----------------------------------------------------------------------------
   Tabs Navigation
   ----------------------------------------------------------------------------- */
.tabs-nav {
  display: flex;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px;
  margin-bottom: 24px;
  overflow-x: auto;
}

.tab-btn {
  background: transparent;
  color: var(--text-muted);
  border: 0;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s ease;
}

.tab-btn:hover {
  color: var(--text);
  background: var(--surface-2);
}

.tab-btn.active {
  color: #0b1120;
  background: var(--accent);
  font-weight: 600;
  box-shadow: var(--accent-glow);
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

/* -----------------------------------------------------------------------------
   Cards & Surfaces
   ----------------------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

.card-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #ffffff;
  margin-bottom: 4px;
}

.card-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
  line-height: 1.5;
}

/* -----------------------------------------------------------------------------
   Form Controls
   ----------------------------------------------------------------------------- */
.form-group {
  margin-bottom: 18px;
  text-align: left;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-row {
  display: flex;
  gap: 12px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  padding: 10px 14px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

input::placeholder, textarea::placeholder {
  color: var(--text-subtle);
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* -----------------------------------------------------------------------------
   Buttons
   ----------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--accent);
  color: #0b1120;
  border-color: var(--accent);
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: var(--accent-glow);
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--surface-3);
  border-color: var(--border-strong);
}

.btn-microsoft {
  background: #1e293b;
  color: #ffffff;
  border: 1px solid #334155;
}

.btn-microsoft:hover {
  background: #334155;
}

/* -----------------------------------------------------------------------------
   Two-Column Account Layout
   ----------------------------------------------------------------------------- */
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

@media (max-width: 840px) {
  .form-grid-2 {
    grid-template-columns: 1fr;
  }
}

.account-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.account-box h3 {
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* -----------------------------------------------------------------------------
   Stats Tiles
   ----------------------------------------------------------------------------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.stat-tile {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}

.stat-val {
  font-size: 28px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.02em;
  margin-bottom: 4px;
  font-family: var(--mono);
}

.stat-label {
  font-size: 13px;
  color: var(--text-muted);
}

/* -----------------------------------------------------------------------------
   Job Cards & Metrics
   ----------------------------------------------------------------------------- */
.job-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
}

.job-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.job-title {
  font-weight: 700;
  font-size: 15px;
  color: #ffffff;
}

.status-badge {
  padding: 3px 10px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.status-running {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(56, 189, 248, 0.4);
}

.status-completed {
  background: var(--success-soft);
  color: var(--success);
  border: 1px solid rgba(52, 211, 153, 0.4);
}

.status-failed {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid rgba(248, 113, 113, 0.4);
}

.status-queued {
  background: var(--warning-soft);
  color: var(--warning);
  border: 1px solid rgba(251, 191, 36, 0.4);
}

.progress-bar-container {
  width: 100%;
  height: 8px;
  background: var(--surface-3);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 10px;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #0284c7 0%, #38bdf8 100%);
  width: 0%;
  transition: width 0.3s ease;
}

.job-metrics {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-muted);
}

/* -----------------------------------------------------------------------------
   Toast Notifications
   ----------------------------------------------------------------------------- */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--surface-3);
  color: #ffffff;
  border: 1px solid var(--border-strong);
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.2s ease forwards;
}

.toast-error {
  background: #7f1d1d;
  border-color: #dc2626;
  color: #fecaca;
}

.toast-success {
  background: #14532d;
  border-color: #16a34a;
  color: #bbf7d0;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
