/* ============================================
   TraumGmbH – Monitor Analytics Dashboard
   ============================================ */

/* === LAYOUT === */
.analytics-wrap {
  padding: 16px;
  max-width: 1200px;
  margin: 0 auto;
}

/* === FILTER BAR === */
.an-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 12px 16px;
}

.an-filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.an-filter-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.an-filter-group select,
.an-filter-group input[type="date"] {
  font-family: var(--font);
  font-size: 13px;
  color: var(--text);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 6px 10px;
  outline: none;
  cursor: pointer;
}

.an-filter-group select:focus,
.an-filter-group input[type="date"]:focus {
  border-color: var(--accent);
}

.an-filter-apply {
  align-self: flex-end;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: var(--r-sm);
  padding: 7px 16px;
  cursor: pointer;
  transition: background 0.15s;
}

.an-filter-apply:hover { background: var(--accent-hover); }

/* === KPI CARDS === */
.an-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.an-kpi {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px;
}

.an-kpi-label {
  font-size: 12px;
  color: var(--text-sec);
  font-weight: 500;
  margin-bottom: 6px;
}

.an-kpi-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.an-kpi-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.an-kpi.good .an-kpi-value  { color: var(--success); }
.an-kpi.warn .an-kpi-value  { color: var(--warning); }
.an-kpi.bad  .an-kpi-value  { color: var(--accent); }

/* === SECTION TITLE === */
.an-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-sec);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 24px 0 12px;
}

/* === CHART CARDS === */
.an-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px;
  margin-bottom: 12px;
}

.an-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
}

.an-card canvas {
  max-height: 260px;
}

/* === WHO WAITS BAR === */
.an-who-wrap {
  margin-top: 8px;
}

.an-who-bar {
  height: 28px;
  border-radius: var(--r-sm);
  overflow: hidden;
  display: flex;
  margin-bottom: 8px;
}

.an-who-kitchen {
  background: var(--info);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  transition: width 0.4s ease;
}

.an-who-pizza {
  background: var(--warning);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  transition: width 0.4s ease;
}

.an-who-legend {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--text-sec);
}

.an-who-legend span { display: flex; align-items: center; gap: 6px; }
.an-who-legend .dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  display: inline-block;
}

/* === HEATMAP === */
.an-heatmap-wrap {
  overflow-x: auto;
}

.an-heatmap {
  display: grid;
  grid-template-columns: 48px repeat(24, 1fr);
  gap: 2px;
  min-width: 700px;
}

.an-hm-cell {
  height: 28px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  color: var(--text);
}

.an-hm-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-sec);
  display: flex;
  align-items: center;
}

.an-hm-hour-label {
  font-size: 10px;
  color: var(--text-muted);
  text-align: center;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Monitor Widget – Bottom Bar ── */
.mk-widget-btn {
  flex: 1;
  border-radius: 10px;
  border: 1.5px solid #81c784;
  background: #f6fdf6;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 6px 10px;
  position: relative;
  transition: background .2s, border-color .2s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.mk-widget-btn:active { transform: scale(.97); }
.mk-widget-btn.yellow { border-color: #fadb75; background: #fefdf5; }
.mk-widget-btn.red    { border-color: rgba(192,57,43,.4); background: #fdf7f6; }

.mk-widget-dot {
  position: absolute;
  top: 7px; right: 7px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #27ae60;
}
.mk-widget-btn.green .mk-widget-dot {
  animation: mk-wd-pulse 2.5s ease-in-out infinite;
}
.mk-widget-btn.yellow .mk-widget-dot { background: #f39c12; }
.mk-widget-btn.red    .mk-widget-dot {
  background: #c0392b;
  animation: mk-wd-blink .9s step-end infinite;
}
@keyframes mk-wd-pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(39,174,96,.5); }
  50%      { box-shadow: 0 0 0 4px rgba(39,174,96,0); }
}
@keyframes mk-wd-blink {
  0%,100% { opacity: 1; }
  50%     { opacity: .1; }
}

.mk-widget-val {
  font-size: 18px;
  font-weight: 700;
  color: #1c1c1a;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.mk-widget-status {
  font-size: 10px;
  font-weight: 700;
  margin-top: 2px;
}
.mk-widget-btn.green  .mk-widget-status { color: #27ae60; }
.mk-widget-btn.yellow .mk-widget-status { color: #d4860a; }
.mk-widget-btn.red    .mk-widget-status { color: #c0392b; }

.mk-widget-hour-lbl {
  position: absolute;
  bottom: 16px; right: 8px;
  font-size: 7px; font-weight: 600;
  color: #1c1c1a; opacity: .25;
  text-transform: uppercase; letter-spacing: .3px;
}
.mk-widget-hour {
  position: absolute;
  bottom: 6px; right: 8px;
  font-size: 9px; font-weight: 500;
  color: #1c1c1a; opacity: .35;
  font-variant-numeric: tabular-nums;
}

/* ── Detail Drawer ── */
.mk-widget-drawer {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  width: 220px;
}
.mk-widget-drawer-inner {
  background: #1c1c1a;
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,.3);
  animation: mk-wd-pop .18s cubic-bezier(.34,1.3,.64,1);
}
@keyframes mk-wd-pop {
  from { opacity: 0; transform: translateY(8px) scale(.96); }
  to   { opacity: 1; transform: none; }
}
.mk-widget-drawer-title {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1.2px;
  color: rgba(255,255,255,.3);
  margin-bottom: 10px;
}
.mk-wd-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.mk-wd-row:last-child { border: none; padding-bottom: 0; }
.mk-wd-key { font-size: 11px; color: rgba(255,255,255,.4); }
.mk-wd-val {
  font-size: 12px; font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: rgba(255,255,255,.8);
}

/* === RAW TABLE === */
.an-table-wrap {
  overflow-x: auto;
}

.an-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.an-table th {
  text-align: left;
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.an-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  white-space: nowrap;
}

.an-table tr:last-child td { border-bottom: none; }
.an-table tr:hover td { background: var(--bg); }

.an-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.an-badge.good { background: var(--success-pale); color: var(--success); }
.an-badge.warn { background: var(--warning-pale); color: var(--warning); }
.an-badge.bad  { background: var(--danger-pale);  color: var(--accent); }
.an-badge.neutral { background: var(--bg-input); color: var(--text-sec); }

/* === PAGINATION === */
.an-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  font-size: 13px;
  color: var(--text-sec);
}

.an-page-btn {
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 6px 14px;
  cursor: pointer;
}

.an-page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.an-page-btn:hover:not(:disabled) { border-color: var(--accent); }

/* === LOADING / EMPTY === */
.an-loading {
  text-align: center;
  padding: 48px;
  color: var(--text-muted);
  font-size: 14px;
}

/* === DESKTOP === */
@media (min-width: 768px) {
  .analytics-wrap { padding: 24px; }
  .an-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
}