/* ═══════════════════════════════════════════════════ */
/* Reset & Base                                        */
/* ═══════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0a0e1a;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-hover: rgba(255, 255, 255, 0.07);
  --surface-solid: #131826;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.15);
  --text: #e6ebf5;
  --text-dim: #8892a8;
  --text-dimmer: #5a6478;
  --accent: #6366f1;
  --accent-2: #8b5cf6;
  --accent-3: #06b6d4;
  --success: #10b981;
  --error: #ef4444;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  --font: "Vazirmatn", system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* Light theme */
html[data-theme="light"] {
  --bg: #f5f7fb;
  --surface: rgba(0, 0, 0, 0.03);
  --surface-hover: rgba(0, 0, 0, 0.06);
  --surface-solid: #ffffff;
  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.15);
  --text: #1a1f2e;
  --text-dim: #5a6478;
  --text-dimmer: #8892a8;
  --shadow: 0 8px 32px rgba(99, 102, 241, 0.1);
}

html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.7;
  overflow-x: hidden;
  position: relative;
  transition: background 0.3s, color 0.3s;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 800px 500px at 20% 0%, rgba(99, 102, 241, 0.18), transparent 60%),
    radial-gradient(ellipse 700px 500px at 90% 30%, rgba(139, 92, 246, 0.14), transparent 60%),
    radial-gradient(ellipse 600px 400px at 50% 100%, rgba(6, 182, 212, 0.10), transparent 60%);
  pointer-events: none;
  z-index: 0;
}
html[data-theme="light"] body::before {
  background:
    radial-gradient(ellipse 800px 500px at 20% 0%, rgba(99, 102, 241, 0.1), transparent 60%),
    radial-gradient(ellipse 700px 500px at 90% 30%, rgba(139, 92, 246, 0.08), transparent 60%);
}

.app {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

.hidden { display: none !important; }

/* ═══════════════════════════════════════════════════ */
/* States                                              */
/* ═══════════════════════════════════════════════════ */
.state--loading,
.state--error,
.state--password {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 70vh;
  text-align: center;
  gap: 16px;
  color: var(--text-dim);
}

.spinner {
  width: 44px; height: 44px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.state--error .icon { font-size: 48px; }
.state--error h2 { color: var(--text); font-size: 1.4rem; }

.pw-card {
  background: var(--surface-solid);
  padding: 32px 24px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
  max-width: 400px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.pw-card .icon { font-size: 40px; margin-bottom: 8px; }
.pw-card h2 { color: var(--text); font-size: 1.2rem; }
.pw-card input {
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  text-align: center;
  direction: ltr;
}
.pw-card input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}
.pw-error {
  color: var(--error);
  font-size: 0.85rem;
  text-align: center;
}

/* ═══════════════════════════════════════════════════ */
/* Header                                              */
/* ═══════════════════════════════════════════════════ */
.header {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 24px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(139, 92, 246, 0.15));
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
}

.header__bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 100% 0%, rgba(6, 182, 212, 0.25), transparent 50%),
    radial-gradient(circle at 0% 100%, rgba(99, 102, 241, 0.3), transparent 50%);
  pointer-events: none;
}

.header__inner {
  position: relative;
  padding: 32px 24px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.header__actions {
  position: absolute;
  top: 16px;
  left: 16px;
  display: flex;
  gap: 8px;
  z-index: 2;
}

.icon-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.icon-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}
.icon-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.badge {
  display: inline-block;
  font-size: 0.8rem;
  padding: 4px 12px;
  border-radius: 100px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid var(--border-strong);
  font-weight: 500;
}
.badge.hidden { display: none; }

.header h1 {
  font-size: 1.85rem;
  font-weight: 800;
  margin-bottom: 12px;
  line-height: 1.3;
  background: linear-gradient(135deg, #fff, #c7d2fe);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  word-break: break-word;
}
html[data-theme="light"] .header h1 {
  background: linear-gradient(135deg, #1a1f2e, #6366f1);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.meta {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-dim);
  flex-wrap: wrap;
}
.dot { opacity: 0.5; }

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}
.tag {
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: 100px;
  background: rgba(99, 102, 241, 0.2);
  color: var(--accent);
  border: 1px solid rgba(99, 102, 241, 0.3);
  font-weight: 500;
}

/* ═══════════════════════════════════════════════════ */
/* Fields                                              */
/* ═══════════════════════════════════════════════════ */
.fields {
  display: grid;
  gap: 12px;
  margin-bottom: 24px;
}

.field {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
  animation: fadeIn 0.3s ease both;
}

.field::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 0; bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  opacity: 0;
  transition: opacity 0.2s;
}

.field:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}
.field:hover::before { opacity: 1; }

.field__label {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-bottom: 6px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

.field__value {
  font-size: 1rem;
  color: var(--text);
  word-break: break-word;
  white-space: pre-wrap;
  font-weight: 500;
}
.field__value--empty {
  color: var(--text-dimmer);
  font-style: italic;
  font-weight: 400;
}
.field--multiline .field__value { line-height: 1.8; }

.field__copy {
  position: absolute;
  top: 12px;
  inset-inline-end: 12px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 0.75rem;
  cursor: pointer;
  font-family: inherit;
  opacity: 0;
  transition: all 0.2s;
}
.field:hover .field__copy { opacity: 1; }
.field__copy:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

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

/* ═══════════════════════════════════════════════════ */
/* Related                                             */
/* ═══════════════════════════════════════════════════ */
.related {
  margin-bottom: 24px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.related h3 {
  font-size: 0.95rem;
  color: var(--text-dim);
  margin-bottom: 12px;
  font-weight: 600;
}
.related-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.related-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  text-decoration: none;
  transition: all 0.2s;
  font-size: 0.9rem;
}
.related-item:hover {
  border-color: var(--accent);
  transform: translateX(-2px);
}

/* ═══════════════════════════════════════════════════ */
/* CTA                                                 */
/* ═══════════════════════════════════════════════════ */
.cta {
  text-align: center;
  margin: 32px 0 24px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 28px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  width: 100%;
  max-width: 340px;
}
.btn--primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.35);
}
.btn--primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(99, 102, 241, 0.5);
}
.btn__icon { font-size: 1.2rem; }
.cta__hint {
  margin-top: 12px;
  font-size: 0.82rem;
  color: var(--text-dim);
  line-height: 1.7;
}

/* ═══════════════════════════════════════════════════ */
/* Footer                                              */
/* ═══════════════════════════════════════════════════ */
.footer {
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-dimmer);
  margin-top: 24px;
}

/* ═══════════════════════════════════════════════════ */
/* Toast                                               */
/* ═══════════════════════════════════════════════════ */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translate(-50%, 80px);
  background: rgba(20, 20, 30, 0.95);
  color: #fff;
  padding: 12px 20px;
  border-radius: 100px;
  font-size: 0.85rem;
  font-weight: 500;
  border: 1px solid var(--border-strong);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  z-index: 100;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.toast--visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ═══════════════════════════════════════════════════ */
/* Responsive                                          */
/* ═══════════════════════════════════════════════════ */
@media (max-width: 480px) {
  .app { padding: 16px 12px 32px; }
  .header__inner { padding: 24px 18px; }
  .header h1 { font-size: 1.5rem; }
  .field { padding: 14px 14px; }
}