/**
 * Módulo Partes — diseño adaptable (móvil y tablet)
 */
.modulo-partes {
  -webkit-text-size-adjust: 100%;
}

@media (max-width: 1024px) {
  .modulo-partes {
    font-size: 16px;
    line-height: 1.5;
  }

  .modulo-partes #cabecera {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 0 0.75rem;
  }

  .modulo-partes .cabecera-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
  }

  .modulo-partes #responsive-image {
    max-height: 56px;
    width: auto;
    max-width: 55%;
    object-fit: contain;
    display: block;
    margin: 0;
  }

  /* Botón menú hamburguesa */
  .modulo-partes .menu-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
    padding: 0.5rem 0.85rem;
    border: 1px solid #c9c9c9;
    border-radius: 8px;
    background: linear-gradient(to bottom, #fff 0%, #f0f0f0 100%);
    color: #333;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  }

  .modulo-partes .menu-toggle__icon {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 22px;
    height: 18px;
  }

  .modulo-partes .menu-toggle__bar {
    display: block;
    width: 100%;
    height: 2px;
    background: #b40e0e;
    border-radius: 1px;
    transition: transform 0.25s ease, opacity 0.2s ease;
  }

  .modulo-partes.menu-abierto .menu-toggle__bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  .modulo-partes.menu-abierto .menu-toggle__bar:nth-child(2) {
    opacity: 0;
  }

  .modulo-partes.menu-abierto .menu-toggle__bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  .modulo-partes.menu-abierto .menu-toggle {
    background: #b40e0e;
    border-color: #b40e0e;
    color: #fff;
  }

  .modulo-partes.menu-abierto .menu-toggle__bar {
    background: #fff;
  }

  /* Menú desplegable (cerrado por defecto) */
  .modulo-partes #menu {
    height: auto;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    border-radius: 10px;
    border: 1px solid transparent;
    margin-top: 0;
    transition:
      max-height 0.35s ease,
      opacity 0.25s ease,
      visibility 0.25s ease,
      margin-top 0.25s ease,
      border-color 0.25s ease;
  }

  .modulo-partes.menu-abierto #menu {
    max-height: 80vh;
    overflow-y: auto;
    opacity: 1;
    visibility: visible;
    margin-top: 0.5rem;
    border-color: #c9c9c9;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  }

  .modulo-partes #menu ul {
    display: flex;
    flex-direction: column;
    width: 100%;
  }

  .modulo-partes #menu li {
    float: none;
    width: 100%;
    line-height: 1.35;
    border-right: none;
    border-bottom: 1px solid #e0e0e0;
  }

  .modulo-partes #menu li:last-child {
    border-bottom: none;
  }

  .modulo-partes #menu li a {
    display: block;
    padding: 0.85rem 1rem;
    font-size: 1rem;
  }

  /* Contenedor principal: columna */
  .modulo-partes #contenedor {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 0 0.75rem;
    margin-top: 1rem;
    margin-bottom: 1.5rem;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }

  .modulo-partes #sidebar {
    float: none;
    width: 100%;
    min-height: 0;
    order: 1;
  }

  .modulo-partes #principal,
  .modulo-partes #principalc {
    float: none;
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
    box-sizing: border-box;
    order: 2;
    padding: 1.15rem;
    border-radius: 10px;
    min-height: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .modulo-partes .bloque {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin-bottom: 0;
    padding: 1rem;
    border-radius: 10px;
  }

  .modulo-partes .bloque h3 {
    font-size: 1.15rem;
    margin-bottom: 0.5rem;
  }

  .modulo-partes .bloque p {
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
    word-break: break-word;
  }

  /* Botones táctiles */
  .modulo-partes .boton,
  .modulo-partes .boton-rojo,
  .modulo-partes .boton-verde,
  .modulo-partes .boton-atras,
  .modulo-partes input[type="submit"],
  .modulo-partes input[type="button"],
  .modulo-partes #principal button,
  .modulo-partes #principalc button {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-height: 44px;
    padding: 0.65rem 1rem;
    font-size: 1rem;
    line-height: 1.35;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    border-radius: 8px;
  }

  .modulo-partes .botonE,
  .modulo-partes .botonEd {
    width: auto;
    min-width: 4.5rem;
    min-height: 40px;
    display: inline-block;
    margin: 0.25rem;
    font-size: 0.9rem;
  }

  .modulo-partes .parte-linea__acciones {
    flex-wrap: nowrap;
  }

  .modulo-partes .parte-linea__acciones .botonEd,
  .modulo-partes .parte-linea__acciones .botonE {
    width: auto !important;
    max-width: none !important;
    min-height: 0 !important;
    min-width: 0 !important;
    padding: 0.3rem 0.65rem !important;
    font-size: 0.78rem !important;
    margin: 0 !important;
    color: #fff !important;
    flex: 0 0 auto !important;
    display: inline-block !important;
  }

  .modulo-partes #ver-todas a {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    text-align: center;
  }

  /* Títulos */
  .modulo-partes #principal h1,
  .modulo-partes #principalc h1 {
    font-size: 1.45rem;
    line-height: 1.25;
    margin-bottom: 0.75rem;
    word-break: break-word;
  }

  .modulo-partes #principal h2,
  .modulo-partes #principalc h2 {
    font-size: 1.15rem;
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
  }

  .modulo-partes #principal p,
  .modulo-partes #principal label {
    font-size: 0.95rem;
    line-height: 1.45;
  }

  .modulo-partes #principal label {
    display: block;
    margin-bottom: 0.35rem;
    word-break: break-word;
  }

  /* Formularios */
  .modulo-partes input[type="text"],
  .modulo-partes input[type="email"],
  .modulo-partes input[type="password"],
  .modulo-partes input[type="date"],
  .modulo-partes select,
  .modulo-partes textarea {
    width: 100% !important;
    max-width: 100%;
    box-sizing: border-box;
    font-size: 16px;
    padding: 0.65rem 0.75rem;
    margin-bottom: 0.75rem;
    border: 1px solid #ccc;
    border-radius: 8px;
  }

  .modulo-partes label + br {
    display: none;
  }

  /* Listado de partes */
  .modulo-partes .entrada {
    display: block;
    padding: 1rem;
    margin-bottom: 0.75rem;
    background: #fafafa;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    border-left: 4px solid #b40e0e;
  }

  .modulo-partes .entrada a {
    display: block;
  }

  .modulo-partes .entrada h2 {
    font-size: 1rem !important;
    margin-top: 0 !important;
    line-height: 1.35;
    color: #333 !important;
    text-shadow: none !important;
  }

  .modulo-partes .spanEntradas {
    font-size: 0.85rem;
    display: block;
    margin-top: 0.35rem;
  }

  /* Tablas: scroll horizontal */
  .modulo-partes #table {
    width: 100%;
    min-width: 520px;
    margin: 0.75rem 0;
    font-size: 0.88rem;
    border-collapse: collapse;
  }

  .modulo-partes #th,
  .modulo-partes #table th {
    padding: 0.6rem 0.45rem;
    font-size: 0.8rem;
    white-space: nowrap;
  }

  .modulo-partes #td,
  .modulo-partes #table td {
    padding: 0.55rem 0.45rem;
    font-size: 0.88rem;
    vertical-align: top;
    word-break: break-word;
  }

  .modulo-partes #table th:last-child,
  .modulo-partes #table td:last-child {
    white-space: nowrap;
  }

  /* Alertas */
  .modulo-partes .alerta,
  .modulo-partes .alerta-error,
  .modulo-partes .avisoOk,
  .modulo-partes .correcto {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    font-size: 0.95rem;
    padding: 0.75rem;
    margin-bottom: 1rem;
    border-radius: 8px;
  }

  /* Pie */
  .modulo-partes #pie {
    width: calc(100% - 1.5rem);
    max-width: 100%;
    margin: 0 auto 1rem;
    padding: 1rem;
    font-size: 0.9rem;
    box-sizing: border-box;
  }

  /* Vacaciones dentro de partes */
  .modulo-partes .vacaciones-operario .vf-resumen-grid,
  .modulo-partes .vacaciones-stats {
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem;
  }

  .modulo-partes .vf-resumen-num,
  .modulo-partes .vacaciones-stat-num {
    font-size: 1.5rem;
  }

  .modulo-partes .vacaciones-periodo-cab {
    flex-direction: column;
    align-items: flex-start;
  }

  .modulo-partes .vacaciones-chip {
    font-size: 0.8rem;
    margin: 0.2rem 0.35rem 0.2rem 0;
  }
}

@media (hover: hover) and (max-width: 1024px) {
  .modulo-partes .bloque:hover,
  .modulo-partes .entrada:hover {
    padding: 1rem;
  }
}

@media (max-width: 480px) {
  .modulo-partes .vacaciones-operario .vf-resumen-grid,
  .modulo-partes .vacaciones-stats {
    grid-template-columns: 1fr;
  }

  .modulo-partes #principal h1 {
    font-size: 1.3rem;
  }

  .modulo-partes .bloque-acceso-portal .boton {
    font-size: 0.95rem;
    padding: 0.75rem 0.85rem;
  }

  .modulo-partes .parte-descripcion-seccion__agregar {
    width: 100%;
  }

  .modulo-partes .parte-btn-cerrar {
    width: 100%;
    max-width: 100%;
    min-height: 44px;
    color: #fff !important;
  }
}

/* Tablet: barra lateral estrecha + contenido (menú sigue desplegable) */
@media (min-width: 768px) and (max-width: 1024px) {
  .modulo-partes #contenedor {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .modulo-partes #sidebar {
    flex: 0 0 200px;
  }

  .modulo-partes #principal,
  .modulo-partes #principalc {
    flex: 1 1 calc(100% - 220px);
    min-width: 0;
  }
}

/* Escritorio: menú siempre visible, sin botón */
@media (min-width: 1025px) {
  .modulo-partes .menu-toggle {
    display: none;
  }

  .modulo-partes .cabecera-top {
    display: block;
    margin-bottom: 0.5rem;
  }

  .modulo-partes #responsive-image {
    max-width: 100%;
    max-height: none;
    margin: 0 auto 0.5rem;
  }

  .modulo-partes #menu {
    max-height: none;
    opacity: 1;
    visibility: visible;
    overflow: visible;
    border-color: #c9c9c9;
  }
}
