/**
 * Betzetu + Tabler integration layer
 */
body.theme-tabler {
  --betzetu-sidebar-width: 15rem;
}

body.theme-tabler.layout-fluid {
  background: var(--tblr-body-bg, #f6f8fb);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* Root shell — block layout (NOT flex) so page-wrapper stays beside fixed sidebar */
body.theme-tabler #app-wrapper.page {
  display: block !important;
  width: 100%;
  min-height: 100vh;
  position: relative;
}

/* Override legacy style.css .sidebar (fixed 260px) + Tabler vertical nav */
body.theme-tabler #sidebar.sidebar,
body.theme-tabler aside.sidebar.navbar-vertical {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  bottom: 0 !important;
  width: var(--betzetu-sidebar-width) !important;
  max-width: var(--betzetu-sidebar-width) !important;
  height: 100vh !important;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 1030;
  flex-shrink: 0;
}

body.theme-tabler #sidebar .navbar-brand img {
  max-height: 36px;
  width: auto;
}

body.theme-tabler #sidebar .nav-section-title {
  display: block;
  list-style: none;
  padding: 0.75rem 1rem 0.35rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
}

body.theme-tabler #sidebar .nav-link.nav-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-radius: var(--tblr-border-radius, 4px);
  margin: 0 0.5rem;
  padding: 0.45rem 0.75rem;
  color: rgba(255, 255, 255, 0.82);
}

body.theme-tabler #sidebar .nav-link-icon {
  display: inline-flex;
  width: 1.25rem;
  justify-content: center;
}

body.theme-tabler #sidebar .nav-link-title {
  display: inline !important;
  flex: 1;
}

body.theme-tabler #sidebar .nav-link.nav-item:hover,
body.theme-tabler #sidebar .nav-link.nav-item.active {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

body.theme-tabler #sidebar .nav-badge {
  margin-left: auto;
  font-size: 0.65rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
}

/* Main column — offset for fixed sidebar */
body.theme-tabler #app-wrapper .page-wrapper {
  margin-left: var(--betzetu-sidebar-width) !important;
  width: auto !important;
  max-width: none !important;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  flex: none;
}

body.theme-tabler .top-bar.navbar {
  min-height: 3.5rem;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  margin-bottom: 0 !important;
  border-bottom: 1px solid var(--tblr-border-color);
  position: sticky;
  top: 0;
  z-index: 1020;
  background: var(--tblr-body-bg) !important;
}

body.theme-tabler .top-bar .container-fluid {
  flex-wrap: wrap;
  gap: 0.75rem;
}

body.theme-tabler .top-bar .page-title-wrap h1 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
  line-height: 1.2;
}

body.theme-tabler .top-bar .page-title-wrap p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--tblr-secondary);
}

body.theme-tabler .page-body {
  flex: 1;
  padding-top: 1.25rem;
  padding-bottom: 2rem;
}

/* SPA sections — not the Tabler root #app-wrapper.page */
body.theme-tabler .container-xl > .page {
  display: none !important;
}

body.theme-tabler .container-xl > .page.active {
  display: block !important;
}

body.theme-tabler .card {
  border: var(--tblr-border-width) solid var(--tblr-border-color);
  border-radius: var(--tblr-border-radius-lg);
  box-shadow: var(--tblr-box-shadow-sm);
  background: var(--tblr-card-bg, #fff);
  margin-bottom: 1.25rem;
}

body.theme-tabler .card-body {
  padding: 1.25rem;
}

body.theme-tabler .page-header h2 {
  font-size: 1.35rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

body.theme-tabler .btn {
  border-radius: var(--tblr-border-radius);
}

body.theme-tabler .table {
  font-size: 0.875rem;
}

body.theme-tabler .loading {
  padding: 1.5rem;
  text-align: center;
  color: var(--tblr-secondary);
}

body.theme-tabler .summary-card,
body.theme-tabler .futuristic-card {
  border-radius: var(--tblr-border-radius-lg);
}

/* Login — superseded by landing.css */
body.theme-tabler .login-page {
  /* legacy class unused */
}

/* Mobile */
body.theme-tabler .mobile-menu-toggle {
  display: none;
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 1040;
  border: 0;
  border-radius: 10px;
  background: #1e293b;
  color: #fff;
  width: 2.5rem;
  height: 2.5rem;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.2);
}

@media (max-width: 991.98px) {
  body.theme-tabler .mobile-menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  body.theme-tabler #sidebar.sidebar.navbar-vertical {
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }

  body.theme-tabler #sidebar.sidebar.navbar-vertical.open,
  body.theme-tabler #sidebar.sidebar.navbar-vertical.mobile-open {
    transform: translateX(0);
  }

  body.theme-tabler #app-wrapper .page-wrapper {
    margin-left: 0 !important;
  }

  body.theme-tabler .top-bar.navbar {
    padding-left: 3.25rem;
  }
}
