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

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

:root {
  --bg:        #0c0e15;
  --surface:   #13161f;
  --surface2:  #1a1e2c;
  --border:    #1f2436;
  --accent:    #00e5a0;
  --accent2:   #0096ff;
  --danger:    #ff4466;
  --text:      #d4dff0;
  --muted:     #4a5470;
  --success-bg:#062918;
  --radius:    10px;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Mono', monospace;
  min-height: 100vh;
  padding-bottom: 80px;
}

/* ── HEADER ── */
#header {
  background: linear-gradient(180deg, #11141e 0%, #0c0e15 100%);
  border-bottom: 1.5px solid var(--accent);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 14px 16px 12px;
}

.header-inner { max-width: 620px; margin: 0 auto; }

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.header-tag {
  font-size: 9px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--accent);
  opacity: .85;
}

.header-actions {
  display: flex;
  gap: 6px;
}

.btn-accion {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 10px;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  letter-spacing: .3px;
  transition: all .18s;
}
.btn-accion:active { transform: scale(.94); }

.btn-pdf {
  background: var(--surface2);
  color: var(--accent2);
  border-color: var(--accent2);
}
.btn-pdf:hover { background: rgba(0,150,255,.12); }

.btn-borrar {
  background: var(--surface2);
  color: var(--danger);
  border-color: var(--danger);
}
.btn-borrar:hover { background: rgba(255,68,102,.12); }

h1 {
  font-family: 'Syne', sans-serif;
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  letter-spacing: .5px;
  margin: 4px 0 12px;
}

.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 12px;
  font-size: 18px;
  color: var(--accent);
  pointer-events: none;
  line-height: 1;
}

#busqueda {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 40px 10px 36px;
  color: var(--text);
  font-size: 15px;
  font-family: 'DM Mono', monospace;
  outline: none;
  transition: border-color .2s;
  -webkit-appearance: none;
}
#busqueda:focus { border-color: var(--accent); }
#busqueda::-webkit-search-cancel-button { display: none; }

.btn-limpiar {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  padding: 4px;
  display: none;
}
.btn-limpiar.visible { display: block; }

.contador {
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--muted);
  margin-top: 8px;
  text-transform: uppercase;
}

/* ── LISTA ── */
#lista {
  max-width: 620px;
  margin: 0 auto;
  padding: 14px 16px 0;
}

.contacto {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 7px;
  transition: border-color .2s, background .2s;
  animation: fadeIn .15s ease both;
}

.contacto.guardado {
  background: var(--success-bg);
  border-color: var(--accent);
}

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

.contacto-info { flex: 1; min-width: 0; }

.contacto-nombre {
  font-size: 12.5px;
  font-weight: 500;
  color: #c5d4ee;
  letter-spacing: .2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.contacto-celular {
  font-size: 14px;
  color: var(--accent);
  margin-top: 4px;
  letter-spacing: 1px;
}

/* ── BOTÓN GUARDAR ── */
.btn-guardar {
  flex-shrink: 0;
  background: var(--surface2);
  border: 1px solid #2a3450;
  border-radius: 8px;
  padding: 8px 13px;
  color: #5a7098;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .5px;
  font-family: 'DM Mono', monospace;
  cursor: pointer;
  transition: all .18s;
  min-width: 90px;
  text-align: center;
  text-transform: uppercase;
}
.btn-guardar:active { transform: scale(.95); }
.btn-guardar.guardado {
  background: var(--accent);
  border-color: var(--accent);
  color: #062918;
  cursor: default;
}

/* ── VACÍO ── */
.sin-resultados {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: 50px 0;
  letter-spacing: 1px;
}

.estado-vacio {
  text-align: center;
  padding: 50px 16px;
}
.estado-vacio .vacio-icono { font-size: 40px; margin-bottom: 12px; }
.estado-vacio .vacio-titulo {
  color: var(--text);
  font-family: 'Syne', sans-serif;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
}
.estado-vacio .vacio-texto {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .5px;
  line-height: 1.6;
}

/* ── MODAL ── */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.75);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-box {
  background: #1a1e2c;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px 20px 20px;
  max-width: 340px;
  width: 100%;
}

.modal-titulo {
  font-family: 'Syne', sans-serif;
  font-size: 17px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 10px;
}

.modal-texto {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 20px;
}

.modal-botones {
  display: flex;
  gap: 10px;
}

.modal-btn {
  flex: 1;
  padding: 11px;
  border-radius: 9px;
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .5px;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: all .18s;
  text-transform: uppercase;
}
.modal-btn-cancel {
  background: var(--surface);
  color: var(--muted);
}
.modal-btn-confirm {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}
.modal-btn:active { transform: scale(.96); }

/* ── PROGRESS BAR ── */
.progress-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 16px;
}
.progress-fill {
  height: 100%;
  background: var(--accent2);
  border-radius: 2px;
  width: 0%;
  transition: width .3s ease;
}

/* ── TOAST ── */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--accent);
  color: #062918;
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .5px;
  padding: 10px 20px;
  border-radius: 30px;
  opacity: 0;
  transition: opacity .25s, transform .25s;
  pointer-events: none;
  white-space: nowrap;
  max-width: 90vw;
  overflow: hidden;
  text-overflow: ellipsis;
  z-index: 200;
}
.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── BOTÓN INSTALAR ── */
.btn-instalar {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent2);
  color: #fff;
  border: none;
  border-radius: 30px;
  padding: 12px 28px;
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .5px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0,150,255,.35);
  z-index: 150;
  transition: transform .15s, box-shadow .15s;
}
.btn-instalar:active {
  transform: translateX(-50%) scale(.96);
  box-shadow: 0 2px 10px rgba(0,150,255,.2);
}

/* scrollbar */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
