/* ═══════════════════════════════════════════════════════════════
   Aurora CRM — Sistema Visual Aurora Global Group
   Tipografía: Poppins | Paleta: morado #1a0b3d/#7c3aed + menta #6ee7b7
   ═══════════════════════════════════════════════════════════════ */

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
button, input, select, textarea { font-family: inherit; }
a { text-decoration: none; }

/* ── Variables ──────────────────────────────────────────────── */
:root {
  --sidebar-w: 220px;

  /* Morados */
  --p-deepest : #1a0b3d;
  --p-dark    : #4a1d96;
  --p-mid     : #6d28d9;
  --p-base    : #7c3aed;
  --p-light   : #a78bfa;
  --p-pale    : #ede9fe;
  --p-soft    : #ddd6fe;

  /* Verdes menta */
  --g-bright  : #6ee7b7;
  --g-base    : #10b981;
  --g-dark    : #065f46;

  /* Neutros */
  --bg        : #f7f5fc;
  --white     : #ffffff;
  --text      : #1f1f2e;
  --text-soft : #6b5b95;
  --border    : #e5e0f5;

  /* Sombras */
  --shadow-sm : 0 2px 8px rgba(74, 29, 150, 0.06);
  --shadow-md : 0 4px 16px rgba(74, 29, 150, 0.12);

  /* Radios */
  --r-card  : 8px;
  --r-input : 6px;
  --r-pill  : 999px;
}

/* ── Base ───────────────────────────────────────────────────── */
html { scroll-behavior: smooth; }

body {
  font-family: 'Poppins', sans-serif;
  font-size: 10pt;
  font-weight: 400;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* ── Barra superior gradiente (6px) ─────────────────────────── */
.top-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 6px;
  background: linear-gradient(90deg, #4a1d96 0%, #7c3aed 40%, #a78bfa 70%, #6ee7b7 100%);
  z-index: 200;
}

/* ── Layout principal ───────────────────────────────────────── */
.layout {
  display: flex;
  min-height: 100vh;
  padding-top: 6px;
}

/* ═══════════════════════════════════════════════════════════════
   SIDEBAR
   ═══════════════════════════════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-w);
  background: var(--p-deepest);
  position: fixed;
  top: 6px; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  padding: 28px 0 24px;
  z-index: 100;
  overflow-y: auto;
}

/* Logo */
.sidebar-logo {
  padding: 0 20px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  margin-bottom: 16px;
}

.logo-text {
  display: block;
  color: var(--white);
  font-size: 18pt;
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1;
}

.logo-sub {
  display: block;
  color: var(--g-bright);
  font-size: 7.5pt;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-top: 3px;
}

/* Navegación */
.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 10px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-input);
  color: rgba(255, 255, 255, 0.55);
  font-size: 9.5pt;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  cursor: pointer;
}

.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; }

.nav-item:hover {
  background: rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.85);
}

.nav-item.active {
  background: rgba(124, 58, 237, 0.35);
  color: var(--white);
}

/* Footer sidebar — botón nuevo contacto */
.sidebar-footer {
  padding: 16px 10px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.btn-new-contact {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 14px;
  background: rgba(110, 231, 183, 0.12);
  border: 1.5px solid var(--g-bright);
  border-radius: var(--r-card);
  color: var(--g-bright);
  font-size: 9.5pt;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-new-contact svg { width: 14px; height: 14px; }

.btn-new-contact:hover {
  background: rgba(110, 231, 183, 0.22);
}

/* ═══════════════════════════════════════════════════════════════
   MAIN CONTENT
   ═══════════════════════════════════════════════════════════════ */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 36px 40px 48px;
  min-height: 100vh;
}

/* ── Views ──────────────────────────────────────────────────── */
.view { display: none; }
.view.active { display: block; }

/* ── View header ────────────────────────────────────────────── */
.view-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
}

.view-title {
  font-size: 30pt;
  font-weight: 800;
  letter-spacing: -1.5px;
  line-height: 1;
  color: var(--p-dark);
}

.view-subtitle {
  font-size: 10pt;
  color: var(--text-soft);
  margin-top: 5px;
}

/* Contador de contactos */
.contacts-badge {
  background: var(--p-pale);
  color: var(--p-mid);
  font-size: 8pt;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 5px 14px;
  border-radius: var(--r-pill);
  align-self: center;
}

/* ── Filtros ────────────────────────────────────────────────── */
.filters-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.search-wrapper {
  position: relative;
  flex: 1;
  min-width: 220px;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--text-soft);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 10px 12px 10px 38px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-input);
  font-size: 10pt;
  color: var(--text);
  background: var(--white);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search-input::placeholder { color: #b0a8c8; }

.search-input:focus {
  border-color: var(--p-base);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.08);
}

.select-filter {
  padding: 10px 34px 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-input);
  font-size: 10pt;
  color: var(--text);
  background: var(--white);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b5b95' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  appearance: none;
  -webkit-appearance: none;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s;
}

.select-filter:focus {
  border-color: var(--p-base);
}

/* ═══════════════════════════════════════════════════════════════
   TABLA DE CONTACTOS
   ═══════════════════════════════════════════════════════════════ */
.table-wrapper {
  background: var(--white);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  border-left: 3px solid var(--p-base);
}

.contacts-table {
  width: 100%;
  border-collapse: collapse;
}

/* Cabeceras */
.contacts-table thead tr {
  border-bottom: 1.5px solid var(--border);
}

.contacts-table th {
  padding: 14px 16px;
  text-align: left;
  font-size: 7.5pt;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-soft);
  white-space: nowrap;
}

/* Filas */
.contacts-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
  cursor: pointer;
}

.contacts-table tbody tr:last-child { border-bottom: none; }

.contacts-table tbody tr:hover { background: #faf8ff; }

.contacts-table td {
  padding: 13px 16px;
  font-size: 10pt;
  vertical-align: middle;
}

/* Columna nombre */
.cell-nombre { min-width: 150px; }

.contact-nombre {
  font-weight: 600;
  color: var(--p-dark);
  line-height: 1.3;
}

/* Columna email */
.cell-email {
  font-size: 9.5pt;
  color: var(--text-soft);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Columna próxima acción */
.cell-accion {
  font-size: 9.5pt;
  color: var(--text);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Fechas */
.fecha-normal  { color: var(--text-soft); font-size: 9.5pt; }
.fecha-hoy     { color: var(--g-base); font-weight: 600; font-size: 9.5pt; }
.fecha-vencida { color: #dc2626; font-weight: 600; font-size: 9.5pt; }
.fecha-vacia   { color: #ccc; }

/* ── Pills de estado ────────────────────────────────────────── */
.pill {
  display: inline-block;
  padding: 3px 11px;
  border-radius: var(--r-pill);
  font-size: 7.5pt;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  white-space: nowrap;
}

.pill-lead       { background: var(--p-pale);  color: #5b21b6; }
.pill-contactado { background: #dbeafe;        color: #1e40af; }
.pill-propuesta  { background: #fef9c3;        color: #854d0e; }
.pill-cliente    { background: #d1fae5;        color: var(--g-dark); }

/* ── Acciones de fila (hover) ───────────────────────────────── */
.row-actions {
  display: flex;
  gap: 6px;
  opacity: 0;
  transition: opacity 0.15s;
  justify-content: flex-end;
}

.contacts-table tbody tr:hover .row-actions { opacity: 1; }

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: background 0.15s;
  flex-shrink: 0;
}

.btn-icon svg { width: 13px; height: 13px; }

.btn-edit   { background: var(--p-pale);  color: var(--p-base); }
.btn-edit:hover   { background: var(--p-soft); }

.btn-delete { background: #fee2e2; color: #dc2626; }
.btn-delete:hover { background: #fecaca; }

/* ── Estado vacío ───────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 72px 24px;
  color: var(--text-soft);
}

.empty-state svg {
  width: 44px;
  height: 44px;
  margin: 0 auto 14px;
  display: block;
  opacity: 0.35;
}

.empty-state p {
  font-size: 11pt;
  margin-bottom: 22px;
}

/* ── Coming soon (vistas futuras) ───────────────────────────── */
.coming-soon {
  text-align: center;
  padding: 80px 24px;
  color: var(--text-soft);
}

.coming-soon svg {
  width: 40px;
  height: 40px;
  margin: 0 auto 14px;
  display: block;
  opacity: 0.3;
}

.coming-soon p { font-size: 11pt; }

/* ═══════════════════════════════════════════════════════════════
   BOTONES GLOBALES
   ═══════════════════════════════════════════════════════════════ */
.btn-primary {
  background: var(--p-base);
  color: var(--white);
  border: none;
  border-radius: var(--r-card);
  padding: 11px 24px;
  font-size: 10pt;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.btn-primary:hover { background: var(--p-mid); }

.btn-secondary {
  background: transparent;
  color: var(--p-dark);
  border: 1.5px solid var(--p-base);
  border-radius: var(--r-card);
  padding: 10px 24px;
  font-size: 10pt;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-secondary:hover { background: var(--p-pale); }

.btn-danger {
  background: #dc2626;
  color: var(--white);
  border: none;
  border-radius: var(--r-card);
  padding: 11px 24px;
  font-size: 10pt;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-danger:hover { background: #b91c1c; }

/* ═══════════════════════════════════════════════════════════════
   MODAL
   ═══════════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 11, 61, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  padding: 20px;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.modal-overlay.hidden { display: none; }

.modal {
  background: var(--white);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-md);
  width: 100%;
  max-width: 620px;
  max-height: 92vh;
  overflow-y: auto;
  padding: 32px 36px;
  border-top: 3px solid var(--p-base);
}

.modal-sm { max-width: 440px; }

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

.modal-header h2 {
  font-size: 16pt;
  font-weight: 700;
  color: var(--p-dark);
  letter-spacing: -0.5px;
}

.modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: none;
  background: var(--bg);
  color: var(--text-soft);
  cursor: pointer;
  transition: background 0.15s;
  flex-shrink: 0;
}

.modal-close svg { width: 16px; height: 16px; }
.modal-close:hover { background: var(--border); }

/* ── Formulario ─────────────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 20px;
  margin-bottom: 8px;
}

.form-full { grid-column: 1 / -1; }

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-group label {
  font-size: 8.5pt;
  font-weight: 700;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-input);
  font-size: 10pt;
  color: var(--text);
  background: var(--white);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  resize: vertical;
}

.form-group input::placeholder,
.form-group textarea::placeholder { color: #b0a8c8; }

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--p-base);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.08);
}

/* Error de formulario */
.form-error {
  background: #fee2e2;
  color: #991b1b;
  border-radius: var(--r-input);
  padding: 10px 14px;
  font-size: 9.5pt;
  font-weight: 500;
  margin-bottom: 16px;
}

/* Acciones del modal */
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}

/* Texto del modal de borrado */
.delete-msg {
  color: var(--text-soft);
  font-size: 10pt;
  line-height: 1.6;
  margin-bottom: 8px;
}

/* ═══════════════════════════════════════════════════════════════
   LOGOUT (sidebar footer)
   ═══════════════════════════════════════════════════════════════ */
.nav-logout {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 8px 12px;
  border-radius: var(--r-input);
  color: rgba(255, 255, 255, 0.35);
  font-size: 9pt;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  text-decoration: none;
}

.nav-logout svg { width: 14px; height: 14px; flex-shrink: 0; }

.nav-logout:hover {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.6);
}

/* ═══════════════════════════════════════════════════════════════
   LOGIN PAGE
   ═══════════════════════════════════════════════════════════════ */
.login-body {
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.login-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
}

.login-card {
  background: var(--white);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-md);
  border-top: 3px solid var(--p-base);
  width: 100%;
  max-width: 400px;
  padding: 40px 40px 36px;
}

.login-logo {
  margin-bottom: 28px;
}

.login-logo-text {
  display: block;
  color: var(--p-dark);
  font-size: 22pt;
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1;
}

.login-logo-sub {
  display: block;
  color: var(--g-base);
  font-size: 7.5pt;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-top: 3px;
}

.login-title {
  font-size: 18pt;
  font-weight: 700;
  color: var(--p-dark);
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}

.login-subtitle {
  font-size: 10pt;
  color: var(--text-soft);
  margin-bottom: 28px;
}

.login-error {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fee2e2;
  color: #991b1b;
  border-radius: var(--r-input);
  padding: 10px 14px;
  font-size: 9.5pt;
  font-weight: 500;
  margin-bottom: 20px;
}

.login-error svg { flex-shrink: 0; }

.login-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.login-btn {
  width: 100%;
  justify-content: center;
  padding: 13px 24px;
  font-size: 10.5pt;
  margin-top: 4px;
}

/* ═══════════════════════════════════════════════════════════════
   UTILIDADES
   ═══════════════════════════════════════════════════════════════ */
.hidden { display: none !important; }

/* Scrollbar sutil */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--p-soft); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--p-light); }

/* ── Responsive básico ──────────────────────────────────────── */
@media (max-width: 768px) {
  .main-content { padding: 20px 16px 40px; }

  .form-grid { grid-template-columns: 1fr; }
  .form-full { grid-column: 1; }

  .view-title { font-size: 22pt; }

  /* Ocultar columnas secundarias en móvil */
  .contacts-table th:nth-child(3),
  .contacts-table td:nth-child(3),
  .contacts-table th:nth-child(4),
  .contacts-table td:nth-child(4),
  .contacts-table th:nth-child(6),
  .contacts-table td:nth-child(6) { display: none; }
}
