﻿/* ============================================================
   eprimo B2B Energie Cockpit – Design System (Neutral)
   ============================================================ */

:root {
  --ep-primary:        #334155;   /* Slate 700 – Hauptfarbe */
  --ep-primary-dark:   #1e293b;   /* Slate 800 – dunkel */
  --ep-primary-darker: #0f172a;   /* Slate 900 – sehr dunkel */
  --ep-surface:        #f8fafc;   /* Slate 50  – helle Flächen */
  --ep-surface-2:      #f1f5f9;   /* Slate 100 – etwas dunkler */
  --ep-border:         #e2e8f0;   /* Slate 200 – Rahmen */
  --ep-border-strong:  #cbd5e1;   /* Slate 300 – stärkere Rahmen */
  --ep-text-muted:     #64748b;   /* Slate 500 – gedämpfter Text */
  --ep-text-subtle:    #94a3b8;   /* Slate 400 – sehr gedämpft */
  --ep-accent:         #3b82f6;   /* Blue 500  – Akzent (Aktiv, Fokus) */
  --ep-accent-dark:    #1d4ed8;   /* Blue 700  – Akzent dunkel */
  --ep-accent-light:   #eff6ff;   /* Blue 50   – Akzent hell */
  --ep-bg:             #f1f5f9;   /* Seitenhintergrund */
  --ep-sidebar-w:      265px;
  --ep-navbar-h:       58px;
}

html, body { height: 100%; }

body {
  background-color: var(--ep-bg);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: #1e293b;
}

/* ── Cards ──────────────────────────────────────────────────── */
.card {
  border: 1px solid var(--ep-border);
  border-radius: 0.6rem;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

/* Einheitlicher Card-Header */
.card-header {
  background-color: var(--ep-surface);
  border-bottom: 1px solid var(--ep-border);
  padding-top: .6rem;
  padding-bottom: .6rem;
}
.card-header h2.h6,
.card-header h2.h5,
.card-header h3.h6 {
  color: var(--ep-primary-dark);
  font-weight: 600;
}
.card-header .text-muted {
  color: var(--ep-text-muted) !important;
}

/* ── Tabellen ───────────────────────────────────────────────── */
.table,
.table > :not(caption) > * > * { border-width: 1px; }

/* ── Formularfelder ─────────────────────────────────────────── */
.form-control,
.form-select {
  border-width: 1.5px;
  border-color: var(--ep-border-strong);
}
.form-control:focus,
.form-select:focus {
  border-color: var(--ep-accent);
  box-shadow: 0 0 0 .2rem rgba(59,130,246,.18);
}

/* ── Buttons ────────────────────────────────────────────────── */
.btn-primary {
  background-color: var(--ep-primary);
  border-color: var(--ep-primary);
  color: #fff;
}
.btn-primary:hover,
.btn-primary:focus {
  background-color: var(--ep-primary-dark);
  border-color: var(--ep-primary-dark);
  color: #fff;
}
.btn-outline-primary {
  color: var(--ep-primary);
  border-color: var(--ep-primary);
  border-width: 1.5px;
}
.btn-outline-primary:hover {
  background-color: var(--ep-primary);
  border-color: var(--ep-primary);
  color: #fff;
}
.btn-outline-secondary { border-width: 1.5px; }
.badge.bg-success { background-color: #16a34a !important; }

/* ── Sortierbare Tabellen ───────────────────────────────────── */
.table-sortable th { cursor: pointer; user-select: none; }
.table-sortable th::after {
  content: " ";
  display: inline-block;
  margin-left: 4px;
  border: 4px solid transparent;
}
.table-sortable th.sort-asc::after  { border-top-color: var(--ep-accent); }
.table-sortable th.sort-desc::after { border-bottom-color: var(--ep-accent); border-top-color: transparent; }

/* ============================================================
   TOP NAVBAR
   ============================================================ */
.ep-navbar {
  background: linear-gradient(135deg, var(--ep-primary-darker) 0%, var(--ep-primary-dark) 100%);
  height: var(--ep-navbar-h);
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
  z-index: 1040;
  flex-shrink: 0;
  flex-wrap: nowrap !important;
  overflow: visible;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ep-navbar > * { flex-shrink: 0; }

.ep-navbar .ep-nav-left {
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
}

/* Centered navbar slot */
.ep-nav-center {
  flex: 0 0 auto;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
  white-space: nowrap;
}

.ep-nav-right {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
}
.ep-nav-right .navbar-nav {
  flex-wrap: nowrap;
  align-items: center;
}
.ep-nav-right .nav-item { flex-shrink: 0; }

.ep-navbar .dropdown-menu {
  position: absolute !important;
  border: 1px solid var(--ep-border);
  border-radius: .5rem;
  box-shadow: 0 4px 16px rgba(0,0,0,.12);
}

/* Logo */
.ep-navbar .navbar-brand {
  padding: 0;
  line-height: 1;
}
.ep-logo {
  height: 34px;
  width: auto;
  display: block;
}

/* User button */
/* ── Logout button in navbar ─────────────────────────────── */
.ep-logout-btn {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .35rem .7rem;
  border-radius: .5rem;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.15);
  color: rgba(255,255,255,.85);
  font-size: .84rem;
  font-weight: 500;
  text-decoration: none;
  transition: background .15s, border-color .15s, color .15s;
  white-space: nowrap;
}
.ep-logout-btn:hover {
  background: rgba(239,68,68,.18);
  border-color: rgba(239,68,68,.4);
  color: #fca5a5;
}

.ep-user-btn {
  display: flex;
  align-items: center;
  gap: .45rem;
  padding: .25rem .5rem;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: .5rem;
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.85);
  transition: background .15s, border-color .15s;
  white-space: nowrap;
}
.ep-user-btn:hover,
.ep-user-btn:focus,
.ep-user-btn[aria-expanded="true"] {
  background: rgba(255,255,255,.15);
  border-color: rgba(255,255,255,.35);
  color: #fff;
  box-shadow: none;
  outline: none;
}

.ep-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,.2);
  border: 1px solid rgba(255,255,255,.3);
  color: #fff;
  font-size: .78rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: 0;
}
.ep-user-name {
  font-size: .84rem;
  font-weight: 500;
  color: rgba(255,255,255,.9);
}
.ep-chevron {
  opacity: .6;
  flex-shrink: 0;
}

#sidebarToggleBtn {
  color: rgba(255,255,255,.8);
  border: none;
  background: transparent;
  padding: .3rem .45rem;
  border-radius: .375rem;
  font-size: 1.25rem;
  line-height: 1;
  transition: background .15s;
  cursor: pointer;
  flex-shrink: 0;
}
#sidebarToggleBtn:hover {
  background: rgba(255,255,255,.1);
  color: #fff;
}

.ep-navbar .ep-search-input {
  background: rgba(255,255,255,.1);
  border: 1.5px solid rgba(255,255,255,.2);
  color: #fff;
  border-radius: .5rem;
  width: 260px;
}
.ep-navbar .ep-search-input::placeholder { color: rgba(255,255,255,.45); }
.ep-navbar .ep-search-input:focus {
  background: rgba(255,255,255,.16);
  border-color: rgba(255,255,255,.45);
  box-shadow: none;
  color: #fff;
  width: 260px;
}

/* Only icon-type nav-links (notifications) inherit white color */
.ep-navbar .btn-link.nav-link { color: rgba(255,255,255,.8) !important; }
.ep-navbar .btn-link.nav-link:hover { color: #fff !important; }

/* Dropdown items in navbar are normal dark-on-white */
.ep-navbar .dropdown-menu .dropdown-item { color: var(--ep-primary); }
.ep-navbar .dropdown-menu .dropdown-item:hover { background: var(--ep-surface-2); }
.ep-navbar .dropdown-menu .dropdown-item.text-danger { color: #dc2626 !important; }
.ep-navbar .dropdown-menu .dropdown-item.text-danger:hover { background: #fef2f2; }

.ep-navbar .ep-role-badge {
  background-color: rgba(255,255,255,.14) !important;
  color: #fff;
  font-weight: 500;
  border: 1px solid rgba(255,255,255,.2);
  white-space: nowrap;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.ep-sidebar {
  width: var(--ep-sidebar-w);
  flex: 0 0 var(--ep-sidebar-w);
  background: #fff;
  border-right: 1px solid var(--ep-border);
  box-shadow: 2px 0 8px rgba(0,0,0,.07);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width .25s ease, flex-basis .25s ease;
  z-index: 1030;
}
.ep-sidebar.ep-sidebar-collapsed {
  width: 0;
  flex: 0 0 0;
}

@media (max-width: 991.98px) {
  .ep-sidebar {
    position: fixed;
    top: var(--ep-navbar-h);
    bottom: 0;
    left: 0;
    width: var(--ep-sidebar-w) !important;
    flex: none !important;
    transform: translateX(-100%);
    box-shadow: 4px 0 20px rgba(0,0,0,.15);
    transition: transform .25s ease;
    overflow-y: auto;
  }
  .ep-sidebar.ep-sidebar-open { transform: translateX(0); }
}

#sidebarOverlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.3);
  z-index: 1029;
}
#sidebarOverlay.show { display: block; }

/* ── Sidebar user block ─────────────────────────────────── */
.sidebar-user-block {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 1rem 1rem .85rem;
  border-bottom: 1px solid var(--ep-border);
  flex-shrink: 0;
}
.sidebar-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--ep-primary-dark);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .95rem;
  flex-shrink: 0;
}
.sidebar-user-info { overflow: hidden; }
.sidebar-user-name {
  font-size: .85rem;
  font-weight: 600;
  color: var(--ep-primary-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-role {
  font-size: .75rem;
  color: var(--ep-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Sidebar nav ────────────────────────────────────────── */
.sidebar-nav {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: .75rem .5rem .5rem;
}

.nav-section-label {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ep-text-subtle);
  padding: .65rem .85rem .3rem;
  margin-top: .25rem;
}
.nav-link-btn {
  border-radius: .4rem;
  border: none;
  font-size: .875rem;
  padding: .5rem .85rem;
  color: var(--ep-primary);
  background: transparent;
  text-align: left;
  width: 100%;
  display: flex;
  align-items: center;
  gap: .65rem;
  transition: background .12s, color .12s;
  margin-bottom: 1px;
  /* Reset <a> tag defaults */
  text-decoration: none !important;
  cursor: pointer;
  line-height: 1.4;
}
.nav-link-btn .nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  opacity: .6;
}
.nav-link-btn .nav-icon svg {
  width: 1rem;
  height: 1rem;
  stroke: currentColor;
  fill: none;
}
.nav-link-btn:hover {
  background-color: var(--ep-surface-2);
  color: var(--ep-primary-dark);
}
.nav-link-btn:hover .nav-icon { opacity: .9; }
.nav-link-btn.active {
  background: var(--ep-primary-dark);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(15,23,42,.2);
}
.nav-link-btn.active .nav-icon { opacity: 1; }

.sidebar-footer {
  padding: .7rem 1rem;
  border-top: 1px solid var(--ep-border);
  font-size: .72rem;
  color: var(--ep-text-subtle);
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ============================================================
   MAIN LAYOUT
   ============================================================ */
.ep-app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}
.ep-main-row {
  flex: 1 1 0;
  display: flex;
  overflow: hidden;
  min-height: 0;
}
.ep-content {
  flex: 1 1 0;
  overflow-y: auto;
  min-width: 0;
  padding: 1.5rem 2rem;
  background-color: var(--ep-bg);
}

.content-view { animation: fadeIn 0.15s ease-out; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   LOGIN
   ============================================================ */
#loginView {
  background: linear-gradient(135deg, var(--ep-primary-darker) 0%, var(--ep-primary-dark) 50%, var(--ep-primary) 100%);
}
#loginView .card {
  border: none;
  border-radius: 1rem;
  box-shadow: 0 8px 32px rgba(0,0,0,.2);
}
#loginView .nav-tabs .nav-link.active {
  color: var(--ep-primary-dark);
  border-bottom: 2px solid var(--ep-accent);
}

/* ============================================================
   MISC
   ============================================================ */
.min-vh-100 { min-height: 100vh; }
.quick-link { cursor: pointer; }

.qr-square {
  width: 140px; height: 140px; border-radius: 12px;
  background-image: linear-gradient(45deg, #212529 25%, transparent 25%, transparent 50%, #212529 50%, #212529 75%, transparent 75%, transparent);
  background-size: 28px 28px;
}

.chart-wrapper { position: relative; width: 100%; height: 100%; overflow-x: auto; }
.chart-wrapper canvas { min-width: 480px; }

table.dataTable, table.table { width: 100% !important; }
.dataTables_length label { display: flex; align-items: center; gap: .5rem; }

#locationMap { position: relative; height: 260px; min-height: 220px; }
.map-weather-overlay {
  position: absolute; left: 8px; bottom: 8px;
  background: rgba(248,249,250,.95); border: 1px solid var(--ep-border);
  border-radius: .375rem; padding: .25rem .5rem;
  font-size: .8rem; display: flex; align-items: center; gap: .35rem;
}
.map-marker { cursor: pointer; transition: transform .1s ease-out, fill .1s ease-out, stroke .1s ease-out; }
.map-marker:hover { transform: scale(1.1); }
.map-marker-active { fill: var(--ep-accent); stroke: var(--ep-accent-dark); stroke-width: 2; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--ep-border-strong); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--ep-text-muted); }

/* ============================================================
   DATATABLES – Neutral Theme + Column-Filter-Popup
   ============================================================ */

.dt-bot-bar {
  padding: .45rem .5rem .35rem;
  border-top: 1px solid var(--ep-border);
}

/* Längen-Dropdown (im Footer) */
.dt-length-wrap { display: flex; align-items: center; }
.dt-length label {
  font-size: .82rem;
  color: var(--ep-text-muted);
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center !important;
  flex-wrap: nowrap !important;
  gap: .4rem;
  white-space: nowrap;
  margin: 0;
}
.dt-length select,
.dt-length .dt-input {
  width: auto !important;
  min-width: 72px;
  border-color: var(--ep-border-strong);
  border-radius: .35rem;
  font-size: .82rem;
  color: var(--ep-primary-dark);
}

/* Info-Text */
.dt-info {
  font-size: .82rem;
  color: var(--ep-text-muted);
  display: flex;
  align-items: center;
  line-height: 1;
  margin: 0;
}

/* Pagination */
.dt-paging {
  display: flex;
  align-items: center;
}
.dt-paging .pagination {
  margin: 0;
  gap: 2px;
  align-items: center;
}
.dt-paging .page-item .page-link {
  border-color: var(--ep-border-strong);
  color: var(--ep-primary);
  border-radius: .35rem !important;
  font-size: .82rem;
  padding: .28rem .6rem;
  min-width: 2rem;
  text-align: center;
}
.dt-paging .page-item.active .page-link {
  background-color: var(--ep-primary-dark);
  border-color: var(--ep-primary-dark);
  color: #fff;
}
.dt-paging .page-item.disabled .page-link {
  color: var(--ep-text-subtle);
  border-color: var(--ep-border);
}
.dt-paging .page-item .page-link:hover {
  background-color: var(--ep-surface-2);
  color: var(--ep-primary-dark);
  border-color: var(--ep-border-strong);
}

/* Tabellen-Header */
table.dataTable thead th,
table.dataTable thead td {
  background: var(--ep-surface);
  color: var(--ep-primary-dark);
  border-bottom: 2px solid var(--ep-border-strong) !important;
  font-size: .83rem;
  font-weight: 600;
  letter-spacing: .02em;
  white-space: nowrap;
  user-select: none;
  padding: .55rem .75rem;
}

/* Sort-Pfeile */
table.dataTable thead th.dt-ordering-asc,
table.dataTable thead th.dt-ordering-desc {
  color: var(--ep-primary-dark);
}
table.dataTable thead .dt-column-order {
  color: var(--ep-text-subtle);
  margin-left: .25rem;
  font-size: .7rem;
}
table.dataTable thead th.dt-ordering-asc  .dt-column-order { color: var(--ep-accent); }
table.dataTable thead th.dt-ordering-desc .dt-column-order { color: var(--ep-accent); }

/* Tabellenzeilen */
table.dataTable tbody tr:hover td {
  background-color: var(--ep-surface-2);
}
table.dataTable tbody tr.selected td {
  background-color: var(--ep-accent-light);
}

/* ── Filter-Icon im Spaltenheader ──────────────────────────── */
.dt-filter-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: .4rem;
  width: 1.1rem;
  height: 1.1rem;
  font-size: .6rem;
  color: var(--ep-text-subtle);
  border: 1px solid transparent;
  border-radius: 3px;
  cursor: pointer;
  vertical-align: middle;
  transition: color .12s, background .12s, border-color .12s;
}
.dt-filter-icon:hover {
  color: var(--ep-primary-dark);
  background: var(--ep-border);
  border-color: var(--ep-border-strong);
}
.dt-filter-icon.active {
  color: #fff;
  background: var(--ep-accent);
  border-color: var(--ep-accent-dark);
}

/* ── Filter-Popover ──────────────────────────────────────────── */
.dt-filter-popover {
  display: none;
  position: absolute;
  z-index: 9000;
  width: 260px;
  background: #fff;
  border: 1px solid var(--ep-border-strong);
  border-radius: .6rem;
  box-shadow: 0 6px 24px rgba(0,0,0,.12);
  overflow: hidden;
  font-size: .87rem;
}

.dt-fp-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .6rem .85rem .5rem;
  background: var(--ep-primary-dark);
  color: #fff;
}

.dt-fp-col-name {
  font-weight: 600;
  font-size: .8rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 190px;
}

.dt-fp-close {
  background: none;
  border: none;
  color: rgba(255,255,255,.65);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 .2rem;
  flex-shrink: 0;
}
.dt-fp-close:hover { color: #fff; }

.dt-fp-body { padding: .85rem; }

.dt-fp-body .form-select,
.dt-fp-body .form-control {
  border-color: var(--ep-border-strong);
  font-size: .85rem;
}
.dt-fp-body .form-select:focus,
.dt-fp-body .form-control:focus {
  border-color: var(--ep-accent);
  box-shadow: 0 0 0 .18rem rgba(59,130,246,.18);
}

.dt-fp-body .btn-primary {
  background: var(--ep-primary);
  border-color: var(--ep-primary);
}
.dt-fp-body .btn-primary:hover {
  background: var(--ep-primary-dark);
  border-color: var(--ep-primary-dark);
}

/* ── Standort-Cockpit ───────────────────────────────────────────────────── */
.map-legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
}

#locationDetailContent {
  overflow-y: auto;
}

#locDetailKpis > div:last-child {
  border-right: none !important;
}

/* ── Rollen / Permission Tree ───────────────────────────────────────────── */
.perm-page-block {
  transition: box-shadow .15s;
}
.perm-page-block:hover {
  box-shadow: 0 0 0 2px var(--ep-accent-light);
}
.perm-element-row:last-child {
  border-bottom: none !important;
}
.perm-element-row .form-check-input {
  cursor: pointer;
}
.perm-page-toggle, .perm-element-toggle {
  cursor: pointer;
}

/* ── Role Table Badges ──────────────────────────────────────────────────── */
.bg-primary-subtle  { background: #eff6ff !important; }
.text-primary-emphasis { color: #1d4ed8 !important; }

/* ── Dashboard Loading Skeleton ──────────────────────────────────────────── */
.skeleton-line {
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s infinite;
}
.skeleton-line.w-50  { width: 50%; }
.skeleton-line.w-75  { width: 75%; }
.skeleton-line.w-40  { width: 40%; }
@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Dashboard Edit Mode ─────────────────────────────────────────────────── */

/* Dashed border on the hidden-widget panel */
.border-dashed {
  border-style: dashed !important;
}

/* Table cards – rounded corners on the table-responsive inside a padded card-body */
.table-card .card-body .table-responsive,
.card-body.p-3 .table-responsive {
  border-radius: calc(var(--bs-border-radius) - 2px);
  overflow: hidden;
}

/* SEPA meter sub-table (inside DataTables child row) */
.sepa-meter-subtable { border-top: 1px solid var(--bs-border-color); }
.sepa-meter-subtable td { font-size: 0.83rem; padding: 0.3rem 0.5rem; vertical-align: middle; }
.sepa-meter-subtable .sepa-meter-indent { padding-left: 2.5rem; width: 44px; }
.sepa-meter-subtable tr:last-child td { border-bottom: none; }

/* Contract child-row (meter numbers expand) */
.contract-toggle-cell { cursor: pointer; }
.contract-toggle-cell:hover { background-color: var(--ep-bg-subtle, #f8fafc); }
tr.dt-row-open > td.contract-toggle-cell { background-color: var(--ep-bg-subtle, #f8fafc); }
td.dt-hasChild { background-color: var(--ep-bg-subtle, #f8fafc) !important; }
tr.child td { padding: 0 !important; }          /* DataTables child row reset */

/* Expiring contract badge – subtle pulse to draw attention */
.contract-expiring-badge {
  animation: badge-pulse 2.2s ease-in-out infinite;
}
@keyframes badge-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.65; }
}

/* Hidden widget card (in the "Ausgeblendete Widgets" pool) */
.widget-card--hidden {
  border: 1.5px dashed var(--ep-border-color) !important;
  box-shadow: none !important;
  opacity: 0.72;
  background: var(--ep-bg-subtle, #f8fafc);
  transition: opacity .2s, border-color .2s;
}
.widget-card--hidden:hover {
  opacity: 1;
  border-color: var(--ep-primary) !important;
  cursor: grab;
}
/* Drop zone highlight when a widget hovers over hidden panel */
.dashboard-edit-mode.sortable-over .widget-card--hidden,
#hiddenWidgetsList.sortable-over {
  background: var(--ep-primary-subtle, #eff6ff);
}

/* Drag handle: hidden in normal view, visible in edit mode */
.widget-drag-handle {
  display: none;
  cursor: grab;
  color: var(--ep-text-muted);
  flex-shrink: 0;
  padding: 2px 4px;
  border-radius: 4px;
  transition: background .15s;
}
.widget-drag-handle:active { cursor: grabbing; }
.widget-drag-handle:hover  { background: var(--ep-bg-hover); }
.widget-drag-handle svg    { display: block; }

.dashboard-edit-mode .widget-drag-handle,
#hiddenWidgetsList .widget-drag-handle {
  display: flex;
  align-items: center;
}

/* Widget cards in edit mode get a subtle dashed border */
.dashboard-edit-mode .widget-card {
  border: 1.5px dashed var(--ep-border-color) !important;
  box-shadow: none !important;
  transition: border-color .2s;
}
.dashboard-edit-mode .widget-card:hover {
  border-color: var(--ep-primary) !important;
}

/* Ghost while dragging */
.widget-drag-ghost {
  opacity: 0.35;
}
.widget-drag-chosen .widget-card {
  box-shadow: 0 4px 16px rgba(0,0,0,.12) !important;
  border-color: var(--ep-primary) !important;
}

/* Cursor for draggable cols */
.dashboard-edit-mode .widget-col {
  cursor: default;
  user-select: none;
}

/* Prevent Leaflet default blue marker color leaking */
.leaflet-div-icon {
  background: transparent !important;
  border: none !important;
}

/* Leaflet tooltip inside cockpit */
.leaflet-tooltip {
  font-size: 0.78rem;
  padding: 4px 8px;
  border-radius: 6px;
}

/* ── Table skeleton / loading state ───────────────────────────────────────── */
@keyframes skeleton-shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position:  600px 0; }
}

/* ── Body skeleton rows ── */
.skeleton-row td {
  padding-top: 0.55rem !important;
  padding-bottom: 0.55rem !important;
  border-color: transparent !important;
}

.skeleton-cell {
  display: block;
  height: 13px;
  border-radius: 6px;
  background: linear-gradient(
    90deg,
    #e2e8f0 25%,
    #f1f5f9 50%,
    #e2e8f0 75%
  );
  background-size: 600px 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
}

/* Vary widths so rows look organic, not like a grid of identical bars */
.skeleton-row:nth-child(odd)  td:nth-child(1) .skeleton-cell { width: 80%; }
.skeleton-row:nth-child(odd)  td:nth-child(2) .skeleton-cell { width: 60%; }
.skeleton-row:nth-child(odd)  td:nth-child(3) .skeleton-cell { width: 75%; }
.skeleton-row:nth-child(odd)  td:nth-child(4) .skeleton-cell { width: 55%; }
.skeleton-row:nth-child(odd)  td:nth-child(5) .skeleton-cell { width: 70%; }
.skeleton-row:nth-child(odd)  td:nth-child(6) .skeleton-cell { width: 50%; }
.skeleton-row:nth-child(odd)  td:nth-child(7) .skeleton-cell { width: 65%; }
.skeleton-row:nth-child(odd)  td:nth-child(8) .skeleton-cell { width: 45%; }
.skeleton-row:nth-child(odd)  td:nth-child(9) .skeleton-cell { width: 30%; }
.skeleton-row:nth-child(even) td:nth-child(1) .skeleton-cell { width: 55%; }
.skeleton-row:nth-child(even) td:nth-child(2) .skeleton-cell { width: 80%; }
.skeleton-row:nth-child(even) td:nth-child(3) .skeleton-cell { width: 50%; }
.skeleton-row:nth-child(even) td:nth-child(4) .skeleton-cell { width: 70%; }
.skeleton-row:nth-child(even) td:nth-child(5) .skeleton-cell { width: 60%; }
.skeleton-row:nth-child(even) td:nth-child(6) .skeleton-cell { width: 75%; }
.skeleton-row:nth-child(even) td:nth-child(7) .skeleton-cell { width: 40%; }
.skeleton-row:nth-child(even) td:nth-child(8) .skeleton-cell { width: 65%; }
.skeleton-row:nth-child(even) td:nth-child(9) .skeleton-cell { width: 35%; }

/* ── Header skeleton (while table-loading class is present) ── */
/* Hide all real header text + icons */
.table-loading thead th {
  color: transparent !important;
  background-color: var(--ep-surface-2) !important;
  border-bottom-color: var(--ep-border) !important;
  pointer-events: none !important;
  user-select: none;
  position: relative;
  white-space: nowrap;
  overflow: hidden;
}

/* Hide any child elements (checkboxes, sort arrows, DataTables wrappers) */
.table-loading thead th > * {
  visibility: hidden;
}

/* Draw a shimmer bar in place of the header text */
.table-loading thead th::after {
  content: '';
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  height: 11px;
  width: 65%;
  min-width: 28px;
  border-radius: 5px;
  background: linear-gradient(
    90deg,
    #cbd5e1 25%,
    #e2e8f0 50%,
    #cbd5e1 75%
  );
  background-size: 600px 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
  /* Slightly offset animation so header and body don't pulse in perfect sync */
  animation-delay: -0.3s;
}

/* First column (checkbox) – very short bar */
.table-loading thead th:first-child::after { width: 20px; left: 50%; transform: translate(-50%, -50%); }
/* Last column (Aktionen) – shorter bar */
.table-loading thead th:last-child::after  { width: 40%; }

/* ══════════════════════════════════════════════════════════════════════════
   Driver.js Onboarding Tour – Voltaris Design-Overrides
   ══════════════════════════════════════════════════════════════════════════ */

/* Popover-Grundgestaltung */
.driver-popover.voltaris-tour-popover {
  background: #ffffff;
  border: 1px solid var(--ep-border);
  border-radius: 0.75rem;
  box-shadow: 0 16px 48px rgba(15, 23, 42, 0.18), 0 4px 12px rgba(15, 23, 42, 0.1);
  padding: 0;
  min-width: 320px;
  max-width: 420px;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* Header-Bereich */
.driver-popover.voltaris-tour-popover .driver-popover-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ep-primary-dark);
  padding: 1rem 1rem 0.35rem 1rem;
  border-bottom: none;
  line-height: 1.4;
}

/* Beschreibung */
.driver-popover.voltaris-tour-popover .driver-popover-description {
  font-size: 0.875rem;
  color: #334155;
  line-height: 1.6;
  padding: 0 1rem 0.75rem 1rem;
}

/* Fortschrittsleiste-Bereich */
.driver-popover.voltaris-tour-popover .driver-popover-footer {
  border-top: 1px solid var(--ep-border);
  background: var(--ep-surface);
  border-radius: 0 0 0.75rem 0.75rem;
  padding: 0.6rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

/* Progress-Text */
.driver-popover.voltaris-tour-popover .driver-popover-progress-text {
  font-size: 0.775rem;
  color: var(--ep-text-muted);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

/* Button-Gruppe */
.driver-popover.voltaris-tour-popover .driver-popover-navigation-btns {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

/* Alle Buttons Basis */
.driver-popover.voltaris-tour-popover button {
  font-size: 0.8rem;
  font-weight: 500;
  border-radius: 0.4rem;
  padding: 0.3rem 0.75rem;
  line-height: 1.4;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  border: 1px solid transparent;
}

/* Zurück-Button */
.driver-popover.voltaris-tour-popover .driver-popover-prev-btn {
  background: transparent;
  color: var(--ep-text-muted);
  border-color: var(--ep-border-strong);
}
.driver-popover.voltaris-tour-popover .driver-popover-prev-btn:hover {
  background: var(--ep-surface-2);
  color: var(--ep-primary-dark);
}

/* Weiter / Fertig-Button */
.driver-popover.voltaris-tour-popover .driver-popover-next-btn {
  background: var(--ep-primary);
  color: #ffffff;
  border-color: var(--ep-primary);
}
.driver-popover.voltaris-tour-popover .driver-popover-next-btn:hover {
  background: var(--ep-primary-dark);
  border-color: var(--ep-primary-dark);
}

/* Schließen-X */
.driver-popover.voltaris-tour-popover .driver-popover-close-btn {
  position: absolute;
  top: 0.65rem;
  right: 0.75rem;
  background: transparent;
  border: none;
  color: var(--ep-text-subtle);
  font-size: 1.1rem;
  padding: 0.15rem 0.35rem;
  line-height: 1;
  border-radius: 0.3rem;
}
.driver-popover.voltaris-tour-popover .driver-popover-close-btn:hover {
  background: var(--ep-surface-2);
  color: var(--ep-primary-dark);
}

/* Pfeil / Caret */
.driver-popover.voltaris-tour-popover .driver-popover-arrow {
  --dp-arrow-color: #ffffff;
}

/* Highlight-Rahmen um das aktive Element – kräftiger Akzentring */
.driver-active-element {
  outline: 3px solid var(--ep-accent) !important;
  outline-offset: 4px !important;
  border-radius: 0.4rem;
  box-shadow: 0 0 0 6px rgba(var(--ep-accent-rgb, 56, 189, 248), 0.18) !important;
}

/* Overlay: bewusst hell gehalten – das Highlight ist dadurch gut sichtbar.
   Die eigentliche Opacity wird über overlayOpacity:0.35 in JS gesteuert;
   dieses CSS-Fallback darf NICHT mit !important überschreiben. */
.driver-overlay {
  /* kein background-Override – Driver.js steuert die Opacity direkt per SVG */
}
