/* ==========================================================================
   NOC Console — Shared Component Library (CSS)
   Used by every page: dashboard, managed-olts, unconfigured-onts,
   provisioning-profiles, vlan-settings, system-logs, access-control,
   platform-settings.
   Plain CSS (no Tailwind @apply dependency) so it works reliably when
   loaded as an external stylesheet alongside the Tailwind CDN script.
   ========================================================================== */

* { font-family: 'Inter', ui-sans-serif, system-ui, sans-serif; }

html, body { background-color: #0b0f19; }

body { color: #e4e4e7; }

/* ---------- Scrollbars ---------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #0f1420; }
::-webkit-scrollbar-thumb { background: #2c3345; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #3d4560; }

/* ==========================================================================
   Layout shell: sidebar / header / backdrop
   ========================================================================== */
#sidebar {
  width: 18rem;
  flex-shrink: 0;
  background-color: #0b0f19;
  border-right: 1px solid rgba(51, 65, 85, 0.5);
  display: flex;
  flex-direction: column;
  transition: transform 0.25s ease-in-out;
}

@media (max-width: 1023px) {
  #sidebar {
    transform: translateX(-100%);
    position: fixed;
    z-index: 50;
    height: 100vh;
    top: 0;
    left: 0;
  }
  #sidebar.sidebar-open { transform: translateX(0); }
}

.nav-link { transition: all 0.15s ease-in-out; }
.nav-link:hover { background-color: rgba(99, 102, 241, 0.08); }
.nav-link.active {
  background-color: rgba(99, 102, 241, 0.15);
  box-shadow: inset 3px 0 0 0 #6366f1;
  color: #ffffff;
}

.status-dot { box-shadow: 0 0 0 3px rgba(0,0,0,0.15); position: relative; }
.status-dot.pulse::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 9999px;
  background: inherit;
  animation: pulse-ring 1.8s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
@keyframes pulse-ring {
  0% { transform: scale(1); opacity: 0.7; }
  100% { transform: scale(2.4); opacity: 0; }
}

/* Content fade used during tenant-switch transitions */
.content-fading { opacity: 0.25; transition: opacity 0.2s ease-in-out; }
.content-fresh { opacity: 1; transition: opacity 0.25s ease-in-out; }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.5rem 0.85rem;
  border-radius: 0.5rem;
  transition: background-color 0.15s ease, opacity 0.15s ease;
  cursor: pointer;
  border: 1px solid transparent;
  white-space: nowrap;
}
.btn:disabled, .btn.is-loading { opacity: 0.75; cursor: not-allowed; }

.btn-primary { background-color: #4f46e5; color: #fff; }
.btn-primary:hover:not(:disabled) { background-color: #4338ca; }

.btn-secondary { background-color: #1e2333; color: #d4d4d8; border-color: rgba(71,85,105,0.5); }
.btn-secondary:hover:not(:disabled) { background-color: #262c40; }

.btn-danger { background-color: rgba(244,63,94,0.15); color: #fb7185; border-color: rgba(244,63,94,0.3); }
.btn-danger:hover:not(:disabled) { background-color: rgba(244,63,94,0.25); }

.btn-ghost { background-color: transparent; color: #a1a1aa; }
.btn-ghost:hover:not(:disabled) { background-color: rgba(148,163,184,0.1); color: #fff; }

.btn-sm { padding: 0.35rem 0.65rem; font-size: 0.7rem; }
.btn-block { width: 100%; }

/* ==========================================================================
   Cards / Panels
   ========================================================================== */
.card {
  background-color: #0f1420;
  border: 1px solid rgba(51,65,85,0.6);
  border-radius: 0.75rem;
  box-shadow: 0 1px 2px 0 rgba(0,0,0,0.4), 0 1px 3px 1px rgba(0,0,0,0.2);
}
.card-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(51,65,85,0.6);
}
.kpi-card { padding: 1.25rem; }

/* ==========================================================================
   Badges
   ========================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 9999px;
  line-height: 1;
  white-space: nowrap;
}
.badge-success { background-color: rgba(16,185,129,0.15); color: #34d399; }
.badge-warning { background-color: rgba(245,158,11,0.15); color: #fbbf24; }
.badge-danger  { background-color: rgba(244,63,94,0.15);  color: #fb7185; }
.badge-info    { background-color: rgba(99,102,241,0.15); color: #818cf8; }
.badge-neutral { background-color: rgba(148,163,184,0.15); color: #a1a1aa; }

/* ==========================================================================
   Form Fields
   ========================================================================== */
.field-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: #a1a1aa;
  margin-bottom: 0.4rem;
}
.field-input, .field-select, .field-textarea {
  width: 100%;
  background-color: #1e2333;
  border: 1px solid rgba(71,85,105,0.6);
  border-radius: 0.5rem;
  padding: 0.6rem 0.75rem;
  font-size: 0.85rem;
  color: #f4f4f5;
}
.field-input::placeholder, .field-textarea::placeholder { color: #71717a; }
.field-input:focus, .field-select:focus, .field-textarea:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.25);
}
.field-input[readonly] {
  background-color: rgba(30,35,51,0.6);
  color: #a1a1aa;
  cursor: not-allowed;
}
.field-select-wrap { position: relative; }
.field-select {
  appearance: none;
  cursor: pointer;
  padding-right: 2.25rem;
}
.field-select-chevron {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: #71717a;
  font-size: 0.7rem;
  pointer-events: none;
}

/* Toggle switch */
.noc-switch { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; }
.noc-switch input { opacity: 0; width: 0; height: 0; }
.noc-switch-track {
  position: absolute; cursor: pointer; inset: 0;
  background-color: #334155; border-radius: 9999px; transition: 0.2s;
}
.noc-switch-track::before {
  content: ""; position: absolute; height: 16px; width: 16px; left: 3px; top: 3px;
  background-color: #e4e4e7; border-radius: 9999px; transition: 0.2s;
}
.noc-switch input:checked + .noc-switch-track { background-color: #4f46e5; }
.noc-switch input:checked + .noc-switch-track::before { transform: translateX(18px); background-color: #fff; }

/* ==========================================================================
   Tables
   ========================================================================== */
.data-table { width: 100%; font-size: 0.875rem; }
.data-table thead th {
  text-align: left;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #71717a;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(51,65,85,0.6);
  white-space: nowrap;
}
.data-table tbody tr { border-bottom: 1px solid rgba(51,65,85,0.4); }
.data-table tbody tr:hover { background-color: rgba(30,41,59,0.3); }
.data-table tbody td { padding: 0.85rem 1rem; vertical-align: middle; }

.row-removing {
  transition: opacity 0.35s ease, transform 0.35s ease;
  opacity: 0;
  transform: translateX(12px);
}

/* ==========================================================================
   Modal
   ========================================================================== */
.noc-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background-color: rgba(0,0,0,0.7);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.noc-modal-panel {
  opacity: 0;
  transform: scale(0.95);
  transition: opacity 0.2s ease, transform 0.2s ease;
  background-color: #0f1420;
  border: 1px solid rgba(71,85,105,0.6);
  border-radius: 1rem;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.7);
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}
.noc-modal-panel.modal-open { opacity: 1; transform: scale(1); }
.noc-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid rgba(51,65,85,0.6);
  position: sticky;
  top: 0;
  background-color: #0f1420;
  z-index: 1;
}
.noc-modal-body { padding: 1.25rem 1.5rem; }
.noc-modal-footer {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.5rem 1.25rem;
  position: sticky;
  bottom: 0;
  background-color: #0f1420;
}

/* ==========================================================================
   Toasts
   ========================================================================== */
#toastContainer { position: fixed; top: 1.25rem; right: 1.25rem; z-index: 70; width: 20rem; }
.toast-item {
  animation: slideInToast 0.25s ease-out;
  background-color: #0f1420;
  border-radius: 0.75rem;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.6);
  padding: 0.85rem 1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  border: 1px solid;
}
@keyframes slideInToast {
  from { transform: translateX(120%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
.toast-success { border-color: rgba(16,185,129,0.4); color: #34d399; }
.toast-info    { border-color: rgba(99,102,241,0.4);  color: #818cf8; }
.toast-neutral { border-color: rgba(113,113,122,0.5); color: #a1a1aa; }
.toast-error   { border-color: rgba(244,63,94,0.4);   color: #fb7185; }

/* ==========================================================================
   Misc
   ========================================================================== */
.mini-bar-track { background-color: #1e2333; }

.spinner {
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: #ffffff;
  border-radius: 9999px;
  width: 14px;
  height: 14px;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.signal-bar-track { background-color: #1e2333; border-radius: 9999px; overflow: hidden; height: 5px; }
