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

:root {
  --bg-color: #05050a;
  --panel-bg: rgba(20, 20, 30, 0.6);
  --panel-border: rgba(255, 255, 255, 0.08);
  
  --color-purple: #9d4edd;
  --color-cyan: #00bbf9;
  --color-yellow: #fee440;
  --color-pink: #f15bb5;
  
  --text-main: #f8f9fa;
  --text-muted: #adb5bd;
  
  --font-main: 'Vazirmatn', system-ui, sans-serif;
}

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

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-color); }
::-webkit-scrollbar-thumb { background: #495057; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--color-purple); }

.bg-animation {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: -1;
  background: radial-gradient(circle at top right, #100b1f 0%, #05050a 100%);
}

.glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(150px);
  opacity: 0.15;
}

.blob-purple {
  width: 40vw; height: 40vw;
  background: var(--color-purple);
  top: -10%; right: -10%;
}

.blob-cyan {
  width: 30vw; height: 30vw;
  background: var(--color-cyan);
  bottom: -10%; left: -10%;
}

.app-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.hidden { display: none !important; }

.top-header {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  margin-bottom: 3rem;
}

.logo-wrapper {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--color-purple), var(--color-cyan));
  border-radius: 16px;
  padding: 2px;
}

.logo-wrapper svg {
  width: 100%;
  height: 100%;
  background: var(--bg-color);
  border-radius: 14px;
  padding: 12px;
  color: var(--text-main);
}

.header-text h1 {
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 0.2rem;
  letter-spacing: 0.5px;
}

.header-text p {
  font-size: 0.95rem;
  color: var(--text-muted);
}

.neon-text {
  background: linear-gradient(to right, #fff, var(--color-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.loading-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 50vh;
}

.magic-spinner {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.1);
  border-top-color: var(--color-cyan);
  animation: spin 1s linear infinite;
  margin-bottom: 1.5rem;
}

.pulse-text {
  color: var(--text-muted);
  font-weight: 600;
  animation: pulse-opacity 1.5s infinite alternate;
}

@keyframes spin { 100% { transform: rotate(360deg); } }
@keyframes pulse-opacity { 0% { opacity: 0.6; } 100% { opacity: 1; } }

.glass-panel {
  background: var(--panel-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  padding: 1.8rem;
  transition: transform 0.3s ease, border-color 0.3s ease;
}

.glass-panel:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 255, 255, 0.15);
}

.dashboard-section {
  margin-bottom: 3.5rem;
  animation: fadeUp 0.5s ease-out forwards;
  opacity: 0;
  transform: translateY(15px);
}

.dashboard-section:nth-child(1) { animation-delay: 0.05s; }
.dashboard-section:nth-child(2) { animation-delay: 0.1s; }
.dashboard-section:nth-child(3) { animation-delay: 0.15s; }
.dashboard-section:nth-child(4) { animation-delay: 0.2s; }

@keyframes fadeUp {
  to { opacity: 1; transform: translateY(0); }
}

.section-heading {
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  color: #fff;
}

.section-heading svg {
  width: 24px;
  height: 24px;
}

.stats-grid, .apps-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

.servers-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 640px) {
  .stats-grid, .apps-grid { grid-template-columns: repeat(2, 1fr); }
  .servers-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 900px) {
  .servers-grid { grid-template-columns: repeat(3, 1fr); }
}

.stat-card {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.stat-header {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.icon-glow {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-glow svg { width: 24px; height: 24px; }

.cyan-glow {
  color: var(--color-cyan);
  background: rgba(0, 187, 249, 0.1);
}

.purple-glow {
  color: var(--color-purple);
  background: rgba(157, 78, 221, 0.1);
}

.stat-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-muted);
}

.stat-numbers {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.stat-numbers strong {
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1;
  color: #fff;
}

.stat-numbers small {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.progress-bg {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  margin-bottom: 0.6rem;
  position: relative;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 8px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.cyan-gradient { background: var(--color-cyan); }
.purple-gradient { background: var(--color-purple); }

.stat-hint { font-size: 0.85rem; font-weight: 600; }
.cyan-text { color: var(--color-cyan); }
.purple-text { color: var(--color-purple); }

.server-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.5rem;
}

.server-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.server-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
}

.server-badge {
  background: rgba(255, 255, 255, 0.05);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.server-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.server-btns {
  display: flex;
  gap: 0.6rem;
  margin-top: auto;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 0.8rem;
  border-radius: 10px;
  font-size: 0.85rem;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
  text-decoration: none;
  border: none;
  flex: 1;
}

.action-btn svg { width: 16px; height: 16px; }

.outline-btn {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}
.outline-btn:hover { background: rgba(255, 255, 255, 0.1); }

.purple-btn {
  background: rgba(157, 78, 221, 0.15);
  color: var(--color-purple);
}
.purple-btn:hover { background: var(--color-purple); color: #fff; }

.yellow-btn {
  background: rgba(254, 228, 64, 0.15);
  color: var(--color-yellow);
}
.yellow-btn:hover { background: var(--color-yellow); color: #000; }

.v2ray-panel { border-right: 3px solid var(--color-yellow); }
.v2ray-help { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 1.2rem; }
.v2ray-controls { display: flex; flex-direction: column; gap: 1rem; }

@media (min-width: 768px) {
  .v2ray-controls { flex-direction: row; align-items: center; }
}

.link-display {
  flex: 1;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 10px;
  padding: 0.8rem 1rem;
  font-family: monospace;
  font-size: 0.85rem;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  direction: ltr;
  text-align: left;
}

.action-buttons { display: flex; gap: 0.6rem; }

.apps-section {
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 3rem;
}

.app-box { display: flex; flex-direction: column; gap: 1rem; padding: 1.2rem; }
.app-title { display: flex; align-items: center; gap: 0.8rem; }
.app-title svg { width: 24px; height: 24px; color: var(--color-pink); }
.app-title h3 { font-size: 1.05rem; font-weight: 700; }

.app-links {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: auto;
}

.dl-link {
  background: rgba(255, 255, 255, 0.03);
  padding: 0.5rem 0.8rem;
  border-radius: 8px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  text-align: center;
  transition: background 0.2s, color 0.2s;
}
.dl-link:hover { background: rgba(241, 91, 181, 0.15); color: #fff; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  background: #101018;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  padding: 1.8rem 1.5rem;
  width: 90%;
  max-width: 340px; 
  display: flex;
  flex-direction: column;
  transform: scale(0.95) translateY(10px);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-backdrop.show .modal-box { transform: scale(1) translateY(0); }

.modal-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.5rem;
}

.neon-text-sm { font-size: 1.15rem; font-weight: 700; color: #fff; }
#qr-subtitle { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.3rem; line-height: 1.4; }

.close-btn {
  background: rgba(255, 255, 255, 0.05);
  border: none;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.close-btn:hover { background: rgba(255, 255, 255, 0.15); color: #fff; }
.close-btn svg { width: 18px; height: 18px; }

.qr-render-area {
  background: #fff;
  padding: 0.8rem;
  border-radius: 16px;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 290px; 
  width: 100%;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.qr-render-area img {
  width: 100%;
  max-width: 270px;
  height: auto;
  aspect-ratio: 1/1;
  display: none;
}

.qr-loader { color: #555; font-size: 0.95rem; font-weight: 600; }
.qr-guide { text-align: center; font-size: 0.85rem; color: var(--text-muted); margin-top: 1.2rem; font-weight: 500;}

.toast-notification {
  position: fixed;
  bottom: 20px;
  left: 20px;
  background: #1a1a24;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  padding: 0.8rem 1.2rem;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 200;
  font-size: 0.9rem;
  font-weight: 600;
}

.toast-notification.active {
  transform: translateY(0);
  opacity: 1;
}

.toast-notification svg { width: 18px; height: 18px; color: var(--color-cyan); }
