/* ═══════════════════════════════════════════════════
   VPN Admin Panel — Custom styles
   (supplements Tailwind utility classes)
═══════════════════════════════════════════════════ */

/* Form elements */
.form-label {
  display: block;
  font-size: 0.75rem;
  color: #9ca3af;
  margin-bottom: 0.25rem;
  font-weight: 500;
}

.form-input {
  width: 100%;
  background-color: #1f2937;
  border: 1px solid #374151;
  border-radius: 0.5rem;
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  color: #f3f4f6;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-input:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}
.form-input::placeholder { color: #6b7280; }
.form-input option { background-color: #1f2937; }

/* Tab buttons */
.tab-btn {
  color: #6b7280;
}
.tab-btn:hover {
  color: #d1d5db;
  background-color: #1f2937;
}
.tab-btn.active {
  color: #818cf8;
  background-color: #1e1b4b;
}

/* Server card */
.server-card {
  background: #111827;
  border: 1px solid #1f2937;
  border-radius: 1rem;
  padding: 1.25rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.server-card:hover {
  border-color: #374151;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

/* Status indicator */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.status-dot.online { background-color: #22c55e; box-shadow: 0 0 6px #22c55e; }
.status-dot.offline { background-color: #ef4444; box-shadow: 0 0 6px #ef4444; }
.status-dot.unknown { background-color: #6b7280; }
.status-dot.deploying {
  background-color: #f59e0b;
  animation: pulse-amber 1s infinite;
}

@keyframes pulse-amber {
  0%, 100% { opacity: 1; box-shadow: 0 0 6px #f59e0b; }
  50% { opacity: 0.5; box-shadow: 0 0 2px #f59e0b; }
}

/* Protocol badge */
.protocol-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
}
.protocol-badge.vless_reality { background: #1e1b4b; color: #a5b4fc; border: 1px solid #3730a3; }
.protocol-badge.trojan { background: #1c1917; color: #fca5a5; border: 1px solid #7f1d1d; }
.protocol-badge.naive_proxy { background: #052e16; color: #86efac; border: 1px solid #166534; }

/* Connection row */
.connection-row {
  background: #1f2937;
  border: 1px solid #374151;
  border-radius: 0.75rem;
  padding: 0.875rem 1rem;
  transition: border-color 0.15s;
}
.connection-row:hover { border-color: #4b5563; }

/* Toggle switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #374151;
  border-radius: 20px;
  transition: 0.2s;
}
.toggle-slider:before {
  content: "";
  position: absolute;
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  border-radius: 50%;
  transition: 0.2s;
}
.toggle-switch input:checked + .toggle-slider { background-color: #6366f1; }
.toggle-switch input:checked + .toggle-slider:before { transform: translateX(16px); }

/* Action button */
.action-btn {
  padding: 0.375rem 0.5rem;
  border-radius: 0.5rem;
  font-size: 0.75rem;
  transition: background-color 0.15s, color 0.15s;
  color: #6b7280;
}
.action-btn:hover { background-color: #374151; color: #d1d5db; }
.action-btn.danger:hover { background-color: #450a0a; color: #fca5a5; }
.action-btn.success:hover { background-color: #052e16; color: #86efac; }

/* Toast */
.toast {
  min-width: 240px;
  max-width: 380px;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  animation: toast-in 0.25s ease;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.toast.success { background: #052e16; border: 1px solid #166534; color: #86efac; }
.toast.error { background: #450a0a; border: 1px solid #7f1d1d; color: #fca5a5; }
.toast.info { background: #1e1b4b; border: 1px solid #3730a3; color: #a5b4fc; }

@keyframes toast-in {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Modal overlay animation */
.modal-overlay { animation: fade-in 0.15s ease; }
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Loading spinner */
.spinner {
  border: 2px solid #374151;
  border-top-color: #6366f1;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Copy button */
.copy-btn {
  padding: 0.25rem 0.5rem;
  background: #374151;
  border-radius: 0.375rem;
  font-size: 0.7rem;
  color: #9ca3af;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.copy-btn:hover { background: #4b5563; color: #fff; }
.copy-btn.copied { background: #052e16; color: #86efac; }

/* Country flag emoji sizing */
.flag { font-size: 1.2rem; line-height: 1; }

/* Role badge */
.role-badge-ru { background: #1c1917; color: #fb923c; border: 1px solid #431407; font-size: 0.65rem; padding: 0.1rem 0.45rem; border-radius: 999px; font-weight: 700; letter-spacing: 0.05em; }
.role-badge-eu { background: #0c1a3a; color: #60a5fa; border: 1px solid #1e3a5f; font-size: 0.65rem; padding: 0.1rem 0.45rem; border-radius: 999px; font-weight: 700; letter-spacing: 0.05em; }
.role-badge-mixed { background: #1a1a2e; color: #a78bfa; border: 1px solid #3b0764; font-size: 0.65rem; padding: 0.1rem 0.45rem; border-radius: 999px; font-weight: 700; letter-spacing: 0.05em; }

/* Scrollbar */
::-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; }

/* ─── Select / Dropdown — global override ───────────────────── */

/* Wrapper adds the custom arrow */
.custom-select-wrap {
  position: relative;
  display: block;
}

.custom-select-wrap::after {
  content: '';
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid #6b7280;
  pointer-events: none;
  transition: border-top-color 0.15s;
  z-index: 1;
}

.custom-select-wrap:focus-within::after {
  border-top-color: #818cf8;
}

/* Apply to ALL select elements (with or without .custom-select class) */
select,
select.form-input,
.custom-select {
  appearance: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  background-image: none !important;
  cursor: pointer;
  padding-right: 2.5rem !important;
  background-color: #1f2937;
  border: 1px solid #374151;
  border-radius: 0.5rem;
  color: #f3f4f6;
  font-size: 0.875rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

select:focus,
select.form-input:focus,
.custom-select:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

select:hover,
select.form-input:hover,
.custom-select:hover {
  border-color: #4b5563;
}

/* Option background — best-effort cross-browser */
select option,
.custom-select option {
  background-color: #111827;
  color: #f3f4f6;
  padding: 8px 12px;
}

select option:checked,
.custom-select option:checked {
  background-color: #312e81;
  color: #a5b4fc;
}

/* Firefox: darker bg for options */
@-moz-document url-prefix() {
  select option,
  .custom-select option {
    background-color: #1f2937;
    color: #f3f4f6;
  }
}

/* ─── TOTP login overlay animation ─────────────────────────── */
#modal-totp-login {
  animation: fade-in 0.2s ease;
}

#modal-totp-login > div {
  animation: slide-up 0.2s ease;
}

@keyframes slide-up {
  from { transform: translateY(12px); opacity: 0; }
  to   { transform: translateY(0);   opacity: 1; }
}

/* ─── AmneziaWG protocol badge ──────────────────────────────── */
.protocol-badge.amnezia_wg {
  background: #0f2b1e;
  color: #6ee7b7;
  border: 1px solid #065f46;
}

/* ─── Config format tabs ─────────────────────────────────────── */
.config-tab-btn {
  transition: background 0.15s, color 0.15s;
}
.config-tab-pane {
  animation: fade-in 0.15s ease;
}
