/* ========================================================
   AMPass Desktop — Premium Dark UI
   Design: Glassmorphism + Indigo Gradient + Inter Font
   ======================================================== */

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

/* ===== Design Tokens ===== */
:root {
  /* Brand Colours */
  --indigo-950:  #0f0c29;
  --indigo-900:  #1a1440;
  --indigo-800:  #241c5c;
  --indigo-700:  #312e81;
  --indigo-600:  #3730a3;
  --indigo-500:  #4338ca;
  --indigo-400:  #4f46e5;
  --indigo-300:  #6366f1;
  --indigo-200:  #818cf8;
  --indigo-100:  #c7d2fe;

  /* Semantic Tokens */
  --accent:       var(--indigo-400);
  --accent-hover: var(--indigo-500);
  --accent-glow:  rgba(79, 70, 229, 0.25);

  /* Surface palette (dark) */
  --bg:           #0d0d14;
  --surface-0:    #13121e;
  --surface-1:    #1a1929;
  --surface-2:    #22213a;
  --surface-3:    #2c2b4a;
  --border:       rgba(255,255,255,0.07);
  --border-hover: rgba(99,102,241,0.4);

  /* Text */
  --text:         #f1f0ff;
  --text-sec:     #a5a3c0;
  --text-muted:   #615f7e;

  /* Status */
  --success:      #22c55e;
  --warning:      #f59e0b;
  --danger:       #ef4444;

  /* Sidebar */
  --sidebar-w:    228px;

  /* Misc */
  --topbar-h:     52px;
  --bottom-h:     46px;
  --radius:       10px;
  --radius-lg:    16px;
  --font:         'Inter', 'Segoe UI', -apple-system, sans-serif;
  --mono:         'Cascadia Code', 'Consolas', monospace;
  --shadow-sm:    0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:    0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg:    0 16px 48px rgba(0,0,0,0.6);
  --transition:   0.18s ease;
}

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  line-height: 1.55;
  height: 100vh;
  overflow: hidden;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}
#app { height: 100vh; display: flex; flex-direction: column; }
button { font-family: var(--font); cursor: pointer; }
input, select, textarea { font-family: var(--font); }
a { text-decoration: none; color: inherit; }

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--indigo-700); }

/* ===================================================
   AUTH SCREENS
   =================================================== */
.auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background:
    radial-gradient(ellipse 80% 80% at 50% -20%, rgba(99,102,241,0.25) 0%, transparent 70%),
    linear-gradient(160deg, #0f0c29 0%, #121228 60%, #0d0d14 100%);
  animation: bgFade 0.4s ease;
}

@keyframes bgFade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.auth-card {
  background: rgba(26,25,41,0.85);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border: 1px solid rgba(99,102,241,0.2);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  width: 400px;
  text-align: center;
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.04) inset,
    var(--shadow-lg);
  animation: cardSlide 0.35s cubic-bezier(0.16,1,0.3,1);
}

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

.auth-logo {
  margin-bottom: 14px;
  animation: logoPop 0.5s cubic-bezier(0.34,1.56,0.64,1) 0.1s both;
}

@keyframes logoPop {
  from { transform: scale(0.6); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

.auth-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  letter-spacing: -0.3px;
}
.auth-sub  { color: var(--text-muted); font-size: 13px; margin-bottom: 20px; }
.auth-form { text-align: left; }
.auth-warning {
  font-size: 10px;
  color: var(--warning);
  margin-top: 16px;
  opacity: 0.7;
}

/* Form fields */
.field-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin: 14px 0 5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.field-input {
  width: 100%;
  padding: 10px 13px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.field-input:focus {
  border-color: var(--indigo-300);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.field-input::placeholder { color: var(--text-muted); opacity: 0.6; }
.field-hint  { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.field-error { color: var(--danger); font-size: 12px; margin-top: 8px; min-height: 18px; }

/* Primary Button */
.btn-primary {
  width: 100%;
  padding: 11px;
  background: linear-gradient(135deg, var(--indigo-400), var(--indigo-300));
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 600;
  margin-top: 16px;
  transition: opacity var(--transition), transform var(--transition), box-shadow var(--transition);
  box-shadow: 0 4px 14px rgba(99,102,241,0.35);
  letter-spacing: 0.01em;
}
.btn-primary:hover {
  opacity: 0.92;
  box-shadow: 0 6px 20px rgba(99,102,241,0.5);
}
.btn-primary:active { transform: scale(0.98); }

/* Checkbox */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text-sec);
  cursor: pointer;
  margin: 8px 0;
}
.checkbox-label input[type="checkbox"] { accent-color: var(--accent); width: 14px; height: 14px; }

/* ===================================================
   MAIN LAYOUT
   =================================================== */
.main-layout { display: flex; height: 100vh; }

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--indigo-900) 0%, var(--indigo-950) 100%);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  border-right: 1px solid rgba(99,102,241,0.12);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px 14px;
  font-size: 15px;
  font-weight: 700;
  color: white;
  letter-spacing: -0.2px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.sidebar-nav {
  flex: 1;
  padding: 10px 8px;
  overflow-y: auto;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 11px;
  border-radius: 8px;
  color: rgba(199,210,254,0.65);
  font-size: 12.5px;
  font-weight: 500;
  text-decoration: none;
  margin-bottom: 2px;
  transition: all var(--transition);
}
.nav-link:hover {
  background: rgba(99,102,241,0.12);
  color: var(--indigo-100);
}
.nav-link.active {
  background: rgba(99,102,241,0.22);
  color: white;
  font-weight: 600;
  box-shadow: inset 2px 0 0 var(--indigo-300);
}
.nav-icon { font-size: 14px; width: 20px; text-align: center; flex-shrink: 0; }
.nav-divider { height: 1px; background: rgba(255,255,255,0.06); margin: 8px 10px; }

.sidebar-footer {
  padding: 10px 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  gap: 8px;
}
.sync-status { display: flex; align-items: center; gap: 7px; flex: 1; min-width: 0; }
.sync-icon { font-size: 14px; flex-shrink: 0; }
.sync-info { display: flex; flex-direction: column; min-width: 0; }
.sync-label { font-size: 10px; color: var(--indigo-100); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sync-time  { font-size: 10px; color: var(--text-muted); }

/* ---- Content Area ---- */
.content { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--surface-0); }

/* ---- Topbar ---- */
.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  padding: 0 18px;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-1);
  flex-shrink: 0;
}

.search-box { flex: 1; position: relative; max-width: 440px; }
.search-icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); font-size: 13px; opacity: 0.35; pointer-events: none; }
.search-input {
  width: 100%;
  padding: 8px 12px 8px 34px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 12.5px;
  outline: none;
  background: var(--surface-2);
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.search-input:focus { border-color: var(--indigo-300); box-shadow: 0 0 0 3px var(--accent-glow); }
.search-input::placeholder { color: var(--text-muted); }

.topbar-actions { display: flex; gap: 4px; margin-left: auto; }

/* ---- Page Area ---- */
.page-area { flex: 1; overflow-y: auto; padding: 22px 24px; }
.page { display: none; animation: fadeIn 0.2s ease; }
.page.active { display: block; }

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

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.page-header h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
}

/* ---- Quick Cards ---- */
.quick-cards { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; margin-bottom: 22px; }

.qcard {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 16px;
  text-align: center;
  transition: border-color var(--transition), transform var(--transition);
  cursor: default;
}
.qcard:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
}
.qcard-num {
  display: block;
  font-size: 28px;
  font-weight: 800;
  color: var(--indigo-300);
  letter-spacing: -1px;
  line-height: 1;
  margin-bottom: 4px;
}
.qcard-label { font-size: 11px; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; }
.qcard-green .qcard-num { color: var(--success); }
.qcard-yellow .qcard-num { color: var(--warning); }
.qcard-red .qcard-num   { color: var(--danger); }

.section-title {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin: 18px 0 8px;
}

/* ---- Item Table ---- */
.item-table { display: flex; flex-direction: column; gap: 3px; }

.item-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 13px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), transform var(--transition);
}
.item-row:hover {
  border-color: var(--border-hover);
  background: var(--surface-2);
  transform: translateX(2px);
}

.item-row .item-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--surface-3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  overflow: hidden;
}
.item-row .item-info  { flex: 1; min-width: 0; }
.item-row .item-title { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.item-row .item-sub   { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.item-row .item-actions { display: flex; gap: 3px; opacity: 0; transition: opacity var(--transition); flex-shrink: 0; }
.item-row:hover .item-actions { opacity: 1; }

.empty-hint {
  color: var(--text-muted);
  font-size: 13px;
  padding: 32px 0;
  text-align: center;
  line-height: 2;
}

/* ---- Detected App Section ---- */
.detected-app-section {
  background: rgba(99,102,241,0.06);
  border: 1px dashed rgba(99,102,241,0.25);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 20px;
  animation: fadeIn 0.3s ease;
}

/* ---- Bottom Bar ---- */
.bottom-bar {
  height: var(--bottom-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-top: 1px solid var(--border);
  background: var(--surface-1);
  flex-shrink: 0;
}
.bottom-actions { display: flex; gap: 6px; }
.bottom-btn {
  padding: 5px 11px;
  font-size: 11px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--text-sec);
  transition: all var(--transition);
  font-weight: 500;
}
.bottom-btn:hover { border-color: var(--accent); color: var(--indigo-200); background: rgba(99,102,241,0.08); }
.bottom-right { font-size: 11px; color: var(--indigo-300); cursor: pointer; font-weight: 500; }
.bottom-right:hover { color: var(--indigo-200); }

/* ===================================================
   BUTTONS
   =================================================== */
.btn-sm  { padding: 6px 13px; font-size: 11.5px; border-radius: 5px; border: none; cursor: pointer; font-weight: 600; }
.btn-add { background: linear-gradient(135deg, var(--indigo-400), var(--indigo-300)); color: white; transition: opacity var(--transition), box-shadow var(--transition); box-shadow: 0 2px 8px rgba(99,102,241,0.3); }
.btn-add:hover { opacity: 0.88; box-shadow: 0 4px 14px rgba(99,102,241,0.45); }

.btn-ghost {
  padding: 8px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 12px;
  color: var(--text-sec);
  width: 100%;
  text-align: left;
  margin-bottom: 6px;
  transition: border-color var(--transition), color var(--transition);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--indigo-200); }

.btn-ghost-sm {
  padding: 5px 8px;
  background: none;
  border: none;
  font-size: 14px;
  border-radius: 5px;
  color: var(--text-muted);
  transition: background var(--transition), color var(--transition);
}
.btn-ghost-sm:hover { background: var(--surface-3); color: var(--text); }

.btn-danger-sm {
  padding: 8px 14px;
  background: none;
  border: 1px solid rgba(239,68,68,0.35);
  border-radius: var(--radius);
  font-size: 12px;
  color: var(--danger);
  width: 100%;
  text-align: left;
  transition: background var(--transition);
}
.btn-danger-sm:hover { background: rgba(239,68,68,0.08); }

/* ===================================================
   PASSWORD GENERATOR
   =================================================== */
.gen-panel { max-width: 500px; }
.gen-output-box { display: flex; gap: 6px; align-items: center; margin-bottom: 10px; }
.gen-pw-field {
  flex: 1;
  padding: 13px 14px;
  font-family: var(--mono);
  font-size: 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  letter-spacing: 0.5px;
}
.gen-strength-bar  { height: 5px; background: var(--surface-3); border-radius: 3px; margin-bottom: 18px; overflow: hidden; }
.gen-str-fill { height: 100%; border-radius: 3px; transition: width 0.3s, background 0.3s; width: 0; }
.gen-controls { display: flex; flex-direction: column; gap: 10px; }
.gen-row { display: flex; align-items: center; gap: 12px; }
.gen-row label { font-size: 12px; color: var(--text-sec); min-width: 52px; }
.gen-row input[type="range"] { flex: 1; accent-color: var(--accent); }
.gen-row span { font-weight: 700; color: var(--indigo-300); min-width: 24px; }
.gen-check { font-size: 12px; color: var(--text-sec); display: flex; align-items: center; gap: 7px; }
.gen-check input { accent-color: var(--accent); width: 14px; height: 14px; }

/* ===================================================
   SETTINGS
   =================================================== */
.settings-list { max-width: 520px; }
.setting-group { margin-bottom: 22px; padding-bottom: 18px; border-bottom: 1px solid var(--border); }
.setting-group h3 { font-size: 10px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 10px; }
.setting-val { font-size: 12px; color: var(--text-sec); }
.setting-row { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--text-sec); margin-bottom: 8px; }
.setting-input {
  width: 64px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 12px;
  text-align: center;
  background: var(--surface-2);
  color: var(--text);
}

/* ===================================================
   MODAL
   =================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.15s ease;
}
.modal {
  background: var(--surface-1);
  border: 1px solid rgba(99,102,241,0.2);
  border-radius: var(--radius-lg);
  width: 460px;
  max-height: 82vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: cardSlide 0.25s cubic-bezier(0.16,1,0.3,1);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface-1);
  z-index: 1;
}
.modal-header h2 { font-size: 15px; font-weight: 600; }
.modal-body   { padding: 20px; }
.modal-footer { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; background: var(--surface-1); }

/* Inputs inside modal */
.modal-body .field-input {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text);
}
.modal-body .field-input:focus {
  border-color: var(--indigo-300);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* Security notice box */
.security-warning-box {
  margin-top: 8px;
  padding: 10px 13px;
  border: 1px solid rgba(249,115,22,0.3);
  background: rgba(249,115,22,0.06);
  border-radius: 8px;
  font-size: 0.8rem;
  color: #fb923c;
  line-height: 1.5;
}

/* Import/Export UI */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { background: var(--surface-2); color: var(--text-muted); font-size: 11px; font-weight: 600; padding: 8px 10px; text-align: left; }
.data-table td { padding: 7px 10px; font-size: 12px; border-bottom: 1px solid var(--border); color: var(--text-sec); }
.data-table tr:last-child td { border-bottom: none; }

/* ===================================================
   TOAST NOTIFICATION
   =================================================== */
.toast {
  position: fixed;
  bottom: 64px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 12.5px;
  z-index: 9999;
  box-shadow: var(--shadow-md);
  animation: toastIn 0.25s cubic-bezier(0.16,1,0.3,1);
  white-space: nowrap;
}

@keyframes toastIn {
  from { transform: translateX(-50%) translateY(12px); opacity: 0; }
  to   { transform: translateX(-50%) translateY(0);    opacity: 1; }
}

/* ===================================================
   PAGE FOOTER HINTS
   =================================================== */
.page-footer-hint {
  margin-top: 20px;
  padding: 14px 16px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.7;
}
.page-footer-hint .text-muted { opacity: 0.65; }
