:root {
  --bg-color: #050505;
  --accent: #3b82f6;
  --accent-glow: rgba(59, 130, 246, 0.4);
  --glass-bg: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.1);
  --text-primary: #ffffff;
  --text-secondary: #94a3b8;
  --success: #10b981;
  --error: #ef4444;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: "Outfit", sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-color);
  color: var(--text-primary);
  overflow-x: hidden;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 40px 20px;
}

#particles-js {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.app-container {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 400px;
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 30px 24px;
  box-shadow:
    0 20px 40px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  animation: fadeIn 0.8s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

header {
  text-align: center;
  margin-bottom: 30px;
}

.logo-circle {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 auto 15px;
  font-size: 24px;
  box-shadow: 0 0 20px var(--accent-glow);
}

h1 {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 5px;
  background: linear-gradient(to right, #fff, #cbd5e1);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

header p {
  color: var(--text-secondary);
  font-size: 14px;
}

form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

input[type="text"] {
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 14px 16px;
  color: var(--text-primary);
  font-size: 15px;
  outline: none;
  transition: all 0.3s ease;
}

.input-wrapper input {
  padding-right: 80px;
}

.suffix {
  position: absolute;
  right: 16px;
  color: var(--text-secondary);
  font-size: 14px;
  pointer-events: none;
}

input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.row-layout {
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  background: rgba(0, 0, 0, 0.2);
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
}

.row-layout label {
  margin-bottom: 0;
}

/* Toggle Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.2);
  transition: 0.4s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}

input:checked + .slider {
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
}

input:checked + .slider:before {
  transform: translateX(20px);
}

/* Button */
button {
  margin-top: 10px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 15px var(--accent-glow);
}

button:active {
  transform: scale(0.98);
}

button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* Button Group for Wizard */
.btn-group {
  display: flex;
  gap: 12px;
  margin-top: 10px;
}

.back-btn {
  background: rgba(255, 255, 255, 0.1);
  box-shadow: none;
  width: 50px;
  border-radius: 12px;
  margin-top: 0;
}

.back-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

.next-btn {
  flex: 1;
  margin-top: 0;
}

/* Step Animations */
.step {
  display: flex;
  flex-direction: column;
  gap: 20px;
  transition:
    opacity 0.3s ease,
    transform 0.3s ease;
}

.step.hidden {
  display: none !important;
  opacity: 0;
  transform: translateX(20px);
}

.step.active {
  display: flex;
  opacity: 1;
  transform: translateX(0);
}

.summary-box {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 16px;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.summary-box span.highlight {
  color: var(--text-primary);
  font-weight: 600;
}

footer {
  margin-top: 30px;
  text-align: center;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.4);
}

footer .bot-info {
  margin-top: 4px;
  font-weight: 500;
  color: rgba(59, 130, 246, 0.6);
}

/* Loader inside button */
.loader {
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 1s ease-in-out infinite;
}

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

.hidden {
  display: none !important;
}

/* Custom Alerts */
.alert-container {
  padding: 14px 16px;
  border-radius: 12px;
  margin-bottom: 20px;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideDown 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.alert-success {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--success);
}

.alert-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--error);
}

/* Welcome Popup */
.welcome-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: opacity 0.5s ease;
}

.welcome-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.welcome-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 30px;
  text-align: center;
  transform: scale(0.9);
  transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.welcome-overlay:not(.hidden) .welcome-card {
  transform: scale(1);
}

.welcome-card i {
  font-size: 40px;
  color: var(--success);
  margin-bottom: 15px;
}

.welcome-card h2 {
  font-size: 22px;
  margin-bottom: 8px;
}

.welcome-card p {
  color: var(--text-secondary);
  font-size: 14px;
}

/* Admin Specific UI */
.custom-select {
  width: 100%;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 14px 16px;
  color: var(--text-primary);
  font-size: 15px;
  outline: none;
  appearance: none;
  cursor: pointer;
  transition: all 0.3s ease;
}

.custom-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.custom-select option {
  background: #111;
  color: #fff;
}

.suffix-icon {
  position: absolute;
  right: 16px;
  color: var(--text-secondary);
  pointer-events: none;
}

.records-container {
  margin-top: 30px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 20px;
}

.records-title {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 15px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.records-title::before {
  content: "";
  display: block;
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--accent-glow);
}

.records-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 250px;
  overflow-y: auto;
  padding-right: 5px;
}

.records-list::-webkit-scrollbar {
  width: 6px;
}

.records-list::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
}

.records-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

.record-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  gap: 10px;
  flex-wrap: wrap;
}

.record-item:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.1);
}

.record-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.record-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.record-content {
  font-size: 12px;
  color: var(--text-secondary);
  font-family: monospace;
}

.record-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.proxy-status {
  font-size: 12px;
}

.proxy-status.active {
  color: #f59e0b; /* Cloudflare Orange */
  text-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
}

.proxy-status.inactive {
  color: var(--text-secondary);
}

.btn-delete {
  background: rgba(239, 68, 68, 0.1);
  color: var(--error);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-delete:hover {
  background: rgba(239, 68, 68, 0.2);
  transform: scale(1.05);
}

.loader-center {
  display: flex;
  justify-content: center;
  padding: 20px 0;
}
