/* ===================================================
   MikroTik PCC Load Balance Generator — Styles
   =================================================== */

:root {
  --bg-base: #0a0b14;
  --bg-card: rgba(255, 255, 255, 0.04);
  --bg-card-hover: rgba(255, 255, 255, 0.07);
  --bg-input: rgba(255, 255, 255, 0.06);

  --accent-1: #6366f1;
  --accent-2: #a855f7;
  --accent-3: #22d3ee;
  --accent-success: #10b981;

  --text-primary: #f0f0ff;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --border: rgba(255, 255, 255, 0.09);
  --border-focus: rgba(99, 102, 241, 0.6);
  --border-accent: rgba(99, 102, 241, 0.3);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --shadow-card: 0 4px 32px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.15);

  --font-main: 'Cairo', sans-serif;
  --font-code: 'JetBrains Mono', monospace;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-main);
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  direction: rtl;
}

/* ===== Background particles ===== */
.bg-particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.particle {
  position: absolute;
  border-radius: 50%;
  animation: float linear infinite;
  opacity: 0.15;
}

@keyframes float {
  0% { transform: translateY(100vh) scale(0); opacity: 0; }
  10% { opacity: 0.15; }
  90% { opacity: 0.15; }
  100% { transform: translateY(-10vh) scale(1); opacity: 0; }
}

/* Background gradient orbs */
body::before {
  content: '';
  position: fixed;
  top: -200px;
  left: -200px;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(99,102,241,0.12) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
  animation: orbPulse 8s ease-in-out infinite alternate;
}

body::after {
  content: '';
  position: fixed;
  bottom: -200px;
  right: -200px;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(168,85,247,0.10) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
  animation: orbPulse 10s ease-in-out infinite alternate-reverse;
}

@keyframes orbPulse {
  from { transform: scale(1); opacity: 0.6; }
  to { transform: scale(1.2); opacity: 1; }
}

/* ===== Header ===== */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: rgba(10, 11, 20, 0.85);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
}

.header-inner {
  max-width: 900px;
  margin: 0 auto;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.logo-icon {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  animation: rotateSlow 20s linear infinite;
}

@keyframes rotateSlow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.logo-title {
  font-size: 15px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo-sub {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
}

.header-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  background: rgba(34, 211, 238, 0.08);
  border: 1px solid rgba(34, 211, 238, 0.2);
  padding: 6px 14px;
  border-radius: 100px;
}

.badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-3);
  animation: blink 2s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ===== Main ===== */
main.main {
  position: relative;
  z-index: 1;
  max-width: 900px;
  margin: 0 auto;
  padding: 48px 24px 80px;
}

/* ===== Hero ===== */
.hero {
  text-align: center;
  margin-bottom: 56px;
}

.hero-content {
  margin-bottom: 24px;
}

.hero-title {
  font-size: clamp(28px, 5vw, 48px);
  font-weight: 900;
  line-height: 1.3;
  margin-bottom: 16px;
  letter-spacing: -0.5px;
}

.gradient-text {
  background: linear-gradient(135deg, var(--accent-1) 0%, var(--accent-2) 50%, var(--accent-3) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  background-size: 200% auto;
  animation: shimmer 4s linear infinite;
}

@keyframes shimmer {
  from { background-position: 0% center; }
  to { background-position: 200% center; }
}

.hero-desc {
  font-size: 16px;
  color: var(--text-secondary);
  max-width: 500px;
  margin: 0 auto;
  line-height: 1.7;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.pill {
  font-size: 13px;
  padding: 6px 16px;
  border-radius: 100px;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.25);
  color: var(--text-secondary);
  transition: all 0.2s;
}

.pill:hover {
  background: rgba(99, 102, 241, 0.2);
  color: var(--text-primary);
}

/* ===== Cards ===== */
.card-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px 32px;
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: box-shadow 0.3s, border-color 0.3s;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(99,102,241,0.4), transparent);
}

.card:hover {
  box-shadow: var(--shadow-card), var(--shadow-glow);
  border-color: var(--border-accent);
}

.card-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.step-num {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
}

.step-num.success {
  background: linear-gradient(135deg, var(--accent-success), #059669);
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4);
  font-size: 20px;
}

.card-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.card-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 400;
}

/* ===== WAN Selector Buttons ===== */
.wan-selector {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.wan-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 90px;
  height: 80px;
  border-radius: var(--radius-md);
  border: 2px solid var(--border);
  background: var(--bg-input);
  color: var(--text-secondary);
  cursor: pointer;
  font-family: var(--font-main);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.wan-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  opacity: 0;
  transition: opacity 0.25s;
}

.wan-btn:hover {
  border-color: var(--accent-1);
  color: var(--text-primary);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.3);
}

.wan-btn:hover::before {
  opacity: 0.1;
}

.wan-btn.active {
  border-color: var(--accent-1);
  color: white;
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
}

.wan-btn.active::before {
  opacity: 0.2;
}

.wan-num {
  font-size: 28px;
  font-weight: 900;
  position: relative;
  z-index: 1;
}

.wan-label {
  font-size: 11px;
  position: relative;
  z-index: 1;
  opacity: 0.8;
}

/* ===== Form Elements ===== */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}

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

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-input,
.form-select {
  font-family: var(--font-code);
  font-size: 13px;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 10px 14px;
  outline: none;
  transition: all 0.2s;
  direction: ltr;
  text-align: left;
}

.form-select {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 12px center;
  padding-left: 36px;
}

.form-input:focus,
.form-select:focus {
  border-color: var(--border-focus);
  background: rgba(99, 102, 241, 0.08);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-hint {
  font-size: 11px;
  color: var(--text-muted);
}

/* ===== WAN Config blocks ===== */
.wan-configs {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.wan-config-item {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  position: relative;
  transition: all 0.25s;
  animation: slideIn 0.3s ease-out;
}

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

.wan-config-item:hover {
  border-color: rgba(99, 102, 241, 0.25);
}

.wan-config-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.wan-config-badge {
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  color: white;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 100px;
  letter-spacing: 0.5px;
}

.wan-config-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.wan-config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}

/* ===== Advanced options toggles ===== */
.options-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.toggle-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s;
  gap: 16px;
}

.toggle-option:hover {
  border-color: var(--border-accent);
  background: rgba(99, 102, 241, 0.07);
}

.toggle-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.toggle-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.toggle-desc {
  font-size: 12px;
  color: var(--text-muted);
}

.toggle-switch {
  flex-shrink: 0;
}

.toggle-switch input[type="checkbox"] {
  display: none;
}

.toggle-slider {
  display: block;
  width: 48px;
  height: 26px;
  background: rgba(255,255,255,0.1);
  border-radius: 100px;
  border: 1.5px solid var(--border);
  position: relative;
  cursor: pointer;
  transition: all 0.3s;
}

.toggle-slider::after {
  content: '';
  position: absolute;
  top: 3px;
  right: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toggle-switch input:checked + .toggle-slider {
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  border-color: var(--accent-1);
}

.toggle-switch input:checked + .toggle-slider::after {
  right: auto;
  left: 3px;
  background: white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* ===== Generate Button ===== */
.generate-section {
  display: flex;
  justify-content: center;
}

.btn-generate {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-main);
  font-size: 18px;
  font-weight: 700;
  padding: 18px 56px;
  border-radius: var(--radius-lg);
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, var(--accent-1) 0%, var(--accent-2) 100%);
  color: white;
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 8px 32px rgba(99, 102, 241, 0.4);
}

.btn-generate svg {
  width: 22px;
  height: 22px;
  transition: transform 0.3s;
}

.btn-generate::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  transition: left 0.6s;
}

.btn-generate:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 48px rgba(99, 102, 241, 0.55);
}

.btn-generate:hover::before {
  left: 100%;
}

.btn-generate:hover svg {
  transform: translateX(-4px);
}

.btn-generate:active {
  transform: translateY(0);
}

/* ===== Output Card ===== */
.output-card {
  animation: slideIn 0.4s ease-out;
}

.output-actions {
  display: flex;
  gap: 10px;
  margin-right: auto;
  margin-left: 0;
  margin-right: auto;
  flex-wrap: wrap;
}

.btn-action {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-main);
  font-size: 13px;
  font-weight: 600;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--bg-input);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-action:hover {
  background: rgba(99,102,241,0.1);
  border-color: var(--accent-1);
  color: var(--text-primary);
}

.btn-download {
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  border-color: transparent;
  color: white;
}

.btn-download:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
  color: white;
  border-color: transparent;
}

/* ===== Script stats ===== */
.script-stats {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 20px;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: var(--radius-md);
  min-width: 80px;
  flex: 1;
}

.stat-value {
  font-size: 22px;
  font-weight: 900;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-3));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ===== Instructions ===== */
.instructions-box {
  background: rgba(34, 211, 238, 0.05);
  border: 1px solid rgba(34, 211, 238, 0.2);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  margin-bottom: 20px;
}

.inst-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--accent-3);
}

.inst-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.inst-step {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: var(--text-secondary);
}

.inst-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(34, 211, 238, 0.15);
  border: 1px solid rgba(34, 211, 238, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-3);
  flex-shrink: 0;
}

.code-inline {
  font-family: var(--font-code);
  font-size: 13px;
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  color: var(--accent-3);
  direction: ltr;
  text-align: left;
}

/* ===== Script Output ===== */
.script-container {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.script-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: rgba(0,0,0,0.4);
  border-bottom: 1px solid var(--border);
}

.script-lang {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-2);
  font-family: var(--font-code);
}

.script-lines {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-code);
}

.script-output {
  background: rgba(0, 0, 0, 0.5);
  padding: 20px;
  overflow-x: auto;
  overflow-y: auto;
  max-height: 520px;
  font-family: var(--font-code);
  font-size: 12px;
  line-height: 1.8;
  color: #e2e8f0;
  direction: ltr;
  text-align: left;
  white-space: pre;
  tab-size: 4;
}

/* ===== Footer ===== */
.footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 24px;
  font-size: 12px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

/* ===== Toast notification ===== */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  color: white;
  padding: 12px 28px;
  border-radius: 100px;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-main);
  box-shadow: 0 8px 32px rgba(99, 102, 241, 0.5);
  z-index: 999;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
  main.main {
    padding: 32px 16px 60px;
  }

  .card {
    padding: 20px 18px;
  }

  .wan-btn {
    width: 72px;
    height: 68px;
  }

  .wan-num {
    font-size: 22px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .wan-config-grid {
    grid-template-columns: 1fr;
  }

  .btn-generate {
    padding: 16px 36px;
    font-size: 16px;
  }

  .header-badge {
    display: none;
  }

  .output-actions {
    width: 100%;
    justify-content: stretch;
  }

  .btn-action {
    flex: 1;
    justify-content: center;
  }
}
