/* ============================================================
   SecureVault — Global Styles
   Dark cyber-vault aesthetic: deep blacks, teal/emerald accents,
   monospace touches, sharp geometric details
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=JetBrains+Mono:wght@300;400;500&display=swap');

/* ── CSS Variables ────────────────────────────────────────── */
:root {
  --bg-void:      #080b0f;
  --bg-deep:      #0c1017;
  --bg-card:      #111820;
  --bg-elevated:  #161f2a;
  --bg-input:     #0e1620;

  --teal:         #00d4aa;
  --teal-dim:     #00a882;
  --teal-glow:    rgba(0, 212, 170, 0.15);
  --teal-border:  rgba(0, 212, 170, 0.25);

  --green:        #00ff88;
  --green-dim:    rgba(0, 255, 136, 0.08);

  --text-primary:   #e8f4f1;
  --text-secondary: #7a9e99;
  --text-muted:     #3d5a56;

  --border:       rgba(255,255,255,0.06);
  --border-hover: rgba(0, 212, 170, 0.4);

  --danger:       #ff4757;
  --danger-dim:   rgba(255, 71, 87, 0.12);
  --warning:      #ffa502;

  --radius-sm:    6px;
  --radius-md:    12px;
  --radius-lg:    18px;

  --font-display: 'Syne', sans-serif;
  --font-mono:    'JetBrains Mono', monospace;

  --transition:   0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow-teal:  0 0 30px rgba(0, 212, 170, 0.12);
  --shadow-card:  0 8px 32px rgba(0,0,0,0.4);
}

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

html { font-size: 16px; -webkit-font-smoothing: antialiased; }

body {
  background: var(--bg-void);
  color: var(--text-primary);
  font-family: var(--font-mono);
  min-height: 100vh;
  line-height: 1.6;
}

/* ── Scrollbar ────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb { background: var(--teal-dim); border-radius: 99px; }

/* ── Typography ───────────────────────────────────────────── */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
}

a {
  color: var(--teal);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover { color: var(--green); }

/* ── Animated Background Grid ────────────────────────────── */
.bg-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-image:
    linear-gradient(rgba(0,212,170,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,212,170,0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

.bg-grid::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(0,212,170,0.06) 0%, transparent 70%);
}

/* ── Card ─────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  transition: border-color var(--transition);
}
.card:hover { border-color: var(--teal-border); }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: background var(--transition);
}
.btn:hover::before { background: rgba(255,255,255,0.05); }
.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--teal);
  color: #000;
  font-weight: 600;
  box-shadow: 0 0 20px rgba(0,212,170,0.3);
}
.btn-primary:hover {
  background: var(--green);
  box-shadow: 0 0 30px rgba(0,255,136,0.4);
}

.btn-ghost {
  background: transparent;
  color: var(--teal);
  border: 1px solid var(--teal-border);
}
.btn-ghost:hover {
  background: var(--teal-glow);
  border-color: var(--teal);
}

.btn-danger {
  background: var(--danger-dim);
  color: var(--danger);
  border: 1px solid rgba(255,71,87,0.2);
}
.btn-danger:hover {
  background: rgba(255,71,87,0.2);
  border-color: var(--danger);
}

.btn-sm { padding: 7px 14px; font-size: 0.8rem; }
.btn-lg { padding: 15px 32px; font-size: 1rem; }
.btn-full { width: 100%; }

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
}

/* ── Form Elements ────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.form-input, .form-select, .form-textarea {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  padding: 12px 16px;
  transition: all var(--transition);
  outline: none;
  width: 100%;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--teal);
  background: var(--bg-elevated);
  box-shadow: 0 0 0 3px var(--teal-glow);
}

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

.form-input.error { border-color: var(--danger); }
.form-error {
  font-size: 0.78rem;
  color: var(--danger);
  display: none;
}
.form-error.show { display: block; }

.form-textarea {
  resize: vertical;
  min-height: 100px;
}

/* Input with icon */
.input-wrapper {
  position: relative;
}
.input-wrapper .form-input { padding-left: 42px; }
.input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1rem;
  pointer-events: none;
}
.input-toggle {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--transition);
  background: none;
  border: none;
  font-size: 1rem;
}
.input-toggle:hover { color: var(--teal); }

/* ── Alerts ───────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  display: none;
  align-items: center;
  gap: 10px;
}
.alert.show { display: flex; }
.alert-error {
  background: var(--danger-dim);
  border: 1px solid rgba(255,71,87,0.25);
  color: #ff6b7a;
}
.alert-success {
  background: rgba(0,212,170,0.08);
  border: 1px solid rgba(0,212,170,0.2);
  color: var(--teal);
}

/* ── Badge ────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.badge-password  { background: rgba(0,212,170,0.12); color: var(--teal); border: 1px solid var(--teal-border); }
.badge-seed      { background: rgba(255,165,2,0.12);  color: var(--warning); border: 1px solid rgba(255,165,2,0.25); }
.badge-note      { background: rgba(99,179,237,0.12); color: #63b3ed; border: 1px solid rgba(99,179,237,0.25); }
.badge-api_key   { background: rgba(154,103,255,0.12);color: #9a67ff; border: 1px solid rgba(154,103,255,0.25); }
.badge-other     { background: rgba(255,255,255,0.06); color: var(--text-secondary); border: 1px solid var(--border); }

/* ── Navbar ───────────────────────────────────────────────── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(8,11,15,0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--text-primary);
  text-decoration: none;
}
.navbar-brand .brand-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--teal), var(--green));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}
.navbar-brand span { color: var(--teal); }

.navbar-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link {
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--text-secondary);
  transition: all var(--transition);
  text-decoration: none;
}
.nav-link:hover, .nav-link.active {
  background: var(--teal-glow);
  color: var(--teal);
}

.navbar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.navbar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--teal-dim), #005544);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--teal);
  border: 1px solid var(--teal-border);
}

/* ── Loading Spinner ──────────────────────────────────────── */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(0,0,0,0.2);
  border-top-color: #000;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: none;
}
.spinner.show { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Toast Notification ───────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toast {
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastIn 0.3s ease;
  max-width: 320px;
}
.toast.success { border-color: rgba(0,212,170,0.4); }
.toast.error   { border-color: rgba(255,71,87,0.4); }
.toast-icon { font-size: 1rem; }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── Modal ────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.modal-overlay.show {
  opacity: 1;
  pointer-events: all;
}
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.6), var(--shadow-teal);
  transform: translateY(10px);
  transition: transform 0.2s ease;
}
.modal-overlay.show .modal { transform: translateY(0); }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.modal-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
}
.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  transition: color var(--transition);
  padding: 4px;
}
.modal-close:hover { color: var(--text-primary); }

/* ── Utility ──────────────────────────────────────────────── */
.text-teal    { color: var(--teal); }
.text-muted   { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-danger  { color: var(--danger); }
.text-mono    { font-family: var(--font-mono); }
.text-center  { text-align: center; }
.text-sm      { font-size: 0.875rem; }
.text-xs      { font-size: 0.75rem; }

.flex         { display: flex; }
.flex-center  { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-sm       { gap: 8px; }
.gap-md       { gap: 16px; }
.gap-lg       { gap: 24px; }

.mt-sm { margin-top: 8px; }
.mt-md { margin-top: 16px; }
.mt-lg { margin-top: 24px; }
.mb-md { margin-bottom: 16px; }

.divider {
  height: 1px;
  background: var(--border);
  margin: 24px 0;
}

/* ── Animations ───────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}
@keyframes shimmer {
  0%   { background-position: -200% center; }
  100% { background-position: 200% center; }
}

.animate-fade-up { animation: fadeUp 0.4s ease both; }
.animate-fade-up-delay-1 { animation: fadeUp 0.4s 0.1s ease both; }
.animate-fade-up-delay-2 { animation: fadeUp 0.4s 0.2s ease both; }
.animate-fade-up-delay-3 { animation: fadeUp 0.4s 0.3s ease both; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
  .navbar { padding: 0 16px; }
  .modal  { padding: 24px; }
}
