/* VoltrAI – Bootstrap 5 theme */

:root {
  --sidebar-width: 240px;
  --topbar-height: 52px;
  --content-bg: #f1f5f9;
  --vlt-primary: #1a6b3c;
  --vlt-primary-hover: #155730;
}

body {
  background: #ffffff;
  color: #1f2937;
  font-family: 'Roboto', system-ui, -apple-system, sans-serif;
  font-size: 0.9em;
}

/* ── Auth page ── */
#vlt-auth-wrapper {
  min-height: 100vh;
  background: linear-gradient(to bottom, #eaf5ee, #ffffff);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Sidebar ── */
#vlt-sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  flex-shrink: 0;
  background: #0f172a;
  transition: transform 0.25s ease;
  z-index: 100;
  position: sticky;
  top: 0;
}

/* Brand */
.sidebar-brand { border-bottom: 1px solid rgba(255,255,255,0.06); }

.sidebar-brand-icon {
  width: 38px;
  height: 38px;
  background: var(--vlt-primary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-brand-icon img {
  max-width: 28px;
  max-height: 28px;
}

.sidebar-brand-name {
  color: #f1f5f9;
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.2;
}

.sidebar-brand-sub {
  color: #64748b;
  font-size: 0.72rem;
  text-transform: capitalize;
  line-height: 1.2;
}

/* Nav label */
.sidebar-nav-label {
  color: #475569;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Nav links */
.sidebar-nav-link {
  color: #94a3b8;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.875rem;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
}

.sidebar-nav-link:hover {
  background: rgba(255,255,255,0.07);
  color: #e2e8f0;
}

.sidebar-nav-link.active {
  background: var(--vlt-primary);
  color: #fff;
}

.sidebar-nav-link i,
.sidebar-nav-link .fas,
.sidebar-nav-link .far,
.sidebar-nav-link .fab {
  font-size: 1rem;
  width: 1.1rem;
  text-align: center;
}

/* Sub-items (e.g. individual installations) */
.sidebar-nav-sub {
  padding-left: 0.5rem;
}

.sidebar-nav-sublink {
  color: #64748b;
  padding: 0.3rem 0.75rem 0.3rem 2rem;
  border-radius: 6px;
  font-size: 0.8rem;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: background 0.15s, color 0.15s;
  margin-bottom: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-nav-sublink:hover {
  background: rgba(255,255,255,0.07);
  color: #cbd5e1;
}

.sidebar-nav-sublink.active {
  color: #a7f3c0;
  background: rgba(26,107,60,0.25);
}

/* Sidebar scrollbar */
#vlt-sidebar .overflow-auto {
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}
#vlt-sidebar .overflow-auto::-webkit-scrollbar { width: 4px; }
#vlt-sidebar .overflow-auto::-webkit-scrollbar-track { background: transparent; }
#vlt-sidebar .overflow-auto::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }
#vlt-sidebar .overflow-auto::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* User footer */
.sidebar-user { border-top: 1px solid rgba(255,255,255,0.06); }

.sidebar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--vlt-primary);
  color: #fff;
  font-weight: 700;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-user-name {
  color: #e2e8f0;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.3;
  display: block;
}

.sidebar-user-name:hover { color: #fff; }

.sidebar-user-email {
  color: #64748b;
  font-size: 0.7rem;
  line-height: 1.3;
}

.sidebar-logout-btn {
  color: #64748b;
  font-size: 1.05rem;
  text-decoration: none;
  transition: color 0.15s;
  flex-shrink: 0;
}

.sidebar-logout-btn:hover { color: #f87171; }

/* ── Topbar ── */
#vlt-topbar {
  height: var(--topbar-height);
  flex-shrink: 0;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
}

.topbar-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #1f2937;
}

.btn-logout { color: #6b7280; }
.btn-logout:hover { color: #dc2626; }

/* ── Layout ── */
#vlt-content {
  min-height: 100vh;
  background: var(--content-bg);
}

#vlt-content main {
  background: var(--content-bg);
}

#vlt-content .container {
  max-width: 100%;
  padding-left: 0;
  padding-right: 0;
}

/* ── Mobile sidebar overlay ── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 99;
}
.sidebar-overlay.show { display: block; }

@media (max-width: 991.98px) {
  #vlt-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    transform: translateX(-100%);
  }
  #vlt-sidebar.show {
    transform: translateX(0);
  }
}

/* Collapsed desktop sidebar */
#vlt-wrapper.sidebar-collapsed #vlt-sidebar {
  width: 0;
  overflow: hidden;
}

/* ── Buttons ── */
.btn-primary {
  background-color: var(--vlt-primary) !important;
  border-color: var(--vlt-primary) !important;
}

.btn-primary:hover {
  background-color: var(--vlt-primary-hover) !important;
  border-color: var(--vlt-primary-hover) !important;
}

.btn-primary:focus {
  background-color: var(--vlt-primary-hover) !important;
  border-color: var(--vlt-primary-hover) !important;
  box-shadow: 0 0 0 0.2rem rgba(26,107,60,0.25) !important;
}

.btn-primary:active {
  background-color: #0f4022 !important;
  border-color: #0f4022 !important;
}

/* ── Cards ── */
.card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.card-header {
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  color: #1f2937;
}

/* ── Tables ── */
.table {
  --bs-table-bg: #fff;
  --bs-table-color: #374151;
  --bs-table-border-color: #f1f5f9;
  --bs-table-hover-bg: rgba(0,0,0,0.015);
  font-size: 0.875rem;
  margin-bottom: 0;
}

.table th {
  font-weight: 600;
  color: #6b7280;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid #e2e8f0;
  background: #f8fafc;
}

.table th a {
  color: #6b7280;
  text-decoration: none;
}
.table th a:hover { color: var(--vlt-primary); }

/* ── Filter bar ── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.filter-bar .form-control,
.filter-bar .btn {
  height: 34px;
  font-size: 0.85rem;
  padding-top: 0;
  padding-bottom: 0;
  line-height: 34px;
}

/* Dropdown multiselect filter */
.filter-dropdown {
  position: relative;
}

.filter-dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  height: 34px;
  padding: 0 0.75rem;
  font-size: 0.85rem;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  color: #374151;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}

.filter-dropdown-toggle:hover {
  border-color: #9ca3af;
}

.filter-dropdown-toggle .badge {
  font-size: 0.7rem;
  padding: 2px 6px;
  background: var(--vlt-primary) !important;
}

.filter-dropdown-toggle i.fa-chevron-down {
  font-size: 0.65rem;
  color: #9ca3af;
  margin-left: 0.25rem;
}

.filter-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 50;
  min-width: 200px;
  max-height: 260px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  padding: 0.35rem 0;
  margin-top: 4px;
}

.filter-dropdown.open .filter-dropdown-menu {
  display: block;
}

.filter-dropdown-menu label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
  color: #374151;
  cursor: pointer;
  margin: 0;
}

.filter-dropdown-menu label:hover {
  background: #f8fafc;
}

.filter-dropdown-menu input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--vlt-primary);
  flex-shrink: 0;
}

.filter-dropdown-menu .filter-dropdown-search {
  padding: 0.35rem 0.75rem;
  border-bottom: 1px solid #f1f5f9;
  margin-bottom: 0.25rem;
}

.filter-dropdown-menu .filter-dropdown-search input {
  width: 100%;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
  outline: none;
}

.filter-dropdown-menu .filter-dropdown-search input:focus {
  border-color: var(--vlt-primary);
}

/* ── Forms ── */
.form-control, .form-select {
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.875rem;
  padding: 0.5rem 0.75rem;
}

.form-control:focus, .form-select:focus {
  border-color: var(--vlt-primary);
  box-shadow: 0 0 0 0.2rem rgba(26,107,60,0.15);
}

.form-label {
  font-size: 0.82rem;
  font-weight: 500;
  color: #374151;
  margin-bottom: 0.3rem;
}

/* ── Breadcrumb ── */
.breadcrumb {
  font-size: 0.82rem;
}

/* ── Alert auto-dismiss ── */
.alert-auto-dismiss { transition: opacity 0.5s; }

/* ── Navbar public (login/register pages) ── */
.navbar-vlt-public {
  background: #0f172a;
}

/* ── Separator ── */
.separator {
  width: 100%;
  text-align: center;
  position: relative;
  z-index: 1;
}

.separator:before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  border-top: 1px solid #999999;
  width: 100%;
  transform: translateY(-50%);
}

.separator .text {
  position: relative;
  background-color: #ffffff;
  padding: 0 10px;
  z-index: 2;
}

/* ── Form outline override (remove MDB floating label pattern) ── */
.form-outline { position: relative; }

/* ── Sortable fields (form builder) ── */
.sortable-list { min-height: 40px; }
.sortable-item {
  margin: 0 3px 3px 3px;
  padding: 0.4em;
  padding-left: 1.5em;
  font-size: 0.8em;
  border: 1px solid #eeeeee;
  background-color: #f4f4f4;
  cursor: grab;
}
.draggable-drag-ico { cursor: grab; color: #888; margin-right: 6px; }
