/* ═══════════════════════════════════════════════
   VaultSync MPA — Shared Stylesheet
   Aesthetic: industrial-terminal, dark, monospace
   ═══════════════════════════════════════════════ */

:root {
  --bg:          #0b0c0f;
  --surface:     #13151a;
  --surface-2:   #1c1f27;
  --surface-3:   #252931;
  --border:      #2a2d38;
  --border-hi:   #3d4255;

  --accent:      #00e5a0;
  --accent-dim:  #00b07c;
  --accent-glow: rgba(0,229,160,0.15);

  --danger:      #ff4d6d;
  --warning:     #f7c948;

  --text:        #e4e6ed;
  --text-muted:  #6b7280;
  --text-dim:    #3d4255;

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

  --radius:      6px;
  --radius-lg:   12px;
  --shadow:      0 4px 24px rgba(0,0,0,0.5);
  --transition:  0.18s ease;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html  { font-size: 15px; }
body  {
  font-family: var(--font-mono);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}
button { cursor: pointer; font-family: inherit; border: none; background: none; }
input  { font-family: inherit; font-size: inherit; }
a      { color: var(--accent); text-decoration: none; transition: opacity var(--transition); }
a:hover { opacity: 0.75; }
.inline-link { color: var(--accent); cursor: pointer; }
.visually-hidden { position: absolute; width:1px; height:1px; overflow:hidden; clip:rect(0,0,0,0); }

/* ── Background grid ── */
.bg-grid {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 40px 40px;
  opacity: 0.3;
}

/* ═══════════════════════════
   LAYOUT SHELLS
   ═══════════════════════════ */

/* Full-page centred card (login, index) */
.page-center {
  position: relative; z-index: 1;
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
  padding: 1.5rem;
}

/* Dashboard card grid */
.page-dashboard {
  position: relative; z-index: 1;
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
  padding: 2rem 1.5rem;
}

/* Sidebar layout (upload, files, settings) */
.page-app {
  position: relative; z-index: 1;
  display: flex;
  min-height: 100vh;
}
.sidebar {
  width: 220px; flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 1.5rem 0;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0 1.2rem 1.25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}
.sidebar-brand .brand-icon { font-size: 1.25rem; color: var(--accent); filter: drop-shadow(0 0 6px var(--accent)); }
.sidebar-brand .brand-name { font-family: var(--font-sans); font-weight: 800; font-size: 1.05rem; }
.sidebar-nav {
  flex: 1; display: flex; flex-direction: column; gap: 0.25rem; padding: 0 0.75rem;
}
.nav-item {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius);
  font-size: 0.8rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: all var(--transition);
}
.nav-item:hover         { background: var(--surface-2); color: var(--text); }
.nav-item.active        { background: var(--accent-glow); color: var(--accent); }
.nav-icon               { font-size: 0.9rem; width: 16px; text-align: center; }
.sidebar-footer {
  padding: 1rem 1.2rem 0;
  border-top: 1px solid var(--border);
  margin-top: auto;
}
.user-email {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Main content area */
.main-content {
  flex: 1;
  padding: 2.5rem;
  overflow-y: auto;
  max-width: 820px;
}
.view-header {
  margin-bottom: 2rem;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}
.view-header h1 {
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: 1.6rem;
  letter-spacing: -0.02em;
}
.view-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  letter-spacing: 0.03em;
}

/* ═══════════════════════════
   BRAND
   ═══════════════════════════ */
.brand { text-align: center; margin-bottom: 2rem; }
.brand-icon {
  display: inline-block;
  font-size: 2.5rem; color: var(--accent); line-height: 1; margin-bottom: 0.5rem;
  filter: drop-shadow(0 0 14px var(--accent));
}
.brand-name { font-family: var(--font-sans); font-size: 1.75rem; font-weight: 800; letter-spacing: -0.02em; }
.brand-tagline { font-size: 0.72rem; color: var(--text-muted); letter-spacing: 0.08em; text-transform: uppercase; margin-top: 0.25rem; }

/* ═══════════════════════════
   CARDS
   ═══════════════════════════ */
.card {
  background: var(--surface);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius-lg);
  padding: 2rem;
  width: 100%; max-width: 420px;
  box-shadow: var(--shadow), 0 0 60px rgba(0,229,160,0.05);
}
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

/* ═══════════════════════════
   FORM ELEMENTS
   ═══════════════════════════ */
.field { margin-bottom: 1rem; }
.field label {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}
.label-hint {
  text-transform: none; letter-spacing: normal;
  font-size: 0.68rem; color: var(--text-dim); margin-left: 0.4rem;
}
input[type="email"],
input[type="password"],
input[type="text"] {
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.88rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
input::placeholder { color: var(--text-dim); }

.password-wrap { position: relative; }
.password-wrap input { padding-right: 2.6rem; }
.toggle-pass {
  position: absolute; right: 0.65rem; top: 50%;
  transform: translateY(-50%);
  font-size: 0.9rem; opacity: 0.4;
  transition: opacity var(--transition);
}
.toggle-pass:hover { opacity: 1; }

/* ═══════════════════════════
   BUTTONS
   ═══════════════════════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.65rem 1.4rem;
  border-radius: var(--radius);
  font-size: 0.82rem; font-weight: 700; letter-spacing: 0.04em;
  transition: all var(--transition); white-space: nowrap;
}
.btn-primary {
  background: var(--accent); color: var(--bg);
}
.btn-primary:hover:not(:disabled) { background: #1ffbb8; box-shadow: 0 0 20px var(--accent-glow); }
.btn-primary:disabled { opacity: 0.35; cursor: not-allowed; }
.btn-ghost {
  border: 1px solid var(--border-hi); color: var(--text-muted); background: transparent;
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger { border: 1px solid var(--danger); color: var(--danger); background: transparent; }
.btn-danger:hover { background: rgba(255,77,109,0.1); }
.btn-sm  { padding: 0.4rem 0.9rem; font-size: 0.75rem; }
.full-width { width: 100%; margin-top: 0.5rem; }
.btn-spinner { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 4px; color: var(--text-muted); font-size: 0.75rem;
  transition: all var(--transition);
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }

/* ═══════════════════════════
   TABS (login page)
   ═══════════════════════════ */
.tab-bar {
  display: flex;
  border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; margin-bottom: 1.5rem;
}
.tab {
  flex: 1; padding: 0.55rem 0;
  font-size: 0.8rem; font-family: var(--font-mono); letter-spacing: 0.05em;
  color: var(--text-muted); background: transparent; transition: all var(--transition);
}
.tab.active { color: var(--bg); background: var(--accent); font-weight: 700; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ═══════════════════════════
   STATUS / FEEDBACK
   ═══════════════════════════ */
.error-msg {
  margin-top: 0.75rem;
  padding: 0.55rem 0.85rem;
  background: rgba(255,77,109,0.1); border: 1px solid rgba(255,77,109,0.3);
  border-radius: var(--radius); color: var(--danger); font-size: 0.78rem;
}
.toast {
  margin-top: 1rem;
  padding: 0.65rem 1rem;
  border-radius: var(--radius); font-size: 0.8rem;
  border-left: 3px solid var(--accent);
  background: var(--surface-2); color: var(--text);
  animation: fadeIn 0.2s ease;
}
.toast.error { border-color: var(--danger); background: rgba(255,77,109,0.07); color: var(--danger); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; } }
.loading-msg { color: var(--text-muted); font-size: 0.8rem; padding: 1rem; }

/* ═══════════════════════════
   STORAGE BADGE
   ═══════════════════════════ */
.storage-badge {
  display: inline-block;
  font-size: 0.62rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 0.22rem 0.55rem; border-radius: 4px; margin-bottom: 0.4rem;
}
.storage-badge.managed {
  background: rgba(0,229,160,0.12); color: var(--accent); border: 1px solid rgba(0,229,160,0.3);
}
.storage-badge.user {
  background: rgba(247,201,72,0.12); color: var(--warning); border: 1px solid rgba(247,201,72,0.3);
}

/* ═══════════════════════════
   STRENGTH METER
   ═══════════════════════════ */
.strength-bar-wrap {
  display: flex; align-items: center; gap: 0.75rem; margin: 0.5rem 0 1rem;
}
.strength-bar { flex: 1; height: 4px; background: var(--surface-3); border-radius: 4px; overflow: hidden; }
.strength-fill { height: 100%; border-radius: 4px; transition: width 0.3s ease, background 0.3s ease; }
.strength-label { font-size: 0.68rem; color: var(--text-muted); letter-spacing: 0.06em; min-width: 48px; text-align: right; }

/* ═══════════════════════════
   PROGRESS BAR
   ═══════════════════════════ */
.progress-section { margin-bottom: 1.5rem; }
.progress-track { height: 6px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.progress-fill {
  height: 100%; background: var(--accent); border-radius: 4px;
  transition: width 0.25s ease; box-shadow: 0 0 10px var(--accent);
}
.progress-label { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.4rem; }

/* ═══════════════════════════
   DROP ZONE (upload page)
   ═══════════════════════════ */
.upload-area {
  border: 2px dashed var(--border-hi); border-radius: var(--radius-lg);
  padding: 3rem 2rem; text-align: center;
  transition: all var(--transition); cursor: pointer;
  background: var(--surface); margin-bottom: 1.5rem;
}
.upload-area:hover, .upload-area.drag-over {
  border-color: var(--accent); background: var(--accent-glow);
}
.drop-icon   { font-size: 2.5rem; color: var(--accent); margin-bottom: 0.75rem; }
.drop-text   { font-size: 0.88rem; color: var(--text); margin-bottom: 0.3rem; }
.drop-hint   { font-size: 0.72rem; color: var(--text-muted); }
.selected-files { margin-top: 1rem; display: flex; flex-direction: column; gap: 0.4rem; }
.selected-file-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.4rem 0.75rem;
  background: var(--surface-2); border-radius: var(--radius);
  font-size: 0.77rem; color: var(--text-muted); border: 1px solid var(--border);
}
.selected-file-item .file-name { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 65%; }

/* ═══════════════════════════
   FILE LIST (files page)
   ═══════════════════════════ */
.file-list { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1.5rem; }
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }
.empty-icon  { font-size: 3rem; display: block; margin-bottom: 0.75rem; opacity: 0.4; }
.file-card {
  display: flex; align-items: center; gap: 1rem;
  padding: 0.85rem 1.1rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); cursor: pointer;
  transition: all var(--transition);
}
.file-card:hover  { border-color: var(--accent); background: var(--surface-2); }
.file-card.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-glow); }
.file-thumb     { font-size: 1.4rem; flex-shrink: 0; }
.file-info      { flex: 1; min-width: 0; }
.file-card-name { font-size: 0.85rem; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-card-meta { font-size: 0.68rem; color: var(--text-muted); margin-top: 0.15rem; }
.file-badge {
  flex-shrink: 0; font-size: 0.6rem;
  background: var(--accent-glow); color: var(--accent);
  padding: 0.2rem 0.5rem; border-radius: 4px;
  letter-spacing: 0.06em; text-transform: uppercase;
}

/* Download / decrypt panel */
.download-panel {
  background: var(--surface); border: 1px solid var(--border-hi);
  border-radius: var(--radius-lg); padding: 1.5rem;
}
.panel-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem;
}
.dl-filename { font-size: 0.88rem; color: var(--accent); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 80%; }
.panel-actions { display: flex; gap: 0.75rem; margin-top: 1rem; }

/* ═══════════════════════════
   DASHBOARD PAGE
   ═══════════════════════════ */
.dashboard-wrap { width: 100%; max-width: 520px; }
.dashboard-brand { text-align: center; margin-bottom: 2rem; }
.dashboard-user {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 0.85rem 1.1rem;
  margin-bottom: 2rem;
}
.dashboard-user-info { display: flex; flex-direction: column; gap: 0.2rem; }
.dashboard-user-label { font-size: 0.62rem; color: var(--text-muted); letter-spacing: 0.08em; text-transform: uppercase; }
.dashboard-user-email { font-size: 0.82rem; color: var(--text); }
.nav-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.85rem;
}
.nav-card {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.6rem; padding: 1.75rem 1rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); text-decoration: none;
  transition: all var(--transition); cursor: pointer;
}
.nav-card:hover { border-color: var(--accent); background: var(--surface-2); box-shadow: 0 0 20px var(--accent-glow); }
.nav-card-icon  { font-size: 1.75rem; }
.nav-card-title { font-size: 0.85rem; font-weight: 700; color: var(--text); text-align: center; }
.nav-card-desc  { font-size: 0.7rem; color: var(--text-muted); text-align: center; line-height: 1.4; }

/* ═══════════════════════════
   SETTINGS PAGE
   ═══════════════════════════ */
.settings-section-title { font-family: var(--font-sans); font-weight: 700; font-size: 1rem; margin-bottom: 0.35rem; }
.settings-section-desc  { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 1.25rem; line-height: 1.6; }

.storage-option {
  border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 0.65rem;
  transition: border-color var(--transition);
}
.storage-option:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-glow); }
.storage-option-label {
  display: flex; align-items: flex-start; gap: 1rem; padding: 1rem 1.1rem; cursor: pointer;
}
.storage-option-label input[type="radio"] {
  margin-top: 3px; flex-shrink: 0; accent-color: var(--accent); width: 15px; height: 15px;
}
.storage-option-body { flex: 1; }
.storage-option-title { display: flex; align-items: center; gap: 0.5rem; font-size: 0.88rem; font-weight: 700; margin-bottom: 0.3rem; }
.option-icon { font-size: 1rem; }
.option-tag {
  font-size: 0.6rem; padding: 0.15rem 0.45rem; border-radius: 4px;
  letter-spacing: 0.06em; text-transform: uppercase; font-weight: 700;
}
.option-tag.recommended { background: var(--accent-glow); color: var(--accent); }
.option-tag:not(.recommended) { background: var(--surface-3); color: var(--text-muted); }
.storage-option-desc { font-size: 0.75rem; color: var(--text-muted); line-height: 1.6; }

.config-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem 1rem; margin-bottom: 1.1rem;
}
.config-status {
  margin-top: 0.65rem; padding: 0.55rem 0.85rem;
  border-radius: var(--radius); font-size: 0.78rem; border-left: 3px solid transparent;
}
.config-status.success { background: var(--accent-glow); border-color: var(--accent); color: var(--accent); }
.config-status.error   { background: rgba(255,77,109,0.08); border-color: var(--danger); color: var(--danger); }
.config-status.info    { background: var(--surface-2); border-color: var(--text-muted); color: var(--text-muted); }
.config-note {
  margin-top: 1rem; padding: 0.65rem 0.9rem;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 0.73rem; color: var(--text-muted); line-height: 1.6;
}
.config-note code { font-family: var(--font-mono); color: var(--accent); font-size: 0.72rem; }

/* ═══════════════════════════
   REDIRECT / LOADING PAGE
   ═══════════════════════════ */
.redirect-page {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 100vh; gap: 1rem; color: var(--text-muted); font-size: 0.82rem;
}
.redirect-spinner { font-size: 2rem; animation: spin 1s linear infinite; color: var(--accent); }

/* ═══════════════════════════
   SCROLLBAR
   ═══════════════════════════ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-hi); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ═══════════════════════════
   RESPONSIVE
   ═══════════════════════════ */
@media (max-width: 640px) {
  .sidebar     { display: none; }
  .main-content { padding: 1.25rem; }
  .panel-actions { flex-direction: column; }
  .nav-grid    { grid-template-columns: 1fr; }
  .config-grid { grid-template-columns: 1fr; }

  /* Mobile bottom navigation bar */
  .mobile-nav {
    display: flex;
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
    background: var(--surface); border-top: 1px solid var(--border);
    padding: 0.4rem 0 env(safe-area-inset-bottom, 0.4rem);
  }
  .mobile-nav a {
    flex: 1; display: flex; flex-direction: column; align-items: center;
    gap: 0.2rem; padding: 0.4rem 0;
    font-size: 0.6rem; color: var(--text-muted); text-decoration: none;
    transition: color var(--transition);
  }
  .mobile-nav a.active, .mobile-nav a:hover { color: var(--accent); }
  .mobile-nav .mobile-nav-icon { font-size: 1.1rem; }

  /* Push content above bottom nav */
  .page-app .main-content { padding-bottom: 5rem; }
}

@media (min-width: 641px) {
  .mobile-nav { display: none; }
}

/* ── Info banner (encrypt / decrypt pages) ──────────────────────────── */
.info-banner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}
.info-step {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.info-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--accent-glow);
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
}
.info-arrow {
  color: var(--text-dim);
  font-size: 0.85rem;
}

/* ── Small file drop zones (decrypt page) ───────────────────────────── */
.file-drop-small {
  border: 1px dashed var(--border-hi);
  border-radius: var(--radius);
  transition: all var(--transition);
}
.file-drop-small:hover { border-color: var(--accent); background: var(--accent-glow); }
.file-drop-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--text-muted);
}
.file-drop-icon { font-size: 1.2rem; flex-shrink: 0; }

/* ── Output panel (encrypt page) ────────────────────────────────────── */
.output-files {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 0.5rem;
}
.output-file-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.output-file-icon { font-size: 1.25rem; flex-shrink: 0; }
.output-file-name { font-size: 0.85rem; color: var(--accent); margin-bottom: 0.2rem; }
.output-file-desc { font-size: 0.72rem; color: var(--text-muted); }