/* =========================================================
   iPass — Design System (1Password-inspired)
   ========================================================= */

:root {
  /* Palette */
  --ip-bg:           #F6F5FF;
  --ip-surface:      #FFFFFF;
  --ip-surface-alt:  #F0EEFF;
  --ip-border:       #E2DEFF;
  --ip-text:         #1A1333;
  --ip-text-muted:   #6B6292;

  /* Brand */
  --ip-sidebar-bg:   #1A103A;
  --ip-accent:       #6C4EFF;
  --ip-accent-2:     #9B6DFF;
  --ip-accent-rgb:   108, 78, 255;

  /* Semantic */
  --ip-success:      #059669;
  --ip-danger:       #DC2626;
  --ip-warning:      #D97706;

  /* Shape */
  --ip-radius-lg:    16px;
  --ip-radius-md:    10px;
  --ip-radius-sm:    7px;

  /* Elevation */
  --ip-shadow:    0 2px 12px rgba(108,78,255,.06), 0 1px 3px rgba(0,0,0,.05);
  --ip-shadow-lg: 0 8px 32px rgba(108,78,255,.12), 0 2px 8px rgba(0,0,0,.08);

  /* Mono */
  --ip-mono: ui-monospace,"SF Mono","Cascadia Code","JetBrains Mono",Consolas,monospace;

  /* Layout */
  --ip-sidebar-w: 242px;
}

[data-theme="dark"] {
  --ip-bg:           #100E24;
  --ip-surface:      #1A1730;
  --ip-surface-alt:  #221F3A;
  --ip-border:       #2E2A4A;
  --ip-text:         #EAE7FF;
  --ip-text-muted:   #7A76A2;
  --ip-sidebar-bg:   #0D0C1E;
  --ip-accent:       #8B6FFF;
  --ip-accent-2:     #A98FFF;
  --ip-accent-rgb:   139, 111, 255;
  --ip-shadow:    0 2px 12px rgba(0,0,0,.4);
  --ip-shadow-lg: 0 8px 32px rgba(0,0,0,.55);
}

@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] {
    --ip-bg:           #100E24;
    --ip-surface:      #1A1730;
    --ip-surface-alt:  #221F3A;
    --ip-border:       #2E2A4A;
    --ip-text:         #EAE7FF;
    --ip-text-muted:   #7A76A2;
    --ip-sidebar-bg:   #0D0C1E;
    --ip-accent:       #8B6FFF;
    --ip-accent-2:     #A98FFF;
    --ip-accent-rgb:   139, 111, 255;
    --ip-shadow:    0 2px 12px rgba(0,0,0,.4);
    --ip-shadow-lg: 0 8px 32px rgba(0,0,0,.55);
  }
}

*, *::before, *::after { box-sizing: border-box; }
body {
  background: var(--ip-bg);
  color: var(--ip-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  margin: 0;
  min-height: 100vh;
}
a { text-decoration: none; color: inherit; }

/* ── Layout ── */
.ip-shell { display: flex; min-height: 100vh; }

/* ── Sidebar ── */
.ip-sidebar {
  width: var(--ip-sidebar-w);
  background: var(--ip-sidebar-bg);
  padding: 20px 12px 20px;
  position: sticky; top: 0; height: 100vh;
  overflow-y: auto; scrollbar-width: none;
  flex-shrink: 0;
  display: flex; flex-direction: column;
  border-right: 1px solid rgba(255,255,255,.05);
}
.ip-sidebar::-webkit-scrollbar { display: none; }

.ip-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 2px 8px 0;
  margin-bottom: 24px;
  font-size: 1.2rem; font-weight: 800;
  color: #fff; letter-spacing: -.01em;
}
.ip-brand-icon {
  width: 36px; height: 36px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--ip-accent), var(--ip-accent-2));
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.1rem; color: #fff; flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(108,78,255,.5);
}

.ip-nav { display: flex; flex-direction: column; gap: 1px; flex-grow: 1; }
.ip-nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  border-radius: var(--ip-radius-sm);
  color: rgba(255,255,255,.55);
  font-size: .875rem; font-weight: 500;
  transition: background .12s, color .12s;
}
.ip-nav-link i { font-size: 1rem; width: 16px; text-align: center; flex-shrink: 0; }
.ip-nav-link:hover { background: rgba(255,255,255,.07); color: rgba(255,255,255,.85); }
.ip-nav-link.active {
  background: rgba(var(--ip-accent-rgb),.22);
  color: #fff;
  font-weight: 600;
}
.ip-nav-link.active i { color: var(--ip-accent-2); }

.ip-nav-sep {
  font-size: .65rem; text-transform: uppercase; letter-spacing: .08em;
  color: rgba(255,255,255,.25); margin: 14px 10px 4px;
}
.ip-nav-footer {
  display: flex; flex-direction: column; gap: 1px;
  padding-top: 12px;
  margin-top: 8px;
  border-top: 1px solid rgba(255,255,255,.07);
}

.ip-theme-toggle {
  background: rgba(255,255,255,.07); border: none;
  color: rgba(255,255,255,.6);
  width: 32px; height: 32px; border-radius: 7px;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: .95rem;
  transition: background .12s, color .12s;
}
.ip-theme-toggle:hover { background: rgba(255,255,255,.13); color: #fff; }

/* ── Main ── */
.ip-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ip-content { padding: 28px 28px 100px; max-width: 900px; margin: 0 auto; width: 100%; }

.ip-topbar {
  background: var(--ip-sidebar-bg);
  color: #fff; padding: 11px 16px;
  position: sticky; top: 0; z-index: 20;
  border-bottom: 1px solid rgba(255,255,255,.05);
}
.ip-brand-mobile { color: #fff; font-weight: 800; font-size: 1.1rem; display: flex; align-items: center; gap: 8px; }
.ip-topbar .ip-theme-toggle { color: rgba(255,255,255,.6); }

.ip-bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--ip-surface); border-top: 1px solid var(--ip-border);
  display: flex; justify-content: space-around; align-items: center;
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  z-index: 30; box-shadow: 0 -2px 16px rgba(0,0,0,.07);
}
.ip-bottom-link {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: .65rem; color: var(--ip-text-muted); padding: 4px 10px;
  border-radius: 8px;
}
.ip-bottom-link i { font-size: 1.2rem; }
.ip-bottom-link.active { color: var(--ip-accent); }
.ip-bottom-add {
  background: linear-gradient(135deg, var(--ip-accent), var(--ip-accent-2));
  color: #fff !important; width: 48px; height: 48px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin-top: -22px; font-size: 1.3rem;
  box-shadow: 0 4px 18px rgba(var(--ip-accent-rgb),.45);
}

/* ── Auth ── */
.ip-auth-body {
  background: linear-gradient(135deg, #0D0C1E 0%, #130F2E 60%, #0A0918 100%);
  min-height: 100vh;
}
.ip-auth-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; }
.ip-auth-card {
  background: var(--ip-surface);
  border: 1px solid var(--ip-border);
  border-radius: 20px;
  box-shadow: 0 24px 64px rgba(0,0,0,.55);
  padding: 36px 32px; width: 100%; max-width: 400px;
}
.ip-auth-logo { text-align: center; margin-bottom: 28px; }
.ip-auth-logo i {
  font-size: 1.9rem; color: #fff;
  width: 62px; height: 62px; border-radius: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--ip-accent), var(--ip-accent-2));
  box-shadow: 0 8px 28px rgba(var(--ip-accent-rgb),.45);
}
.ip-auth-logo h1 { font-weight: 800; margin: 12px 0 3px; }
.ip-auth-logo p { color: var(--ip-text-muted); font-size: .9rem; margin: 0; }
.ip-link-muted { color: var(--ip-text-muted); font-size: .88rem; }
.ip-collapsible { opacity: .7; }

/* ── Search ── */
.ip-search-hero { display: flex; gap: 12px; align-items: center; margin-bottom: 20px; }
.ip-search-box {
  flex: 1; background: var(--ip-surface);
  border: 1.5px solid var(--ip-border);
  border-radius: 12px;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; box-shadow: var(--ip-shadow);
  transition: border-color .15s, box-shadow .15s;
}
.ip-search-box:focus-within {
  border-color: var(--ip-accent);
  box-shadow: 0 0 0 3px rgba(var(--ip-accent-rgb),.15), var(--ip-shadow);
}
.ip-search-box i { color: var(--ip-text-muted); }
.ip-search-input { border: none; outline: none; background: transparent; flex: 1; font-size: 1rem; color: var(--ip-text); }
.ip-new-btn {
  border-radius: 10px; white-space: nowrap; font-weight: 600;
  background: linear-gradient(135deg, var(--ip-accent), var(--ip-accent-2));
  border: none;
  box-shadow: 0 3px 14px rgba(var(--ip-accent-rgb),.35);
  transition: transform .12s, box-shadow .12s;
  padding: 11px 20px;
  color: #fff;
}
.ip-new-btn:hover { transform: translateY(-1px); box-shadow: 0 5px 20px rgba(var(--ip-accent-rgb),.45); color: #fff; }

/* ── Section title ── */
.ip-section-title {
  font-size: .72rem; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--ip-text-muted);
  margin: 16px 0 8px; display: flex; align-items: center; gap: 7px;
}

/* ── Category chips ── */
.ip-category-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.ip-category-row::-webkit-scrollbar { display: none; }
.ip-category-chip {
  background: var(--ip-surface); border: 1.5px solid var(--ip-border);
  border-radius: 8px; padding: 6px 13px;
  font-size: .8rem; font-weight: 600; white-space: nowrap;
  display: flex; align-items: center; gap: 6px;
  color: var(--ip-text-muted);
  transition: all .12s; cursor: pointer;
}
.ip-category-chip.active {
  background: rgba(var(--ip-accent-rgb), .1);
  border-color: rgba(var(--ip-accent-rgb), .4);
  color: var(--ip-accent);
}
.ip-category-chip:hover:not(.active) {
  border-color: var(--ip-accent);
  color: var(--ip-accent);
}

/* ── Item list (1Password-style connected list) ── */
.ip-item-list {
  background: var(--ip-surface);
  border: 1px solid var(--ip-border);
  border-radius: var(--ip-radius-lg);
  overflow: hidden;
  box-shadow: var(--ip-shadow);
}

/* Cards dentro de ip-item-list: viram linhas de lista */
.ip-item-list .ip-cred-card {
  border-radius: 0;
  border: none;
  border-bottom: 1px solid var(--ip-border);
  box-shadow: none;
  background: transparent;
}
.ip-item-list .ip-cred-card:last-child { border-bottom: none; }
.ip-item-list .ip-cred-card:hover {
  transform: none;
  box-shadow: none;
  background: var(--ip-surface-alt);
  border-color: var(--ip-border);
}

/* Cards isolados (fora de ip-item-list): mantém estilo card */
.ip-cred-card {
  background: var(--ip-surface); border: 1px solid var(--ip-border);
  border-radius: var(--ip-radius-md);
  box-shadow: var(--ip-shadow);
  overflow: hidden;
  transition: transform .14s, box-shadow .14s, border-color .14s;
}
.ip-cred-card:hover {
  transform: translateY(-2px); box-shadow: var(--ip-shadow-lg);
  border-color: rgba(var(--ip-accent-rgb), .3);
}

.ip-cred-head {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 13px 9px;
}
.ip-cred-chevron {
  color: var(--ip-border); font-size: .75rem;
  transition: transform .14s, color .14s; flex-shrink: 0;
}
.ip-cred-card:hover .ip-cred-chevron { transform: translateX(3px); color: var(--ip-accent); }

.ip-cred-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 13px;
  border-top: 1px solid var(--ip-border);
}
.ip-cred-row-icon { color: var(--ip-text-muted); font-size: .8rem; width: 14px; text-align: center; flex-shrink: 0; }
.ip-cred-value {
  flex: 1; min-width: 0;
  font-family: var(--ip-mono); font-size: .8rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: var(--ip-text); letter-spacing: .01em;
}
.ip-cred-action {
  width: 26px; height: 26px; flex-shrink: 0;
  background: transparent; border: none;
  border-radius: 6px; color: var(--ip-text-muted);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: .82rem;
  transition: color .12s, background .12s;
  opacity: 0;
}
.ip-cred-card:hover .ip-cred-action,
.ip-item-list .ip-cred-card .ip-cred-action { opacity: 1; }
.ip-cred-action:hover { color: var(--ip-accent); background: rgba(var(--ip-accent-rgb),.1); }
.ip-cred-action.ip-copied { color: var(--ip-success) !important; }

/* ── Grid (segurança, cofres, etc.) ── */
.ip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }

/* ── Vault cards ── */
.ip-vault-card {
  background: var(--ip-surface); border: 1px solid var(--ip-border);
  border-radius: var(--ip-radius-md); padding: 14px 16px;
  display: flex; align-items: center; gap: 12px;
  box-shadow: var(--ip-shadow);
  transition: transform .12s, box-shadow .12s, border-color .12s;
}
.ip-vault-card:hover { transform: translateY(-2px); box-shadow: var(--ip-shadow-lg); border-color: rgba(var(--ip-accent-rgb),.25); }

.ip-item-icon, .ip-vault-icon {
  width: 40px; height: 40px; border-radius: 9px; flex-shrink: 0;
  background: rgba(var(--ip-accent-rgb), .1);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; color: var(--ip-accent);
}
.ip-item-body, .ip-vault-body { flex: 1; min-width: 0; }
.ip-item-title, .ip-vault-title {
  font-weight: 600; font-size: .9rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: flex; align-items: center; gap: 5px;
}
.ip-item-sub, .ip-vault-sub { font-size: .77rem; color: var(--ip-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ip-item-fav { font-size: .72rem; }

/* ── Stats ── */
.ip-stat-card {
  background: var(--ip-surface); border: 1px solid var(--ip-border);
  border-radius: var(--ip-radius-md); padding: 16px 14px 13px;
  text-align: center; box-shadow: var(--ip-shadow);
  position: relative; overflow: hidden;
  transition: transform .14s, box-shadow .14s;
}
.ip-stat-card::after {
  content: ''; position: absolute;
  top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--ip-accent), var(--ip-accent-2));
}
.ip-stat-card:hover { transform: translateY(-2px); box-shadow: var(--ip-shadow-lg); }
.ip-stat-value { font-size: 1.7rem; font-weight: 800; font-family: var(--ip-mono); line-height: 1; }
.ip-stat-label { font-size: .72rem; color: var(--ip-text-muted); margin-top: 5px; font-weight: 500; }

/* ── Badges ── */
.ip-badge-danger, .ip-badge-warning {
  font-size: .62rem; font-weight: 700; padding: 2px 8px;
  border-radius: 999px; white-space: nowrap; flex-shrink: 0;
}
.ip-badge-danger  { background: rgba(220,38,38,.1);  color: var(--ip-danger);  }
.ip-badge-warning { background: rgba(217,119,6,.1);  color: var(--ip-warning); }

/* ── Security alerts ── */
.ip-alerts-bar {
  background: rgba(220,38,38,.04);
  border: 1px solid rgba(220,38,38,.15); border-left: 3px solid var(--ip-danger);
  border-radius: var(--ip-radius-md); padding: 11px 15px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.ip-alerts-title { font-weight: 700; font-size: .8rem; color: var(--ip-danger); white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.ip-alerts-pills { display: flex; gap: 7px; flex-wrap: wrap; }
.ip-alert-pill {
  font-size: .76rem; font-weight: 700; padding: 4px 11px; border-radius: 999px;
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid transparent;
  transition: opacity .15s;
}
.ip-alert-pill:hover { opacity: .8; }
.ip-alert-danger  { background: rgba(220,38,38,.1);  color: var(--ip-danger);  border-color: rgba(220,38,38,.2); }
.ip-alert-warning { background: rgba(217,119,6,.1);  color: var(--ip-warning); border-color: rgba(217,119,6,.2); }

/* ── Forms ── */
.ip-form-wrap { max-width: 680px; margin: 0 auto; }
.ip-back-btn {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--ip-surface); border: 1px solid var(--ip-border);
  display: flex; align-items: center; justify-content: center;
  margin-right: 10px; color: var(--ip-text-muted);
  transition: color .12s, border-color .12s;
}
.ip-back-btn:hover { color: var(--ip-accent); border-color: var(--ip-accent); }
.ip-page-title { font-size: 1.35rem; font-weight: 800; }

.ip-card-form {
  background: var(--ip-surface); border: 1px solid var(--ip-border);
  border-radius: var(--ip-radius-lg); padding: 22px; box-shadow: var(--ip-shadow);
}
.ip-more-options {
  background: var(--ip-surface-alt); border: 1px solid var(--ip-border);
  border-radius: var(--ip-radius-md); padding: 16px;
}
.ip-form-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }

.ip-strength-meter { height: 4px; border-radius: 999px; background: var(--ip-surface-alt); overflow: hidden; }
.ip-strength-bar { height: 100%; width: 0; background: var(--ip-danger); transition: width .2s, background .2s; }

.form-control, .form-select {
  background: var(--ip-surface); border: 1.5px solid var(--ip-border);
  color: var(--ip-text); border-radius: var(--ip-radius-sm);
  transition: border-color .13s, box-shadow .13s;
}
.form-control:focus, .form-select:focus {
  background: var(--ip-surface); color: var(--ip-text);
  border-color: var(--ip-accent);
  box-shadow: 0 0 0 3px rgba(var(--ip-accent-rgb),.15);
}

/* ── Buttons ── */
.btn-primary {
  background: linear-gradient(135deg, var(--ip-accent), var(--ip-accent-2));
  border: none; font-weight: 600;
  box-shadow: 0 3px 12px rgba(var(--ip-accent-rgb),.3);
}
.btn-primary:hover, .btn-primary:focus {
  background: linear-gradient(135deg, #5A3EEE, #8A5FFF);
  border: none; box-shadow: 0 5px 18px rgba(var(--ip-accent-rgb),.42);
}
.btn-success {
  background: linear-gradient(135deg, #059669, #047857);
  border: none; font-weight: 600;
}

/* ── View item ── */
.ip-view-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 11px 0; border-bottom: 1px solid var(--ip-border); gap: 12px;
}
.ip-view-row:last-child { border-bottom: none; }
.ip-view-label { color: var(--ip-text-muted); font-size: .78rem; flex-shrink: 0; font-weight: 500; }
.ip-view-value { font-weight: 600; text-align: right; display: flex; align-items: center; gap: 8px; word-break: break-word; font-size: .9rem; }
.ip-view-notes { flex-direction: column; align-items: flex-start; }
.ip-view-notes .ip-view-value { text-align: left; }
.ip-password-mask { font-family: var(--ip-mono); font-size: 1rem; letter-spacing: 2px; }

.ip-copy-btn {
  background: var(--ip-surface-alt); border: 1px solid var(--ip-border);
  border-radius: 7px; width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ip-text-muted); cursor: pointer;
  transition: color .12s, background .12s, border-color .12s;
}
.ip-copy-btn:hover { color: var(--ip-accent); border-color: rgba(var(--ip-accent-rgb),.3); background: rgba(var(--ip-accent-rgb),.08); }

.ip-view-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.ip-shares-list { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ── 2FA QR ── */
.ip-qr-wrap {
  display: inline-block; padding: 12px; background: #fff;
  border-radius: var(--ip-radius-md); border: 1px solid var(--ip-border);
  box-shadow: var(--ip-shadow);
}
.ip-totp-secret {
  font-family: var(--ip-mono); font-size: .84rem; word-break: break-all;
  color: var(--ip-accent); background: var(--ip-surface-alt);
  padding: 4px 8px; border-radius: 6px;
}

/* ── Tables ── */
.ip-table-card {
  background: var(--ip-surface); border: 1px solid var(--ip-border);
  border-radius: var(--ip-radius-lg); overflow-x: auto; box-shadow: var(--ip-shadow);
}
.ip-table-card table { color: var(--ip-text); margin-bottom: 0; font-size: .86rem; }
.ip-table-card thead {
  background: var(--ip-surface-alt); font-size: .7rem;
  text-transform: uppercase; letter-spacing: .06em; color: var(--ip-text-muted);
}
.ip-table-card thead th { padding: 10px 14px; font-weight: 700; border-bottom: 1px solid var(--ip-border); }
.ip-table-card tbody td { padding: 10px 14px; }
.ip-table-card tbody tr:hover { background: rgba(var(--ip-accent-rgb),.03); }

/* ── Toasts ── */
.ip-toast-host { position: fixed; bottom: 86px; left: 50%; transform: translateX(-50%); z-index: 1080; }
.ip-toast {
  background: var(--ip-sidebar-bg);
  border: 1px solid rgba(var(--ip-accent-rgb),.2);
  color: #fff; padding: 10px 18px; border-radius: 999px;
  box-shadow: 0 8px 28px rgba(0,0,0,.4);
  margin-bottom: 8px; font-size: .86rem;
  display: flex; align-items: center; gap: 8px; white-space: nowrap;
  animation: ip-toast-in .18s ease;
}
@keyframes ip-toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Empty state ── */
.ip-empty-state {
  text-align: center; padding: 52px 20px; color: var(--ip-text-muted);
}
.ip-empty-state i { font-size: 2.5rem; margin-bottom: 14px; display: block; opacity: .4; }

/* ── Responsive ── */
@media (min-width: 992px) { .ip-content { padding: 28px 32px 40px; } }
@media (max-width: 991px) { .ip-content { padding: 14px 14px 110px; } }

/* ── Misc ── */
.font-monospace { font-family: var(--ip-mono) !important; }
