/* CSS RESET & VARIABLES */
:root {
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', Courier, monospace;

  /* Colors */
  --bg-color: #08090d;
  --bg-card: rgba(16, 18, 27, 0.4);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(138, 92, 246, 0.2);
  
  --primary-rgb: 138, 92, 246; /* Purple (#8b5cf6) */
  --primary: rgb(var(--primary-rgb));
  --primary-hover: #7c3aed;
  --primary-glow: rgba(138, 92, 246, 0.35);

  --secondary: #1f2937;
  --secondary-hover: #374151;

  --accent-rgb: 59, 130, 246; /* Royal Blue (#3b82f6) */
  --accent: rgb(var(--accent-rgb));
  
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.2);
  --danger: #ef4444;
  --danger-glow: rgba(239, 68, 68, 0.2);
  --warning: #f59e0b;
  --info: #60a5fa;

  --txt-main: #f3f4f6;
  --txt-muted: #9ca3af;
  --txt-dark: #6b7280;

  --transition-speed: 0.25s;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-color);
  color: var(--txt-main);
  font-family: var(--font-sans);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* Background Decorative Glowing Orbs */
.orb {
  position: fixed;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  filter: blur(140px);
  z-index: -1;
  opacity: 0.25;
  pointer-events: none;
  animation: floatOrb 20s infinite alternate ease-in-out;
}

.orb-1 {
  background: radial-gradient(circle, rgba(138, 92, 246, 0.8) 0%, rgba(59, 130, 246, 0.2) 100%);
  top: -150px;
  right: -50px;
}

.orb-2 {
  background: radial-gradient(circle, rgba(236, 72, 153, 0.6) 0%, rgba(138, 92, 246, 0) 100%);
  bottom: -200px;
  left: -100px;
  animation-delay: -10s;
}

@keyframes floatOrb {
  0% {
    transform: translate(0, 0) scale(1);
  }
  100% {
    transform: translate(80px, 50px) scale(1.15);
  }
}

/* App Container */
.app-container {
  max-width: 1560px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
}

/* Brand Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  box-shadow: 0 0 15px var(--primary-glow);
  position: relative;
}

.logo-icon::after {
  content: '';
  position: absolute;
  top: 30%;
  left: 30%;
  width: 40%;
  height: 40%;
  border-radius: 50%;
  background: white;
  opacity: 0.8;
}

.logo-area h1 {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.1rem;
  background: linear-gradient(to right, #ffffff, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-area p {
  font-size: 0.8rem;
  color: var(--txt-muted);
  font-weight: 400;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.03);
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.indicator-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--txt-dark);
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.1);
  transition: background-color 0.3s, box-shadow 0.3s;
}

.indicator-dot.active {
  background-color: var(--success);
  box-shadow: 0 0 10px var(--success);
  animation: pulseDot 1.5s infinite;
}

@keyframes pulseDot {
  0% { transform: scale(0.9); opacity: 0.8; }
  50% { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.8; }
}

/* Glassmorphism Panel */
.glass-panel {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  transition: border-color var(--transition-speed), box-shadow var(--transition-speed);
}

.glass-panel:hover {
  border-color: var(--border-glow);
}

/* Grid Layout */
.dashboard-grid {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 1.5rem;
}

.double-col {
  grid-column: span 1;
}

@media (min-width: 1200px) {
  .dashboard-grid {
    grid-template-columns: 380px 1fr 1fr;
  }
  .double-col {
    grid-column: span 2;
  }
}

.grid-col {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Card Structure */
.card {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 0.8rem;
}

.card-header h2 {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--txt-main);
}

/* Badges */
.badge {
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-accent {
  background-color: rgba(138, 92, 246, 0.15);
  color: #c084fc;
  border: 1px solid rgba(138, 92, 246, 0.3);
}

/* Forms */
.control-form {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

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

.form-row {
  display: flex;
  gap: 1rem;
}

.form-row .form-group {
  flex: 1;
}

label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--txt-muted);
}

input[type="url"],
input[type="number"],
select,
textarea {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--txt-main);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}

input[type="url"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 10px rgba(138, 92, 246, 0.2);
}

select option {
  background: #0f1015;
  color: var(--txt-main);
}

.input-tip {
  font-size: 0.75rem;
  color: var(--txt-dark);
}

.hidden {
  display: none !important;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 8px;
  padding: 11px 18px;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  border: none;
  transition: background-color 0.2s, transform 0.1s, box-shadow 0.2s;
  width: 100%;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), #a78bfa);
  color: white;
  box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-hover), #9061f9);
  box-shadow: 0 4px 20px rgba(138, 92, 246, 0.5);
  transform: translateY(-1px);
}

.btn-danger {
  background: var(--danger);
  color: white;
  box-shadow: 0 4px 12px var(--danger-glow);
}

.btn-danger:hover {
  background: #dc2626;
  box-shadow: 0 4px 18px rgba(220, 38, 38, 0.4);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--txt-main);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: 6px;
}

.btn-text {
  background: none;
  border: none;
  color: var(--txt-muted);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
}

.btn-text:hover {
  color: var(--txt-main);
}

/* Statistics row */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.stat-card {
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 15px;
}

.stat-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
}

.icon-proxies::before {
  content: "🛰️";
  font-size: 1.4rem;
}

.icon-success::before {
  content: "✅";
  font-size: 1.4rem;
}

.icon-failed::before {
  content: "❌";
  font-size: 1.4rem;
}

.stat-content {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--txt-muted);
}

.stat-number {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.25;
}

.stat-sub {
  font-size: 0.75rem;
  color: var(--txt-dark);
}

.txt-success {
  color: var(--success);
}

.txt-danger {
  color: var(--danger);
}

/* Terminal Console UI */
.terminal-card {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  min-height: 280px;
}

.terminal-header {
  display: flex;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 0.5rem;
}

.terminal-dots {
  display: flex;
  gap: 6px;
  margin-right: 15px;
}

.terminal-dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: block;
}

.terminal-dots span:nth-child(1) { background-color: #ff5f56; }
.terminal-dots span:nth-child(2) { background-color: #ffbd2e; }
.terminal-dots span:nth-child(3) { background-color: #27c93f; }

.terminal-body {
  background: rgba(5, 5, 8, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  padding: 1rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.5;
  overflow-y: auto;
  flex-grow: 1;
  max-height: 380px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Log Lines Styling */
.log-line {
  word-break: break-all;
  opacity: 0.9;
}

.log-time {
  color: var(--txt-dark);
  margin-right: 6px;
}

.log-system {
  color: var(--txt-muted);
  border-left: 2px solid var(--txt-dark);
  padding-left: 8px;
}

.log-info {
  color: #93c5fd;
}

.log-warn {
  color: #fde047;
}

.log-success {
  color: #86efac;
}

.log-error {
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.05);
  border-left: 2px solid var(--danger);
  padding-left: 8px;
}

/* Proxy Manager Layout */
.proxy-manager-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 900px) {
  .proxy-manager-layout {
    grid-template-columns: 320px 1fr;
  }
}

.upload-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.drag-drop-zone {
  border: 2px dashed rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.01);
  transition: border-color 0.2s, background-color 0.2s;
  text-align: center;
}

.drag-drop-zone:hover {
  border-color: var(--primary);
  background: rgba(138, 92, 246, 0.02);
}

.drag-drop-zone p {
  font-size: 0.85rem;
  font-weight: 600;
}

.drag-drop-zone span {
  font-size: 0.75rem;
  color: var(--txt-muted);
}

.paste-zone {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.paste-zone textarea {
  height: 120px;
  resize: none;
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

/* Proxy Table */
.table-section {
  overflow: hidden;
}

.table-wrapper {
  max-height: 380px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.85rem;
}

th {
  background: rgba(255, 255, 255, 0.02);
  color: var(--txt-muted);
  font-weight: 600;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 2;
  font-size: 0.8rem;
}

td {
  padding: 11px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  color: var(--txt-main);
}

tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.table-empty {
  text-align: center;
  color: var(--txt-dark);
  padding: 3rem;
  font-style: italic;
}

/* Status dots in table */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 600;
}

.pill-active { background: rgba(16, 185, 129, 0.1); color: #34d399; }
.pill-dead { background: rgba(239, 68, 68, 0.1); color: #f87171; }
.pill-unchecked { background: rgba(255, 255, 255, 0.05); color: var(--txt-muted); }

/* Runs history */
.history-wrapper {
  max-height: 220px;
  overflow-y: auto;
}

.history-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.history-empty {
  text-align: center;
  color: var(--txt-dark);
  font-style: italic;
  padding: 1rem 0;
  font-size: 0.85rem;
}

.history-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  transition: background 0.2s;
}

.history-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.history-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.history-target {
  font-weight: 600;
  color: var(--txt-main);
  word-break: break-all;
}

.history-meta {
  color: var(--txt-muted);
  font-size: 0.75rem;
}

.history-stats {
  display: flex;
  gap: 8px;
}
