/* ===== Base ===== */
body {
  background: #0d0d0d;
  color: #c9d1d9;
  font-size: .875rem;
}

/* ===== Navbar ===== */
.navbar {
  background: #111 !important;
  border-bottom: 1px solid #222 !important;
  padding-top: .4rem;
  padding-bottom: .4rem;
}
.navbar-brand {
  font-family: 'Courier New', Courier, monospace;
  font-weight: 700;
  letter-spacing: .05em;
  color: #58a6ff !important;
  font-size: .95rem;
}
.nav-link {
  color: #8b949e !important;
  font-size: .8rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: .3rem .75rem !important;
  border-radius: 3px;
  transition: color .15s, background .15s;
}
.nav-link:hover {
  color: #c9d1d9 !important;
  background: #1c1c1c;
}
.nav-link.active {
  color: #58a6ff !important;
  background: #161b22;
}

/* ===== Notification Dropdown ===== */
#notif-menu {
  min-width: 320px;
  max-height: 280px !important;
  overflow-y: auto !important;
}

/* ===== Cards ===== */
.card {
  background: #111;
  border: 1px solid #222;
  border-radius: 4px;
}
.kpi-card {
  border: 1px solid #1f6feb;
  background: #0d1117;
  border-radius: 4px;
  padding: 1.25rem;
  text-align: center;
}
.kpi-card .kpi-value {
  font-size: 2rem;
  font-weight: 700;
  font-family: 'Courier New', Courier, monospace;
  color: #58a6ff;
  line-height: 1.1;
}
.kpi-card .kpi-label {
  font-size: .7rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #8b949e;
  margin-top: .25rem;
}
.kpi-card.kpi-green .kpi-value { color: #3fb950; }
.kpi-card.kpi-green { border-color: #238636; }
.kpi-card.kpi-yellow .kpi-value { color: #d29922; }
.kpi-card.kpi-yellow { border-color: #9e6a03; }

/* ===== Tables ===== */
.table {
  color: #c9d1d9;
  font-size: .8rem;
}
.table th {
  font-size: .68rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #8b949e;
  border-color: #21262d;
  padding: .4rem .5rem;
  font-weight: 500;
}
.table td {
  border-color: #21262d;
  padding: .35rem .5rem;
  vertical-align: middle;
}
.table-hover tbody tr:hover {
  background: #161b22;
  color: #fff;
  cursor: pointer;
}
.table-striped > tbody > tr:nth-of-type(odd) > * {
  background-color: #0d1117;
  color: #c9d1d9;
}
.table-striped > tbody > tr:nth-of-type(even) > * {
  background-color: #111;
  color: #c9d1d9;
}
td.num, th.num { text-align: right; }

/* ===== Mono codes ===== */
.code-mono {
  font-family: 'Courier New', Courier, monospace;
  font-size: .78rem;
  color: #79c0ff;
  letter-spacing: .02em;
}

/* ===== Badges ===== */
.badge { font-size: .65rem; letter-spacing: .04em; border-radius: 3px; }

/* ===== Section header ===== */
.section-header {
  font-size: .7rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #8b949e;
  border-bottom: 1px solid #21262d;
  padding-bottom: .4rem;
  margin-bottom: 1rem;
}

/* ===== Forms ===== */
.form-control,
.form-control:focus,
.form-select,
.form-select:focus {
  background: #0d1117;
  border-color: #30363d;
  color: #c9d1d9;
  font-size: .83rem;
  border-radius: 4px;
}
.form-control:focus,
.form-select:focus {
  border-color: #1f6feb;
  box-shadow: 0 0 0 2px rgba(31,111,235,.25);
}
.form-label {
  font-size: .7rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #8b949e;
  margin-bottom: .25rem;
}
textarea.form-control {
  font-family: 'Courier New', Courier, monospace;
  font-size: .78rem;
  color: #79c0ff;
}

/* ===== Buttons ===== */
.btn-primary {
  background: #1f6feb;
  border-color: #1f6feb;
  font-size: .8rem;
  border-radius: 4px;
}
.btn-primary:hover { background: #388bfd; border-color: #388bfd; }
.btn-outline-secondary {
  border-color: #30363d;
  color: #8b949e;
  font-size: .78rem;
  border-radius: 4px;
}
.btn-outline-secondary:hover { background: #21262d; color: #c9d1d9; }

/* ===== Chart container ===== */
#chart-wrap {
  background: #0d1117;
  border: 1px solid #21262d;
  border-radius: 4px;
  padding: 1rem;
}

/* ===== Detail table ===== */
.detail-table td:first-child {
  color: #8b949e;
  font-size: .7rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  width: 160px;
}
.detail-table td:last-child {
  font-family: 'Courier New', Courier, monospace;
  color: #c9d1d9;
}

/* ===== Sync button ===== */
.btn-sync {
  border: 1px solid #238636;
  color: #3fb950;
  background: transparent;
  font-size: .8rem;
  border-radius: 4px;
  padding: .35rem .85rem;
  letter-spacing: .04em;
  transition: background .15s, color .15s;
}
.btn-sync:hover {
  background: #238636;
  color: #fff;
}

/* ===== Concentration badges ===== */
.badge-conc-alta   { background: #da3633; color: #fff; }
.badge-conc-media  { background: #9e6a03; color: #fff; }
.badge-conc-bassa  { background: #238636; color: #fff; }

/* ===== DataTables dark override ===== */
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
  background: #0d1117;
  border: 1px solid #30363d;
  color: #c9d1d9;
  border-radius: 3px;
  padding: .2rem .4rem;
}
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate .paginate_button {
  color: #8b949e !important;
  font-size: .75rem;
}
.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background: #21262d !important;
  color: #c9d1d9 !important;
  border: 1px solid #30363d !important;
  border-radius: 3px;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
  background: #1f6feb !important;
  color: #fff !important;
  border: 1px solid #1f6feb !important;
  border-radius: 3px;
}

/* ===== Alert ===== */
.alert { border-radius: 4px; font-size: .82rem; }

/* ===== Toast Notifications (Bottom Right Timed Toasts) ===== */
.toast-container-bottom-right {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1090;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 440px;
  width: calc(100vw - 48px);
  pointer-events: none;
}

.toast-item {
  pointer-events: auto;
  background: rgba(22, 27, 34, 0.96);
  backdrop-filter: blur(12px);
  color: #f0f6fc;
  border-radius: 8px;
  padding: 0.85rem 1rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5), 0 0 1px rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid #30363d;
  border-left: 4px solid #58a6ff !important;
  animation: toastSlideInRight 0.35s cubic-bezier(0.21, 1.02, 0.73, 1) forwards;
  transition: transform 0.3s ease, opacity 0.3s ease;
  position: relative;
  overflow: hidden;
}

.toast-item.toast-success { border-left-color: #2ea043 !important; }
.toast-item.toast-danger  { border-left-color: #da3633 !important; }
.toast-item.toast-warning { border-left-color: #d29922 !important; }
.toast-item.toast-info    { border-left-color: #58a6ff !important; }

.toast-item.toast-hiding {
  animation: toastSlideOutRight 0.3s cubic-bezier(0.06, 0.67, 0.37, 0.99) forwards;
}

.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.3);
  width: 100%;
  animation: toastProgress linear forwards;
}

.toast-item.toast-success .toast-progress { background: #3fb950; }
.toast-item.toast-danger .toast-progress  { background: #f85149; }
.toast-item.toast-warning .toast-progress { background: #e3b341; }
.toast-item.toast-info .toast-progress    { background: #58a6ff; }

@keyframes toastSlideInRight {
  from {
    opacity: 0;
    transform: translateX(110%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes toastSlideOutRight {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(110%);
  }
}

@keyframes toastProgress {
  from { width: 100%; }
  to { width: 0%; }
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #0d0d0d; }
::-webkit-scrollbar-thumb { background: #30363d; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #58a6ff; }
