/* ==================== BASE & LAYOUT ==================== */

:root {
  --bg-color: #f4f5f7;
  --sidebar-width: 240px;
  --primary-color: #0052cc;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  background-color: var(--bg-color);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Kanban board uses its own internal scroll containers */
body.board-body {
  overflow: hidden;
}

/* ==================== SYSTEM HEALTH INDICATOR ==================== */

.system-health-indicator {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  display: inline-block;
  border: 1px solid rgba(255,255,255,0.35);
  box-shadow: 0 0 0 2px rgba(0,0,0,0.15) inset;
}

.system-health-indicator.health-ok {
  background: #22c55e;
}

.system-health-indicator.health-yellow {
  background: #facc15;
}

.system-health-indicator.health-orange {
  background: #f97316;
}

.system-health-indicator.health-bad {
  background: #ef4444;
}

.system-health-indicator.health-unknown {
  background: #9ca3af;
}

.system-health-indicator.health-loading {
  background: #f59e0b;
}

/* Match the label color to the indicator state (navbar overrides need !important) */
.system-health-label.health-ok { color: #22c55e !important; }
.system-health-label.health-yellow { color: #facc15 !important; }
.system-health-label.health-orange { color: #f97316 !important; }
.system-health-label.health-bad { color: #ef4444 !important; }
.system-health-label.health-unknown { color: #9ca3af !important; }
.system-health-label.health-loading { color: #f59e0b !important; }

/* Main content wrapper for non-board pages (enables vertical scrolling) */
#page-container {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: visible;
}

#app-container {
  display: flex;
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
}

#main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;  /* scrollable content area; board-body overrides with its own scroll */
  overflow-x: hidden;
  position: relative;
  min-width: 0;
}

/* ==================== SIDEBAR ==================== */

#sidebar {
  width: var(--sidebar-width);
  background-color: #091e42;
  color: white;
  display: flex;
  flex-direction: column;
  padding: 16px;
  overflow: hidden;
  height: 100%;
  box-sizing: border-box;
  transition: width 0.2s ease, padding 0.2s ease;
  flex-shrink: 0;
}

/* Desktop sidebar collapse */
@media (min-width: 992px) {
  body.board-body.sidebar-collapsed #sidebar {
    width: 0;
    padding: 0;
  }
}

.sidebar-collapse-btn {
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.9);
  border-radius: 10px;
  width: 36px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.2s ease;
  flex-shrink: 0;
}

.sidebar-collapse-btn:hover {
  background: rgba(255,255,255,0.14);
  border-color: rgba(255,255,255,0.28);
}

.sidebar-title-text {
  transition: opacity 0.15s ease;
  white-space: nowrap;
  overflow: hidden;
}

/* Mobile sidebar collapse (board page)
   Uses body.sidebar-open to slide the sidebar in/out and show an overlay. */
#sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 1040;
}

@media (max-width: 991.98px) {
  body.board-body #sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    height: 100vh;
    z-index: 1050;
    transform: translateX(-100%);
    transition: transform 0.18s ease;
  }

  body.board-body.sidebar-open #sidebar {
    transform: translateX(0);
  }

  body.board-body.sidebar-open #sidebar-overlay {
    display: block !important;
  }
}

.sidebar-header {
  flex-shrink: 0;
}

.sidebar-reorder-toggle {
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.9);
  border-radius: 10px;
  width: 40px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.sidebar-reorder-toggle:hover {
  background: rgba(255,255,255,0.14);
  border-color: rgba(255,255,255,0.28);
}

.sidebar-reorder-toggle.active {
  background: rgba(255,255,255,0.22);
  border-color: rgba(255,255,255,0.38);
}

#board-list {
  list-style: none;
  padding: 0;
  margin: 10px 0 0 0;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 0 1 auto;
  min-height: 0;
  max-height: calc(100vh - 220px);
}

#board-list::-webkit-scrollbar {
  width: 6px;
}

#board-list::-webkit-scrollbar-track {
  background: rgba(255,255,255,0.05);
  border-radius: 3px;
}

#board-list::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.2);
  border-radius: 3px;
}

#board-list::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.3);
}

.sidebar-footer {
  flex-shrink: 0;
  flex-grow: 0;
  padding-top: 12px;
  margin-top: auto;
  position: relative;
  z-index: 10;
}

.sidebar-separator {
  border: 0;
  border-top: 1px solid rgba(255,255,255,0.15);
  margin: 12px 0;
}

.sidebar-settings-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.85);
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.12s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 500;
  font-size: 0.95rem;
}

.sidebar-settings-btn:hover {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.35);
  color: #ffffff;
}

.sidebar-settings-btn .settings-icon {
  font-size: 1.1rem;
}

#add-board-btn {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.25);
  color: #ffffff;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.12s ease;
}

#add-board-btn:hover {
  background: rgba(255,255,255,0.18);
  border-color: rgba(255,255,255,0.4);
}

.add-board-container {
  flex-shrink: 0;
  padding: 12px 0 0 0;
  margin-top: 0;
  border-top: 1px solid rgba(255,255,255,0.15);
}

#board-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  margin-bottom: 6px;
  border: 1px solid transparent;
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease,
    box-shadow 0.12s ease;
  color: rgba(255,255,255,0.92);
}

#board-list li:hover {
  background-color: rgba(255,255,255,0.14);
  border-color: rgba(255,255,255,0.22);
  color: #ffffff;
  box-shadow: 0 0 0 1px rgba(9,30,66,0.18);
}

#board-list li.active {
  background-color: rgba(255,255,255,0.24);
  border-color: rgba(255,255,255,0.4);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 6px 14px rgba(9,30,66,0.28);
}

.board-list-link {
  flex: 1;
  text-align: left;
  background: transparent;
  border: none;
  color: #ffffff !important;
  font-weight: 600;
  padding: 4px 0;
  cursor: pointer;
  letter-spacing: 0.01em;
  text-shadow: 0 1px 2px rgba(9,30,66,0.45);
}

.board-list-link:focus-visible,
.board-menu-btn:focus-visible {
  outline: 2px solid rgba(255,255,255,0.7);
  outline-offset: 2px;
}

.board-menu-btn {
  border: none;
  background: rgba(255,255,255,0.08);
  color: white;
  border-radius: 6px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.1s;
}

.board-menu-btn:hover {
  background: rgba(255,255,255,0.24);
}

.board-color-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,0.28);
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.08);
}

.board-drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  cursor: grab;
  user-select: none;
  color: rgba(255,255,255,0.75);
  background: rgba(255,255,255,0.08);
  font-size: 0.9rem;
}

.board-drag-handle:active {
  cursor: grabbing;
}

#board-list .sortable-ghost {
  opacity: 0.5;
}

#top-bar .board-color-dot {
  border-color: rgba(0,0,0,0.18);
}

#current-board-title {
  font-size: 1.4rem;
}

#current-board-desc {
  max-width: 720px;
  white-space: pre-wrap;
}

/* Legacy sidebar-bottom-list - kept for Calendar link */
#sidebar-bottom-list {
  list-style: none;
  padding: 0;
  margin: 0;
  border-top: 1px solid rgba(255,255,255,0.1);
}

#sidebar-bottom-list li {
  padding: 10px 16px;
  cursor: pointer;
  transition: background-color 0.1s;
  color: #deebff;
}

#sidebar-bottom-list li:hover {
  background-color: rgba(255,255,255,0.1);
  color: white;
}

#sidebar-bottom-list li.active {
  background-color: rgba(255,255,255,0.2);
  color: white;
  font-weight: bold;
}

/* ==================== FORMS & BUTTONS ==================== */

.form-group {
  margin-bottom: 12px;
}

.form-group label {
  display: block;
  margin-bottom: 4px;
  font-weight: 600;
  font-size: 12px;
  color: #5e6c84;
}

.form-group input, .form-group textarea {
  width: 100%;
  padding: 8px;
  border: 1px solid #dfe1e6;
  border-radius: 3px;
  box-sizing: border-box;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

button {
  padding: 8px 12px;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  font-weight: 600;
}

button[type="submit"] {
  background-color: #0052cc;
  color: white;
}

button[type="button"] {
  background-color: rgba(9,30,66,0.04);
  color: #42526e;
}

/* ==================== MODALS & UTILS ==================== */

.modal-content {
  background-color: white;
  padding: 20px;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.close-btn {
  float: right;
  font-size: 24px;
  cursor: pointer;
  color: #aaa;
}

.close-btn:hover {
  color: black;
}

.modal-xl {
  max-width: 90%;
}

/* Ensure modals and content appear above backdrops */
.modal-backdrop {
  z-index: 1040 !important;
}

/* Ensure modal backdrop doesn't cover modal content */
.modal-backdrop.show {
  z-index: 1050 !important;
}

/* Color Palette */
.color-palette {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 5px;
}

.color-swatch {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.1s, box-shadow 0.1s;
}

.color-swatch:hover {
  transform: scale(1.1);
}

.color-swatch.selected {
  border-color: #172b4d; /* Dark border to indicate selection */
  box-shadow: 0 0 0 2px white inset; /* Inner white ring for contrast */
  transform: scale(1.1);
}
