/* Entity colours/icons live in public/js/entity-theme.js -> generated public/css/theme.css. */

.navbar {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* ~13 üst menü öğesi var: xxl'de tek satıra sığması için yatay padding kıs */
.navbar-expand-xxl .navbar-nav .nav-link {
  padding-left: 0.55rem;
  padding-right: 0.55rem;
  white-space: nowrap;
}

/* xxl altı (<1400px): hamburger açılır panel — taşmasın, kaydırılabilir olsun */
@media (max-width: 1399.98px) {
  .navbar .navbar-collapse {
    max-height: calc(100vh - 60px);
    overflow-y: auto;
    margin-top: 0.5rem;
  }
  .navbar .navbar-collapse .navbar-nav {
    margin-bottom: 0.5rem;
  }
  /* sağ taraf kontrolleri (TR/EN + kullanıcı) hamburger içinde solda hizalı */
  .navbar .navbar-collapse > .d-flex {
    justify-content: flex-start;
    padding: 0.25rem 0;
  }
}

/* Navbar validation error badges */
.nav-error-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-left: 6px;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1;
  color: #fff;
  background-color: #dc3545;
  border-radius: 10px;
  vertical-align: middle;
}

.nav-has-error {
  color: #ff8a8a !important;
}

.nav-warning-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-left: 4px;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1;
  color: #000;
  background-color: #ffc107;
  border-radius: 10px;
  vertical-align: middle;
}

.nav-has-warning:not(.nav-has-error) {
  color: #ffe08a !important;
}

/* Entity cards on home page */
.entity-card {
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
  border: none;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.entity-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.entity-card .card-body {
  text-align: center;
}

.entity-card .count {
  font-size: 2.5rem;
  font-weight: bold;
}

/* Tables */
.table-container {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  overflow: hidden;
}

.table thead th {
  background-color: #f0f2f5;
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #495057;
  border-bottom: 2px solid #dee2e6;
}

.table-hover tbody tr {
  cursor: pointer;
}

.table-hover tbody tr:hover {
  background-color: #f8f9fb;
}

/* ID links in tables */
.id-link {
  color: #0d6efd;
  text-decoration: none;
  font-weight: 600;
}

.id-link:hover {
  color: #0a58ca;
  text-decoration: underline;
}

/* Validation errors */
.validation-error {
  border-left: 4px solid #dc3545;
  padding: 8px 12px;
  margin-bottom: 4px;
  background-color: #fff;
  cursor: pointer;
  border-radius: 0 6px 6px 0;
  transition: transform 0.15s, background-color 0.15s;
}

.validation-error:hover {
  background-color: #fff5f5;
  transform: translateX(4px);
}

.validation-warning {
  border-left: 4px solid #ffc107;
  padding: 8px 12px;
  margin-bottom: 4px;
  background-color: #fff;
  cursor: pointer;
  border-radius: 0 6px 6px 0;
  transition: transform 0.15s, background-color 0.15s;
}

.validation-warning:hover {
  background-color: #fffbeb;
  transform: translateX(4px);
}

/* Cards */
.card {
  border: none;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* Search inputs - Material Design with icon */
.search-input-group .input-group-text {
  background: #fff;
  border-right: none;
  border-radius: 20px 0 0 20px;
  color: #6c757d;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.search-input-group .form-control {
  border-left: none;
  border-radius: 0 20px 20px 0;
}

.search-input-group .form-control:focus {
  box-shadow: none;
  border-color: #0d6efd;
}

.search-input-group:focus-within .input-group-text {
  border-color: #0d6efd;
  color: #0d6efd;
}

/* New / Add buttons */
.btn-primary:not(.btn-group .btn-primary) {
  border-radius: 8px;
}

/* btn-group consistent radius */
.btn-group>.btn:first-child {
  border-radius: 8px 0 0 8px;
}

.btn-group>.btn:last-child {
  border-radius: 0 8px 8px 0;
}

.btn-group>.btn:not(:first-child):not(:last-child) {
  border-radius: 0;
}

/* Edit modal */
#editModal .modal-header {
  background: linear-gradient(135deg, #6f42c1 0%, #0d6efd 100%);
  color: #fff;
  border-bottom: none;
}

#editModal .modal-header .modal-title {
  color: #fff;
}

#editModal .modal-header .btn-close {
  filter: brightness(0) invert(1);
}

#editModal .modal-body {
  overflow-y: scroll;
}

#editModal .modal-footer {
  background-color: #f8f9fa;
  border-top: 1px solid #dee2e6;
}

/* Array field groups */
.array-item {
  border: 1px solid #dee2e6;
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 8px;
  background: #fff;
  position: relative;
}

.array-item .array-item-actions {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 5;
  display: flex;
  gap: 2px;
}

.array-item .array-item-actions .insert-btn,
.array-item .array-item-actions .remove-btn {
  padding: 2px 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  background: #fff;
  border: 1px solid #dee2e6;
  color: #6c757d;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
  font-size: 0.7rem;
}

.array-item .array-item-actions .insert-btn:hover {
  background: #0d6efd;
  border-color: #0d6efd;
  color: #fff;
  box-shadow: 0 2px 6px rgba(13, 110, 253, 0.3);
}

.array-item .array-item-actions .remove-btn:hover {
  background: #dc3545;
  border-color: #dc3545;
  color: #fff;
  box-shadow: 0 2px 6px rgba(220, 53, 69, 0.3);
}

/* Legacy fallback for direct remove-btn (without actions wrapper) */
.array-item > .remove-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 5;
  padding: 2px 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: #fff;
  border: 1px solid #dee2e6;
  color: #6c757d;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
  font-size: 0.7rem;
}

.array-item > .remove-btn:hover {
  background: #dc3545;
  border-color: #dc3545;
  color: #fff;
  box-shadow: 0 2px 6px rgba(220, 53, 69, 0.3);
}

/* Sortable array items - drag & drop */
.array-editor.sortable .array-item {
  padding-left: 36px;
  cursor: grab;
}

.array-editor.sortable .array-item:active {
  cursor: grabbing;
}

.array-item .drag-handle {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  color: #adb5bd;
  cursor: grab;
  font-size: 1.1rem;
}

.array-item .drag-handle:hover {
  color: #6c757d;
}

.array-item.dragging {
  opacity: 0.5;
  border-style: dashed;
}

.array-item.drag-over {
  border-color: #0d6efd;
  background: #e7f1ff;
}

.array-item .index-badge {
  min-width: 24px;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
}

/* Nested form cards */
.nested-card {
  border-left: 3px solid #0d6efd;
  margin-bottom: 12px;
}

/* Form sections */
.form-section {
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
  background: #fff;
}

.form-section h6 {
  color: #495057;
  border-bottom: 1px solid #dee2e6;
  padding-bottom: 8px;
  margin-bottom: 12px;
}

/* Tag input */
.tag-container {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  min-height: 38px;
  background: #fff;
  cursor: text;
}

.tag-container .tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  background-color: #0d6efd;
  color: white;
  border-radius: 3px;
  font-size: 0.85rem;
}

.tag-container .tag .remove-tag {
  margin-left: 6px;
  cursor: pointer;
  font-weight: bold;
  opacity: 0.8;
  font-size: 0.9em;
  transition: opacity 0.15s ease;
}

.tag-container .tag .remove-tag:hover {
  opacity: 1;
}

.tag-container input {
  border: none;
  outline: none;
  flex: 1;
  min-width: 80px;
  padding: 2px 4px;
}

/* Route flow visualization */
.flow-diagram {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-radius: 8px;
  overflow-x: auto;
}

.flow-box {
  min-width: 140px;
  max-width: 220px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.8rem;
  text-align: left;
}

.flow-box .flow-title {
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  padding-bottom: 4px;
  margin-bottom: 6px;
}

.flow-box .flow-detail {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.7rem;
  color: #495057;
  word-break: break-all;
}

.flow-box .flow-detail-item {
  padding: 1px 0;
  font-family: monospace;
  font-size: 0.72rem;
}

.flow-source {
  background: #d1ecf1;
  border: 2px solid #0dcaf0;
}

.flow-transform {
  background: #fff3cd;
  border: 2px solid #ffc107;
}

.flow-output {
  background: #d1e7dd;
  border: 2px solid #198754;
}

.flow-framer {
  background: #cfe2ff;
  border: 2px solid #0d6efd;
}

.flow-dispatch {
  background: #f8d7da;
  border: 2px solid #dc3545;
}

.flow-messages {
  background: #e0cffc;
  border: 2px solid #6f42c1;
}

.flow-filter {
  background: #e2e3e5;
  border: 2px solid #6c757d;
}

.flow-compose {
  background: #e0cffc;
  border: 2px solid #6f42c1;
}

.flow-interface {
  background: #d1ecf1;
  border: 2px solid #0dcaf0;
}

.flow-protocol {
  background: #cfe2ff;
  border: 2px solid #0d6efd;
}

.flow-selector {
  background: #fff3cd;
  border: 2px solid #ffc107;
}

.flow-arrow {
  display: flex;
  align-items: center;
  font-size: 1.5rem;
  color: #6c757d;
  flex-shrink: 0;
  padding-top: 8px;
}

.flow-arrow-labeled {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 1.3rem;
  color: #6c757d;
  flex-shrink: 0;
  min-width: 40px;
}

.flow-arrow-label {
  font-size: 0.65rem;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  color: #495057;
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  padding: 1px 6px;
  margin-bottom: 2px;
  white-space: nowrap;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Fan-in / Fan-out multi-arrow layouts */
.flow-fan {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: stretch;
}

.flow-fan-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.flow-fan-row .flow-box {
  flex: 1;
  min-width: 120px;
}

.flow-fan-row .flow-arrow,
.flow-fan-row .flow-arrow-labeled {
  padding-top: 0;
}

/* Mini flow for list tables */
.flow-mini {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  white-space: nowrap;
}

.flow-mini-box {
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}

.flow-mini-arrow {
  color: #6c757d;
}

.flow-mini .flow-source {
  border-width: 1px;
}

.flow-mini .flow-transform {
  border-width: 1px;
}

.flow-mini .flow-output {
  border-width: 1px;
}

/* Byte layout visualization for messages */
.byte-layout {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 8px;
  background: #f8f9fa;
  border-radius: 6px;
}

.byte-block {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-family: monospace;
  background: #cfe2ff;
  border: 1px solid #0d6efd;
  text-align: center;
}

.byte-block .byte-name {
  font-weight: 600;
  display: block;
}

.byte-block .byte-range {
  font-size: 0.65rem;
  color: #6c757d;
}

/* CSV column preview */
.csv-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 8px;
  background: #f8f9fa;
  border-radius: 6px;
}

.csv-col {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-family: monospace;
  background: #d1ecf1;
  border: 1px solid #0dcaf0;
}

/* Expression editor */
.expr-input {
  font-family: monospace;
  background-color: #f8f9fa;
}

/* System page comparison */
.file-status-unchanged {
  color: #198754;
}

.file-status-modified {
  color: #fd7e14;
  font-weight: 600;
}

.file-status-new {
  color: #0d6efd;
  font-weight: 600;
}

.file-status-deleted {
  color: #dc3545;
  font-weight: 600;
}

/* Active nav link */
.nav-link.active-page {
  color: #fff !important;
  font-weight: 600;
}

/* Dropdown item active */
.dropdown-item.active-page {
  background-color: #0d6efd;
  color: #fff;
}

/* Badge colors for interface types */
.badge-type-serial {
  background-color: var(--clr-messages) !important;
  color: #fff !important;
}

.badge-type-can {
  background-color: #22c55e !important;
  color: #fff !important;
}

.badge-type-udp {
  background-color: var(--clr-protocols) !important;
  color: #fff !important;
}

.badge-type-tcp_client,
.badge-type-tcp_server {
  background-color: #8b5cf6 !important;
  color: #fff !important;
}

.badge-type-ros {
  background-color: var(--clr-ros) !important;
  color: #fff !important;
}

/* Device section header colors */
.bg-serial-section {
  background-color: #6366f1 !important;
  color: #fff !important;
}

.bg-can-section {
  background-color: #22c55e !important;
  color: #fff !important;
}

.bg-eth-section {
  background-color: var(--clr-protocols) !important;
  color: #fff !important;
}

/* Loading overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.loading-gear {
  font-size: 4rem;
  color: #0d6efd;
  animation: login-spin 1.5s linear infinite !important;
}

/* LUT map editor */
.lut-entry {
  display: flex;
  gap: 8px;
  margin-bottom: 4px;
}

.lut-entry input {
  flex: 1;
}

/* ===== Material Design Floating Label ===== */
.form-floating-sm {
  position: relative;
}

.form-floating-sm>.form-control,
.form-floating-sm>.form-select {
  height: calc(2.8rem + 2px);
  padding: 1.2rem 0.75rem 0.4rem;
  font-size: 0.85rem;
  line-height: 1.25;
  border-radius: 6px;
  border: 1px solid #ced4da;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  background-color: #fff;
}

.form-floating-sm>label {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  padding: 0.8rem 0.75rem;
  pointer-events: none;
  border: 1px solid transparent;
  transform-origin: 0 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
  color: #6c757d;
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.form-floating-sm>.form-control:focus~label,
.form-floating-sm>.form-control:not(:placeholder-shown)~label,
.form-floating-sm>.form-select~label {
  opacity: 0.85;
  transform: scale(0.78) translateY(-0.55rem) translateX(0.15rem);
  color: #495057;
  font-weight: 600;
}

.form-floating-sm>.form-control:focus,
.form-floating-sm>.form-select:focus {
  border-color: #0d6efd;
  box-shadow: 0 2px 0 0 #0d6efd;
  outline: none;
}

/* Hide placeholder when label is in resting position; show on focus */
.form-floating-sm>.form-control::placeholder {
  color: transparent;
}

.form-floating-sm>.form-control:focus::placeholder {
  color: #6c757d;
}

.form-floating-sm>.searchable-select-container>.form-control::placeholder {
  color: transparent;
}

.form-floating-sm>.searchable-select-container>.form-control:focus::placeholder {
  color: #6c757d;
}

/* Invalid state */
.form-floating-sm>.form-control.is-invalid,
.form-floating-sm>.form-select.is-invalid {
  border-color: #dc3545;
  box-shadow: none;
}

.form-floating-sm>.form-control.is-invalid:focus,
.form-floating-sm>.form-select.is-invalid:focus {
  box-shadow: 0 2px 0 0 #dc3545;
}

.form-floating-sm>.form-control.is-invalid~label {
  color: #dc3545;
}

/* Invalid feedback */
.mb-2>.invalid-feedback {
  display: none;
  font-size: 0.75rem;
  color: #dc3545;
  margin-top: 2px;
  padding-left: 4px;
}

.mb-2.has-validation-error>.invalid-feedback {
  display: block;
}

/* Read-only floating */
.form-floating-sm>.form-control[readonly] {
  background-color: #f8f9fa;
  cursor: default;
}

/* Expression input in floating label */
.form-floating-sm>.form-control.expr-input {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

/* Searchable/Editable Select - Material Design style */
.form-floating-sm>.searchable-select-container {
  position: relative;
  width: 100%;
  overflow: visible;
}

/* Ensure dropdowns are not clipped by modal or scrollable ancestors */
.form-floating-sm {
  overflow: visible;
}

.modal-body .mb-2,
.modal-body .row {
  overflow: visible;
}

.form-floating-sm>.searchable-select-container>.form-control {
  height: calc(2.8rem + 2px);
  padding: 1.2rem 2rem 0.4rem 0.75rem;
  font-size: 0.85rem;
  line-height: 1.25;
  border-radius: 6px;
  border: 1px solid #ced4da;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.55rem center;
  background-size: 14px 10px;
}

.form-floating-sm>.searchable-select-container>.form-control:focus {
  border-color: #0d6efd;
  box-shadow: 0 2px 0 0 #0d6efd;
  outline: none;
}

.form-floating-sm>.searchable-select-container>.form-control.is-invalid {
  border-color: #dc3545;
  box-shadow: none;
}

.form-floating-sm>.searchable-select-container>.form-control.is-invalid:focus {
  box-shadow: 0 2px 0 0 #dc3545;
}

/* Label animation for searchable select - :has() and fallback classes */
.form-floating-sm:has(.searchable-select-container > .form-control:focus)>label,
.form-floating-sm:has(.searchable-select-container > .form-control:not(:placeholder-shown))>label,
.form-floating-sm.has-focus>label,
.form-floating-sm.has-value>label {
  opacity: 0.85;
  transform: scale(0.78) translateY(-0.55rem) translateX(0.15rem);
  color: #495057;
  font-weight: 600;
}

.form-floating-sm:has(.searchable-select-container > .form-control.is-invalid)>label,
.has-validation-error .form-floating-sm>label {
  color: #dc3545;
}

/* Searchable select dropdown styling */
.searchable-select-dropdown {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: calc(2.8rem + 2px);
  max-height: 220px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #dee2e6;
  border-top: none;
  border-radius: 0 0 8px 8px;
  z-index: 1050;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #ced4da transparent;
}

.searchable-select-dropdown.open {
  display: block;
  animation: ss-slide-down 0.15s ease-out;
}

@keyframes ss-slide-down {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.searchable-select-dropdown::-webkit-scrollbar {
  width: 6px;
}

.searchable-select-dropdown::-webkit-scrollbar-track {
  background: transparent;
}

.searchable-select-dropdown::-webkit-scrollbar-thumb {
  background: #ced4da;
  border-radius: 3px;
}

.searchable-select-item {
  padding: 7px 12px;
  cursor: pointer;
  font-size: 0.85rem;
  color: #212529;
  transition: background-color 0.1s ease;
  border-left: 3px solid transparent;
}

.searchable-select-item:hover {
  background-color: #f0f4ff;
  border-left-color: #0d6efd;
}

.searchable-select-item.active {
  background-color: #e7f0ff;
  border-left-color: #0d6efd;
}

.searchable-select-item.selected {
  font-weight: 600;
  color: #0d6efd;
}

.searchable-select-empty {
  padding: 10px 12px;
  color: #6c757d;
  font-size: 0.82rem;
  text-align: center;
  font-style: italic;
}

.searchable-select-item mark {
  background: #d4e5ff;
  color: #0d6efd;
  padding: 0 1px;
  border-radius: 2px;
}

/* When dropdown is open, connect input border to dropdown */
.searchable-select-container:has(.searchable-select-dropdown.open) > .form-control {
  border-radius: 6px 6px 0 0;
  border-bottom-color: #dee2e6;
}

/* Hint tooltip icon */
.hint-icon {
  font-size: 0.72rem;
  color: #6c757d;
  cursor: help;
  margin-left: 3px;
  pointer-events: auto;
  position: relative;
  z-index: 2;
}

.hint-icon:hover {
  color: #0d6efd;
}

/* Tooltip style */
.tooltip-inner {
  max-width: 280px;
  text-align: left;
  font-size: 0.78rem;
  padding: 6px 10px;
}

/* Tag field wrapper - Material Design style */
.tag-field-wrapper {
  position: relative;
  border: 1px solid #ced4da;
  border-radius: 6px;
  background: #fff;
  padding-top: 1.2rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.tag-field-wrapper:focus-within {
  border-color: #0d6efd;
  box-shadow: 0 2px 0 0 #0d6efd;
}

.tag-field-wrapper>.tag-field-label {
  position: absolute;
  top: 0;
  left: 0.75rem;
  transform: scale(0.78) translateY(-0.05rem);
  transform-origin: 0 0;
  color: #495057;
  font-size: 0.85rem;
  font-weight: 600;
  pointer-events: none;
  opacity: 0.85;
  white-space: nowrap;
}

.tag-field-wrapper>.tag-field-label .hint-icon {
  pointer-events: auto;
}

.tag-field-wrapper>.tag-container {
  border: none;
  border-radius: 0 0 6px 6px;
  min-height: 2rem;
  box-shadow: none;
}

.tag-field-wrapper>.tag-container:focus-within {
  box-shadow: none;
}

/* Tag container match floating height (standalone) */
.mb-2>.tag-container {
  min-height: calc(2.8rem + 2px);
  border-radius: 6px;
  transition: border-color 0.2s ease;
}

.mb-2>.tag-container:focus-within {
  border-color: #0d6efd;
  box-shadow: 0 2px 0 0 #0d6efd;
}

/* Number input spinner */
.form-floating-sm>input[type="number"]::-webkit-inner-spin-button {
  margin-top: 0.8rem;
}

/* Autocomplete dropdown for tag input */
.autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 220px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #dee2e6;
  border-top: none;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
  z-index: 1050;
  display: none;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #ced4da transparent;
}

.autocomplete-dropdown::-webkit-scrollbar {
  width: 6px;
}

.autocomplete-dropdown::-webkit-scrollbar-track {
  background: transparent;
}

.autocomplete-dropdown::-webkit-scrollbar-thumb {
  background: #ced4da;
  border-radius: 3px;
}

.autocomplete-dropdown.show {
  display: block;
  animation: ss-slide-down 0.15s ease-out;
}

.autocomplete-item {
  padding: 7px 12px;
  cursor: pointer;
  font-size: 0.85rem;
  color: #212529;
  transition: background-color 0.1s ease;
  border-left: 3px solid transparent;
}

.autocomplete-item:hover,
.autocomplete-item.active {
  background-color: #f0f4ff;
  border-left-color: #0d6efd;
}

.autocomplete-item mark {
  background: #d4e5ff;
  color: #0d6efd;
  padding: 0 1px;
  border-radius: 2px;
}

/* ===== Diff Comparison View ===== */
.diff-link {
  color: #0d6efd;
  text-decoration: none;
}

.diff-link:hover {
  text-decoration: underline;
}

.diff-container {
  font-size: 0.82rem;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

.diff-header-row,
.diff-row {
  display: flex;
  border-bottom: 1px solid #e9ecef;
}

.diff-header-row {
  background: #f8f9fa;
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 1;
  border-bottom: 2px solid #dee2e6;
}

.diff-col-path {
  flex: 0 0 20%;
  padding: 4px 8px;
  color: #495057;
  border-right: 1px solid #e9ecef;
  word-break: break-all;
}

.diff-col-data,
.diff-col-applied {
  flex: 0 0 30%;
  padding: 4px 8px;
  word-break: break-all;
}

.diff-col-applied {
  border-right: 1px solid #e9ecef;
}

.diff-col-path-right {
  flex: 0 0 20%;
  padding: 4px 8px;
  color: #495057;
  border-left: 1px solid #e9ecef;
  word-break: break-all;
}

/* Entity headers */
.diff-entity {
  margin-bottom: 8px;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  overflow: hidden;
}

.diff-entity-header {
  padding: 6px 12px;
  background: #f1f3f5;
  border-bottom: 1px solid #dee2e6;
  font-size: 0.85rem;
}

.diff-entity-added .diff-entity-header {
  background: #d1e7dd;
}

.diff-entity-removed .diff-entity-header {
  background: #f8d7da;
}

.diff-entity-modified .diff-entity-header {
  background: #fff3cd;
}

/* Row colors */
.diff-row-added {
  background: rgba(209, 231, 221, 0.25);
}

.diff-added {
  background: #d1e7dd;
  font-weight: 600;
}

.diff-row-removed {
  background: rgba(248, 215, 218, 0.25);
}

.diff-removed {
  background: #f8d7da;
  font-weight: 600;
}

.diff-row-changed {
  background: rgba(255, 243, 205, 0.25);
}

.diff-changed-data {
  background: #d1e7dd;
  font-weight: 600;
}

.diff-changed-applied {
  background: #f8d7da;
  font-weight: 600;
}

/* Diff-only mode - sadece değişiklikleri göster */
.diff-only-mode .diff-row:not(.diff-has-change) {
  display: none;
}

.diff-only-mode .diff-entity-unchanged {
  display: none;
}

.diff-filter-row {
  padding: 8px 12px;
  background: #f8f9fa;
  border-radius: 6px;
  border: 1px solid #e9ecef;
}

/* ===== Validation Status Dots ===== */
.validation-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}

.validation-dot-error {
  background-color: #dc3545;
}

.validation-dot-warning {
  background-color: #ffc107;
}

.validation-dot-ok {
  background-color: #198754;
}

/* ===== Validation Filter Pills ===== */
.validation-filter {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 12px;
  border-radius: 14px;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid #dee2e6;
  background: #fff;
  color: #495057;
  transition: all 0.2s ease;
  user-select: none;
}

.filter-pill:hover:not(.disabled) {
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.filter-pill.disabled {
  opacity: 0.4;
  cursor: default;
}

.filter-pill-all.active {
  background: #0d6efd;
  color: #fff;
  border-color: #0d6efd;
}

.filter-pill-error.active {
  background: #dc3545;
  color: #fff;
  border-color: #dc3545;
}

.filter-pill-warning.active {
  background: #ffc107;
  color: #212529;
  border-color: #ffc107;
}

.filter-pill-ok.active {
  background: #198754;
  color: #fff;
  border-color: #198754;
}

/* ===== Mermaid Diagram ===== */
#system-diagram .node {
  cursor: pointer;
}

/* No hover filter on node shapes: a CSS filter on any element inside the
   inline SVG makes Chrome re-rasterize the whole diagram layer for the
   duration of the effect, and the far-away nodes (compose hexagons) flash
   bright for a frame or two before settling. The hover highlight is the
   stroke change applied by the JS hover-intent handler (home.js), which is a
   paint-only property. */

/* Ok geçiş efektleri (hover JS ile yönetilir) */
#system-diagram .edgePath path {
  transition: stroke-width 0.2s ease, stroke 0.2s ease;
}

#system-diagram .mermaid {
  overflow-x: auto;
}

/* Diagram zoom/pan wrapper */
.diagram-viewport {
  position: relative;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fafbfc;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}

.diagram-viewport:active {
  cursor: grabbing;
}

.diagram-viewport .mermaid {
  transform-origin: 0 0;
  overflow: visible;
}

/* Edge label parts that open an editor: producer half and message half, each
   painted as that entity's chip. The label box itself stays transparent. */
.diagram-viewport .edgeLabel .edge-chip { display: inline-block; font-weight: 500; font-size: 11px; line-height: 1.1; padding: 1px 5px; margin: 0; border-radius: 0; background: #f1f5f9; color: #334155; border: 1px solid #cbd5e1; }
.diagram-viewport .edgeLabel .edge-chip + .edge-chip { margin-left: -1px; }
.diagram-viewport .edgeLabel .edge-chip:first-child { border-top-left-radius: 6px; border-bottom-left-radius: 6px; }
.diagram-viewport .edgeLabel .edge-chip:last-child { border-top-right-radius: 6px; border-bottom-right-radius: 6px; }
.diagram-viewport .edgeLabel .edge-link { cursor: pointer; }
/* No filter/opacity here: a CSS filter inside a foreignObject makes Chrome
   re-rasterize the whole SVG layer on every hover (the diagram blinks). */
.diagram-viewport .edgeLabel .edge-link:hover { text-decoration: underline; }
.diagram-viewport .edgeLabel:has(.edge-link) p,
.diagram-viewport .edgeLabel:has(.edge-link) > span { background: transparent !important; }

.diagram-controls {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 10;
}

.diagram-controls button {
  width: 32px;
  height: 32px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  color: #374151;
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  transition: background 0.15s, border-color 0.15s;
  padding: 0;
  line-height: 1;
}

.diagram-controls button:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
}

.diagram-zoom-info {
  position: absolute;
  bottom: 8px;
  right: 8px;
  font-size: 0.7rem;
  color: #6b7280;
  background: rgba(255,255,255,0.85);
  padding: 2px 8px;
  border-radius: 4px;
  z-index: 10;
  pointer-events: none;
}

/* Unused entities HTML grid (below Mermaid diagram) */
.unused-entities-section {
  margin-top: 16px;
  padding: 12px 16px;
  background: #fff8f0;
  border: 1px dashed #e2e8f0;
  border-radius: 8px;
}

.unused-entities-header {
  margin-bottom: 10px;
  font-size: 0.9rem;
}

.unused-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 8px;
}

.unused-card {
  border: 1px dashed;
  border-radius: 8px;
  padding: 8px 12px;
  opacity: 0.85;
  cursor: pointer;
  text-align: center;
  transition: opacity 0.15s, transform 0.15s, box-shadow 0.15s;
}

.unused-card:hover {
  opacity: 1;
  transform: translateY(-2px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.unused-card-type {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.unused-card-id {
  font-weight: 700;
  font-size: 0.88rem;
  margin-top: 2px;
}

.unused-card-details {
  font-size: 0.7rem;
  opacity: 0.7;
  margin-top: 2px;
}

.unused-dot-err {
  color: #dc3545;
}

.unused-dot-warn {
  color: #ffc107;
}

/* ===== Diagram Loader ===== */
.diagram-loader-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: #6b7280;
  background: #fafbfc;
  z-index: 15;
}

.diagram-loader-overlay .spinner-border {
  width: 2rem;
  height: 2rem;
  color: #0d6efd;
}

.diagram-loader-text {
  font-size: 0.85rem;
}

/* ===== Login Overlay ===== */
.login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.login-loading {
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-loading-icon {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 120px;
  height: 120px;
}

.bi-gear-fill {
  display: inline-block;
  animation: login-spin 5s linear infinite !important;
}

.login-loading-logo {
  font-size: 150px;
  color: rgba(255, 255, 255, 0.9);
  z-index: 1;
  animation: login-spin 2s linear infinite !important;
}


@keyframes login-spin {
  to {
    transform: rotate(360deg);
  }
}

.login-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  width: 100%;
  max-width: 400px;
  overflow: hidden;
}

.login-header {
  text-align: center;
  padding: 32px 24px 16px;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-bottom: 1px solid #dee2e6;
}

.login-logo {
  font-size: 3rem;
  color: #0d6efd;
  display: block;
  margin-bottom: 8px;
}

.login-header h3 {
  margin: 0;
  font-weight: 700;
  color: #212529;
  letter-spacing: 2px;
}

.login-header small {
  color: #6c757d;
  font-size: 0.85rem;
}

.login-body {
  padding: 24px;
}

.login-body .form-label {
  font-weight: 600;
  font-size: 0.85rem;
  color: #495057;
}

.login-body .input-group-text {
  background: #f8f9fa;
  border-right: none;
}

.login-body .input-group .form-control {
  border-left: none;
}

.login-body .input-group .form-control:focus {
  box-shadow: none;
  border-color: #0d6efd;
}

.login-body .input-group:focus-within .input-group-text {
  border-color: #0d6efd;
  color: #0d6efd;
}

/* ===== Log Panel ===== */
.log-table-wrapper {
  max-height: 500px;
  overflow-y: auto;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  font-size: 0.82rem;
}

#logs-table {
  table-layout: fixed;
  word-break: break-word;
}

#logs-table thead {
  background: #f8f9fa;
  z-index: 1;
}

#logs-table th,
#logs-table td {
  padding: 0.25rem 0.4rem;
  vertical-align: top;
}

.log-cell-time {
  font-family: monospace;
  font-size: 0.78rem;
  color: #6c757d;
  white-space: nowrap;
}

.log-cell-component {
  font-family: monospace;
  font-size: 0.78rem;
}

.log-cell-message {
  word-break: break-word;
}

.log-cell-fields {
  font-size: 0.75rem;
  line-height: 1.5;
  word-break: break-all;
}

.log-level-badge {
  font-size: 0.68rem;
  padding: 0.15em 0.4em;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.log-field-important {
  display: inline-block;
  background: #e2e3e5;
  border-radius: 3px;
  padding: 0 3px;
  margin: 1px 2px 1px 0;
  font-family: monospace;
  font-size: 0.73rem;
}

.log-field-important em {
  font-style: normal;
  font-weight: 600;
}

.log-field {
  display: inline-block;
  margin: 1px 2px 1px 0;
  font-family: monospace;
  font-size: 0.73rem;
  color: #6c757d;
}

.log-field em {
  font-style: normal;
}

.log-row-error {
  background-color: #f8d7da !important;
}

.log-row-warn {
  background-color: #fff3cd !important;
}

.log-row-raw {
  background-color: #f0f0f0 !important;
}

/* ===== System Resources (60s timeline charts) ===== */
.resource-card {
  --chart-color: var(--clr-cpu);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  background: #fff;
}
.resource-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.resource-label {
  font-weight: 600;
  color: #374151;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
}
.resource-label .bi {
  color: var(--chart-color);
}
.resource-scale {
  font-size: 0.7rem;
  font-weight: 500;
  color: #9ca3af;
}
.resource-pct-inline {
  font-size: 1.25rem;
  font-weight: 700;
  color: #1f2937;
  font-variant-numeric: tabular-nums;
}
.resource-chart-wrap {
  position: relative;
  width: 100%;
  height: 90px;
  margin-top: 2px;
}
.resource-chart {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}
.chart-grid {
  stroke: #e5e7eb;
  stroke-width: 1;
  stroke-dasharray: 3 3;
  vector-effect: non-scaling-stroke;
}
.chart-line {
  fill: none;
  stroke: var(--chart-color);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}
.chart-area {
  fill: var(--chart-color);
  opacity: 0.18;
  stroke: none;
}
.resource-axis {
  display: flex;
  justify-content: space-between;
  font-size: 0.65rem;
  color: #9ca3af;
  margin-top: 2px;
  padding: 0 1px;
}

/* Canli Diagnostics (babcore) tile yardimcilari */
.diag-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  vertical-align: middle;
  margin-right: 2px;
  margin-bottom: 2px;
}
.diag-state-chart {
  background: rgba(0, 0, 0, 0.03);
  border-radius: 4px;
}
.diag-iface-bar .progress-bar { transition: width .3s ease; }

#logs-filters .form-select-sm,
#logs-filters .form-control-sm {
  font-size: 0.8rem;
}

.badge-type-modbus_tcp {
  background-color: #b45309 !important;
  color: #fff !important;
}

/* ===== Page skeleton (style guide §3) ===== */
.page-header h4 { font-weight: 600; letter-spacing: -0.01em; }
.page-intro { border-radius: .5rem; padding: .6rem .9rem; margin-bottom: 1rem; font-size: .9rem; border: 1px solid rgba(0,0,0,.06); }
.page-intro code { background: rgba(255,255,255,.55); padding: 0 .25rem; border-radius: .2rem; color: inherit; }
.ent-badge, .ent-chip, .type-badge { font-weight: 500; letter-spacing: .01em; }
.form-section { border: 1px solid #e5e7eb; border-radius: .5rem; padding: .75rem 1rem; margin-bottom: 1rem; background: #fff; }
.form-section > h6 { font-weight: 600; color: #334155; margin-bottom: .75rem; }
.form-text { color: #64748b; }
