/* =========================================================
   mxAURA — Unified Stylesheet
   Consolidated and precedence-preserved (2025-01)
   FIXED: Table styling normalized to match Pools view
========================================================= */

/* ===== Base Reset ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: var(--font-family, "Inter", sans-serif);
  background: var(--mm-bg-page, #F8FAFC);
  color: var(--mm-text-primary, #0F172A);
  overflow: hidden;
  font-size: var(--text-body, 14px);
  line-height: var(--leading-body, 20px);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* =========================================================
   TOP NAVBAR
========================================================= */
.topbar {
  height: 50px;
  background: #0b1a33;
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 18px;
  font-weight: 500;
  z-index: 100;
  position: sticky;
  top: 0;
}

.topbar .logo-text { font-size: 16px; font-weight: 600; }

.topbar .top-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.account { display: flex; align-items: center; gap: 6px; }
.account .avatar { width: 28px; height: 28px; border-radius: 50%; }

/* =========================================================
   LAYOUT: CONTAINER + SIDEBAR + MAIN
========================================================= */
.container {
  display: flex;
  flex-direction: row;
  height: calc(100vh - 50px);
  overflow: visible !important;
  background: var(--slate-50, #F8FAFC);
  position: relative;
  z-index: 1;
}

.sidebar {
  width: 220px;
  background: #0b1a33;
  color: #fff;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  padding-top: 8px;
  overflow: visible !important;
  position: relative;
  z-index: 10;
}

.sidebar ul { list-style: none; padding: 0; margin: 0; }
.nav-item.active {
  background: #13294b;
  border-left: 4px solid #2c7be5;
}
.nav-group-header .caret {
  display: inline-block;
  margin-left: auto;
  font-size: 13px;
  transition: transform 0.25s ease;
  transform-origin: center;
}
.nav-group-header.open .caret { transform: rotate(90deg); }
.nav-group-header.active {
  background: #13294b;
  border-left: 4px solid #2c7be5;
}
.nav-group.open .nav-flyout {
  display: flex !important;
  opacity: 1 !important;
  transform: translateX(0) !important;
}

/* =========================================================
   FORM ELEMENTS - inherit the page font
   Browsers default <textarea> to monospace and inputs/selects
   to the UA font. base/core.css carried this reset but is not
   loaded anywhere, so views re-added it one control at a time
   and missed some (the framework description textarea).
========================================================= */
input, textarea, select, button {
  font-family: inherit;
}

/* =========================================================
   MAIN CONTENT AREA
========================================================= */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
  width: 100%;
}

/* Context header - title area alignment */
.context-header,
.mm-context-header,
#context-header {
  display: flex;
  flex-direction: column;
  padding: 16px 24px 0;
  background: #fff;
  border-bottom: none;
  flex-shrink: 0;
  min-height: 70px;
}

.context-left h2,
.mm-context-left h2,
#context-title {
  font-size: 22px;
  font-weight: 600;
  color: var(--mm-text-primary, #0F172A);
  margin: 0;
  padding: 0;
}

/* =========================================================
   DATA CONTENT AREA
========================================================= */
.data-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding: 0 24px 16px 24px;
  background: #fff;
}

/* Let table managers handle their own scrolling */
#data-list {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* Dashboard scroll — override overflow:hidden when dashboard is active */
#data-list.db-container {
  overflow-y: auto !important;
  overflow-x: hidden;
}

/* =========================================================
   SEARCH FIELD
========================================================= */
.section-search {
  padding: 8px 12px 8px 36px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 14px;
  height: 38px;
  width: 240px;
  background: #fff url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='%2394a3b8' stroke-width='2' viewBox='0 0 24 24'><circle cx='11' cy='11' r='7'/><line x1='21' y1='21' x2='16.65' y2='16.65'/></svg>") no-repeat 10px center;
  background-size: 16px;
  color: #1e293b;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.section-search:focus {
  border-color: #94a3b8;
  box-shadow: 0 0 0 2px rgba(148, 163, 184, 0.15);
}
.section-search::placeholder {
  color: #94a3b8;
}

/* =========================================================
   UNIVERSAL BUTTONS - Now in base/buttons.css
   .grey-btn and .mm-btn are loaded from there
========================================================= */

/* =========================================================
   BULK ACTION BAR - Now in base/actionBar.css
========================================================= */

/* =========================================================
   TABLE STYLES - Now centralized in tableManagerStyles.css
   All .mm-table, .data-table-wrapper styles removed from here
========================================================= */

/* =========================================================
   MODALS — Now centralized in base/modals.css
   Loaded automatically by modalHelper.js
========================================================= */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(40px);
  background: #16a34a;
  color: #fff;
  padding: 10px 18px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  transition: all 0.35s ease;
  z-index: 99999;
  box-shadow: 0 4px 10px rgba(0,0,0,0.25);
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

/* =========================================================
   UTILITIES
========================================================= */
.hidden { display: none !important; }

/* =========================================================
   RESPONSIVE
========================================================= */
@media (max-width: 768px) {
  .sidebar { width: 180px; }
  .section-search { width: 100%; }
  th, td { font-size: 13px; padding: 8px 6px; }
}

/* =========================================================
   BRANDING LOGO PREVIEW
========================================================= */
.logo-thumb {
  width: 64px;
  height: 40px;
  background: #1e293b;
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: all 0.15s ease;
}
.logo-thumb:hover { transform: scale(1.05); background: #334155; }
.logo-thumb img {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
  filter: brightness(1.1);
}

/* =========================================================
   DASHBOARD CARDS
========================================================= */
.dashboard {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 20px;
  align-content: flex-start;
}
.dashboard .card {
  flex: 1 1 calc(25% - 16px);
  background: var(--slate-50, #F8FAFC);
  border: 1px solid var(--slate-200, #E2E8F0);
  border-radius: 8px;
  padding: 20px;
  min-width: 200px;
  position: relative;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  transition: all 0.2s ease;
  cursor: pointer;
}
.dashboard .card:hover { background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,0.08); }
.dashboard .card h3 { font-size: 16px; font-weight: 600; color: var(--mm-text-primary, #0F172A); margin-bottom: 6px; }
.dashboard .card .count {
  position: absolute;
  bottom: 12px;
  right: 16px;
  font-size: 18px;
  font-weight: 700;
  color: var(--primary-500, #6366F1);
}

/* =========================================================
   ROW STATES - Now in tableManagerStyles.css
========================================================= */

/* =========================================================
   INLINE EDIT INPUTS
========================================================= */
.row-edit-input {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  height: 28px;
  padding: 4px 8px;
  margin: 0;
  border: 1px solid var(--slate-200, #E2E8F0);
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  outline: none;
}

/* =========================================================
   ENABLED TOGGLE SLIDER
========================================================= */
.enabled-toggle-container {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  background-color: var(--slate-300, #CBD5E1);
  border-radius: 24px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.enabled-toggle-container[data-enabled="1"] {
  background-color: var(--primary-500, #6366F1);
}

.enabled-toggle-switch {
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: transform 0.2s ease;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.enabled-toggle-container[data-enabled="1"] .enabled-toggle-switch {
  transform: translateX(20px);
}

/* v3.1.280: restored - the cleanup's dedup kept copies that live in sheets
   which are never loaded (base/core.css and friends). These are the live ones. */
a {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}
.context-right,
.mm-context-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: #dc2626; }
.toast.info { background: var(--primary-500, #6366F1); }

/* v3.1.309: restored - removed by the cleanup as unused, but referenced in JS. */
.icon-btn {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
}
.nav-item {
  display: block;
  padding: 10px 18px;
  font-size: 14px;
  color: #fff;
  border-left: 4px solid transparent;
  transition: background 0.15s ease, border-left 0.15s ease;
}
.nav-item:hover { background: #13294b; }
.nav-group { position: relative; width: 100%; overflow: visible !important; }
.nav-group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #fff;
  cursor: pointer;
  user-select: none;
  padding: 10px 18px;
  font-size: 14px;
  line-height: 1.4;
  font-weight: 500;
  border-left: 4px solid transparent;
}
.nav-group-header span:first-child {
  flex: 1;
  text-align: left;
}
.nav-group-header:hover { background: rgba(255,255,255,0.1); }
.nav-flyout {
  position: absolute;
  top: 0;
  left: 220px;
  background: #142847;
  color: #fff;
  width: 200px;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  display: none;
  flex-direction: column;
  padding: 8px 0;
  z-index: 9999;
  opacity: 0;
  transform: translateX(-8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.nav-flyout .nav-item {
  padding: 10px 16px;
  font-size: 14px;
  color: #fff;
  font-weight: 400;
  transition: background 0.15s ease;
}
.nav-flyout .nav-item:hover { background: #1b386b; }
.text-right { text-align: right; }
