/* ================= v2ray page ================= */

/* ---------------- tabs ---------------- */
.v2-tabs {
  position: relative;
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  background: rgba(6,11,22,0.5);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 5px;
}

.v2-tab {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  padding: 10px;
  border-radius: 9px;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}

.v2-tab.active {
  background: linear-gradient(135deg, var(--sky-bright), var(--sky-deep));
  color: #06172B;
}

.v2-panel {
  display: none;
  position: relative;
}

.v2-panel.active {
  display: block;
  animation: fadeSlideIn 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------------- manual form ---------------- */
.manual-form {
  width: 100%;
  box-sizing: border-box;
}

.manual-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  width: 100%;
}

@media (min-width: 640px) {
  .manual-grid { grid-template-columns: 1fr 1fr; }
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0; /* جلوگیری از سرریز افقی سلول‌های گرید */
}

.field.span-2 {
  grid-column: 1 / -1;
}

.field label {
  font-size: 11.5px;
  color: var(--text-dim);
  font-weight: 600;
}

.field input,
.field select {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  background: rgba(6,11,22,0.55);
  border: 1.5px solid var(--border-light);
  border-radius: 10px;
  padding: 11px 13px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field select {
  font-family: var(--font-display);
  cursor: pointer;
}

.field input:focus,
.field select:focus {
  border-color: var(--sky);
  box-shadow: 0 0 0 3px rgba(79,182,255,0.14);
}

.field input::placeholder {
  color: var(--text-faint);
  font-size: 12px;
}

/* ---------------- config grid ---------------- */
.config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  width: 100%;
}

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

.config-card {
  position: relative;
  min-width: 0;
  box-sizing: border-box;
  background: linear-gradient(180deg, rgba(17,37,68,0.7), rgba(13,30,54,0.5));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  backdrop-filter: blur(12px);
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.12s ease, box-shadow 0.18s ease;
}

.config-card:hover {
  border-color: var(--sky-deep);
  background: linear-gradient(180deg, rgba(23,51,92,0.8), rgba(17,37,68,0.6));
  transform: translateY(-1px);
  box-shadow: 0 12px 28px -14px rgba(79,182,255,0.4);
}

.config-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.config-protocol {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--sky-bright);
  background: rgba(79,182,255,0.12);
  border: 1px solid rgba(79,182,255,0.28);
  border-radius: 999px;
  padding: 4px 10px;
  text-transform: uppercase;
}

.config-protocol .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
}

.btn-delete-config {
  background: transparent;
  border: 1px solid var(--border-light);
  color: var(--text-faint);
  border-radius: 9px;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.btn-delete-config:hover {
  color: var(--red);
  border-color: var(--red);
}

.config-name {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.config-detail-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(29,51,88,0.5);
  min-width: 0;
}

.config-detail-row:last-of-type {
  border-bottom: none;
}

.config-detail-row .k {
  color: var(--text-faint);
  flex-shrink: 0;
}

.config-detail-row .v {
  font-family: var(--font-mono);
  color: var(--text-dim);
  direction: ltr;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1;
}

.config-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.btn-copy-link,
.btn-show-qr {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: var(--radius-sm);
  padding: 10px;
  font-family: var(--font-display);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.1s ease;
}

.btn-copy-link:active,
.btn-show-qr:active {
  transform: scale(0.96);
}

.btn-copy-link {
  background: linear-gradient(135deg, var(--sky-bright), var(--sky-deep));
  color: #06172B;
  border: none;
  box-shadow: 0 6px 16px -8px rgba(79,182,255,0.75);
}

.btn-copy-link:hover { filter: brightness(1.08); }

.btn-copy-link.copied {
  background: linear-gradient(135deg, var(--green), #1f9c6c);
}

.btn-show-qr {
  background: rgba(79,182,255,0.1);
  color: var(--sky-bright);
  border: 1px solid var(--border-light);
}

.btn-show-qr:hover {
  border-color: var(--sky);
}

/* ---------------- QR modal ---------------- */
.qr-modal {
  text-align: center;
  max-width: 340px;
}

.qr-box {
  width: 100%;
  max-width: 220px;
  aspect-ratio: 1 / 1;
  margin: 4px auto 14px;
  background: #fff;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  box-sizing: border-box;
  box-shadow: 0 10px 30px -10px rgba(79,182,255,0.35);
}

.qr-box img,
.qr-box canvas {
  width: 100% !important;
  height: 100% !important;
}

.qr-name {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
  word-break: break-all;
}
