/* Estilos propios de Mantenimientos, encima de Ynex y de user/custom.css. */

/* Menú lateral oscuro: Ynex pinta los subitems en gris oscuro, ilegible sobre el fondo. */
[data-menu-styles=dark] .app-sidebar .slide-menu .side-menu__item {
  color: #d1d5db !important;
}
[data-menu-styles=dark] .app-sidebar .slide-menu .side-menu__item.active,
[data-menu-styles=dark] .app-sidebar .slide-menu .side-menu__item:hover {
  color: #fff !important;
  background: rgba(var(--primary-rgb), .2) !important;
}
[data-menu-styles=dark] .app-sidebar .slide-menu .side-menu__item::before {
  border-color: #9ca3af !important;
}
/* Contraste (WCAG AA, 4,5:1). Ynex escribe el texto con el mismo color de la marca sobre su
   fondo translúcido (≈2,5:1) y usa un gris muy claro para el texto secundario. Se mantienen
   los fondos y se oscurece solo el texto. */
:root {
  --text-muted: #6b7280;
}
.text-muted { color: var(--text-muted) !important; }
.bg-primary-transparent { color: #c2410c !important; }
.alert-primary, .alert-primary .alert-link { color: #c2410c; }
.btn-primary-light:not(:hover):not(:active) { color: #c2410c; }
.bg-secondary-transparent { color: #0e6f8c !important; }
.alert-secondary, .alert-secondary .alert-link { color: #0e6f8c; }
.btn-secondary-light:not(:hover):not(:active) { color: #0e6f8c; }
.bg-info-transparent { color: #0b6a9e !important; }
.alert-info, .alert-info .alert-link { color: #0b6a9e; }
.btn-info-light:not(:hover):not(:active) { color: #0b6a9e; }
.bg-success-transparent { color: #0f7a5c !important; }
.alert-success, .alert-success .alert-link { color: #0f7a5c; }
.btn-success-light:not(:hover):not(:active) { color: #0f7a5c; }
.bg-warning-transparent { color: #8a5a00 !important; }
.alert-warning, .alert-warning .alert-link { color: #8a5a00; }
.btn-warning-light:not(:hover):not(:active) { color: #8a5a00; }
.bg-danger-transparent { color: #b42318 !important; }
.alert-danger, .alert-danger .alert-link { color: #b42318; }
.btn-danger-light:not(:hover):not(:active) { color: #b42318; }
.text-success { color: #0f7a5c !important; }
.text-danger { color: #b42318 !important; }
.badge.bg-info, .badge.bg-warning { color: #1f2328 !important; }
.form-text, .form-label .text-muted { color: var(--text-muted); }

.module-card {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.module-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 0.5rem 1.25rem rgb(0 0 0 / 0.08);
}
.module-card .avatar {
  width: 3rem;
  height: 3rem;
}
.env-badge {
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Miniaturas de fotos de la OT */
.photo-thumb {
  position: relative;
  width: 96px;
  height: 96px;
  border-radius: 0.5rem;
  overflow: hidden;
  border: 1px solid rgb(0 0 0 / 0.08);
  background: #f5f6f8;
}
.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.photo-thumb .photo-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  padding: 0;
  line-height: 1;
  border-radius: 50%;
}
.photo-thumb .photo-pending {
  position: absolute;
  inset: auto 0 0 0;
  font-size: 0.6rem;
  text-align: center;
  background: rgb(0 0 0 / 0.55);
  color: #fff;
  padding: 1px 2px;
}
.maintenance-path {
  font-size: 0.75rem;
  color: var(--text-muted, #8c9097);
}

/* Stepper de fases de la Orden de Trabajo */
.wo-stepper {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
}
.wo-stepper li {
  flex: 1 1 0;
  min-width: 150px;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.75rem;
  border-radius: 0.5rem;
  background: #f5f6f8;
  color: #8c9097;
  font-size: 0.8rem;
}
.wo-stepper .wo-step-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #e3e5ea;
  font-weight: 600;
}
.wo-stepper li.is-done { color: #1a9f6e; background: rgb(38 191 148 / 0.08); }
.wo-stepper li.is-done .wo-step-icon { background: #26bf94; color: #fff; }
.wo-stepper li.is-current { color: #1f2328; background: rgba(var(--primary-rgb), 0.1); font-weight: 600; }
.wo-stepper li.is-current .wo-step-icon { background: rgb(var(--primary-rgb)); color: #fff; }
.wo-stepper li.is-next { color: #1f2328; border: 1px dashed rgba(var(--primary-rgb), 0.6); background: #fff; }
.wo-section.is-upcoming { opacity: 0.85; }
.wo-section.is-upcoming .card-body { background: var(--light, #f9fafb); }
.wo-file {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  max-width: 100%;
  padding: 0.25rem 0.5rem;
  border: 1px solid rgb(0 0 0 / 0.08);
  border-radius: 0.4rem;
  font-size: 0.8rem;
}
.wo-file a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.wo-total { font-size: 1.1rem; font-weight: 600; }

/* Ynex capitaliza cada palabra de los títulos; en español se escribe solo la inicial. */
.card.custom-card .card-header .card-title,
.card-title {
  text-transform: none;
}

/* Bitácora */
.logbook-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.logbook-timeline li + li {
  border-top: 1px dashed rgb(0 0 0 / 0.08);
  padding-top: 0.75rem;
}

/* Celdas de texto largo en grillas con text-nowrap: permiten salto de línea. */
.table td.cell-wrap {
  white-space: normal;
  min-width: 160px;
  max-width: 260px;
}

.table td.cell-status {
  white-space: normal;
  min-width: 110px;
  max-width: 140px;
}

/* Grillas anchas: la columna de acciones queda fija a la derecha mientras la tabla se desplaza. */
.table-sticky-actions > :not(caption) > tr > :last-child {
  position: sticky;
  right: 0;
  z-index: 1;
  background-color: var(--custom-white, #fff);
  box-shadow: inset 1px 0 0 var(--default-border, #f3f3f3);
}

/* Encabezado: Ynex aplica h-100 al logo, que en pantallas chicas ocupa todo el alto. */
.app-header .horizontal-logo .header-logo img { height: 1.6rem !important; width: auto; }
.project-switcher { max-width: 100%; }
.project-switcher__menu { min-width: 20rem; max-width: calc(100vw - 1.5rem); }
.project-switcher__menu .dropdown-item { white-space: normal; }
.country-flag { flex-shrink: 0; border-radius: 2px; box-shadow: 0 0 0 1px rgb(0 0 0 / .12); }
/* En el ítem seleccionado (fondo naranjo) el texto secundario debe seguir legible. */
.dropdown-item.active .text-muted,
.dropdown-item:active .text-muted { color: rgb(255 255 255 / .9) !important; }
.project-switcher__name { display: block; max-width: 14rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 575.98px) {
  .app-header .lang-switcher__name,
  .project-switcher__label { display: none !important; }
  .project-switcher__name { max-width: 7rem; }
  .project-switcher > .bx { display: none; }
  .project-switcher { padding-inline: .45rem; gap: .35rem !important; }
  .app-header .header-content-right .header-element.me-2 { margin-inline-end: .15rem !important; }
  .app-header .header-content-right .header-link,
  .app-header .lang-switcher__toggle { padding-inline: .35rem !important; }
  .app-header .main-header-container { padding-inline: .5rem; }
}

/* Grillas en móvil: cada fila se apila como tarjeta y cada celda muestra el título de su
   columna (data-label, que copia app.js desde el encabezado). */
@media (max-width: 767.98px) {
  .table-responsive > .table:not(.table-no-stack) { min-width: 0; }
  .table-responsive > .table:not(.table-no-stack) > thead { display: none; }
  .table-responsive > .table:not(.table-no-stack),
  .table-responsive > .table:not(.table-no-stack) > tbody,
  .table-responsive > .table:not(.table-no-stack) > tbody > tr,
  .table-responsive > .table:not(.table-no-stack) > tbody > tr > td {
    display: block;
    width: 100%;
  }
  .table-responsive > .table:not(.table-no-stack) > tbody > tr {
    padding: .5rem 0;
    border-bottom: 1px solid var(--default-border, #f3f3f3);
  }
  .table-responsive > .table:not(.table-no-stack) > tbody > tr > td {
    border: 0;
    padding: .3rem 1rem;
    white-space: normal;
    text-align: start !important;
    min-width: 0;
    max-width: none;
  }
  .table-responsive > .table:not(.table-no-stack) > tbody > tr > td[data-label]:not([data-label=""])::before {
    content: attr(data-label);
    display: block;
    margin-bottom: .1rem;
    font-size: .7rem;
    font-weight: 600;
    letter-spacing: .02em;
    text-transform: uppercase;
    color: var(--text-muted);
  }
  .table-responsive > .table:not(.table-no-stack) > tbody > tr > td[colspan] { text-align: center !important; }
  .table-sticky-actions > :not(caption) > tr > :last-child { position: static; box-shadow: none; background: transparent; }
  .table-responsive > .table:not(.table-no-stack) td .d-inline-flex { flex-wrap: wrap; }
}
