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

:root {
  --bg: #080818;
  --glass: rgba(255, 255, 255, 0.047);
  --glass-border: rgba(46, 175, 250, 0.144);
  --accent: #3a30ffbd;
  --accent2: #007086b4;
  --text: #e8e8f0;
  --text-muted: #7a7a9a;
  --danger: #700000;
  --success: #00e676;
  --warn: #7e6b00;
  --radius: 18px;
  --blur: blur(22px);
}

/* ───────────────────────── */
/* BASE */
/* ───────────────────────── */
html, body {
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', Tahoma, system-ui, sans-serif;
  min-height: 100%;
  overflow-x: hidden;
  direction: rtl;
  scroll-behavior: smooth;
}

/* ───────────────────────── */
/* PARTICLES */
/* ───────────────────────── */
#particles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 0;
}

/* ───────────────────────── */
/* SPOTLIGHT */
/* ───────────────────────── */
.spotlight {
  position: fixed;
  width: 800px;
  height: 800px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 1;
  transform: translate(-50%, -50%);
  background: radial-gradient(
    circle,
    rgba(107, 99, 255, 0.048) 0%,
    rgba(108,99,255,0.05) 30%,
    transparent 50%
  );
  filter: blur(50px);
}

/* ───────────────────────── */
/* GLASS */
/* ───────────────────────── */
.glass-card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border-radius: var(--radius);
  position: relative;
  z-index: 2;
  will-change: transform;
  transform: translateZ(0);
}

/* ───────────────────────── */
/* LOGIN */
/* ───────────────────────── */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100%;
}

.login-card {
  width: 400px;
  padding: 35px 40px;
  text-align: center;
  animation: fadeUp 0.55s ease-in;
}

.logo:hover {
  background: linear-gradient(13deg, #4c24fff8, #ffffffa6); 
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.logo-app:hover {
  background: linear-gradient(13deg, #4c24fff8, #ffffffa6); 
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo {
  animation: fadeUp 0.55s ease-in 0.30s backwards;
  font-size: 2.2rem;
  font-weight: 550;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 6px;
}

.logo-app {
  text-decoration: none;
  color: inherit;
  font-weight: bold;
  animation: fadeUp 0.55s ease-in 0.30s backwards;
  font-size: 1.8rem;
  font-weight: 550;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 6px;
  justify-content: right;
}
.subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 36px;
}

.field {
  position: relative;
  margin-bottom: 16px;
}

.field-icon {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
}

.field input {
  width: 100%;
  padding: 13px 42px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--glass-border);
  border-radius: 11px;
  color: var(--text);
  text-align: right;
  direction: ltr;
}

.field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(108,99,255,0.18);
}

.toggle-pass {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
}

/* ───────────────────────── */
/* BUTTONS */
/* ───────────────────────── */
.btn-primary {
  width: 50%;
  padding: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: none;
  border-radius: 12px;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  margin-top: 10px;
  box-shadow: 0 6px 25px rgba(108,99,255,0.25);
  transition: 0.3s;
}

.btn-primary:hover {
  box-shadow: 0 0px 30px rgba(80, 71, 255, 0.575);
}

.btn-logout {
  padding: 10px 20px;
  background: transparent;
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  color: var(--text);
  cursor: pointer;
}
.btn-secondary {
  padding: 5px 10px;
  font-size:  1.0rem;
  background: transparent;
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  color: var(--text);
  cursor: pointer;
  margin-right: 1px;
}

#err {
  white-space: pre-line;
}
#warning {
  white-space: pre-line;
}
.error-msg {
  color: var(--danger);
  margin-top: 25px;
}
.warning-msg {
  color: var(--warn);
  margin-top: 25px;
}

/* ───────────────────────── */
/* DASHBOARD */
/* ───────────────────────── */

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 28px;
  margin: 16px;
}

.topbar > div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dashboard {
  padding: 0 16px 40px;
  max-width: 1100px;
  margin: auto;
  animation: fadeUp 0.6s ease;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
  margin-bottom: 20px;
}

/* ───────────────────────── */
/* STAT */
/* ───────────────────────── */
.stat-card {
  padding: 28px 22px;
  text-align: center;
  transition: 0.25s;
}

.stat-card:hover {
  transform: translateY(-6px) scale(1.01);
}

.stat-value {
  font-size: 1.7rem;
  color: var(--accent2);
}

/* ───────────────────────── */
/* PROGRESS */
/* ───────────────────────── */
.progress-bar {
  height: 6px;
  background: rgba(255,255,255,0.07);
  border-radius: 4px;
  margin: 14px 0;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
}

/* ───────────────────────── */
/* CONFIG */
/* ───────────────────────── */
.config-card {
  padding: 28px;
  margin-bottom: 20px;
}

.config-box {
  background: rgba(0,0,0,0.35);
  border-radius: 11px;
  padding: 16px;
  margin-bottom: 18px;
  direction: ltr;
}

/* ───────────────────────── */
/* CHART */
/* ───────────────────────── */
.chart-card {
  padding: 28px;
}

#usageChart {
  width: 100%;
  height: 200px;
}

/* ───────────────────────── */
/* ANIMATION */
/* ───────────────────────── */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(28px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ───────────────────────── */
/* RESPONSIVE */
/* ───────────────────────── */
@media (max-width: 768px) {
  .dashboard {
    padding: 0 12px 30px;
  }

  .stat-card {
    padding: 22px 16px;
  }

  .config-card,
  .chart-card {
    padding: 20px;
  }
}

@media (max-width: 520px) {
  .login-card {
    width: 70%;
    padding: 30px 20px;
  }
}

@media (max-width: 360px) {
  .cards-grid {
    grid-template-columns: 1fr;
  }
}

/* ───────── Skeleton Loading ───────── */

.skeleton {
  background: linear-gradient(
    90deg,
    rgba(255,255,255,0.06) 25%,
    rgba(255,255,255,0.12) 50%,
    rgba(255,255,255,0.06) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite linear;
  border-radius: 12px;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skel-card {
  height: 140px;
  border-radius: 18px;
}

.skel-line {
  height: 14px;
  margin: 10px 0;
  border-radius: 8px;
}

#loading-state {
  display: block;
}

.config-box {
  display: flex;
  box-shadow: 0 3px 30px rgba(0,0,0,0.2);
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.config-box {
  position: relative;
  overflow: hidden;
}

/* overlay */
.copy-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10,10,30,0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #01ffbf;
  font-weight: bold;
  font-size: 0.9rem;
  opacity: 0;
  transition: 0.3s;
  pointer-events: none;
}

/* وقتی فعال شد */
.config-box.copied .copy-overlay {
  opacity: 1;
}

/* blur کردن محتوای پشت */
.config-box.copied code,
.config-box.copied button {
  filter: blur(3px);
}
.config-box code {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.btn-lp{
  /* background: linear-gradient(90deg, #00000052, #00000044); */
  background: rgba(0, 0, 0, 0);
  width: 80px;
  height: 40px;
  font-size: 0.55rem;
  color: var(--accent2);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  margin-left: auto;
}
/* ───────── LIGHT MODE ───────── */

body.light {
  --bg: hsla(251, 100%, 24%, 0.129);
  --glass: rgba(0, 0, 0, 0.479);
  --glass-border: rgba(33, 18, 173, 0.26);
  --text: #111;
  --text-muted: #555;
  --accent: #06007c85;
  --accent2: #0162749a;
}

body.light .config-box{
  background: #0000000c ;
}
body.light .btn-lp{
  background: rgba(0, 0, 0, 0);
  color: var(--accent2);
  border-radius: 10px;
}
body.light .glass-card {
  background: rgba(255, 255, 255, 0.425);
}
.dashboard-page.light {
  background: hsla(251, 100%, 24%, 0.129);
  height: 100%;
}
