/* ============================================================
   OPS Dashboard - Custom Styles
   ============================================================ */

/* ---------- Scrollbars ---------- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: #111827;
}
::-webkit-scrollbar-thumb {
  background: #374151;
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: #4B5563;
}
* {
  scrollbar-width: thin;
  scrollbar-color: #374151 #111827;
}

/* ---------- Terminal / Log Output ---------- */
.terminal {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
  font-size: 0.8125rem;
  line-height: 1.6;
  background: #0a0e1a;
  color: #d1fae5;
  border: 1px solid #1f2937;
  border-radius: 0.5rem;
  padding: 1rem;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.terminal .line-info   { color: #93c5fd; }
.terminal .line-ok     { color: #6ee7b7; }
.terminal .line-warn   { color: #fcd34d; }
.terminal .line-error  { color: #fca5a5; }
.terminal .line-dim    { color: #6b7280; }
.terminal .line-cmd    { color: #c4b5fd; }

/* ---------- Status Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.125rem 0.625rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.025em;
  text-transform: uppercase;
}
.badge-green  { background: rgba(16,185,129,0.15); color: #34d399; border: 1px solid rgba(52,211,153,0.3); }
.badge-red    { background: rgba(239,68,68,0.15);  color: #f87171; border: 1px solid rgba(248,113,113,0.3); }
.badge-yellow { background: rgba(245,158,11,0.15); color: #fbbf24; border: 1px solid rgba(251,191,36,0.3); }
.badge-gray   { background: rgba(107,114,128,0.15);color: #9ca3af; border: 1px solid rgba(156,163,175,0.3); }
.badge-blue   { background: rgba(59,130,246,0.15); color: #60a5fa; border: 1px solid rgba(96,165,250,0.3); }

/* Status dot pulse for "starting" / "restarting" states */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.status-dot-green  { background: #34d399; }
.status-dot-red    { background: #f87171; }
.status-dot-yellow { background: #fbbf24; animation: pulse-yellow 1.5s infinite; }
.status-dot-gray   { background: #6b7280; }

@keyframes pulse-yellow {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

/* ---------- Loading / Spinner ---------- */
.spinner {
  width: 1rem;
  height: 1rem;
  border: 2px solid #374151;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
  flex-shrink: 0;
}
.spinner-lg {
  width: 2rem;
  height: 2rem;
  border-width: 3px;
}

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

/* Pulse shimmer for loading placeholders */
@keyframes shimmer {
  0%   { opacity: 0.4; }
  50%  { opacity: 0.8; }
  100% { opacity: 0.4; }
}
.shimmer { animation: shimmer 1.5s ease-in-out infinite; }

/* ---------- Page Transitions ---------- */
.page-enter {
  animation: pageIn 0.2s ease-out;
}
@keyframes pageIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Progress Bars ---------- */
.progress-bar-track {
  background: #1f2937;
  border-radius: 9999px;
  height: 0.625rem;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  border-radius: 9999px;
  transition: width 0.4s ease;
}

/* ---------- Sidebar ---------- */
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.9375rem;
  font-weight: 500;
  color: #9ca3af;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  user-select: none;
}
.sidebar-link:hover {
  background: #1f2937;
  color: #f3f4f6;
}
.sidebar-link.active {
  background: rgba(59,130,246,0.15);
  color: #60a5fa;
  border: 1px solid rgba(59,130,246,0.25);
}

/* ---------- Cards ---------- */
.card {
  background: #1f2937;
  border: 1px solid #374151;
  border-radius: 0.75rem;
  padding: 1.25rem;
  transition: border-color 0.2s;
}
.card:hover {
  border-color: #4b5563;
}

/* ---------- Toast Notifications ---------- */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  min-width: 280px;
  max-width: 420px;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  border-radius: 0.625rem;
  border: 1px solid transparent;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
  animation: toastIn 0.25s ease-out;
  font-size: 0.875rem;
  line-height: 1.4;
}
.toast-success { background: #064e3b; border-color: #065f46; color: #6ee7b7; }
.toast-error   { background: #450a0a; border-color: #7f1d1d; color: #fca5a5; }
.toast-warning { background: #451a03; border-color: #78350f; color: #fcd34d; }
.toast-info    { background: #1e3a5f; border-color: #1e40af; color: #93c5fd; }

.toast-dismiss {
  margin-left: auto;
  cursor: pointer;
  opacity: 0.6;
  padding: 0 0.25rem;
  font-size: 1rem;
  flex-shrink: 0;
}
.toast-dismiss:hover { opacity: 1; }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}
.toast-out {
  animation: toastOut 0.2s ease-in forwards;
}
@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(20px); }
}

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(2px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn 0.15s ease-out;
}
.modal-box {
  background: #1f2937;
  border: 1px solid #374151;
  border-radius: 0.875rem;
  width: 100%;
  max-width: 560px;
  max-height: 85vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: modalIn 0.2s ease-out;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #374151;
}
.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}
.modal-footer {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  padding: 1rem 1.5rem;
  border-top: 1px solid #374151;
}

@keyframes fadeIn  { from { opacity: 0 } to { opacity: 1 } }
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(-10px); }
  to   { opacity: 1; transform: scale(1)    translateY(0); }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s, transform 0.1s;
  border: none;
  outline: none;
  white-space: nowrap;
  user-select: none;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary { background: #2563eb; color: #fff; }
.btn-primary:hover:not(:disabled) { background: #1d4ed8; }

.btn-success { background: #059669; color: #fff; }
.btn-success:hover:not(:disabled) { background: #047857; }

.btn-danger  { background: #dc2626; color: #fff; }
.btn-danger:hover:not(:disabled)  { background: #b91c1c; }

.btn-warning { background: #d97706; color: #fff; }
.btn-warning:hover:not(:disabled) { background: #b45309; }

.btn-ghost   { background: transparent; color: #9ca3af; border: 1px solid #374151; }
.btn-ghost:hover:not(:disabled) { background: #1f2937; color: #f3f4f6; }

.btn-sm { padding: 0.25rem 0.625rem; font-size: 0.8125rem; }
.btn-xs { padding: 0.125rem 0.5rem;  font-size: 0.75rem; border-radius: 0.375rem; }

/* ---------- Tables ---------- */
.table-wrapper {
  overflow-x: auto;
  border-radius: 0.5rem;
  border: 1px solid #374151;
}
table.ops-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
table.ops-table th {
  background: #111827;
  color: #6b7280;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.75rem 1rem;
  text-align: left;
  white-space: nowrap;
}
table.ops-table td {
  padding: 0.75rem 1rem;
  border-top: 1px solid #1f2937;
  color: #d1d5db;
  vertical-align: middle;
}
table.ops-table tbody tr:hover td { background: rgba(255,255,255,0.02); }

/* ---------- Form Elements ---------- */
.form-input, .form-select {
  background: #111827;
  border: 1px solid #374151;
  border-radius: 0.5rem;
  color: #f3f4f6;
  font-size: 0.875rem;
  padding: 0.5rem 0.875rem;
  width: 100%;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-input:focus, .form-select:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.2);
}
.form-input::placeholder { color: #4b5563; }
.form-select option { background: #1f2937; color: #f3f4f6; }

.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #9ca3af;
  margin-bottom: 0.375rem;
}

/* ---------- Auto-refresh indicator ---------- */
.refresh-ring {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #374151;
  border-top-color: #3b82f6;
  animation: spin 1s linear infinite;
}
.refresh-ring.paused { animation: none; border-top-color: #374151; }

/* ---------- Disk usage color thresholds ---------- */
.disk-ok      { background: #059669; }
.disk-warn    { background: #d97706; }
.disk-danger  { background: #dc2626; }

/* ---------- Responsive sidebar ---------- */
@media (max-width: 768px) {
  .sidebar-mobile-hidden { display: none; }
  .sidebar-mobile-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 40;
  }
}

/* ---------- Utility ---------- */
.truncate-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.mono { font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace; }

/* Mini Action Buttons for Enhanced Dashboard */
.btn-mini {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: white;
  border-radius: 0.25rem;
  transition: background-color 0.2s;
  border: none;
  cursor: pointer;
}

.btn-micro {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.375rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: white;
  border-radius: 0.25rem;
  transition: background-color 0.2s;
  border: none;
  cursor: pointer;
}

/* Dashboard Spacing Fixes */
/* Remove excessive spacing that creates visual lines */
.page-enter.space-y-6 > * + * {
  margin-top: 1rem !important;
}

.mb-8 {
  margin-bottom: 1.5rem !important;
}

/* Ensure smooth transitions between sections */
.card {
  border: 1px solid rgba(55, 65, 81, 0.5);
  background: rgba(17, 24, 39, 0.8);
  backdrop-filter: blur(8px);
}

/* Remove any potential border or shadow artifacts */
.space-y-6 {
  gap: 1rem;
}
/* Mobile Modal Fixes */
.modal-overlay, .overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 9999;
}

/* Make modals easier to dismiss on mobile */
.modal {
  position: relative;
  max-height: 80vh;
  overflow-y: auto;
  margin: 10vh auto;
  max-width: 95vw;
}

/* Add visible X button for mobile */
.modal-header {
  position: relative;
}

.modal-close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10001;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Force modal to be dismissible */
[x-show] {
  transition: opacity 0.2s ease;
}

/* Emergency close button - always visible */
.emergency-close {
  position: fixed;
  top: 1rem;
  right: 1rem;
  background: #ef4444;
  color: white;
  border: none;
  padding: 0.5rem;
  border-radius: 50%;
  width: 2.5rem;
  height: 2.5rem;
  z-index: 99999;
  cursor: pointer;
  display: none;
}

body.modal-open .emergency-close {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Micro Action Buttons for Services */
.btn-micro {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.375rem;
  font-size: 0.75rem;
  border-radius: 0.25rem;
  border: none;
  cursor: pointer;
  transition: background-color 0.2s;
  min-width: 2rem;
  min-height: 2rem;
}

.btn-micro:hover {
  transform: scale(1.05);
}

.btn-micro:active {
  transform: scale(0.95);
}

/* Touch-friendly sizing for mobile */
@media (max-width: 768px) {
  .btn-micro {
    padding: 0.5rem;
    min-width: 2.5rem;
    min-height: 2.5rem;
  }
}
