/* IDP - Chaos Engineering | styles.css */

:root {
  --bs-primary: #1e30f3;
  --bs-secondary: #e21e80;
  --bs-success: #198754;
  --bs-info: #0dcaf0;
  --bs-warning: #ffc107;
  --bs-danger: #dc3545;
  --bs-light: #f8f9fa;
  --bs-dark: #212529;
}

/* ---- Gradient utilities (login page) ---- */
.bg-gradient-primary-to-secondary {
  background: linear-gradient(45deg, var(--bs-primary) 0%, var(--bs-secondary) 100%);
}

.text-gradient {
  background: linear-gradient(45deg, var(--bs-primary) 0%, var(--bs-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ---- Card ---- */
.card {
  transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

/* ---- Form focus ---- */
.form-control:focus,
.form-select:focus {
  border-color: var(--bs-primary);
  box-shadow: 0 0 0 0.2rem rgba(30, 48, 243, 0.25);
}

/* ---- Buttons ---- */
.btn {
  transition: all 0.2s ease-in-out;
}

.btn-primary {
  background: linear-gradient(45deg, var(--bs-primary) 0%, #1826c2 100%);
  border: none;
}

.btn-primary:hover {
  background: linear-gradient(45deg, #1826c2 0%, var(--bs-primary) 100%);
}

/* ---- Alerts ---- */
.alert {
  border: none;
  border-radius: 0.5rem;
}

.alert-danger {
  background: linear-gradient(45deg, #f8d7da 0%, #f5c2c7 100%);
  color: #842029;
}

/* ---- Fade animation ---- */
.fade-in {
  animation: fadeIn 0.5s ease-in-out;
}

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

/* ---- Custom scrollbar ---- */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #f1f1f1; border-radius: 4px; }
::-webkit-scrollbar-thumb { background: var(--bs-primary); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #1826c2; }

/* ---- Sidebar brand: left-aligned, smaller text, larger icon ---- */
.sidebar .sidebar-brand {
  justify-content: flex-start !important;
  text-align: left;
  padding-left: 1rem;
}
.sidebar .sidebar-brand .sidebar-brand-text {
  font-size: 0.75rem; /* 25% smaller than 1rem */
}
.sidebar .sidebar-brand .sidebar-brand-icon i {
  font-size: 2.5rem; /* 25% larger than 2rem */
}
@media (min-width: 768px) {
  .sidebar .sidebar-brand .sidebar-brand-icon i {
    font-size: 2.5rem;
  }
}
.sidebar.toggled .sidebar-brand .sidebar-brand-icon i {
  font-size: 2.5rem;
}

/* Sidebar version block - bottom left */
#accordionSidebar {
  display: flex;
  flex-direction: column;
}
.sidebar-version {
  margin-top: auto;
  padding-bottom: 1rem;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.8);
}
.sidebar-version a {
  color: rgba(255, 255, 255, 0.8);
}
.sidebar-version a:hover {
  color: #fff !important;
  text-decoration: underline;
}
.sidebar.toggled .sidebar-version {
  display: none !important;
}

/* ---- SB Admin 2 overrides ---- */
.bg-gradient-primary {
  background: linear-gradient(180deg, #225fa1 10%, #1a4a7d 100%) !important;
}

/* Running Containers card - custom blue #225fa1 */
.card.border-left-primary {
  border-left-color: #225fa1 !important;
}

.card.border-left-primary .text-primary {
  color: #225fa1 !important;
}

#btn-rescan {
  background: #225fa1 !important;
  border-color: #225fa1 !important;
}

#btn-rescan:hover {
  background: #1a4a7d !important;
  border-color: #1a4a7d !important;
}

/* Topbar env badge */
#envDisplayTopbar {
  font-size: 0.8rem;
}

/* Scenario rows in dashboard */
.scenario-row {
  background: #f8f9fa;
}

/* Stop All button large version (hidden by default, shown via JS) */
#btn-stop-all {
  letter-spacing: 0.05em;
}

/* Stat card buttons - consistent size, no text wrap */
.stat-card-btn {
  white-space: nowrap;
  min-width: 9.5rem;
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
}

/* Chaos command dropdown - less rounded */
.chaos-command-select,
.chaos-command-select.form-control {
  border-radius: 0.2rem;
}

/* ---- Users page: fixed sidebar; only #content-wrapper scrolls (tablet/desktop) ----
   Lock document scroll (body position:fixed); SB Admin flex + min-height chain otherwise
   still scrolls the window. */
@media (min-width: 768px) {
  html.users-scroll-layout {
    height: 100%;
    min-height: 100vh;
    overflow: hidden;
  }

  html.users-scroll-layout body.users-scroll-layout {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    max-height: 100%;
    margin: 0;
    overflow: hidden !important;
    overscroll-behavior: none;
  }

  body.users-scroll-layout #wrapper {
    display: block;
    position: relative;
    height: 100%;
    min-height: 0;
    max-height: 100%;
    overflow: hidden;
  }

  /* Sidebar pinned to viewport; scroll inside sidebar only if nav is taller than screen */
  body.users-scroll-layout #accordionSidebar.sidebar {
    position: fixed !important;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1020;
    width: 14rem !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }

  body.users-scroll-layout #accordionSidebar.sidebar.toggled {
    width: 6.5rem !important;
    overflow: visible !important;
  }

  /* Main column: offset for fixed sidebar; this element is the scroll container */
  body.users-scroll-layout #content-wrapper {
    margin-left: 14rem !important;
    width: calc(100% - 14rem) !important;
    max-width: none !important;
    min-height: 0 !important;
    height: 100% !important;
    max-height: 100% !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    overscroll-behavior: contain;
  }

  /* Flex child: allow #content-wrapper to shrink so overflow-y applies (SB Admin uses flex: 1 0 auto). */
  body.users-scroll-layout #wrapper #content-wrapper #content {
    flex: 1 1 auto !important;
    min-height: 0 !important;
  }

  body.users-scroll-layout #accordionSidebar.sidebar.toggled ~ #content-wrapper {
    margin-left: 6.5rem !important;
    width: calc(100% - 6.5rem) !important;
  }
}
