/* ==========================================================
   پنل مشتری VPN - استایل Dark Glassmorphism
   پالت رنگی: پس‌زمینه فضایی تیره + گرادیان تیل/بنفش الکتریکی
   ========================================================== */

:root {
  --bg-deep: #0a0e1a;
  --bg-deep-2: #0d1224;
  --glass-bg: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-highlight: rgba(255, 255, 255, 0.08);

  --accent-teal: #00d9c0;
  --accent-violet: #7c5cff;
  --accent-gradient: linear-gradient(135deg, var(--accent-teal), var(--accent-violet));

  --text-primary: #eef1f8;
  --text-secondary: #97a1bd;
  --text-muted: #6b7593;

  --status-active: #22d3a6;
  --status-expired: #ff5470;
  --status-depleted: #ffb648;
  --status-disabled: #6b7593;

  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 10px;
}

* {
  box-sizing: border-box;
}

html, body {
  min-height: 100%;
}

body {
  font-family: 'Vazirmatn', 'Segoe UI', Tahoma, sans-serif;
  background: var(--bg-deep);
  color: var(--text-primary);
  overflow-x: hidden;
  position: relative;
  line-height: 1.7;
}

/* ---------------- پس‌زمینه انیمیشنی ---------------- */
.bg-blobs {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background: radial-gradient(ellipse at top, var(--bg-deep-2), var(--bg-deep) 65%);
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.35;
  animation: float 22s ease-in-out infinite;
}

.blob-1 {
  width: 420px;
  height: 420px;
  background: var(--accent-teal);
  top: -10%;
  right: -8%;
  animation-delay: 0s;
}

.blob-2 {
  width: 380px;
  height: 380px;
  background: var(--accent-violet);
  bottom: -12%;
  left: -6%;
  animation-delay: -7s;
}

.blob-3 {
  width: 260px;
  height: 260px;
  background: #3b82f6;
  top: 40%;
  left: 45%;
  animation-delay: -14s;
  opacity: 0.2;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%      { transform: translate(30px, -40px) scale(1.08); }
  66%      { transform: translate(-25px, 25px) scale(0.95); }
}

/* ---------------- هدر / برند ---------------- */
.brand-logo-wrap {
  display: flex;
  justify-content: center;
}

.brand-logo {
  width: 68px;
  height: 68px;
  border-radius: 20px;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  box-shadow: 0 8px 30px rgba(0, 217, 192, 0.35);
}

.brand-title {
  font-weight: 800;
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 0.4rem;
}

.brand-subtitle {
  color: var(--text-secondary);
  font-size: 0.98rem;
}

/* ---------------- کارت شیشه‌ای ---------------- */
.glass-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  padding: 2rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4), inset 0 1px 0 var(--glass-highlight);
}

@media (max-width: 576px) {
  .glass-card { padding: 1.4rem; }
}

/* ---------------- کادر جستجو ---------------- */
.search-label {
  display: block;
  color: var(--text-secondary);
  font-size: 0.92rem;
  margin-bottom: 0.8rem;
}

.search-box {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.search-input {
  flex: 1 1 220px;
  min-width: 0;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: 0.9rem 1.1rem;
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.25s, box-shadow 0.25s;
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-input:focus {
  border-color: var(--accent-teal);
  box-shadow: 0 0 0 4px rgba(0, 217, 192, 0.15);
}

.btn-search {
  border: none;
  border-radius: var(--radius-md);
  padding: 0.9rem 1.6rem;
  font-weight: 700;
  font-family: inherit;
  color: #06120f;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  white-space: nowrap;
}

.btn-search:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(0, 217, 192, 0.3);
}

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

.btn-search:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.alert-error {
  background: rgba(255, 84, 112, 0.12);
  border: 1px solid rgba(255, 84, 112, 0.35);
  color: #ffb2c0;
  border-radius: var(--radius-sm);
  padding: 0.8rem 1rem;
  font-size: 0.9rem;
}

/* ---------------- Modal مرکزی کارت نتیجه ---------------- */
.result-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1050;
  background: rgba(5, 8, 16, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow-y: auto;
}

.result-modal-content {
  position: relative;
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  margin: auto;
}

.result-close {
  position: absolute;
  top: 14px;
  left: 14px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
  z-index: 2;
}

.result-close:hover {
  background: rgba(255, 255, 255, 0.16);
  transform: rotate(90deg);
}

/* ---------------- کارت نتیجه ---------------- */
.result-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 1.6rem;
}

.result-email {
  font-weight: 700;
  font-size: 1.15rem;
  margin-bottom: 6px;
  word-break: break-all;
}

.status-badge {
  display: inline-block;
  padding: 0.3rem 0.9rem;
  border-radius: 50px;
  font-size: 0.82rem;
  font-weight: 700;
}

.status-badge.status-active   { background: rgba(34, 211, 166, 0.15); color: var(--status-active); }
.status-badge.status-expired  { background: rgba(255, 84, 112, 0.15); color: var(--status-expired); }
.status-badge.status-depleted { background: rgba(255, 182, 72, 0.15); color: var(--status-depleted); }
.status-badge.status-disabled { background: rgba(107, 117, 147, 0.2); color: var(--status-disabled); }

.protocol-chip {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--accent-teal);
  white-space: nowrap;
}

/* نوار مصرف */
.usage-section {
  margin-bottom: 1.8rem;
}

.usage-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.6rem;
}

.usage-used-label b { color: #4da3ff; }
.usage-remaining-label b { color: #ff5470; }

.usage-progress {
  width: 100%;
  height: 12px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
  position: relative;
}

.usage-progress-bar {
  height: 100%;
  border-radius: 20px;
  background: var(--accent-gradient);
  transition: width 0.9s cubic-bezier(0.22, 1, 0.36, 1);
  position: relative;
}

.usage-progress-bar.warn { background: linear-gradient(135deg, #ffb648, #ff8a3d); }
.usage-progress-bar.danger { background: linear-gradient(135deg, #ff5470, #ff2e63); }

.usage-percent {
  text-align: center;
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* گرید اطلاعات */
.info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.8rem;
  margin-bottom: 1.4rem;
}

@media (max-width: 576px) {
  .info-grid { grid-template-columns: repeat(2, 1fr); }
}

.info-box {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 0.8rem 0.9rem;
  transition: background 0.2s;
}

.info-box:hover {
  background: rgba(255, 255, 255, 0.07);
}

.info-box-used {
  background: rgba(77, 163, 255, 0.12);
  border-color: rgba(77, 163, 255, 0.35);
}

.info-box-remaining {
  background: rgba(255, 84, 112, 0.12);
  border-color: rgba(255, 84, 112, 0.35);
}

.info-value-used {
  color: #4da3ff;
  font-size: 1.05rem;
}

.info-value-remaining {
  color: #ff5470;
  font-size: 1.05rem;
}

.info-label {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.info-value {
  font-weight: 700;
  font-size: 0.95rem;
  word-break: break-word;
}

/* UUID */
.uuid-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 0.9rem;
  margin-bottom: 1.4rem;
}

.uuid-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.uuid-text {
  flex: 1 1 auto;
  min-width: 0;
  background: none;
  color: var(--accent-teal);
  font-size: 0.9rem;
  word-break: break-all;
  direction: ltr;
  text-align: left;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
  flex-shrink: 0;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

/* دکمه‌های عملیاتی */
.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.action-btn {
  flex: 1 1 auto;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 0.7rem 1rem;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: background 0.2s, transform 0.15s, border-color 0.2s;
  white-space: nowrap;
}

.action-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--accent-teal);
  transform: translateY(-2px);
  color: var(--text-primary);
}

.action-btn-support {
  background: rgba(124, 92, 255, 0.15);
  border-color: rgba(124, 92, 255, 0.4);
}

.action-btn-support:hover {
  background: rgba(124, 92, 255, 0.25);
}

/* ---------------- مودال QR ---------------- */
.qr-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 16, 0.75);
  backdrop-filter: blur(6px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.qr-modal.show {
  display: flex;
}

.qr-modal-content {
  background: #10152a;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 1.6rem;
  position: relative;
  text-align: center;
  animation: popIn 0.25s ease;
}

@keyframes popIn {
  from { transform: scale(0.9); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

#qrcodeBox {
  background: #fff;
  padding: 12px;
  border-radius: 12px;
  display: inline-block;
}

.qr-hint {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-top: 0.8rem;
  margin-bottom: 0;
}

.qr-close {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: var(--text-primary);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
}

/* ---------------- انیمیشن‌های ورود ---------------- */
@media (prefers-reduced-motion: no-preference) {
  .fade-in {
    animation: fadeIn 0.6s ease both;
  }

  .result-card {
    animation: fadeUp 0.5s ease both;
  }

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

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

.footer-note {
  color: var(--text-muted);
}

/* focus visible برای دسترسی‌پذیری */
button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent-teal);
  outline-offset: 2px;
}
