/* ============================================================
   STÖRUNGEN MODULE - Styles
   ============================================================ */

/* --- Header --- */
.sto-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 8px;
}

.sto-header h2 {
  font-size: 24px;
  font-weight: 700;
  color: #1e293b;
}

.sto-header-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.sto-meta {
  font-size: 13px;
  color: #64748b;
  margin-bottom: 20px;
}

.sto-warnings {
  background: #fffbeb;
  border: 1px solid #fbbf24;
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 13px;
  color: #92400e;
}

/* --- Quick Time Filters (Pill Buttons) --- */
.sto-quick-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 16px;
  padding: 12px 16px;
  background: white;
  border-radius: 14px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.sto-pill {
  padding: 8px 16px;
  border-radius: 20px;
  border: 1.5px solid #e2e8f0;
  background: #f8fafc;
  color: #475569;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.sto-pill:hover {
  background: #e2e8f0;
  color: #1e293b;
  transform: translateY(-1px);
}

.sto-pill.active {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  color: white;
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
}

.sto-date-inputs {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-left: 4px;
}

.sto-date-inputs input[type="date"] {
  padding: 7px 10px;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-size: 13px;
  color: #475569;
  background: #f8fafc;
  width: 140px;
}

.sto-date-inputs input[type="date"]:focus {
  border-color: #4f46e5;
  outline: none;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.sto-filter-toggle {
  margin-left: auto;
}

/* --- Advanced Filters (collapsible) --- */
.sto-advanced-filters {
  display: none;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 16px;
  animation: stoSlideDown 0.2s ease-out;
}

.sto-advanced-filters.expanded {
  display: block;
}

.sto-filter-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.sto-filter-row .form-group {
  flex: 1;
  min-width: 160px;
  margin-bottom: 0;
}

.sto-filter-row .form-group label {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 4px;
  display: block;
}

.sto-filter-row select,
.sto-filter-row input {
  width: 100%;
  padding: 8px 10px;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  background: white;
}

.sto-filter-row select:focus,
.sto-filter-row input:focus {
  border-color: #4f46e5;
  outline: none;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.sto-filter-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

/* --- KPI Grid (5 cards) --- */
.sto-kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.sto-kpi-card {
  background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
  padding: 20px;
  border-radius: 14px;
  border: 2px solid #e2e8f0;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.sto-kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
}

.sto-kpi-card:nth-child(1)::before { background: #ef4444; }
.sto-kpi-card:nth-child(2)::before { background: #f59e0b; }
.sto-kpi-card:nth-child(3)::before { background: #3b82f6; }
.sto-kpi-card:nth-child(4)::before { background: #10b981; }
.sto-kpi-card:nth-child(5)::before { background: #8b5cf6; }

.sto-kpi-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.sto-kpi-card:nth-child(1):hover { border-color: #ef4444; }
.sto-kpi-card:nth-child(2):hover { border-color: #f59e0b; }
.sto-kpi-card:nth-child(3):hover { border-color: #3b82f6; }
.sto-kpi-card:nth-child(4):hover { border-color: #10b981; }
.sto-kpi-card:nth-child(5):hover { border-color: #8b5cf6; }

.sto-kpi-label {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.sto-kpi-value {
  font-size: 28px;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.2;
}

.sto-kpi-sub {
  font-size: 12px;
  color: #64748b;
  margin-top: 4px;
}

.sto-kpi-delta {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 6px;
  margin-top: 6px;
}

.sto-kpi-delta.up {
  color: #ef4444;
  background: #fef2f2;
}

.sto-kpi-delta.down {
  color: #10b981;
  background: #ecfdf5;
}

.sto-kpi-delta.neutral {
  color: #64748b;
  background: #f1f5f9;
}

/* --- Tabs --- */
.sto-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  background: white;
  padding: 8px;
  border-radius: 14px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.sto-tab {
  flex: 1;
  padding: 12px 20px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: #475569;
  background: #f1f5f9;
  transition: all 0.25s ease;
  text-align: center;
}

.sto-tab:hover {
  background: #e2e8f0;
  color: #1e293b;
  transform: translateY(-1px);
}

.sto-tab.active {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
}

/* --- Dashboard Charts Layout --- */
.sto-chart-row {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
}

.sto-chart-box {
  background: white;
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  border: 1px solid #e2e8f0;
}

.sto-chart-box.w60 { flex: 3; min-width: 0; }
.sto-chart-box.w40 { flex: 2; min-width: 0; }
.sto-chart-box.w50 { flex: 1; min-width: 0; }
.sto-chart-box.full { width: 100%; }

.sto-chart-box h3 {
  font-size: 15px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 14px;
}

.sto-chart-canvas {
  position: relative;
  width: 100%;
  max-height: 300px;
}

/* --- Incident Table --- */
.sto-table-controls {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.sto-search {
  flex: 1;
  min-width: 200px;
  padding: 10px 14px 10px 36px;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  font-size: 14px;
  background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E") 12px center no-repeat;
  transition: all 0.2s ease;
}

.sto-search:focus {
  border-color: #4f46e5;
  outline: none;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.sto-status-filter {
  padding: 10px 14px;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  font-size: 14px;
  background: white;
  min-width: 130px;
}

/* Table itself */
.sto-table-wrap {
  overflow-x: auto;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.sto-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
  background: white;
}

.sto-table thead th {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  color: white;
  padding: 14px 12px;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
  user-select: none;
}

.sto-table thead th:first-child {
  border-radius: 12px 0 0 0;
}

.sto-table thead th:last-child {
  border-radius: 0 12px 0 0;
}

.sto-table thead th .sort-arrow {
  opacity: 0.5;
  margin-left: 4px;
  font-size: 10px;
}

.sto-table thead th.sorted .sort-arrow {
  opacity: 1;
}

.sto-table tbody td {
  padding: 12px;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
  vertical-align: middle;
}

.sto-table tbody tr {
  cursor: pointer;
  transition: background 0.15s ease;
}

.sto-table tbody tr:hover {
  background: #f8fafc;
}

.sto-table tbody tr.expanded {
  background: #eef2ff;
}

.sto-table tbody tr.selected {
  background: #fef2f2;
}
.sto-table tbody tr.selected.expanded {
  background: #fee2e2;
}

/* Expanded detail row */
.sto-detail-row td {
  padding: 0 !important;
  border-bottom: 2px solid #e2e8f0;
}

.sto-detail-content {
  padding: 16px 20px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  animation: stoSlideDown 0.2s ease-out;
}

.sto-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.sto-detail-field {
  font-size: 13px;
}

.sto-detail-field label {
  font-weight: 700;
  color: #64748b;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  display: block;
  margin-bottom: 2px;
}

.sto-detail-field span {
  color: #1e293b;
}

.sto-detail-field.full-width {
  grid-column: 1 / -1;
}

.sto-detail-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #e2e8f0;
}

/* --- Status Badge --- */
.sto-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.sto-status.offen {
  color: #ef4444;
  background: #fef2f2;
  border: 1px solid #fecaca;
}

.sto-status.behoben {
  color: #10b981;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
}

.sto-status.toggleable {
  cursor: pointer;
  transition: all 0.2s ease;
}

.sto-status.toggleable:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

/* --- Kategorie Badge --- */
.sto-kat-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  background: #f1f5f9;
  color: #475569;
}

/* --- Duration Cell --- */
.sto-dauer {
  font-weight: 700;
  white-space: nowrap;
}

.sto-dauer.high { color: #ef4444; }
.sto-dauer.medium { color: #f59e0b; }
.sto-dauer.low { color: #10b981; }

/* --- Pagination --- */
.sto-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  flex-wrap: wrap;
  gap: 10px;
}

.sto-pagination-info {
  font-size: 13px;
  color: #64748b;
}

.sto-pagination-buttons {
  display: flex;
  gap: 4px;
}

.sto-page-btn {
  padding: 6px 12px;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  background: white;
  color: #475569;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.sto-page-btn:hover {
  background: #f1f5f9;
  border-color: #4f46e5;
}

.sto-page-btn.active {
  background: #4f46e5;
  color: white;
  border-color: #4f46e5;
}

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

/* --- Recurring Issues Table --- */
.sto-recurring-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
}

.sto-recurring-badge.critical {
  color: #ef4444;
  background: #fef2f2;
}

.sto-recurring-badge.warning {
  color: #f59e0b;
  background: #fffbeb;
}

.sto-recurring-badge.ok {
  color: #64748b;
  background: #f1f5f9;
}

/* --- Analysis Section --- */
.sto-analysis-section {
  background: white;
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  border: 1px solid #e2e8f0;
}

.sto-analysis-section h3 {
  font-size: 15px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 14px;
}

.sto-side-by-side {
  display: flex;
  gap: 20px;
}

.sto-side-by-side > div {
  flex: 1;
  min-width: 0;
}

/* --- Quick-Add Preset Buttons --- */
.sto-quick-presets {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.sto-preset-btn {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1.5px solid #e2e8f0;
  background: #f8fafc;
  color: #475569;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.sto-preset-btn:hover {
  background: #eef2ff;
  border-color: #4f46e5;
  color: #4f46e5;
}

/* --- Empty State --- */
.sto-empty {
  text-align: center;
  padding: 60px 20px;
  color: #94a3b8;
  font-size: 15px;
}

.sto-empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}

/* --- Animations --- */
@keyframes stoSlideDown {
  from { opacity: 0; max-height: 0; transform: translateY(-8px); }
  to { opacity: 1; max-height: 600px; transform: translateY(0); }
}

/* --- Responsive --- */
@media (max-width: 1200px) {
  .sto-kpi-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 900px) {
  .sto-chart-row {
    flex-direction: column;
  }

  .sto-side-by-side {
    flex-direction: column;
  }

  .sto-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .sto-kpi-value {
    font-size: 22px;
  }
}

@media (max-width: 600px) {
  .sto-kpi-grid {
    grid-template-columns: 1fr 1fr;
  }

  .sto-kpi-card {
    padding: 14px;
  }

  .sto-quick-filters {
    padding: 8px 10px;
  }

  .sto-pill {
    padding: 6px 10px;
    font-size: 12px;
  }

  .sto-date-inputs {
    width: 100%;
  }

  .sto-date-inputs input[type="date"] {
    flex: 1;
    min-width: 0;
  }

  .sto-detail-grid {
    grid-template-columns: 1fr;
  }

  .sto-tabs {
    gap: 4px;
    padding: 6px;
  }

  .sto-tab {
    padding: 10px 8px;
    font-size: 12px;
  }
}
