/**
 * Estilos para parte.php - Formulario de Partes Técnicos
 */

/* ===========================================
   RESET Y BASE
   =========================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background: #f0f4f8;
    padding: 15px;
    line-height: 1.5;
    overflow-x: hidden;
}

/* --- UTILIDADES --- */
.oculto {
    display: none !important;
}

.visible {
    display: block !important;
}

/* ===========================================
   CONTENEDOR PRINCIPAL
   =========================================== */
.container {
    max-width: 600px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* ===========================================
   CABECERA
   =========================================== */
.header {
    position: relative;
    background: linear-gradient(135deg, #ff9800, #f57c00);
    color: white;
    padding: 20px;
    text-align: center;
    border-radius: 12px;
    margin-bottom: 15px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.header h1 {
    font-size: 22px;
    margin-bottom: 5px;
    font-weight: 700;
}

.header p {
    font-size: 14px;
    opacity: 0.9;
}

.icon-clear {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s;
}

.icon-clear:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* --- BARRA DE NAVEGACIÓN DEL HEADER --- */
.header-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    margin-bottom: 15px;
}

.header-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    text-decoration: none;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.header-btn:hover {
    background: rgba(255, 255, 255, 0.35);
    transform: translateY(-1px);
}

.header-btn-icon {
    font-size: 14px;
}

.header-btn-logout {
    background: rgba(220, 38, 38, 0.3);
    border-color: rgba(220, 38, 38, 0.5);
}

.header-btn-logout:hover {
    background: rgba(220, 38, 38, 0.5);
}

/* Spacer para separar botón limpiar de los demás */
.header-nav-spacer {
    flex-grow: 1;
}

/* Botón limpiar en el header */
.header-btn-limpiar {
    background: rgba(255, 255, 255, 0.9);
    color: #f57c00;
    border: none;
}

.header-btn-limpiar:hover {
    background: white;
}

/* --- BOTÓN LIMPIAR FORMULARIO (standalone) --- */
.btn-limpiar-form {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: white;
    color: #f57c00;
    border: 2px solid #f57c00;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-limpiar-form:hover {
    background: #fff8f0;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 152, 0, 0.2);
}

.btn-limpiar-form:active {
    transform: translateY(0);
}

/* Responsive: ajustar botones en móvil */
@media (max-width: 480px) {
    .header-btn {
        padding: 5px 10px;
        font-size: 12px;
    }
    .header-btn-icon {
        font-size: 12px;
    }
}

/* ===========================================
   FORMULARIO
   =========================================== */
.form-content {
    padding: 25px 20px;
}

.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 14px;
    color: #374151;
}

/* ===========================================
   INPUTS
   =========================================== */
input[type="text"],
input[type="date"],
input[type="time"],
input[type="number"],
input[type="tel"],
input[type="email"],
textarea,
select {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
    /*transition: border-color 0.2s, box-shadow 0.2s;*/
    color: #1f2937;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

input:disabled,
input[readonly] {
    background: #f3f4f6;
    color: #6b7280;
    cursor: not-allowed;
}

/* --- INPUT CON BOTÓN DENTRO --- */
.input-con-boton {
    position: relative;
    width: 100%;
}

.input-con-boton input {
    padding-right: 45px;
}

.btn-dentro-input {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-dentro-input:hover {
    background: #e5e7eb;
}

/* --- BOTÓN COPIAR JUNTO AL TÍTULO --- */
.btn-copiar-fuera {
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-copiar-fuera:hover {
    background: #e5e7eb;
}

textarea {
    min-height: 100px;
    resize: vertical;
}

/* ===========================================
   PLACEHOLDERS (GLOBAL)
   =========================================== */

/* Chrome, Safari, Edge, Opera */
input[type="text"]::-webkit-input-placeholder,
input[type="number"]::-webkit-input-placeholder,
input[type="tel"]::-webkit-input-placeholder,
input[type="email"]::-webkit-input-placeholder,
textarea::-webkit-input-placeholder {
    color: #9ca3af !important;
    opacity: 1 !important;
    -webkit-text-fill-color: #9ca3af !important;
}

/* Firefox */
input[type="text"]::-moz-placeholder,
input[type="number"]::-moz-placeholder,
input[type="tel"]::-moz-placeholder,
input[type="email"]::-moz-placeholder,
textarea::-moz-placeholder {
    color: #9ca3af !important;
    opacity: 1 !important;
    -moz-appearance: none !important;
}

/* Firefox - hack para forzar color */
@-moz-document url-prefix() {
    ::placeholder {
        color: #9ca3af !important;
        opacity: 1 !important;
    }
}

/* Estándar (incluye Firefox moderno) */
input[type="text"]::placeholder,
input[type="number"]::placeholder,
input[type="tel"]::placeholder,
input[type="email"]::placeholder,
textarea::placeholder {
    color: #9ca3af !important;
    opacity: 1 !important;
}

input[type="date"],
input[type="time"] {
    -webkit-appearance: none;
    appearance: none;
    min-height: 46px;
}
/* ===========================================
   FIX PARA IOS (IPHONE/IPAD)
   =========================================== */

/* 1. Quitamos el estilo nativo y forzamos blanco */
select,
input[type="date"],
input[type="time"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-color: #ffffff; /* IMPORTANTE: Fuerza el blanco sobre el gris de iOS */
}

/* 2. Como hemos borrado la flecha nativa del select, ponemos una nuestra */
select {
    /* Flecha SVG gris moderna (muy ligera) */
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 14px center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 40px; /* Hacemos sitio para que el texto no tape la flecha */
}

/* Ajuste específico para que fecha/hora tengan altura correcta en móviles */
input[type="date"],
input[type="time"] {
    min-height: 46px;
    max-width: 100%;
    min-width: 0;
}

/* ===========================================
   GRID Y FILAS
   =========================================== */
.row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.row > * {
    min-width: 0;
}

.row-25-75 {
    grid-template-columns: 1fr 3fr;
}

/* ===========================================
   RADIO BUTTONS (ARREGLADO)
   =========================================== */
.radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 8px;
}

/* CAMBIO: Ahora esto se aplica a la etiqueta LABEL padre */
.radio-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer; /* Importante: manita en toda la caja */
    transition: all 0.2s;
    user-select: none; /* Evita que se seleccione el texto al clicar rápido */
}

.radio-item:hover {
    border-color: #2563eb;
    background: #eff6ff;
}

/* El selector :has sigue funcionando perfecto */
.radio-item:has(input:checked) {
    border-color: #2563eb;
    background: #eff6ff;
}

.radio-item input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #2563eb;
}

/* CAMBIO: En lugar de 'label', ahora estilizamos el 'span' o texto */
.radio-text {
    margin: 0;
    font-weight: 500;
    cursor: pointer;
    color: #374151;
}

/* ===========================================
   SECCIONES ESPECIALES
   =========================================== */
.section-facturable {
    background: #fef2f2;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    border: 2px solid #fecaca;
}

.section-facturable label {
    color: #dc2626;
    font-size: 15px;
}

.section-facturable .radio-item:has(input:checked) {
    border-color: #dc2626;
    background: #fee2e2;
}

.section-facturable input[type="radio"] {
    accent-color: #dc2626;
}

.section-email {
    background: #eff6ff;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    border: 2px solid #bfdbfe;
}

.section-email label {
    color: #1d4ed8;
}

.section-borradores {
    background: #f0f9ff;
    padding: 20px;
    border-radius: 10px;
    margin: 20px 0;
    border: 2px solid #bae6fd;
}

.radio-item input[type="radio"] {
    /* 1. Le decimos al navegador que no use su estilo */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;

    /* 2. Por si acaso, lo hacemos invisible y sin tamaño */
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute; /* Para que no ocupe espacio físico */
    margin: 0;
}

/* ===========================================
   CSS DEFINITIVO: GRID + BORDES NÍTIDOS
   =========================================== */

/* 1. EL CONTENEDOR (Grid para forzar 50%/50%) */
.radio-row {
    display: grid !important;
    grid-template-columns: 1fr 1fr; /* Divide en dos fracciones exactas */
    gap: 10px;       /* Espacio en medio */
    width: 100%;
    margin-top: 5px;
}

/* 2. EL LABEL (Limpieza total) */
.radio-row .radio-item {
    width: 100%; margin: 0; padding: 0; display: block; cursor: pointer;
    /* Aseguramos que no tenga bordes propios */
    border: none; background: transparent;
}

/* 3. EL INPUT (Invisible) */
.radio-item input[type="radio"] {
    position: absolute; opacity: 0; width: 0; height: 0;
    -webkit-appearance: none;
}

/* 4. EL BOTÓN VISUAL (El SPAN - Estado Normal) */
.radio-item span {
    display: flex;
    justify-content: center;
    align-items: center;
    
    width: 100%;
    height: 100%; /* Altura consistente */
    padding: 12px 5px;
    
    background-color: #ffffff;
    /* Borde nítido de 1px */
    border: 1px solid #d1d5db; 
    border-radius: 8px;
    
    color: #4b5563;
    font-weight: 500;
    font-size: 14px;
    text-align: center;
    white-space: nowrap;
    transition: all 0.2s ease-in-out; /* Transición suave */
}

/* 5. ESTADO SELECCIONADO (AZUL) - ¡CORREGIDO! */
.radio-item input[type="radio"]:checked + span {
    background-color: #eff6ff;
    /* SOLO cambiamos el color del borde, sin añadir sombras extra */
    border-color: #2563eb; 
    color: #2563eb;
    font-weight: 600;
}

/* 6. ESTADO SELECCIONADO (ROJO - Para facturable) - ¡CORREGIDO! */
.section-facturable .radio-item input[type="radio"]:checked + span {
    background-color: #fee2e2;
    /* SOLO cambiamos el color del borde */
    border-color: #dc2626; 
    color: #dc2626;
    font-weight: 600;
}

/* ===========================================
   FIRMA
   =========================================== */
.firma-container {
    border: 2px dashed #d1d5db;
    border-radius: 10px;
    background: #f9fafb;
    padding: 15px;
    margin-top: 10px;
}

.firma-container-cliente {
    background: #fff7ed;
    border-color: #fdba74;
}

/* Etiqueta principal de la sección */
.block-label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    color: #111827;
    font-size: 16px;
}

/* Parte superior: Input del nombre */
.firma-header {
    margin-bottom: 15px;
}

.firma-header label {
    display: block;
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 5px;
    font-weight: 500;
}

/* 1. El envoltorio lleva el borde (EXACTO al de tus inputs) */
.canvas-wrapper {
    position: relative;
    width: 100%;
    /* Sin altura fija, dejamos que el aspect-ratio mande */
    
    /* COPIA EXACTA DE TU ESTILO DE INPUT */
    border: 2px solid #e5e7eb; 
    border-radius: 8px;
    
    background: #ffffff; /* Fondo blanco igual que el input */
    overflow: hidden;
    transition: border-color 0.2s;
}

/* 2. IMPORTANTE: Al canvas de dentro le QUITAMOS el borde */
.firma-canvas {
    width: 100%;
    height: auto;
    aspect-ratio: 2 / 1; /* Mantiene la proporción rectangular */
    
    /* Quitamos el borde aquí para que no se sume al del wrapper */
    border: none; 
    outline: none;
    
    cursor: crosshair;
    touch-action: none;
    display: block;
}

/* Efecto Focus/Hover igual que en tus inputs */
.canvas-wrapper:hover {
    border-color: #2563eb; /* Azul al pasar el ratón */
}

/* Texto de ayuda que queda "detrás" (visual) */
.canvas-placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #9ca3af;
    font-size: 14px;
    pointer-events: none; /* Para que no moleste al clic */
    user-select: none;
    z-index: 0;
}

/* Botón de borrar flotante (esquina superior derecha) */
.btn-borrar-flotante {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #e5e7eb;
    color: #ef4444; /* Rojo suave */
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 20px;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: all 0.2s;
    z-index: 10; /* Encima del canvas */
}

.btn-borrar-flotante:hover {
    background: #fee2e2;
    color: #dc2626;
}

/* Aviso firma copiada */
.aviso-firma-copiada {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #ecfdf5;
    border: 2px solid #6ee7b7;
    border-radius: 10px;
    padding: 16px 18px;
    color: #065f46;
    font-size: 15px;
    font-weight: 500;
}

.aviso-firma-icono {
    font-size: 20px;
    flex-shrink: 0;
}

/* ===========================================
   BOTONES
   =========================================== */
.btn-primary {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}
.btn-guardarborrador {
    color: black;
    background: #bae6fd;
    font-weight: normal;
}


.btn-clear {
    width: 100%;
    padding: 14px;
    background: white;
    color: #dc2626;
    border: 2px solid #fecaca;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-clear:hover {
    background: #fef2f2;
}

.btn-secondary {
    padding: 10px 20px;
    background: #f3f4f6;
    color: #374151;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: #e5e7eb;
}

.btn-small {
    font-size: 13px;
    padding: 6px 12px;
    border: 1px solid #d1d5db;
    background: #f9fafb;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-small:hover {
    background: #e5e7eb;
}

/* ===========================================
   MENSAJES
   =========================================== */
.mensaje {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    text-align: center;
    display: none;
    font-weight: 500;
}

.mensaje.show {
    display: block;
}

.mensaje.exito {
    background: #d1fae5;
    color: #065f46;
    border: 2px solid #10b981;
}

.mensaje.error {
    background: #fee2e2;
    color: #991b1b;
    border: 2px solid #ef4444;
}

.info-box {
    background: #eff6ff;
    border-left: 4px solid #2563eb;
    padding: 12px 15px;
    margin: 10px 0;
    font-size: 13px;
    color: #1e40af;
    border-radius: 0 8px 8px 0;
}

.info-list {
    margin: 10px 0 0 0;
    padding-left: 20px;
    font-size: 13px;
    color: #6b7280;
}

.info-list li {
    margin-bottom: 4px;
}

/* ===========================================
   BORRADORES
   =========================================== */
.borradores-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.borradores-actions select {
    flex: 1;
}

.borradores-actions button {
    padding: 10px 15px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    
}

.borradores-actions .btn-cargar {
    background: #0ea5e9;
    color: white;
}

.borradores-actions .btn-eliminar {
    background: #ef4444;
    color: white;
}

#msgBorrador {
    font-size: 13px;
    margin-top: 12px;
    text-align: center;
    font-weight: 600;
    min-height: 18px;
}

/* ===========================================
   TARJETA DE JORNADA (FECHA Y HORAS)
   =========================================== */

/* El contenedor principal (La Caja) */
.schedule-card {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    overflow: hidden;
}

/* Estilo común para las etiquetas dentro de la tarjeta */
.schedule-row label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #6b7280;
    margin-bottom: 6px;
}

/* FILA DE FECHA */
.full-width {
    width: 100%;
}

/* LÍNEA SEPARADORA DECORATIVA */
.schedule-divider {
    height: 1px;
    background: #e5e7eb;
    margin: 15px 0; /* Separación vertical */
}

/* GRID PARA LAS HORAS (Solución iPhone) */
.time-split {
    display: grid;
    grid-template-columns: 1fr 1fr; /* 50% y 50% exacto */
    gap: 15px; /* Espacio en medio */
    overflow: hidden;
}

.time-col {
    min-width: 0;
}

/* Ajuste fino para inputs de hora en móviles */
.time-col input[type="time"] {
    text-align: center; /* La hora centrada se lee mejor en cajas pequeñas */
    padding-left: 5px;
    padding-right: 5px;
}

/* ===========================================
   RESPONSIVE
   =========================================== */
@media (max-width: 600px) {
    body {
        padding: 10px;
    }

    .row {
        grid-template-columns: 1fr;
    }

    .row-horas {
        display: grid;
        grid-template-columns: 1fr 1fr; /* Dos columnas de igual tamaño */
        gap: 12px; /* Espacio entre los dos inputs */
        align-items: start; /* Alineados arriba por si las etiquetas ocupan distinto */
    }

/* Opcional: Si sientes que en iPhone SE muy pegado, reduce el padding lateral de los inputs solo dentro de esta fila */
.row-horas input[type="time"] {
        padding-left: 5px;  /* Ajuste fino para ganar espacio */
        padding-right: 5px;
        text-align: center; /* Queda mejor centrado en cajas pequeñas */
    }

    .radio-group {
        flex-direction: column;
        gap: 10px;
    }

    .radio-item {
        width: 100%;
    }

    .header h1 {
        font-size: 18px;
    }

    .borradores-actions {
        flex-wrap: wrap;
    }

    .borradores-actions select {
        width: 100%;
    }
}

/* ===========================================
   LOGIN (Pantalla de acceso)
   =========================================== */
.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
    background: linear-gradient(135deg, #f0f4f8, #e5e7eb);
}

.login-card {
    background: white;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 340px;
    text-align: center;
}

.login-card .logo {
    font-size: 50px;
    margin-bottom: 10px;
    display: block;
}

.login-card h2 {
    margin: 0 0 10px 0;
    color: #374151;
}

.login-card p {
    color: #6b7280;
    font-size: 14px;
    margin-bottom: 25px;
}

.login-card input {
    width: 100%;
    padding: 14px;
    margin-bottom: 15px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 16px;
}

.login-card button {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #ea580c, #c2410c);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.login-card button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(234, 88, 12, 0.4);
}

.login-card .error {
    color: #dc2626;
    margin-bottom: 15px;
    display: block;
    font-size: 14px;
}

/* ===========================================
   SECCIÓN MATERIAL
   =========================================== */
.section-material {
    background: #fef2f2;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    border: 2px solid #fca5a5;
}

.section-material label {
    color: #991b1b;
    font-size: 15px;
    margin-bottom: 12px;
}

.btn-material {
    width: 100%;
    padding: 14px 20px;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-material:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4);
}

.resumen-material {
    margin-top: 12px;
    padding: 10px;
    background: white;
    border-radius: 6px;
    border: 1px solid #bbf7d0;
}

.material-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.material-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.material-badge.instalado {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
}

.material-badge.retirado {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
}

/* ===========================================
   MODAL MATERIAL
   =========================================== */
.modal-material {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: flex-start;
    padding: 20px;
    overflow-y: auto;
}

.modal-material.show {
    display: flex;
}

.modal-material-content {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    margin: auto;
}

.modal-material-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
    border-radius: 12px 12px 0 0;
}

.modal-material-header h3 {
    margin: 0;
    font-size: 18px;
    color: #111827;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #6b7280;
    line-height: 1;
    padding: 0;
}

.modal-close:hover {
    color: #111827;
}

.modal-material-body {
    padding: 20px;
}

.modal-material-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 20px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
    border-radius: 0 0 12px 12px;
}

/* Tabs del modal */
.material-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.tab-btn {
    flex: 1;
    padding: 10px 16px;
    border: 2px solid #e5e7eb;
    background: white;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    color: #6b7280;
}

.tab-btn:hover {
    border-color: #d1d5db;
    background: #f9fafb;
}

.tab-btn.active {
    border-color: #22c55e;
    background: #f0fdf4;
    color: #166534;
}

/* Tab Retirar - Rojo */
.tab-btn[data-tab="retirar"] {
    border-color: #fecaca;
    color: #dc2626;
}

.tab-btn[data-tab="retirar"]:hover {
    background: #fef2f2;
    border-color: #f87171;
}

.tab-btn[data-tab="retirar"].active {
    border-color: #dc2626;
    background: #fef2f2;
    color: #dc2626;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Búsqueda */
.search-material {
    margin-bottom: 12px;
}

.search-material input {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
}

.search-material input:focus {
    outline: none;
    border-color: #22c55e;
}

/* Buscador en tab Retirar - Rojo */
#tabRetirar .search-material input {
    border-color: #fecaca;
}

#tabRetirar .search-material input:focus {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.search-material .hint-text {
    display: block;
    font-size: 11px;
    color: #888;
    margin-top: 4px;
    font-style: italic;
}

#tabRetirar .resultados-material {
    border-color: #fecaca;
    background: #fef2f2;
}

#tabRetirar .resultado-item:hover {
    background: #fee2e2;
}

/* Resultados de búsqueda */
.resultados-material {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #f9fafb;
}

.resultado-item {
    padding: 12px;
    border-bottom: 1px solid #e5e7eb;
    cursor: pointer;
    transition: background 0.15s;
}

.resultado-item:last-child {
    border-bottom: none;
}

.resultado-item:hover {
    background: #ecfdf5;
}

.resultado-item .nombre {
    font-weight: 500;
    color: #111827;
}

.resultado-item .info {
    font-size: 12px;
    color: #6b7280;
    margin-top: 2px;
}

.resultado-item .stock {
    display: inline-block;
    padding: 2px 8px;
    background: #dcfce7;
    color: #166534;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
    margin-left: 8px;
}

.resultado-item .stock.bajo {
    background: #fef3c7;
    color: #92400e;
}

.resultado-item .stock.cero {
    background: #fee2e2;
    color: #991b1b;
}

/* Info serie retirar */
.info-serie-retirar {
    padding: 12px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    min-height: 60px;
}

.info-serie-retirar .no-encontrado {
    color: #6b7280;
    font-style: italic;
    text-align: center;
    padding: 20px;
}

.info-serie-retirar .serie-encontrada {
    padding: 10px;
}

.info-serie-retirar .serie-encontrada .nombre {
    font-weight: 600;
    color: #111827;
    margin-bottom: 4px;
}

.info-serie-retirar .serie-encontrada .detalles {
    font-size: 13px;
    color: #6b7280;
}

/* Input con botón generar S/N */
.input-con-boton {
    display: flex;
    gap: 8px;
}

.input-con-boton input {
    flex: 1;
}

.btn-generar-sn {
    padding: 8px 12px;
    background: #6366f1;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
}

.btn-generar-sn:hover {
    background: #4f46e5;
}

.aviso-escribir-sn {
    margin-top: 8px;
    padding: 10px 12px;
    background: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: 6px;
    color: #92400e;
    font-size: 13px;
}

/* Material seleccionado */
.material-seleccionado {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #e5e7eb;
}

.material-seleccionado h4 {
    font-size: 14px;
    color: #374151;
    margin-bottom: 10px;
}

/* Etiquetas de listas */
.lista-material-header {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 6px;
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
}

.lista-material-header.instalado {
    background: #dcfce7;
    color: #166534;
}

.lista-material-header.retirado {
    background: #fee2e2;
    color: #991b1b;
}

.lista-material {
    margin-bottom: 12px;
}

.lista-material .empty-msg {
    color: #9ca3af;
    font-size: 13px;
    font-style: italic;
    text-align: center;
    padding: 8px;
}

.item-material {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-radius: 6px;
    margin-bottom: 6px;
}

/* Material instalado - fondo verde claro */
#listaMaterialInstalado .item-material {
    background: #f0fdf4;
    border: 1px solid #86efac;
}

/* Material retirado - fondo rojo claro */
#listaMaterialRetirado .item-material {
    background: #fef2f2;
    border: 1px solid #fecaca;
}

.item-material .info-item {
    flex: 1;
}

.item-material .info-item .nombre {
    font-weight: 500;
    font-size: 13px;
}

.item-material .info-item .serie {
    font-size: 11px;
    color: #6b7280;
}

.item-material .btn-quitar {
    background: #fee2e2;
    color: #dc2626;
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 12px;
    cursor: pointer;
}

.item-material .btn-quitar:hover {
    background: #fecaca;
}

/* ===========================================
   TAB RETIRAR - FLUJO POR PASOS
   =========================================== */

/* Enlace "Modelo no existe" */
.modelo-no-existe {
    text-align: center;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed #e5e7eb;
}

.btn-link {
    background: none;
    border: none;
    color: #0284c7;
    font-size: 13px;
    cursor: pointer;
    text-decoration: underline;
    padding: 8px;
}

.btn-link:hover {
    color: #0369a1;
}

/* Paso 2: Modelo seleccionado + S/N */
.retirar-paso2 {
    padding: 16px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
}

.modelo-seleccionado-info {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #fecaca;
}

.modelo-seleccionado-info .label {
    font-size: 13px;
    color: #6b7280;
}

.modelo-seleccionado-info .valor {
    flex: 1;
    font-weight: 600;
    color: #dc2626;
}

.btn-cambiar {
    background: #fee2e2;
    color: #dc2626;
    border: none;
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 12px;
    cursor: pointer;
}

.btn-cambiar:hover {
    background: #fecaca;
}

.campo-serie-retirar {
    margin-bottom: 16px;
}

.campo-serie-retirar label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 6px;
}

.campo-serie-retirar input {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #fecaca;
    border-radius: 8px;
    font-size: 15px;
    background: white;
}

.campo-serie-retirar input:focus {
    outline: none;
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
}

.campo-problema-retirar {
    margin-bottom: 16px;
}

.campo-problema-retirar label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 6px;
}

.campo-problema-retirar input {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #fecaca;
    border-radius: 8px;
    font-size: 15px;
    background: white;
}

.campo-problema-retirar input:focus {
    outline: none;
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
}

.retirar-modelo-nuevo .campo-problema-retirar input {
    border-color: #fcd34d;
}

.retirar-modelo-nuevo .campo-problema-retirar input:focus {
    border-color: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

.btn-anadir-retirado {
    width: 100%;
    padding: 12px;
    background: #dc2626;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-anadir-retirado:hover {
    background: #b91c1c;
}

/* Formulario modelo nuevo */
.retirar-modelo-nuevo {
    padding: 16px;
    background: #fef3c7;
    border: 1px solid #fcd34d;
    border-radius: 8px;
}

.campo-modelo-nuevo {
    margin-bottom: 12px;
}

.campo-modelo-nuevo label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #92400e;
    margin-bottom: 6px;
}

.campo-modelo-nuevo input {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #fcd34d;
    border-radius: 8px;
    font-size: 15px;
    background: white;
}

.campo-modelo-nuevo input:focus {
    outline: none;
    border-color: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

.campo-categoria-nuevo {
    margin-bottom: 12px;
}

.campo-categoria-nuevo label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #92400e;
    margin-bottom: 6px;
}

.campo-categoria-nuevo select {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #fcd34d;
    border-radius: 8px;
    font-size: 15px;
    background: white;
}

.campo-categoria-nuevo select:focus {
    outline: none;
    border-color: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

.retirar-modelo-nuevo .campo-serie-retirar input {
    border-color: #fcd34d;
}

.retirar-modelo-nuevo .campo-serie-retirar input:focus {
    border-color: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

.botones-modelo-nuevo {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

.botones-modelo-nuevo .btn-secondary {
    flex: 1;
}

.botones-modelo-nuevo .btn-primary {
    flex: 1;
    background: #f59e0b;
}

.botones-modelo-nuevo .btn-primary:hover {
    background: #d97706;
}

/* ===========================================
   EQUIPAMIENTO TÉCNICO (en parte.php)
   =========================================== */
.equipo-card {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.equipo-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 15px;
    background: #f1f5f9;
    font-weight: 600;
    font-size: 14px;
    color: #334155;
    border-bottom: 1px solid #e2e8f0;
}

.equipo-card-msg {
    padding: 10px 15px;
    font-size: 12px;
    color: #64748b;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    line-height: 1.4;
}

.equipo-card-body {
    padding: 15px;
}

.equipo-row {
    margin-bottom: 0;
}

.equipo-row label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #6b7280;
    margin-bottom: 6px;
}

.equipo-valor {
    padding: 10px 14px;
    background: #e0f2fe;
    border: 1px solid #7dd3fc;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #0c4a6e;
}

.equipo-select {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #fbbf24;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    color: #1f2937;
    background-color: #fffbeb;
}

.equipo-select:focus {
    outline: none;
    border-color: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

.equipo-divider {
    height: 1px;
    background: #e5e7eb;
    margin: 12px 0;
}

/* Indicador de pendiente en la cabecera */
.equipo-card-header .equipo-pendiente {
    margin-left: auto;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    background: #fef3c7;
    color: #92400e;
    border-radius: 10px;
}

/* ===========================================
   TOAST / NOTIFICACIONES INLINE
   =========================================== */
.toast-container {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    max-width: 400px;
    margin: 0 auto;
    z-index: 9999;
    pointer-events: none;
    overflow: hidden;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    border-radius: 10px;
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    animation: toastSlideUp 0.3s ease-out;
    pointer-events: auto;
}

.toast.toast-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.toast.toast-success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #86efac;
}

.toast.toast-warning {
    background: #fefce8;
    color: #854d0e;
    border: 1px solid #fde047;
}

.toast.toast-info {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

.toast-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.toast-message {
    flex: 1;
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    opacity: 0.5;
    padding: 0;
    line-height: 1;
}

.toast-close:hover {
    opacity: 1;
}

@keyframes toastSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes toastFadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(10px);
    }
}

.toast.hiding {
    animation: toastFadeOut 0.2s ease-in forwards;
}

/* Mensaje inline para campos específicos */
.field-error {
    display: block;
    margin-top: 6px;
    padding: 8px 12px;
    background: #fef2f2;
    color: #dc2626;
    border-radius: 6px;
    font-size: 13px;
    border-left: 3px solid #dc2626;
    animation: fieldErrorPulse 0.3s ease-out;
}

@keyframes fieldErrorPulse {
    0% { transform: scale(0.95); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* --- ESCÁNER --- */
#scannerVideo {
    object-fit: cover;
}

/* --- BOTÓN ESCÁNER --- */
.btn-scan {
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
    color: #374151;
    font-size: 16px;
    flex-shrink: 0;
}
.btn-scan:hover {
    background: #e5e7eb;
}


