/* Archivo: css/inicio/clientes.css */

/* === LAYOUT PRINCIPAL === */
.clientes-wrapper {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 20px;
  align-items: start;
  padding: 8px 0 24px;
}

/* === PANEL IZQUIERDO: FORMULARIO === */
.clientes-form-panel {
  background: #ffffff;
  border-radius: 20px;
  border: 1.5px solid #f1f5f9;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
  padding: 24px 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 24px;
}

.clientes-form-title {
  font-size: 1rem;
  font-weight: 700;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.clientes-form-title span.material-symbols-outlined {
  font-size: 20px;
  color: #0ea5e9;
}

.clientes-form-divider {
  height: 1px;
  background: #f1f5f9;
  margin: -6px 0;
}

/* Campos del formulario */
.clientes-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.clientes-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.clientes-input,
.clientes-select {
  width: 100%;
  padding: 10px 13px;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  font-family: 'Inter', sans-serif;
  font-size: 0.88rem;
  color: #1e293b;
  background: #f8fafc;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  box-sizing: border-box;
}

.clientes-input:focus,
.clientes-select:focus {
  border-color: #0ea5e9;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
  background: #ffffff;
}

.clientes-input.error,
.clientes-select.error {
  border-color: #ef4444;
}

.clientes-select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

/* Sexo: botones tipo toggle */
.clientes-sexo-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.clientes-sexo-btn {
  padding: 9px 0;
  border-radius: 10px;
  border: 1.5px solid #e2e8f0;
  background: #f8fafc;
  font-family: 'Inter', sans-serif;
  font-size: 0.84rem;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  transition: all 0.18s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.clientes-sexo-btn:hover {
  border-color: #cbd5e1;
  background: #f1f5f9;
}

.clientes-sexo-btn.active-m {
  border-color: #3b82f6;
  background: #eff6ff;
  color: #2563eb;
}

.clientes-sexo-btn.active-f {
  border-color: #ec4899;
  background: #fdf2f8;
  color: #db2777;
}

/* Botón guardar */
.clientes-submit-btn {
  width: 100%;
  padding: 11px;
  background: #0ea5e9;
  color: #ffffff;
  border: none;
  border-radius: 10px;
  font-family: 'Inter', sans-serif;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: background 0.2s, transform 0.15s;
  margin-top: 4px;
}

.clientes-submit-btn:hover {
  background: #0284c7;
}

.clientes-submit-btn:active {
  transform: scale(0.98);
}

.clientes-submit-btn:disabled {
  background: #bae6fd;
  cursor: not-allowed;
}

/* Mensaje de feedback */
.clientes-form-msg {
  font-size: 0.8rem;
  font-weight: 600;
  text-align: center;
  padding: 8px 10px;
  border-radius: 8px;
  display: none;
}

.clientes-form-msg.success {
  display: block;
  background: #f0fdf4;
  color: #16a34a;
}

.clientes-form-msg.error {
  display: block;
  background: #fef2f2;
  color: #dc2626;
}

/* === PANEL DERECHO: TABLA === */
.clientes-list-panel {
  background: #ffffff;
  border-radius: 20px;
  border: 1.5px solid #f1f5f9;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
  overflow: visible;
  display: flex;
  flex-direction: column;
}

.clientes-list-header {
  padding: 20px 22px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1.5px solid #f1f5f9;
  flex-shrink: 0;
}

.clientes-list-title {
  font-size: 1rem;
  font-weight: 700;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.clientes-list-title span.material-symbols-outlined {
  font-size: 20px;
  color: #0ea5e9;
}

.clientes-count-badge {
  background: #f1f5f9;
  color: #475569;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 99px;
}

/* Cabecera de columnas */
.clientes-table-head {
  display: grid;
  grid-template-columns: 2fr 1.2fr 1.4fr 0.8fr 88px;
  padding: 10px 22px;
  background: #f8fafc;
  border-bottom: 1.5px solid #f1f5f9;
  flex-shrink: 0;
}

.clientes-table-head span {
  font-size: 0.7rem;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Contenedor con scroll */
.clientes-table-body {
  overflow-y: auto;
  max-height: 420px;
  flex: 1;
}

/* Scrollbar estilizado */
.clientes-table-body::-webkit-scrollbar {
  width: 5px;
}
.clientes-table-body::-webkit-scrollbar-track {
  background: #f8fafc;
}
.clientes-table-body::-webkit-scrollbar-thumb {
  background: #e2e8f0;
  border-radius: 99px;
}
.clientes-table-body::-webkit-scrollbar-thumb:hover {
  background: #cbd5e1;
}

/* Filas */
.clientes-row {
  display: grid;
  grid-template-columns: 2fr 1.2fr 1.4fr 0.8fr 88px;
  padding: 13px 22px;
  border-bottom: 1px solid #f8fafc;
  align-items: center;
  transition: background 0.15s;
}

.clientes-row:last-child {
  border-bottom: none;
}

.clientes-row:hover {
  background: #f8fafc;
}

.clientes-cell {
  font-size: 0.84rem;
  color: #334155;
  font-weight: 500;
  white-space: nowrap;
  overflow: visible;
  text-overflow: unset;
  padding-right: 8px;
}

.clientes-cell-name {
  font-weight: 700;
  color: #1e293b;
}

/* Badge categoría */
.clientes-cat-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
}

.clientes-cat-badge.whatsapp {
  background: #f0fdf4;
  color: #16a34a;
}

.clientes-cat-badge.facebook {
  background: #eff6ff;
  color: #2563eb;
}

/* Badge sexo */
.clientes-sexo-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #64748b;
}

/* Acciones */
.clientes-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.clientes-action-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}

.clientes-action-btn span {
  font-size: 16px;
}

.clientes-btn-edit {
  background: #f0f9ff;
  color: #0ea5e9;
}
.clientes-btn-edit:hover {
  background: #e0f2fe;
}

.clientes-btn-delete {
  background: #fef2f2;
  color: #ef4444;
}
.clientes-btn-delete:hover {
  background: #fee2e2;
}

/* Estado vacío */
.clientes-empty {
  padding: 52px 20px;
  text-align: center;
  color: #94a3b8;
  font-size: 0.88rem;
  font-weight: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.clientes-empty span.material-symbols-outlined {
  font-size: 40px;
  color: #cbd5e1;
}

/* === RESPONSIVE === */
@media (max-width: 1024px) {
  .clientes-wrapper {
    grid-template-columns: 300px 1fr;
  }
}

@media (max-width: 768px) {
  .clientes-wrapper {
    grid-template-columns: 1fr;
  }

  .clientes-form-panel {
    position: static;
  }

  /* Panel sin overflow para que el scroll interno funcione */
  .clientes-list-panel {
    overflow: hidden;
  }

  /* Cabecera fija sin scroll */
  .clientes-table-head {
    min-width: 680px;
    grid-template-columns: 160px 130px 180px 100px 88px;
    overflow: hidden;
  }

  /* Wrapper scroll: ambas direcciones */
  .clientes-table-scroll-x {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 340px;
    -webkit-overflow-scrolling: touch;
  }

  /* Scrollbars visibles */
  .clientes-table-scroll-x::-webkit-scrollbar {
    width: 4px;
    height: 4px;
  }
  .clientes-table-scroll-x::-webkit-scrollbar-track {
    background: #f8fafc;
  }
  .clientes-table-scroll-x::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 99px;
  }

  /* Filas con ancho fijo, sin recorte */
  .clientes-row {
    min-width: 680px;
    grid-template-columns: 160px 130px 180px 100px 88px;
  }

  /* Celdas sin recorte de texto */
  .clientes-cell {
    white-space: nowrap !important;
    overflow: visible !important;
    text-overflow: unset !important;
  }

  /* Body sin scroll propio — lo maneja scroll-x */
  .clientes-table-body {
    max-height: none;
    overflow: visible;
  }
}

/* Botón cancelar edición */
.clientes-cancel-btn {
  width: 100%;
  padding: 9px;
  background: #f1f5f9;
  color: #64748b;
  border: none;
  border-radius: 10px;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background 0.2s;
  margin-top: -8px;
}

.clientes-cancel-btn:hover {
  background: #e2e8f0;
  color: #475569;
}

/* Buscador en el header de la lista */
.clientes-search-input {
  padding: 7px 12px 7px 32px;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 0.82rem;
  color: #1e293b;
  background: #f8fafc url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E") no-repeat 10px center;
  outline: none;
  width: 180px;
  transition: border-color 0.2s, box-shadow 0.2s, width 0.2s;
}

.clientes-search-input:focus {
  border-color: #0ea5e9;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
  background-color: #ffffff;
  width: 220px;
}

@media (max-width: 768px) {
  .clientes-search-input {
    width: 130px;
    font-size: 0.78rem;
  }
  .clientes-search-input:focus {
    width: 160px;
  }
}