/*** GENERAL STYLES ***/

html,
body {
  margin: 0;
  background: linear-gradient(217deg, var(--primary-color) 0%, var(--background-color) 50%, rgba(208, 188, 255, 1) 100%);
  font-family: var(--font-family) !important;
  color: var(--text-color);
  background-repeat: no-repeat;
  background-attachment: fixed;
  font-size: var(--font-size-base);

}

html {
  background: var(--primary-color) !important; /* o el color de tu web */
}

footer {
  display: none;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  max-width: 960px;
  width: 90%;
}

.scroller {
  background-color: var(--primary-color) !important;
}

@media only screen and (min-width: 993px) {
  .container {
    width: 70%;
  }
}
@media only screen and (min-width: 601px) {
  .container {
    width: 85%;
  }
}

.hidden {
  display: none;
}

/* Fecha de Finanzas: MM/AAAA en el ordenador (en el móvil, MM/AA) */
.fecha-corta {
  display: none;
}

.logo {
  width: 200px;
  display: block;
  margin: 20px auto 50px auto;
}

a {
  text-decoration: underline !important;
  text-decoration-thickness: 2px !important;
  color: var(--text-color) !important;
}

/*** HEADINGS ***/
h2 {
  font-size: 30px; /* Eliminar cuando desaparezca materialize */
  padding: 5px 0 !important;
  color: var(--primary-color);
}

.title-list {
  display: inline;
  font-size: 30px;
}

.nuevo {
  float: right;
}

/*** TICKETS ***/
#recibo-content {
  overflow: auto;
}

#recibo-content h2 {
  font-size: 20px;
  padding: 5px 0 0 0 !important;
  color: var(--secondary-color);
  display: inline-block;
}

.p-h2 {
  display: inline-block;
  font-weight: bold;
  padding-left: 15px !important;
}

.p-h3 {
  font-size: 19px;
}

.p-h4 {
  font-size: 14px;
}

.p-izq {
  float: left;
  width: 64%; /* Ajusta el ancho según sea necesario */
  margin: 4px 0; /* Espacio entre párrafos */
}
.p-title {
  float: left;
  width: 100%; /* Ajusta el ancho según sea necesario */
  margin: 4px 0; /* Espacio entre párrafos */
}

.p-der {
  float: right;
  width: 36%; /* Ajusta el ancho según sea necesario */
  text-align: right;
  margin: 4px 0; /* Espacio entre párrafos */
}

.p-tot {
  float: right;
  width: 100%; /* Ajusta el ancho según sea necesario */
  text-align: right;
  margin: 4px 0; /* Espacio entre párrafos */
}

.p-total {
  margin-top: 50px !important;
  font-size: 20px;
}

/* Asegúrate de limpiar los floats */
.clearfix::after {
  content: "";
  display: table;
  clear: both;
}

/*** FORMS ***/
.form-grid {
  display: grid;
  grid-template-columns: 1fr; /* Una columna por defecto */
  gap: 16px; /* Espaciado entre los campos */
}

.form-grid input,
.form-grid select,
.form-grid textarea {
  min-height: 40px;
  box-sizing: border-box;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.total-factura {
  display: flex;
  justify-content: flex-end; /* todo a la derecha */
  align-items: center;
  gap: 6px;
  font-size: 18px;
  font-weight: bold;
}

/* CSS para expandir el campo de comentarios */
.span-2 {
  grid-column: span 2;
}

.form-row {
  display: flex;
  gap: 1rem; /* Espaciado entre los campos */
}

textarea {
  height: 100px; /* Altura mínima para el campo de comentarios */
  resize: vertical; /* Permite redimensionar verticalmente */
}

#comentarios {
  min-height: 120px; /* Ajusta el valor según sea necesario */
}

.mitad {
  flex: 1; /* Cada campo ocupa la mitad del espacio disponible */
}

/* Estilo para campos de solo lectura */
md-outlined-text-field[readonly] input {
  color: white !important; /* Texto gris */
}
.actions-form a {
  text-decoration: none !important;
}

/* Acciones de las tablas siempre en línea (lápiz, descarga, etc.) */
.actions-form {
  white-space: nowrap;
}

md-outlined-text-field {
  height: 55px !important;
}
md-outlined-text-field::part(input) {
  --md-outlined-field-content-font: var(--font-family) !important;
  --input-text-font: var(--font-family) !important;
  font-family: var(--font-family) !important;
}

md-outlined-text-field input {
  height: 53px;
}

/* Mensajes: alineados con el contenido y sin salirse de la pantalla en el móvil.
   El texto largo pasa a varias líneas desde script.js (ajustarMensajes). */
md-chip-set#mensaje-chip,
md-chip-set#error-chip {
  display: flex;
  max-width: 100%;
  margin: 0 0 16px;
}

md-chip-set#mensaje-chip md-input-chip,
md-chip-set#error-chip md-input-chip {
  max-width: 100%;
  height: auto;
  --md-input-chip-container-height: auto;
}

.actions-form span:hover {
  transform: scale(1.2); /* Aumenta ligeramente el tamaño */
  transition: var(--transition); /* Transición suave */
}
.actions-form span {
  transition: var(--transition); /* Transición suave */
}

@media (min-width: 768px) {
  .form-grid-2 {
    grid-template-columns: repeat(2, 1fr); /* Dos columnas en pantallas grandes */
  }
  body {
    padding: 2rem;
    min-height: 100vh;
    box-sizing: border-box;
  }
}

.form-grid-3 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 15px; /* Espacio entre el título y el formulario */
}

.form-grid-12 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 15px; /* Espacio entre el título y el formulario */
}

.actions {
  grid-column: span 2; /* Para formularios con 2 columnas */
  /*display: inline-block;
  gap: 12px;
  padding-top: 10px;*/
}

.actions .derecha {
  margin-left: auto;
  float: right;
}

@media (min-width: 768px) {
  .form-grid-3 .actions,
  .form-grid-12 .actions {
    grid-column: span 3; /* Para buscadores con 3 columnas */
  }
  .form-grid-3 {
    grid-template-columns: repeat(3, 1fr); /* Tres columnas en pantallas grandes */
  }
  .form-grid-12 {
    grid-template-columns: 2fr 1fr 1fr; /* Tres columnas en pantallas grandes */
  }
}

/*** BUTTONS ***/

md-dialog md-outlined-button {
  --md-outlined-button-label-text-color: var(--secondary-color);
  --md-outlined-button-icon-color: var(--secondary-color);
  --md-outlined-button-container-color: var(--secondary-color);
}

md-dialog md-outlined-button md-icon {
  --md-outlined-button-focus-label-text-color: var(--secondary-color);
  color: var(--secondary-color);
}

md-outlined-button {
  height: 40px;
  color: var(--text-color);
  font-family: var(--font-family);
}

md-outlined-button md-icon {
  position: relative;
  font-size: 22px;
  vertical-align: middle;
  padding-right: 3px;
  /*color: var(--text-color);*/
}

md-outlined-button {
  --md-outlined-button-container-color: var(--primary-color);
  --md-outlined-button-label-text-color: var(--primary-color);
  --md-outlined-button-icon-color: var(--primary-color);
  --md-outlined-button-outline-color: var(var(--outline-color));
}

md-outlined-button:hover {
  --md-outlined-button-container-color: var(--secondary-color);
}

/*** PAGINATION ***/
ul:not(.browser-default) > li {
  list-style-type: none;
}

.pagination li {
  display: inline-block;
  border-radius: 2px;
  text-align: center;
  vertical-align: top;
  height: 30px;
}

/*** TABLES ***/
table {
  width: 100%;
  margin-top: 1rem;
  font-size: var(--font-size-base);
  border-collapse: inherit !important;
  display: table;
  border-spacing: 0;
  padding-bottom: 15px;
}

table td:first-child,
table th:first-child {
  text-align: left;
}

table td:last-child,
table th:last-child {
  text-align: right;
}

table td:not(:first-child):not(:last-child),
table th:not(:first-child):not(:last-child) {
  text-align: center;
}

thead {
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

th {
  color: var(--text-color);
  font-size: 12px;
}

td:first-child,
tr:first-child th:first-child {
  border-left-color: var(--outline-color);
  border-left-style: solid;
  border-left-width: 1px;
}

tr:first-child th {
  border-top-color: var(--outline-color);
  border-top-style: solid;
  border-top-width: 1px;
  border-bottom-color: var(--outline-color);
  border-bottom-style: solid;
  border-bottom-width: 1px;
}

tr td {
  border-bottom-color: var(--outline-color);
  border-bottom-style: solid;
  border-bottom-width: 1px;
}

th {
  padding: 15px 5px;
}

td {
  padding: 13px 5px;
}

td.nombre {
  background-color: var(--primary-color);
  font-weight: bold;
  color: var(--secondary-color);
  text-align: center;
  text-transform: uppercase;
  font-size: 13px;
  font-weight: bold;
}

.chip-label {
  font-weight: 600;
  text-transform: uppercase;
  font-size: 12px;
  display: none;
}

.fin td {
  padding: 4px 5px !important;
}

td:last-child,
tr:first-child th:last-child {
  border-right-color: var(--outline-color);
  border-right-style: solid;
  border-right-width: 1px;
}

tr:last-child td:last-child {
  border-bottom-right-radius: 8px !important;
}

tr:first-child th:first-child {
  border-top-left-radius: 8px !important;
}

tr:first-child th:last-child {
  border-top-right-radius: 8px !important;
}

tr:last-child td:first-child {
  border-bottom-left-radius: 8px !important;
}

tr:nth-child(odd) {
  background-color: transparent !important;
}

td {
  color: var(--text-color);
}

td,
th {
  border-radius: 0 !important;
}

td.td-right {
  text-align: right !important;
}

td.td-left {
  text-align: left !important;
}

td.td-center {
  text-align: center !important;
}

tfoot td,
tfoot th {
  border: none !important;
}

/*** TOOLTIP ***/
.tooltip {
  position: relative;
  display: inline-block;
  cursor: pointer;
  /*text-align: center;*/
}

/* Los textos de ayuda son invisibles hasta pasar el ratón: que no tapen el icono de arriba */
.tooltip::after,
.tooltip::before {
  pointer-events: none;
}

.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  background-color: var(--text-color);
  color: var(--secondary-color);
  font-size: 12px;
  padding: 6px 8px;
  border-radius: 4px;
  white-space: nowrap;
  bottom: 125%; /* por encima */
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease-in-out;
  z-index: 10;
}

.tooltip::before {
  content: "";
  position: absolute;
  bottom: 115%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--text-color);
  opacity: 0;
  transition: opacity 0.2s ease-in-out;
  z-index: 10;
}

.tooltip:hover::after,
.tooltip:hover::before {
  opacity: 1;
}

.button:before {
  background-color: inherit !important;
}

/*** MODAL ***/
/* Contenido del modal */
md-dialog div {
  font-family: "Google Sans Code";
  background-color: var(--primary-color);
  color: var(--secondary-color);
  text-align: left;
}

md-dialog:not(:first-child) {
  font-size: 14px;
}

/*** RECIBO ***/
.recibo {
  max-width: 300px;
  margin: auto;
  text-align: center;
  font-size: var(--font-size-base);
}

.recibo h2 {
  font-size: 18px;
  margin-bottom: 10px;
  color: var(--primary-color);
}

.recibo p {
  margin: 5px 0;
  color: var(--text-color);
}

/*** PRINT STYLES ***/
@media print {
  @page {
    size: A5;
    margin: 10%;
  }

  html,
  body {
    background: none;
    background: white;
  }

  body * {
    visibility: hidden; /* Oculta todo excepto el contenedor de impresión */
  }

  #recibo-modal,
  header,
  .form-grid-3,
  .form-grid-12,
  .nuevo,
  .title-list,
  table,
  .actions {
    display: none;
  }
  #print-container,
  #print-container * {
    visibility: visible;
  }
  #print-container {
    width: 430px;
    height: 570px;
    position: absolute;
    border: 1px transparent solid;
    padding: 35px;
    font-size: 11px;
    top: 0px;
    left: 0px;
    overflow: hidden; /* Evita que el contenido desborde */
    scale: 1.5; /* Ajusta el tamaño del contenido para que quepa en A5 */
    margin-left: 90px;
    margin-top: 100px;
  }

  #print-container p {
    color: black;
    margin: 0;
    padding: 4px 0;
  }

  #print-container h2 {
    font-size: 16px;
    color: black;
    display: inline-block;
    padding: 5px 0 0 0 !important;
  }
}
input[type="date"] {
  font-family: "Google Sans Code", sans-serif !important;
}
:root {
  /* Colores principales */
  --primary-color: #381e72; /* Color primario */
  --secondary-color: #b69df8; /* Color secundario */
  --background-color: #b69df8; /* Fondo */
  --text-color: #381e72; /* Texto principal */
  /*--text-color-light: #ffffff; /* Texto claro */

  /* Otros colores */
  --error-color: #b00020; /* Color de error */
  --success-color: #00c853; /* Color de éxito */
  --warning-color: #ffab00; /* Color de advertencia */

  /* Tipografía */
  --font-family: "Google Sans Code", sans-serif;
  --font-size-base: 14px;
  --md-outlined-text-field-label-text-font: var(--font-family);
  --md-outlined-text-field-input-text-font: var(--font-family);
  --md-outlined-select-text-field-label-text-font: var(--font-family);
  --md-outlined-select-text-field-input-text-font: var(--font-family);
  --md-menu-item-label-text-font: var(--font-family);
  --md-filter-chip-label-text-font: var(--font-family);

  --md-primary-tab-container-color: transparent;
  --md-divider-color: transparent;

  --outline-color: rgb(121, 116, 126);
  --transition: 0.5s ease;
}

md-outlined-select,
md-outlined-text-field {
  min-width: 175px;
}

.menu-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin-top: 50px;
}

/* Casillas de verificación con su texto al lado */
.form-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  align-items: center;
}

.form-checks label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* Varias casillas en su propia fila del formulario: una debajo de otra */
.form-checks.span-2 {
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
}

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

.header-actions h4 {
  margin: 0;
}

md-filter-chip[selected] ::slotted([slot="selected-icon"]) {
  display: none;
}

md-fab {
  --md-fab-container-color: var(--primary-color);
  --md-fab-icon-color: var(--text-color);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

md-fab:hover {
  --md-fab-container-color: var(--primary-color-dark);
}

/* Mantener el estilo del ícono sin cambios de color */
.estado-pendiente .icono-pendiente,
.estado-pagado .icono-pagado,
.estado-liquidado .icono-liquidado {
  display: inline-block;
  transition: var(--transition);
}

.estado-pendiente:hover .icono-pendiente::before,
.estado-pagado:hover .icono-pagado::before,
.estado-liquidado:hover .icono-liquidado::before {
  content: "add_card"; /* Cambia el ícono al pasar el cursor */
}

.estado-pendiente:hover .icono-pendiente,
.estado-pagado:hover .icono-pagado,
.estado-liquidado:hover .icono-liquidado {
  content: ""; /* Asegúrate de que el contenido original no se muestre */
  transform: scale(1.2); /* Aumenta ligeramente el tamaño */
  transition: var(--transition);
}

/*** TABLE ***/
#saldos .btn-toggle-grupo {
  margin-right: 6px;
  cursor: pointer;
  border: none;
  background: transparent;
  font-weight: bold;
  font-size: 1rem;
}

#saldos tr.grupo-detalle td {
  padding-left: 24px; /* para que se vea "indentado" */
}

@media (max-width: 800px) {
  .celda-nombre-direccion {
    min-width: 100;
    white-space: normal;
  }
  .celda-nombre-direccion .direccion-movil {
    display: block;
    color: #888;
    font-size: 0.95em;
    margin-top: 0.2em;
  }
  body {
    min-height: 100dvh;
  }
  html, body {
    overflow-x: hidden;
    height: 100%;
  }
  footer {
    display: block;
  }
}
@media (min-width: 801px) {
  .celda-nombre-direccion .direccion-movil {
    display: none;
  }
}

/*** FILTRO PLEGADO EN MÓVILES ***/
.filter-toggle-btn {
  display: none;
  margin-right: 10px;
}

#tabs {
  width: 100%;
  margin-top: 25px;
}

#filtro-form {
  max-height: max-content;
  overflow: visible;
  transition:
    max-height 0.3s ease,
    opacity 0.3s ease;
}

@media (max-width: 767px) {
  /* CSS para expandir el campo de comentarios */
  .span-2-mobile {
    grid-column: span 2;
  }

  .filter-toggle-btn {
    display: block;
    float: right;
  }

  #filtro-form.collapsed {
    display: none;
  }

  #filtro-form.expanded {
    display: grid;
  }

  table,
  table thead th {
    font-size: 11px;
  }

  /* Menos relleno lateral para que las tablas quepan en la pantalla */
  td:not(:first-child):not(:last-child),
  th:not(:first-child):not(:last-child),
  .fin td:not(:first-child):not(:last-child) {
    padding-left: 2px !important;
    padding-right: 2px !important;
  }

  /* Margen lateral de 16 px en todas las pantallas */
  .container {
    width: calc(100% - 32px);
  }

  /* Cabeceras e iconos de tabla más compactos para que ninguna tabla se salga de la pantalla */
  table thead th {
    letter-spacing: 0;
    font-size: 10px;
  }

  table td md-icon {
    --md-icon-size: 20px;
  }

  .fin td {
    padding: 4px 2px !important;
  }

  /* Finanzas: los importes (luz, total y la fila de totales) no se parten */
  table.fin:not(#saldos) td:nth-child(5),
  table.fin:not(#saldos) td:nth-child(6),
  table.fin tfoot td {
    white-space: nowrap;
  }

  /* Fecha de Finanzas: MM/AA en el móvil */
  .fecha-larga {
    display: none;
  }

  .fecha-corta {
    display: inline;
  }

  /* Los campos de formulario pueden estrecharse (dos columnas en 360 px) */
  md-outlined-select,
  md-outlined-text-field {
    min-width: 0;
  }

  /* Dos columnas iguales, aunque el contenido de una sea más largo */
  .form-grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .coste {
    min-width: 66px !important;
  }
}
/** {
  outline: 1px solid red;
}*/

/*** PAGE LOADER ***/
.page-loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.78);
  opacity: 1;
  pointer-events: all;
  transition: opacity 160ms ease, visibility 160ms ease;
  visibility: visible;
}

.page-loader.is-hidden {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.page-loader__spinner {
  width: 44px;
  height: 44px;
  border: 4px solid rgba(56, 30, 114, 0.18);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: page-loader-spin 800ms linear infinite;
}

@keyframes page-loader-spin {
  to {
    transform: rotate(360deg);
  }
}
/*** USUARIOS Y LOGIN ***/
.user-bar {
  position: absolute;
  top: 8px;
  right: 12px;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: var(--secondary-color);
}

.user-bar a {
  color: var(--secondary-color) !important;
  text-decoration: none !important;
  display: flex;
}

.user-bar__name {
  display: flex;
  align-items: center;
  gap: 4px;
}

.user-bar md-icon {
  font-size: 20px;
  --md-icon-size: 20px;
}

.auth-form {
  max-width: 360px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}


.auth-error {
  color: #b3261e;
  font-weight: 600;
}

.boton-icono {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: inherit;
}

.portal-contrato {
  margin-bottom: 2rem;
}

@media (max-width: 767px) {
  /* En móvil la barra de usuario va arriba y el logo justo debajo, sin pisarse */
  .user-bar__name {
    display: none;
  }

  .logo {
    margin-top: 44px;
  }
}

/* Finanzas en móvil (desde 400 px): descripción de 130 px, lo justo para no pasar de 3 líneas,
   y el resto de columnas más holgado. En pantallas más estrechas la tabla reparte sola. */
@media (min-width: 400px) and (max-width: 767px) {
  table.fin:not(#saldos) td:first-child {
    box-sizing: border-box;
    width: 130px;
    min-width: 130px;
    max-width: 130px;
  }
}
