/* ========================================
   Verindra Platform - Custom Styles
   Companion to Tailwind CSS CDN
   ======================================== */

/* ─── Custom Properties ───────────────────────────── */
:root {
  --color-bg-primary: #0a0f1a;
  --color-bg-card: #111827;
  --color-bg-sidebar: #0d1320;
  --color-accent: #06b6d4;
  --admin-header-height: 58px;
  --font-display: 'Rajdhani', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

/* ─── Scrollbar ───────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

/* ─── Alpine.js Cloak ─────────────────────────────── */
[x-cloak] {
  display: none !important;
}

/* ─── Sidebar ─────────────────────────────────────── */
.sidebar {
  width: 240px;
  min-height: 100vh;
  background: var(--color-bg-sidebar);
  border-right: 1px solid #1e293b;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.66);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 35;
}

.sidebar-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.sidebar-header {
  padding: 0 1rem;
  /* Extra top padding on devices with notch/Dynamic Island */
  padding-top: max(0px, env(safe-area-inset-top));
  border-bottom: 1px solid #1e293b;
  min-height: var(--admin-header-height);
  display: flex;
  align-items: center;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 1rem;
  border-radius: 0.5rem;
  color: #94a3b8;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.15s ease;
  text-decoration: none;
}

.nav-link:hover {
  background: rgba(6, 182, 212, 0.08);
  color: #e2e8f0;
}

.nav-link.active {
  background: rgba(6, 182, 212, 0.12);
  color: #06b6d4;
}

.nav-link .material-icons {
  flex-shrink: 0;
}

.main-content {
  margin-left: 240px;
  min-height: 100vh;
}

.main-content>header {
  height: var(--admin-header-height);
  box-sizing: border-box;
  align-items: center;
  /* Avoid content hiding behind iOS status bar on scroll */
  padding-top: max(0px, env(safe-area-inset-top));
}

/* ─── Toast Notifications ─────────────────────────── */
.toast-container {
  position: fixed;
  /* Respect iOS notch / Dynamic Island */
  top: max(1rem, calc(env(safe-area-inset-top) + 0.5rem));
  right: max(1rem, calc(env(safe-area-inset-right) + 0.5rem));
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  transform: translateX(120%);
  transition: transform 0.3s ease;
  max-width: 360px;
}

.toast--visible {
  transform: translateX(0);
}

.toast--success {
  background: #065f46;
  color: #a7f3d0;
  border: 1px solid #10b981;
}

.toast--error {
  background: #7f1d1d;
  color: #fca5a5;
  border: 1px solid #ef4444;
}

.toast--info {
  background: #164e63;
  color: #a5f3fc;
  border: 1px solid #06b6d4;
}

/* ─── Pulse Animation ─────────────────────────────── */
@keyframes pulse-dot {

  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
  }

  50% {
    box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
  }
}

.pulse-online {
  animation: pulse-dot 2s infinite;
}

/* ─── Ping Colors ─────────────────────────────────── */
.ping-good {
  color: #22c55e;
}

.ping-medium {
  color: #eab308;
}

.ping-bad {
  color: #ef4444;
}

/* ─── VPN Badge ───────────────────────────────────── */
.vpn-yes {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.vpn-no {
  color: #22c55e;
  font-size: 0.75rem;
}

.ui-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 1rem;
  height: 1rem;
  border-radius: 0.25rem;
  border: 1px solid #334155;
  background-color: #0b1220;
  cursor: pointer;
  transition: all 0.18s ease;
  display: inline-block;
  vertical-align: middle;
}

.ui-checkbox:hover {
  border-color: #0ea5b7;
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.12);
}

.ui-checkbox:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.22);
}

.ui-checkbox:checked {
  border-color: #06b6d4;
  background-color: #06b6d4;
  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='%23040b18' stroke-width='3' stroke-linecap='round' stroke-linejoin='round' d='M3.5 8.5 6.7 11.7 12.5 5.8'/%3E%3C/svg%3E");
  background-size: 0.72rem 0.72rem;
  background-position: center;
  background-repeat: no-repeat;
}

.ui-checkbox:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

/* ─── Flag ────────────────────────────────────────── */
.flag-img {
  vertical-align: middle;
  border-radius: 2px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* ─── Modal ───────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

/* ─── RCON Console ────────────────────────────────── */
.rcon-output {
  background: #030712;
  border: 1px solid #1e293b;
  border-radius: 0.5rem;
  padding: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  /* pre-wrap: preserves newlines but wraps long lines on mobile */
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 300px;
  overflow-y: auto;
  color: #22c55e;
  overflow-x: hidden;
}

/* ─── Ban Type Colors ─────────────────────────────── */
.ban-ip {
  background: #dc2626;
}

.ban-guid {
  background: #0891b2;
}

.ban-range {
  background: #d97706;
}

.ban-asn {
  background: #7c3aed;
}

.ban-isp {
  background: #db2777;
}

.ban-country {
  background: #16a34a;
}

.ban-name {
  background: #ca8a04;
}

.ban-city {
  background: #2563eb;
}

/* ─── Table Hover ─────────────────────────────────── */
tbody tr {
  transition: background 0.15s ease;
}

tbody tr:hover {
  background: rgba(6, 182, 212, 0.06);
}

/* Match Tailwind's md: breakpoint (768px) — no 1px gap at exactly 768px */
@media (max-width: 767px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    display: block;
  }

  .main-content {
    margin-left: 0;
  }

  /* Sidebar footer above iOS home bar */
  .sidebar>*:last-child {
    padding-bottom: max(0.75rem, calc(env(safe-area-inset-bottom) + 0.25rem));
  }
}

@media (min-width: 768px) {
  .sidebar-backdrop {
    display: none;
  }
}