/* ============================================================
   Confinality MIG Scheduling Dashboard — Main Stylesheet
   Brand palette: deep black-brown · copper/amber accent
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* Brand colours */
  --color-sidebar:     #0f0d0c;
  --color-sidebar-alt: #1a1410;
  --color-accent:      #c07a3a;
  --color-accent-hover:#a8622e;
  --color-accent-dim:  rgba(192, 122, 58, 0.15);
  --color-success:     #2ec4b6;
  --color-danger:      #e63946;
  --color-bg:          #f9f7f5;
  --color-border:      #e8e2dc;
  --color-text:        #1c1915;
  --color-muted:       #7a6e66;

  /* Layout */
  --sidebar-width: 248px;
  --radius-lg: 0.875rem;
  --radius-md: 0.5rem;

  /* Glow used on sidebar hover & active items */
  --glow-amber: 0 0 12px rgba(192, 122, 58, 0.35);
}

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

body {
  background: var(--color-bg);
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  color: var(--color-text);
  margin: 0;
  overflow-x: hidden;
  line-height: 1.6;
}

/* ════════════════════════════════
   SIDEBAR
════════════════════════════════ */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--color-sidebar);
  color: #e2d8cc;
  z-index: 1000;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* Brand / logo area */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 1.25rem 1.25rem 1rem;
  background: var(--color-sidebar-alt);
  border-bottom: 1px solid rgba(192,122,58,0.18);
  text-decoration: none;
  flex-shrink: 0;
}

.sidebar-logo-mark {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

.sidebar-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.sidebar-brand-name {
  font-size: 1rem;
  font-weight: 700;
  color: #f0e8dc;
  letter-spacing: 0.02em;
}

.sidebar-brand-sub {
  font-size: 0.65rem;
  color: #8a7a6a;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 1px;
}

/* Nav links */
.sidebar-nav {
  padding: 1rem 0.75rem;
  flex-grow: 1;
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-md);
  color: #9a8a7a;
  font-size: 0.875rem;
  text-decoration: none;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
  margin-bottom: 2px;
  font-weight: 500;
}

.sidebar-nav .nav-link:hover {
  background: rgba(192,122,58,0.12);
  color: #f0e0cc;
}

.sidebar-nav .nav-link.active {
  background: rgba(192,122,58,0.2);
  color: #e8a86a;
  border-left: 3px solid var(--color-accent);
  padding-left: calc(0.75rem - 3px);
  box-shadow: var(--glow-amber);
}

.nav-section-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #4a3e34;
  padding: 0.85rem 0.75rem 0.3rem;
  font-weight: 600;
}

/* Footer / user info */
.sidebar-footer {
  padding: 1rem 1rem;
  border-top: 1px solid rgba(192,122,58,0.12);
  flex-shrink: 0;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}

.user-info i {
  color: var(--color-accent);
  font-size: 1.2rem;
  flex-shrink: 0;
}

.user-email {
  font-size: 0.75rem;
  color: #b0a090;
  word-break: break-all;
  line-height: 1.3;
}

/* Sidebar logout button */
.sidebar-footer .btn-outline-light {
  border-color: rgba(192,122,58,0.35);
  color: #c8b8a8;
  font-size: 0.82rem;
}
.sidebar-footer .btn-outline-light:hover {
  background: rgba(192,122,58,0.2);
  border-color: var(--color-accent);
  color: #f0d8b8;
}

/* ════════════════════════════════
   MAIN CONTENT
════════════════════════════════ */
.main-content {
  margin-left: var(--sidebar-width);
  padding: 1.75rem 2rem;
  min-height: 100vh;
}

@media (max-width: 768px) {
  .sidebar { width: 100%; height: auto; position: relative; }
  .main-content { margin-left: 0; padding: 1rem; }
}

/* ── Page header ── */
.page-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--color-border);
}

.page-header h4 .text-primary { color: var(--color-accent) !important; }

/* ════════════════════════════════
   STAT CARDS
════════════════════════════════ */
.stat-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05), 0 0 0 1px var(--color-border);
  height: 100%;
  transition: box-shadow 0.2s;
}
.stat-card:hover {
  box-shadow: 0 4px 16px rgba(192,122,58,0.1), 0 0 0 1px var(--color-border);
}

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

/* Override Bootstrap bg-opacity icon colours to copper tones */
.stat-icon.bg-primary.bg-opacity-10 { background: rgba(192,122,58,0.12) !important; }
.stat-icon.text-primary             { color: var(--color-accent) !important; }

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--color-text);
}

.stat-label {
  font-size: 0.72rem;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 2px;
}

/* ════════════════════════════════
   CARDS
════════════════════════════════ */
.card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: #fff;
}

.card-header {
  background: #fff;
  border-bottom: 1px solid var(--color-border);
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
}

/* ════════════════════════════════
   TABLES
════════════════════════════════ */
.table th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-muted);
  font-weight: 600;
  white-space: nowrap;
}

.table td { vertical-align: middle; }

.table-hover > tbody > tr:hover > td {
  background: rgba(192,122,58,0.04);
}

/* ════════════════════════════════
   LINES INPUT
════════════════════════════════ */
.lines-input {
  border-color: #ddd5ca;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.lines-input:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(192,122,58,0.18);
  outline: none;
}

.lines-input.changed {
  border-color: #d07030;
  background: #fffaf5;
}

/* ── Min instances display ── */
.min-instances-display { color: var(--color-accent) !important; }

/* ════════════════════════════════
   BUTTONS
════════════════════════════════ */
.btn-primary {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #fff;
  font-weight: 500;
}
.btn-primary:hover, .btn-primary:focus {
  background: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
  color: #fff;
}
.btn-primary:focus { box-shadow: 0 0 0 3px rgba(192,122,58,0.3); }

.btn-outline-primary {
  color: var(--color-accent);
  border-color: var(--color-accent);
}
.btn-outline-primary:hover {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #fff;
}

/* ════════════════════════════════
   BADGES
════════════════════════════════ */
.badge { font-weight: 500; letter-spacing: 0.02em; }

/* Sync status colours */
.badge.bg-success { background: #1a7a4a !important; }
.badge.bg-warning { background: #b86b10 !important; }

/* MIG type badges */
.badge.bg-primary { background: var(--color-accent) !important; }

/* ════════════════════════════════
   LOGIN PAGE
════════════════════════════════ */

/* Pull the login wrapper edge-to-edge, cancelling main-content padding */
.login-wrapper {
  position: relative;
  margin: -1.75rem -2rem;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 20% 85%, rgba(192, 100, 20, 0.5)  0%, transparent 55%),
    radial-gradient(ellipse at 75% 15%, rgba(120,  60, 10, 0.25) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba( 60,  30,  5, 0.15) 0%, transparent 70%),
    #080706;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  overflow: hidden;
}

/* ── Large background orbital sphere ── */
.login-orb-bg {
  position: absolute;
  right: -120px;
  bottom: -140px;
  width: 620px;
  height: 620px;
  pointer-events: none;
  opacity: 0.22;
  animation: orb-spin 60s linear infinite;
}
.login-orb-svg {
  width: 100%;
  height: 100%;
}

/* Second, smaller ghost orb top-left */
.login-orb-bg::after {
  content: '';
  position: absolute;
  top: -300px;
  left: -420px;
  width: 380px;
  height: 380px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(192,122,58,0.12) 0%, transparent 70%);
}

@keyframes orb-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ── Login card — no white borders anywhere ── */
.login-card {
  position: relative;
  z-index: 1;
  background: rgba(14, 11, 8, 0.88);
  border: 1px solid rgba(192, 122, 58, 0.2);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  width: 100%;
  max-width: 420px;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.65),
    0 32px 80px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

.login-header {
  padding: 2.5rem 2rem 1.5rem;
  text-align: center;
  border-bottom: 1px solid rgba(192, 122, 58, 0.1);
  background: rgba(192, 122, 58, 0.03);
}

.login-logo-mark {
  width: 56px;
  height: 56px;
  margin: 0 auto 1rem;
  filter: drop-shadow(0 0 10px rgba(192, 122, 58, 0.5));
}

.login-title {
  color: #f0e8dc;
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 4px;
  letter-spacing: 0.01em;
}

.login-sub {
  color: #5a504a;
  font-size: 0.82rem;
}

.login-body {
  padding: 1.75rem 2rem 2rem;
}

.login-body .form-label {
  color: #9a8a7a;
  font-size: 0.82rem;
  font-weight: 500;
  margin-bottom: 0.35rem;
}

/* ── Kill Bootstrap's light borders on every input/button in login ── */
.login-body .form-control {
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid rgba(192, 122, 58, 0.22) !important;
  color: #f0e8dc !important;
  border-radius: var(--radius-md);
}
.login-body .form-control::placeholder { color: #3a3028 !important; }
.login-body .form-control:focus {
  background: rgba(255, 255, 255, 0.07) !important;
  border-color: var(--color-accent) !important;
  box-shadow: 0 0 0 3px rgba(192, 122, 58, 0.2) !important;
  color: #f0e8dc !important;
}

/* Input group: remove the seam between input and eye button */
.login-body .input-group .form-control {
  border-right: none !important;
}
.login-body .input-group .btn-outline-secondary {
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid rgba(192, 122, 58, 0.22) !important;
  border-left: none !important;
  color: #7a6a5a !important;
  border-radius: 0 var(--radius-md) var(--radius-md) 0 !important;
}
.login-body .input-group .btn-outline-secondary:hover {
  background: rgba(192, 122, 58, 0.12) !important;
  color: #c8a880 !important;
}
/* Remove Bootstrap's focus outline on input-group button */
.login-body .input-group .btn-outline-secondary:focus {
  box-shadow: none !important;
}

.login-body .form-check-input {
  background-color: rgba(255, 255, 255, 0.06) !important;
  border: 1px solid rgba(192, 122, 58, 0.3) !important;
}
.login-body .form-check-input:checked {
  background-color: var(--color-accent) !important;
  border-color: var(--color-accent) !important;
}
.login-body .form-check-label { color: #6a5e56; font-size: 0.82rem; }

.login-body .btn-primary {
  background: linear-gradient(135deg, #c07a3a 0%, #9a5818 100%) !important;
  border: none !important;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 0.65rem 1rem;
  box-shadow: 0 4px 20px rgba(192, 122, 58, 0.35);
  transition: box-shadow 0.2s, background 0.2s;
}
.login-body .btn-primary:hover {
  background: linear-gradient(135deg, #d08848 0%, #aa6828 100%) !important;
  box-shadow: 0 4px 28px rgba(192, 122, 58, 0.55);
}

/* ════════════════════════════════
   SPINNER
════════════════════════════════ */
.btn .spinner-border-sm {
  width: 0.85em;
  height: 0.85em;
  border-width: 0.15em;
}

/* ════════════════════════════════
   MISC OVERRIDES
════════════════════════════════ */
a { color: var(--color-accent); }
a:hover { color: var(--color-accent-hover); }

.text-primary { color: var(--color-accent) !important; }
.border-primary { border-color: var(--color-accent) !important; }
.bg-primary { background: var(--color-accent) !important; }

/* Alert info uses amber tones */
.alert-info {
  background: rgba(192,122,58,0.1);
  border-color: rgba(192,122,58,0.3);
  color: #7a4a18;
}

/* Pagination */
.page-link { color: var(--color-accent); }
.page-link:hover { color: var(--color-accent-hover); }
.page-item.active .page-link {
  background: var(--color-accent);
  border-color: var(--color-accent);
}

/* Toasts – keep standard Bootstrap colours */
.toast-container { z-index: 9999; }
