/* ─────────────────────────────────────────────
   MZ Unlimited Deployer — Main Stylesheet
   ───────────────────────────────────────────── */

:root {
  --accent:        #f97316;
  --accent-hover:  #ea580c;
  --navy:          #0f172a;
  --navy-mid:      #1e293b;
  --muted:         #94a3b8;
  --border:        #e2e8f0;
  --radius:        0.75rem;
  --radius-sm:     0.45rem;
}

/* ── Base ── */
body {
  font-family: "Space Grotesk", sans-serif;
  background: radial-gradient(circle at 18% 0%, #1e293b 0%, #0f172a 45%, #020617 100%);
  min-height: 100vh;
  color: #1e293b;
}

/* ─────────────────────────────────────────────
   NAVBAR
   ───────────────────────────────────────────── */
.nav-glass {
  background: linear-gradient(120deg, rgba(15,23,42,.96), rgba(30,64,175,.88));
  border-bottom: 1px solid rgba(255,255,255,.10);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.navbar-brand {
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -.01em;
}

.nav-glass .nav-link {
  font-size: .875rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  padding: .4rem .75rem;
  transition: background .15s, color .15s;
}

.nav-glass .nav-link:hover  { background: rgba(255,255,255,.08); }
.nav-glass .nav-link.active { background: rgba(255,255,255,.14); color: #fff !important; }

/* User menu button */
.btn-user-menu {
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.18);
  color: #fff;
  font-size: .875rem;
  font-weight: 500;
  border-radius: 99px;
  padding: .3rem .85rem .3rem .5rem;
  transition: background .15s;
}
.btn-user-menu:hover,
.btn-user-menu:focus { background: rgba(255,255,255,.18); color: #fff; }

/* Avatar circle */
.avatar-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: .75rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* Dropdown */
.dropdown-menu {
  border-radius: var(--radius);
  font-size: .875rem;
  padding: .5rem;
  min-width: 200px;
}
.dropdown-item {
  border-radius: var(--radius-sm);
  transition: background .12s;
}
.dropdown-header {
  padding: .5rem .75rem;
}

/* ─────────────────────────────────────────────
   BREADCRUMB
   ───────────────────────────────────────────── */
.breadcrumb {
  font-size: .8rem;
  background: transparent;
  padding: 0;
  margin-bottom: 1.25rem;
}
.breadcrumb-item a {
  color: var(--muted);
  text-decoration: none;
}
.breadcrumb-item a:hover { color: var(--accent); }
.breadcrumb-item.active { color: #475569; }
.breadcrumb-item + .breadcrumb-item::before { color: var(--muted); }

/* ─────────────────────────────────────────────
   CARDS
   ───────────────────────────────────────────── */
.card {
  border-radius: var(--radius);
  border-color: var(--border);
}
.card-header.bg-white {
  border-bottom: 1px solid var(--border);
  padding: .85rem 1.1rem;
  font-size: .875rem;
}
.card-body { padding: 1.1rem; }

/* Stat cards */
.stat-card {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #fff;
  transition: transform .15s ease, box-shadow .15s ease;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,.08) !important;
}
.stat-label {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: .35rem;
}
.stat-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
}

/* ─────────────────────────────────────────────
   TABLES
   ───────────────────────────────────────────── */
.table th {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom-width: 1px;
  padding: .65rem 1rem;
  white-space: nowrap;
}
.table td {
  font-size: .875rem;
  vertical-align: middle;
  padding: .65rem 1rem;
}
.table-hover tbody tr { transition: background .1s; }
.table-hover tbody tr:hover { background-color: #f8fafc; }

/* ─────────────────────────────────────────────
   STATUS BADGES
   ───────────────────────────────────────────── */
.badge {
  font-weight: 600;
  letter-spacing: .03em;
}

.badge-success {
  background: #dcfce7; color: #15803d;
  font-size: .7rem; padding: .3em .7em; border-radius: 99px;
}
.badge-failed {
  background: #fee2e2; color: #b91c1c;
  font-size: .7rem; padding: .3em .7em; border-radius: 99px;
}
.badge-pending {
  background: #f1f5f9; color: #475569;
  font-size: .7rem; padding: .3em .7em; border-radius: 99px;
}
.badge-running {
  background: #fef9c3; color: #92400e;
  font-size: .7rem; padding: .3em .7em; border-radius: 99px;
  display: inline-flex; align-items: center; gap: 5px;
}
.badge-running::before {
  content: "";
  display: inline-block;
  width: 6px; height: 6px;
  background: #f59e0b;
  border-radius: 50%;
  animation: pulse-dot 1.2s ease-in-out infinite;
}

/* Health badges */
.badge-health-up      { background:#dcfce7; color:#15803d; font-size:.7rem; padding:.3em .7em; border-radius:99px; font-weight:600; }
.badge-health-down    { background:#fee2e2; color:#b91c1c; font-size:.7rem; padding:.3em .7em; border-radius:99px; font-weight:600; animation: glow-danger 2s ease-in-out infinite; }
.badge-health-unknown { background:#f1f5f9; color:#64748b; font-size:.7rem; padding:.3em .7em; border-radius:99px; font-weight:600; }

/* Alert level badges */
.badge-level-down      { background:#fee2e2; color:#b91c1c; font-size:.7rem; padding:.3em .7em; border-radius:99px; font-weight:600; }
.badge-level-recovered { background:#dcfce7; color:#15803d; font-size:.7rem; padding:.3em .7em; border-radius:99px; font-weight:600; }
.badge-level-info      { background:#dbeafe; color:#1d4ed8; font-size:.7rem; padding:.3em .7em; border-radius:99px; font-weight:600; }

@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
.spin { animation: spin 1s linear infinite; display: inline-block; }

@keyframes pulse-dot {
  0%, 100% { opacity:1;  transform:scale(1); }
  50%       { opacity:.4; transform:scale(.75); }
}
@keyframes glow-danger {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0); }
  50%       { box-shadow: 0 0 0 4px rgba(239,68,68,.15); }
}

/* ─────────────────────────────────────────────
   RUNNING INDICATOR
   ───────────────────────────────────────────── */
.running-indicator {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  color: #92400e;
  font-weight: 600;
  font-size: .82rem;
  background: #fef9c3;
  padding: .3rem .75rem;
  border-radius: 99px;
}
.running-indicator .dot {
  width: 7px; height: 7px;
  background: #f59e0b;
  border-radius: 50%;
  animation: pulse-dot 1.2s ease-in-out infinite;
}

/* ─────────────────────────────────────────────
   BUTTONS
   ───────────────────────────────────────────── */
.btn-primary {
  background-color: var(--accent);
  border-color: var(--accent);
}
.btn-primary:hover,
.btn-primary:focus {
  background-color: var(--accent-hover);
  border-color: var(--accent-hover);
}

/* ─────────────────────────────────────────────
   FORMS
   ───────────────────────────────────────────── */
.form-control:focus,
.form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 .2rem rgba(249,115,22,.15);
}
.form-label { font-weight: 500; font-size: .875rem; }

/* ─────────────────────────────────────────────
   LOG BLOCK
   ───────────────────────────────────────────── */
.logs-block {
  white-space: pre-wrap;
  font-size: .8rem;
  line-height: 1.6;
  max-height: 72vh;
  overflow: auto;
  background: #0d1117;
  color: #e6edf3;
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 1.1rem 1.25rem;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

/* ─────────────────────────────────────────────
   HERO CARD (landing)
   ───────────────────────────────────────────── */
.hero-card {
  background: linear-gradient(135deg, rgba(30,64,175,.85), rgba(15,23,42,.95));
  border-radius: 1.25rem;
  color: #f8fafc;
  box-shadow: 0 24px 70px rgba(2,6,23,.4);
}

.eyebrow {
  letter-spacing: .18em;
  text-transform: uppercase;
  color: #fdba74;
  font-size: .75rem;
  font-weight: 700;
}

.feature-card {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: .9rem;
  padding: 1.1rem 1.2rem;
  transition: background .2s, transform .2s;
}
.feature-card:hover {
  background: rgba(255,255,255,.10);
  transform: translateY(-2px);
}
.feature-icon {
  width: 40px; height: 40px;
  background: rgba(249,115,22,.18);
  border-radius: .6rem;
  display: flex; align-items: center; justify-content: center;
  color: #fdba74;
  font-size: 1.1rem;
  margin-bottom: .75rem;
}
.feature-title { font-weight: 700; margin-bottom: .3rem; font-size: .95rem; }
.feature-text  { color: rgba(241,245,249,.75); font-size: .85rem; line-height: 1.5; }

/* ─────────────────────────────────────────────
   LOGIN PAGE
   ───────────────────────────────────────────── */
.login-wrap {
  min-height: calc(100vh - 200px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(2,6,23,.25);
  overflow: hidden;
}

.login-card-header {
  background: linear-gradient(135deg, var(--navy), #1e3a8a);
  padding: 2rem 2rem 1.5rem;
  text-align: center;
}

/* ─────────────────────────────────────────────
   FOOTER
   ───────────────────────────────────────────── */
.site-footer {
  background: rgba(15,23,42,.96);
  border-top: 1px solid rgba(255,255,255,.08);
  padding: 2rem 0 1.5rem;
  margin-top: auto;
}

.footer-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1.5rem;
}

@media (max-width: 767px) {
  .footer-inner {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .footer-links { justify-content: center; }
  .footer-copy  { text-align: center; }
}

.footer-brand span { color: #f8fafc; font-size: .9rem; }
.footer-tagline { color: var(--muted); font-size: .75rem; margin: 0; }

.footer-links {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.footer-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: .82rem;
  font-weight: 500;
  transition: color .15s;
}
.footer-links a:hover { color: #f8fafc; }

.footer-copy {
  text-align: right;
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.6;
}
.footer-disclaimer {
  font-size: .72rem;
  opacity: .65;
}

/* ─────────────────────────────────────────────
   DASHBOARD STAT CARDS
   ───────────────────────────────────────────── */
.kpi-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.4rem;
  display: flex;
  align-items: center;
  gap: 1.1rem;
  transition: transform .15s, box-shadow .15s;
  position: relative;
  overflow: hidden;
}
.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(0,0,0,.09);
}
.kpi-card::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  border-radius: var(--radius) 0 0 var(--radius);
  background: var(--kpi-color, var(--accent));
}
.kpi-icon {
  width: 46px; height: 46px;
  border-radius: .65rem;
  background: var(--kpi-bg, #fff7ed);
  color: var(--kpi-color, var(--accent));
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.kpi-label {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: .2rem;
}
.kpi-value {
  font-size: 1.85rem;
  font-weight: 700;
  line-height: 1;
  color: #0f172a;
}
.kpi-value.kpi-success { color: #15803d; }
.kpi-value.kpi-danger  { color: #b91c1c; }

/* ─────────────────────────────────────────────
   DASHBOARD FEED (deployments / alerts)
   ───────────────────────────────────────────── */
.feed-list {
  list-style: none;
  margin: 0; padding: 0;
}
.feed-item {
  display: flex;
  align-items: center;
  gap: .85rem;
  padding: .8rem 1.1rem;
  border-bottom: 1px solid #f1f5f9;
  transition: background .1s;
}
.feed-item:last-child { border-bottom: none; }
.feed-item:hover { background: #f8fafc; }

.feed-icon {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem;
  flex-shrink: 0;
}
.feed-icon-success  { background: #dcfce7; color: #15803d; }
.feed-icon-failed   { background: #fee2e2; color: #b91c1c; }
.feed-icon-running  { background: #fef9c3; color: #92400e; }
.feed-icon-pending  { background: #f1f5f9; color: #64748b; }
.feed-icon-down     { background: #fee2e2; color: #b91c1c; }
.feed-icon-recovered{ background: #dcfce7; color: #15803d; }

.feed-body { flex: 1; min-width: 0; }
.feed-title {
  font-size: .875rem;
  font-weight: 600;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.feed-subtitle {
  font-size: .75rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.feed-meta {
  font-size: .72rem;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.feed-empty {
  padding: 2.5rem 1rem;
  text-align: center;
  color: var(--muted);
  font-size: .875rem;
}
.feed-empty i { font-size: 1.8rem; display: block; margin-bottom: .5rem; opacity: .4; }

/* ─────────────────────────────────────────────
   APP CARDS (list view)
   ───────────────────────────────────────────── */
.app-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform .15s, box-shadow .15s;
  display: flex;
  flex-direction: column;
  height: 100%;
}
.app-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 32px rgba(0,0,0,.10);
}
.app-card-header {
  padding: 1rem 1.1rem .7rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .5rem;
}
.app-card-body {
  padding: 0 1.1rem .9rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: .45rem;
}
.app-card-footer {
  padding: .75rem 1.1rem;
  border-top: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  background: #fafafa;
}
.app-card-name {
  font-weight: 700;
  font-size: .95rem;
  color: #0f172a;
  text-decoration: none;
  line-height: 1.3;
}
.app-card-name:hover { color: var(--accent); }
.app-card-domain {
  font-size: .78rem;
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, monospace;
}
.app-card-row {
  display: flex;
  align-items: center;
  gap: .45rem;
  font-size: .78rem;
  color: #475569;
}
.app-card-row i { color: var(--muted); font-size: .8rem; width: 14px; text-align: center; }

/* Health stripe on left */
.app-card-stripe {
  width: 4px;
  flex-shrink: 0;
  align-self: stretch;
}
.app-card-stripe-up      { background: #22c55e; }
.app-card-stripe-down    { background: #ef4444; }
.app-card-stripe-unknown { background: #cbd5e1; }

.app-card-inner {
  display: flex;
  flex: 1;
  flex-direction: column;
}

/* ─────────────────────────────────────────────
   SESSION TIMEOUT MODAL
   ───────────────────────────────────────────── */
#sessionModal .modal-content {
  border-radius: var(--radius);
}
#sessionCountdown {
  font-variant-numeric: tabular-nums;
  font-size: 2.4rem !important;
}

/* ─────────────────────────────────────────────
   MISC UTILITIES
   ───────────────────────────────────────────── */
.text-muted-xs { font-size: .78rem; color: var(--muted); }
.font-monospace { font-family: "SFMono-Regular", Consolas, monospace; }

/* Page header divider */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}
.page-header h1 { font-size: 1.5rem; font-weight: 700; margin: 0; }
.page-header .subtitle { color: #64748b; font-size: .875rem; margin: .25rem 0 0; }
