* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8f0 100%);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 15px;
    color: #333;
    line-height: 1.5;
}

/* Navbar mejorado para móvil */
.navbar {
    background: linear-gradient(to right, #002244 0%, #003366 100%);
    padding: 12px 0;
    box-shadow: 0 4px 12px rgba(0, 51, 102, 0.2);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(to right, #f7941d, #ffcc00);
}

.navbar-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}

.navbar-brand {
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.logo-text {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    background: linear-gradient(45deg, #f7941d, #ffcc00);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.navbar-subtitle {
    font-size: 0.8rem;
    color: #b0c4de;
    font-weight: 300;
}

/* Contenedor principal mejorado */
.main-container {
    max-width: 1100px;
    margin: 20px auto;
    padding: 0 12px;
}

/* Contenedor del formulario */
.form-container {
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    border: 1px solid #e0e0e0;
    transition: box-shadow 0.3s ease;
}

/* Header mejorado */
.form-header {
    background: linear-gradient(135deg, #003366 0%, #002244 100%);
    padding: 20px 16px;
    position: relative;
    border-bottom: 1px solid #e0e0e0;
}

.form-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(to right, #f7941d, #ffcc00);
}

.titulo-section h4 {
    margin: 0 0 12px 0;
    color: #ffffff;
    font-size: 1.3rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-align: center;
}

/* Advertencia mejorada */
.advertencia-roja {
    background: #ffebee;
    color: #c62828;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    padding: 12px 16px;
    border: 1px solid #ffcdd2;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(198, 40, 40, 0.1);
}

/* Pasos del formulario */
.step {
    padding: 20px 16px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Indicador de progreso mejorado */
.step-indicator {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 24px;
    padding: 0 10px;
}

.step-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #e1e8f0;
    transition: all 0.3s ease;
}

.step-dot.active {
    background: #003366;
    transform: scale(1.2);
}

/* Tabla del formulario mejorada */
.form-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
}

.form-table td {
    padding: 12px 10px;
    background-color: #ffffff;
    border: 1px solid #f0f0f0;
    vertical-align: top;
}

/* Encabezados de sección mejorados */
.seccion-header {
    background: #f5f7fa;
    color: #003366;
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 14px 16px !important;
    text-align: left;
    border-left: 4px solid #003366;
}

/* Celdas de 50% mejoradas */
.col-50 {
    width: 50%;
    padding: 12px 10px;
    border-right: 1px solid #f0f0f0;
}

.col-50:last-child {
    border-right: none;
}

/* Contenedores de checkbox mejorados para móvil */
.check-container {
    display: flex;
    align-items: center;
    padding: 12px 14px;
    margin: 6px 0;
    background: #ffffff;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 50px;
    gap: 16px;
}

.check-container:hover {
    background: #f8fafd;
    border-color: #003366;
    box-shadow: 0 2px 8px rgba(0, 51, 102, 0.15);
    transform: translateY(-1px);
}

.check-container input[type="checkbox"] {
    width: 24px;
    height: 24px;
    cursor: pointer;
    accent-color: #003366;
    flex-shrink: 0;
    margin: 0; /* Eliminar margen por defecto */
    transform: scale(1.1);
}

.check-container label {
    margin: 0;
    cursor: pointer;
    user-select: none;
    flex: 1;
    font-size: 1rem;
    color: #333;
    font-weight: 500;
    line-height: 1.5;
    padding: 2px 0; /* Pequeño padding vertical */
    letter-spacing: 0.2px; /* Mejor legibilidad */
}

/* Etiquetas de celda mejoradas */
.cell-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #003366;
    display: block;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Inputs mejorados */
.cell-input {
    width: 100%;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    padding: 12px 14px;
    background-color: #ffffff;
    font-family: 'Segoe UI', sans-serif;
    color: #333;
    transition: all 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
}

.cell-input:focus {
    outline: none;
    border-color: #003366;
    background-color: #f8fafd;
    box-shadow: 0 0 0 3px rgba(0, 51, 102, 0.1);
}

textarea.cell-input {
    min-height: 100px;
    resize: vertical;
}

select.cell-input {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='%23003366' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 14px;
    padding-right: 40px;
}

/* Lista de técnicos mejorada */
.lista-tecnicos {
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 4px;
    background: #ffffff;
    margin: 12px 0;
}

.lista-tecnicos .form-check {
    padding: 14px 16px;
    border-bottom: 1px solid #f0f0f0;
    margin: 0;
    transition: background-color 0.2s ease;
}

.lista-tecnicos .form-check:last-child {
    border-bottom: none;
}

.lista-tecnicos .form-check:hover {
    background-color: #f8fafd;
}

.lista-tecnicos .form-check-input {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    accent-color: #003366;
}

.lista-tecnicos .form-check-label {
    font-size: 0.95rem;
    color: #333;
}

/* Botones mejorados */
.btn-submit, .btn-secondary, .btn-success {
    background: #003366;
    color: white;
    border: none;
    padding: 14px 24px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 51, 102, 0.2);
    min-height: 48px;
    width: 100%;
    margin: 4px 0;
}

.btn-submit:hover, .btn-secondary:hover, .btn-success:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 51, 102, 0.25);
}

.btn-submit:active, .btn-secondary:active, .btn-success:active {
    transform: translateY(0);
}

.btn-secondary {
    background: #6c757d;
    box-shadow: 0 2px 4px rgba(108, 117, 125, 0.2);
}

.btn-success {
    background: #28a745;
    box-shadow: 0 2px 4px rgba(40, 167, 69, 0.2);
}

/* Botón de cancelar mejorado */
.d-flex.justify-content-end .btn-submit {
    background: #dc3545;
    width: 100%;
    padding: 14px 20px;
    margin: 8px 0;
    font-size: 1rem;
}

/* Footer del formulario mejorado */
.form-footer {
    padding: 16px;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 16px;
    border-radius: 0 0 12px 12px;
}

/* Contenedor de verificación final */
.text-center.p-4 {
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    margin: 12px 0;
    padding: 16px !important;
}

.text-center.p-4 .check-container {
    justify-content: center;
    padding: 16px;
    background: #f0f7ff;
    border: 2px solid #c3d9ff;
}

/* Utilidades */
.text-center { text-align: center; }
.text-left { text-align: left; }
.mt-3 { margin-top: 1rem; }
.mt-5 { margin-top: 2rem; }
.mb-0 { margin-bottom: 0; }
.mb-3 { margin-bottom: 1rem; }
.p-4 { padding: 1.5rem; }

.d-flex { display: flex; }
.justify-content-between { justify-content: space-between; }
.justify-content-center { justify-content: center; }
.justify-content-end { justify-content: flex-end; }
.align-items-center { align-items: center; }

/* Media queries mejorados para móvil */
@media (max-width: 768px) {
    .main-container {
        margin: 12px auto;
        padding: 0 10px;
    }

    .form-container {
        border-radius: 10px;
    }

    .form-header {
        padding: 16px 12px;
    }

    .titulo-section h4 {
        font-size: 1.2rem;
    }

    .advertencia-roja {
        font-size: 0.8rem;
        padding: 10px 12px;
    }

    .step {
        padding: 16px 12px;
    }

    /* Convertir tabla en bloques */
    .form-table,
    .form-table tbody,
    .form-table tr,
    .form-table td {
        display: block;
        width: 100%;
    }

    .form-table tr {
        margin-bottom: 16px;
        border: 1px solid #f0f0f0;
        border-radius: 8px;
        overflow: hidden;
    }

    .form-table td {
        border: none;
        border-bottom: 1px solid #f0f0f0;
        padding: 14px 12px;
    }

    .form-table td:last-child {
        border-bottom: none;
    }

    .col-50 {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #f0f0f0;
        padding: 14px 12px;
    }

    .col-50:last-child {
        border-bottom: none;
    }

    .seccion-header {
        text-align: center;
        font-size: 0.85rem;
        padding: 14px 12px !important;
        border-left: none;
        border-top: 1px solid #e0e0e0;
    }

    /* Versión para móvil con aún más espacio */
@media (max-width: 768px) {
    .check-container {
        padding: 16px 20px;
        margin: 10px 0;
        min-height: 68px;
        gap: 18px;
        border-radius: 12px;
    }

    .check-container input[type="checkbox"] {
        width: 28px;
        height: 28px;
        transform: scale(1);
    }

    .check-container label {
        font-size: 1.05rem;
        line-height: 1.4;
    }
}

    /* Inputs más grandes para móvil */
    .cell-input {
        padding: 14px;
        font-size: 16px; /* Evita zoom automático en iOS */
        border-radius: 8px;
    }

    select.cell-input {
        font-size: 16px;
        padding: 14px;
    }

    /* Lista de técnicos mejorada */
    .lista-tecnicos {
        max-height: 300px;
        border-radius: 8px;
    }

    .lista-tecnicos .form-check {
        padding: 16px;
    }

    .lista-tecnicos .form-check-input {
        width: 24px;
        height: 24px;
    }

    .lista-tecnicos .form-check-label {
        font-size: 1rem;
    }

    /* Botones más grandes para móvil */
    .btn-submit, .btn-secondary, .btn-success {
        padding: 16px 20px;
        font-size: 1rem;
        min-height: 52px;
        border-radius: 8px;
    }

    .d-flex.justify-content-end .btn-submit {
        padding: 16px;
        margin: 6px 0;
    }

    .form-footer {
        padding: 16px 12px;
        gap: 10px;
    }

    /* Botones en fila para pantallas más grandes */
    .form-footer.d-flex {
        flex-direction: row;
    }

    .form-footer.d-flex .btn-submit {
        width: 48%;
        margin: 0;
    }
}

/* Para pantallas muy pequeñas */
@media (max-width: 380px) {
    .titulo-section h4 {
        font-size: 1.1rem;
    }

    .navbar-brand {
        flex-direction: column;
        gap: 4px;
        text-align: center;
    }

    .logo-text {
        font-size: 1.2rem;
    }

    .navbar-subtitle {
        font-size: 0.75rem;
    }

    .check-container {
        padding: 12px 10px;
    }

    .check-container label {
        font-size: 0.9rem;
    }

    .cell-label {
        font-size: 0.75rem;
    }

    .form-footer.d-flex {
        flex-direction: column;
    }

    .form-footer.d-flex .btn-submit {
        width: 100%;
        margin: 4px 0;
    }
}

/* Para pantallas medianas y tablets */
@media (min-width: 769px) and (max-width: 1024px) {
    .main-container {
        max-width: 90%;
        margin: 30px auto;
    }

    .step {
        padding: 25px;
    }

    .form-table td {
        padding: 16px;
    }

    .check-container {
        padding: 12px 16px;
    }
}

/* Para pantallas grandes */
@media (min-width: 1025px) {
    .btn-submit, .btn-secondary, .btn-success {
        width: auto;
        min-width: 200px;
    }

    .d-flex.justify-content-end .btn-submit {
        width: auto;
    }

    .form-footer {
        flex-direction: row;
        justify-content: space-between;
    }

    .form-footer .btn-submit {
        width: auto;
        margin: 0;
    }
}

/* Mejoras para impresión */
@media print {
    body {
        background: white;
    }

    .form-container {
        box-shadow: none;
        border: 1px solid #ddd;
    }

    .btn-submit, .btn-secondary, .btn-success,
    .form-footer, .d-flex.justify-content-end {
        display: none !important;
    }

    .check-container {
        border: 1px solid #ddd;
        break-inside: avoid;
    }

    .step {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}

/* ===== BOTONES DE SELECCIÓN RÁPIDA ===== */
.btn-selector {
    background: linear-gradient(135deg, #f8fafd 0%, #eef2f7 100%);
    color: #003366;
    border: 1.5px solid #cbd5e0;
    padding: 8px 16px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 51, 102, 0.05);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
}

.btn-selector:hover {
    background: linear-gradient(135deg, #eef2f7 0%, #e2e8f0 100%);
    border-color: #003366;
    color: #003366;
    box-shadow: 0 4px 8px rgba(0, 51, 102, 0.15);
    transform: translateY(-1px);
}

.btn-selector:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 51, 102, 0.1);
}

.btn-selector i {
    font-size: 0.9rem;
    color: #f7941d;
    transition: transform 0.2s ease;
}

.btn-selector:hover i {
    transform: scale(1.1);
}

/* Estado cuando está en "Deseleccionar Todo" */
.btn-selector.deselect {
    background: linear-gradient(135deg, #fff4e5 0%, #ffe4cc 100%);
    border-color: #f7941d;
    color: #b45309;
}

.btn-selector.deselect i {
    color: #dc3545;
}

/* Para móvil */
@media (max-width: 768px) {
    .btn-selector {
        padding: 10px 18px;
        font-size: 0.85rem;
        min-height: 42px;
        border-radius: 24px;
        width: 100%;
        justify-content: center;
        margin: 4px 0;
    }

    .d-flex.justify-content-end {
        margin-bottom: 12px !important;
    }
}

/* Contenedor de botones en fila */
.selector-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
    margin-bottom: 15px;
}

.selector-group .btn-selector {
    margin: 0;
}

/* Animación sutil */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

.btn-selector:focus {
    outline: none;
    animation: pulse 0.3s ease;
}

/* ===== MEJORAS PARA MÓVIL EN SECCIÓN EPP ===== */
@media (max-width: 768px) {
    #seccion-epp {
        flex-direction: column !important;
        gap: 10px !important;
    }

    #seccion-epp > div {
        width: 100%;
    }

    /* Opcional: mejorar la visualización de los checkboxes en móvil */
    #seccion-epp .check-container {
        width: 100%;
        margin: 5px 0;
    }
}

/* Para pantallas muy pequeñas, asegurar que no haya desbordamiento */
@media (max-width: 480px) {
    .form-table td {
        overflow-x: hidden;
    }

    #seccion-epp {
        max-width: 100%;
    }
}