/* Archivo: css/inicio/metas.css */

/* === LAYOUT === */
.metas-wrapper {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 8px 0 24px;
}

/* === CARD BASE === */
.metas-card {
  background: #ffffff;
  border-radius: 20px;
  border: 1.5px solid #f1f5f9;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
  overflow: hidden;
}

.metas-card-header {
  padding: 20px 24px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1.5px solid #f1f5f9;
}

.metas-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.metas-card-title span.material-symbols-outlined {
  font-size: 20px;
  color: #0ea5e9;
}

/* === META DEL MES === */
.metas-mes-body {
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 32px;
}

.metas-mes-amount {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 180px;
}

.metas-mes-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.metas-mes-value {
  font-size: 2.2rem;
  font-weight: 800;
  color: #1e293b;
  letter-spacing: -0.03em;
  line-height: 1;
}

.metas-mes-currency {
  font-size: 1.1rem;
  font-weight: 600;
  color: #94a3b8;
  margin-right: 4px;
}

.metas-mes-divider {
  width: 1px;
  height: 56px;
  background: #f1f5f9;
  flex-shrink: 0;
}

/* Formulario edición meta mes */
.metas-mes-form {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}

.metas-mes-form-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: #64748b;
  white-space: nowrap;
}

.metas-input-group {
  display: flex;
  align-items: center;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
  background: #f8fafc;
  transition: border-color 0.2s, box-shadow 0.2s;
  flex: 1;
  max-width: 220px;
}

.metas-input-group:focus-within {
  border-color: #0ea5e9;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
  background: #ffffff;
}

.metas-input-prefix {
  padding: 0 10px;
  font-size: 0.85rem;
  font-weight: 700;
  color: #94a3b8;
  background: #f1f5f9;
  height: 38px;
  display: flex;
  align-items: center;
  border-right: 1.5px solid #e2e8f0;
  flex-shrink: 0;
}

.metas-input {
  border: none;
  outline: none;
  background: transparent;
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  color: #1e293b;
  padding: 0 12px;
  height: 38px;
  width: 100%;
}

.metas-save-btn {
  padding: 9px 18px;
  background: #0ea5e9;
  color: #ffffff;
  border: none;
  border-radius: 10px;
  font-family: 'Inter', sans-serif;
  font-size: 0.83rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}

.metas-save-btn:hover { background: #0284c7; }

.metas-save-btn span { font-size: 16px; }

/* Feedback inline */
.metas-inline-msg {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0;
  opacity: 0;
  transition: opacity 0.3s;
  white-space: nowrap;
}

.metas-inline-msg.show-ok  { opacity: 1; color: #16a34a; }
.metas-inline-msg.show-err { opacity: 1; color: #dc2626; }

/* === TABLA METAS POR USUARIO === */
.metas-table-head {
  display: grid;
  grid-template-columns: 2fr 1.5fr 1.5fr 90px;
  padding: 10px 24px;
  background: #f8fafc;
  border-bottom: 1.5px solid #f1f5f9;
}

.metas-table-head span {
  font-size: 0.7rem;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.metas-table-body {
  overflow-y: auto;
  max-height: 360px;
}

.metas-table-body::-webkit-scrollbar { width: 4px; }
.metas-table-body::-webkit-scrollbar-track { background: #f8fafc; }
.metas-table-body::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 99px; }

/* Fila */
.metas-row {
  display: grid;
  grid-template-columns: 2fr 1.5fr 1.5fr 90px;
  padding: 13px 24px;
  border-bottom: 1px solid #f8fafc;
  align-items: center;
  transition: background 0.15s;
}

.metas-row:last-child { border-bottom: none; }
.metas-row:hover { background: #f8fafc; }

.metas-cell {
  font-size: 0.84rem;
  color: #334155;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 8px;
}

.metas-cell-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.metas-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #f1f5f9;
  flex-shrink: 0;
}

.metas-user-initials {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #475569;
  font-size: 0.72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.metas-user-name {
  font-weight: 700;
  color: #1e293b;
  font-size: 0.85rem;
}

.metas-user-rango {
  font-size: 0.72rem;
  color: #94a3b8;
  font-weight: 500;
}

.metas-amount-cell {
  font-weight: 700;
  color: #0ea5e9;
  font-size: 0.9rem;
}

/* Edición inline de meta */
.metas-row-editing .metas-amount-cell {
  display: none;
}

.metas-row-edit-input {
  display: none;
}

.metas-row.metas-row-editing .metas-row-edit-input {
  display: flex;
  align-items: center;
  gap: 6px;
}

.metas-row-edit-input input {
  width: 110px;
  padding: 5px 8px;
  border: 1.5px solid #0ea5e9;
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 0.84rem;
  font-weight: 600;
  color: #1e293b;
  outline: none;
}

.metas-row-edit-confirm {
  width: 28px;
  height: 28px;
  background: #f0fdf4;
  color: #16a34a;
  border: none;
  border-radius: 7px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  transition: background 0.15s;
}

.metas-row-edit-confirm:hover { background: #dcfce7; }

/* Acciones fila */
.metas-row-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.metas-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;
}

.metas-action-btn span { font-size: 16px; }

.metas-btn-edit   { background: #f0f9ff; color: #0ea5e9; }
.metas-btn-edit:hover { background: #e0f2fe; }
.metas-btn-delete { background: #fef2f2; color: #ef4444; }
.metas-btn-delete:hover { background: #fee2e2; }

/* Estado vacío */
.metas-empty {
  padding: 48px 20px;
  text-align: center;
  color: #94a3b8;
  font-size: 0.88rem;
  font-weight: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.metas-empty span.material-symbols-outlined {
  font-size: 38px;
  color: #cbd5e1;
}

/* === MODAL AGREGAR META === */
.metas-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(3px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.metas-modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.metas-modal-box {
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.14);
  width: 100%;
  max-width: 420px;
  padding: 26px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  transform: translateY(14px) scale(0.98);
  transition: transform 0.22s ease, opacity 0.22s ease;
  opacity: 0;
}

.metas-modal-overlay.active .metas-modal-box {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.metas-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.metas-modal-title {
  font-size: 1rem;
  font-weight: 700;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.metas-modal-title span.material-symbols-outlined {
  font-size: 20px;
  color: #0ea5e9;
}

.metas-modal-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: #f1f5f9;
  color: #64748b;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.metas-modal-close:hover { background: #e2e8f0; }
.metas-modal-close span  { font-size: 18px; }

.metas-modal-divider {
  height: 1px;
  background: #f1f5f9;
  margin: -6px 0;
}

.metas-modal-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.metas-modal-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.metas-modal-select {
  width: 100%;
  padding: 10px 36px 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;
  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;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.metas-modal-select:focus {
  border-color: #0ea5e9;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
  background-color: #ffffff;
}

.metas-modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 4px;
}

.metas-modal-btn {
  padding: 9px 20px;
  border-radius: 10px;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}

.metas-modal-btn-cancel { background: #f1f5f9; color: #64748b; }
.metas-modal-btn-cancel:hover { background: #e2e8f0; }
.metas-modal-btn-save { background: #0ea5e9; color: #ffffff; display: flex; align-items: center; gap: 6px; }
.metas-modal-btn-save:hover { background: #0284c7; }
.metas-modal-btn-save span { font-size: 16px; }

/* === RESPONSIVE === */
@media (max-width: 768px) {
  .metas-mes-body {
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
  }

  .metas-mes-divider { display: none; }

  .metas-mes-form {
    flex-wrap: wrap;
    width: 100%;
  }

  .metas-input-group { max-width: 100%; flex: 1; }

  /* Tabla: un solo contenedor con scroll horizontal Y vertical */
  .metas-table-scroll {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 340px;
    -webkit-overflow-scrolling: touch;
  }

  .metas-table-scroll::-webkit-scrollbar { width: 4px; height: 4px; }
  .metas-table-scroll::-webkit-scrollbar-track { background: #f8fafc; }
  .metas-table-scroll::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 99px; }

  /* Ancho fijo para que las columnas no se aplasten */
  .metas-table-head,
  .metas-row {
    min-width: 600px;
    grid-template-columns: 180px 140px 160px 90px;
  }

  /* Sin recorte de texto en celdas */
  .metas-cell {
    white-space: nowrap !important;
    overflow: visible !important;
    text-overflow: unset !important;
  }

  /* Body sin scroll propio — lo maneja el contenedor padre */
  .metas-table-body {
    max-height: none;
    overflow: visible;
  }
}