/* ============================================================================
   Argos — El guardián de tus llaves.
   Estilos. Modo oscuro nativo, sin frameworks, sin dependencias externas.
   ============================================================================ */

:root {
  --bg: #0d0f14;
  --bg-elev: #161a22;
  --bg-elev-2: #1f2530;
  --border: #2a3140;
  --text: #e6e9ef;
  --text-dim: #8b95a7;
  --text-faint: #5a6478;
  --accent: #6d8cff;
  --accent-hover: #8aa3ff;
  --accent-dim: #2d3a66;
  --danger: #ff5d6c;
  --danger-dim: #4a1f24;
  --warning: #ffb347;
  --success: #4ade80;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  --radius: 10px;
  --radius-sm: 6px;
  --transition: 0.15s ease;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "Cascadia Code", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* ============================================================================
   Topbar
   ============================================================================ */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.topbar-left, .topbar-right { display: flex; gap: 12px; align-items: center; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 600; }
.brand-icon { font-size: 22px; }
.brand-name { font-size: 16px; letter-spacing: 1px; }

.brand-title {
  background: linear-gradient(135deg, var(--accent) 0%, #a78bfa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 1.5px;
}

/* ============================================================================
   Main / layout
   ============================================================================ */
.main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}

.page-login .main, .page-setup .main, .page-lock .main {
  max-width: 440px;
  padding-top: 80px;
}

/* ============================================================================
   Auth card (login, setup, lock)
   ============================================================================ */
.auth-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
}
.auth-card h1 {
  font-size: 24px;
  margin-bottom: 8px;
}
.subtitle {
  color: var(--text-dim);
  margin-bottom: 24px;
  font-size: 14px;
}

.warning-box {
  background: rgba(255, 179, 71, 0.08);
  border: 1px solid rgba(255, 179, 71, 0.3);
  border-left: 3px solid var(--warning);
  color: #f4d4a0;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 20px;
  line-height: 1.6;
}
.warning-box code {
  background: rgba(0, 0, 0, 0.3);
  padding: 1px 5px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 13px;
}

.hint {
  text-align: center;
  margin-top: 20px;
  color: var(--text-faint);
  font-size: 13px;
}

/* ============================================================================
   Form fields
   ============================================================================ */
.field {
  display: block;
  margin-bottom: 16px;
}
.field > span {
  display: block;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 6px;
  font-weight: 500;
}
.field input[type="text"],
.field input[type="password"],
.field input[type="email"],
.field input[type="search"],
.field textarea,
.field input[type="range"] {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  transition: border-color var(--transition), background var(--transition);
}
.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg-elev-2);
}
.field textarea { resize: vertical; min-height: 80px; }

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
.field-row .field { margin-bottom: 0; }

.pwd-wrap {
  display: flex;
  gap: 6px;
  align-items: stretch;
}
.pwd-wrap input { flex: 1; }
.pwd-wrap .toggle-pwd,
.pwd-wrap .btn-mini {
  flex: 0 0 auto;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  transition: background var(--transition);
}
.pwd-wrap .toggle-pwd:hover,
.pwd-wrap .btn-mini:hover { background: var(--border); }

/* ============================================================================
   Buttons
   ============================================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elev-2);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), transform 0.05s;
  text-decoration: none;
}
.btn:hover { background: var(--border); }
.btn:active { transform: scale(0.98); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--bg-elev-2); }

.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-dim); border-color: var(--danger); }

.btn-mini {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: 4px;
}

.btn-large { padding: 12px 24px; font-size: 15px; width: 100%; justify-content: center; }

.inline-form { display: inline; }

/* ============================================================================
   Strength meter
   ============================================================================ */
.strength-meter { margin: 8px 0 20px; }
.strength-bar {
  height: 6px;
  background: var(--bg-elev-2);
  border-radius: 3px;
  overflow: hidden;
}
.strength-fill {
  height: 100%;
  width: 0;
  background: var(--danger);
  transition: width 0.3s ease, background 0.3s ease;
}
.strength-fill.muy-débil, .strength-fill.muy-debil { background: #ff5d6c; }
.strength-fill.débil, .strength-fill.debil { background: #ff8e3c; }
.strength-fill.aceptable { background: #ffd23f; }
.strength-fill.fuerte { background: #4ade80; }
.strength-fill.muy-fuerte { background: #34d399; }
.strength-label {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 4px;
}

/* ============================================================================
   Alerts
   ============================================================================ */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  font-size: 14px;
  border: 1px solid;
}
.alert-error {
  background: rgba(255, 93, 108, 0.08);
  border-color: rgba(255, 93, 108, 0.3);
  border-left: 3px solid var(--danger);
  color: #ffb3ba;
}
.alert-success {
  background: rgba(74, 222, 128, 0.08);
  border-color: rgba(74, 222, 128, 0.3);
  border-left: 3px solid var(--success);
  color: #b6f5cd;
}

/* ============================================================================
   Vault
   ============================================================================ */
.vault-toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 20px;
}
.search-form { flex: 1; }
.search-form input {
  width: 100%;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  transition: border-color var(--transition);
}
.search-form input:focus {
  outline: none;
  border-color: var(--accent);
}

.vault-stats {
  color: var(--text-dim);
  font-size: 13px;
  margin-bottom: 12px;
}

.entry-list { display: flex; flex-direction: column; gap: 8px; }
.entry-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color var(--transition), background var(--transition);
}
.entry-row:hover { border-color: var(--accent-dim); background: var(--bg-elev-2); }
.entry-main { flex: 1; min-width: 0; }
.entry-title {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.entry-meta {
  display: flex;
  gap: 12px;
  font-size: 13px;
  color: var(--text-dim);
  overflow: hidden;
}
.entry-meta > * {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.entry-user::before { content: "👤 "; }
.entry-url::before { content: "🔗 "; opacity: 0.6; }
.entry-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* ============================================================================
   Empty state
   ============================================================================ */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
}
.empty-icon { font-size: 64px; margin-bottom: 12px; opacity: 0.5; }
.empty-state h2 { color: var(--text); font-weight: 500; margin-bottom: 8px; }
.empty-state p { margin-bottom: 20px; }

/* ============================================================================
   Entry form
   ============================================================================ */
.entry-form-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  max-width: 640px;
  margin: 0 auto;
}
.entry-form-card h1 { margin-bottom: 20px; font-size: 22px; }
.entry-form-card .card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.entry-form-card .card-header h1 { margin-bottom: 0; }
.entry-form-card .card-actions {
  display: flex;
  gap: 8px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.form-actions { display: flex; gap: 8px; margin-top: 20px; }

/* ============================================================================
   Generator
   ============================================================================ */
.opts {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 16px 0;
}
.opts label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  cursor: pointer;
}
.result-box {
  display: flex;
  gap: 8px;
  margin: 16px 0;
}
.result-box input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 14px;
}

/* ============================================================================
   Settings
   ============================================================================ */
.settings h1 { margin-bottom: 24px; }
.settings-section {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}
.settings-section h2 { font-size: 18px; margin-bottom: 8px; }
.settings-section form .btn { margin-top: 12px; }

/* ============================================================================
   Audit table
   ============================================================================ */
.audit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.audit-table th,
.audit-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
.audit-table th {
  color: var(--text-dim);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.audit-table tr.ok td:first-child { border-left: 2px solid var(--success); }
.audit-table tr.fail td:first-child { border-left: 2px solid var(--danger); }
.audit-table code {
  font-family: var(--font-mono);
  background: var(--bg-elev-2);
  padding: 1px 6px;
  border-radius: 3px;
}
.audit-table pre {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  white-space: pre-wrap;
  max-width: 300px;
}

/* ============================================================================
   Responsive
   ============================================================================ */
@media (max-width: 720px) {
  .main { padding: 16px 12px 60px; }
  .field-row { grid-template-columns: 1fr; }
  .vault-toolbar { flex-wrap: wrap; }
  .entry-row { flex-direction: column; align-items: flex-start; }
  .entry-actions { width: 100%; flex-wrap: wrap; }
  .audit-table { font-size: 11px; }
  .audit-table th:nth-child(4),
  .audit-table td:nth-child(4),
  .audit-table th:nth-child(5),
  .audit-table td:nth-child(5) { display: none; }
}
