/* ==========================================================================
   1. BASE & RESETS (Estilos globales)
   ========================================================================== */
* { 
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background: #f4f5f7;
    color: #333;
}

#logo {
    max-width: 150px;
    margin-left: 0; 
    margin-bottom: 15px;
}

h1, h2 {
    margin: 0 0 12px;
    color: #1b3f72;
}
    
h2 {
    margin-top: 24px;
    padding-bottom: 8px;
    border-bottom: 2px solid #f0f0f0;
}

small {
    color: #888;
    font-style: italic;
    margin-top: 5px;
    display: block;
}

/* ==========================================================================
   2. LAYOUT & GRID (Estructura de la página)
   ========================================================================== */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 16px;
}

.section-group {
    margin-bottom: 25px;
    padding: 10px 0;
}

.row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.flex-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Sistema de columnas */
.col-3 { flex: 1 1 calc(33.333% - 15px); }
.col-4 { flex: 0 0 calc(33.333% - 6px); }
.col-6 { flex: 0 0 calc(50% - 4px); }
.col-12 { flex: 0 0 100%; }

/* Contenedor en dos columnas */
.grid-tecnicos {
    display: grid;
    grid-template-columns: 1fr 1fr; /* Dos columnas iguales */
    gap: 15px;                      /* Margen entre campos */
    margin-top: 10px;
    width:100%;
}

/* Contenedor individual de cada input + botón X */
.fila-tecnico {
    display: flex;
    gap:5px;
    align-items: center;
}



/* Ajuste para que el texto no se pise con la X */
.fila-tecnico input {
    padding-right: 30px !important; 
    margin-bottom: 0 !important; /* Quitamos el margen inferior para que el grid controle el espacio */
}

/* Responsivo: 1 columna en móviles */
@media (max-width: 600px) {
    .grid-tecnicos {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   3. FORM ELEMENTS (Inputs, Labels y validaciones)
   ========================================================================== */
label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-top: 8px;
    margin-bottom: 4px;
}

.asterisco-campo-obligatorio {
    font-weight: bold;
    color: red;
}

input[type="text"],
input[type="tel"],
input[type="number"],
input[type="time"],
input[type="date"],
input[type="email"],
textarea,
select {
    width: 100%;
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #ccc;
    font-size: 13px;
}

textarea {
    min-height: 70px;
    resize: vertical;
}

.subtitle {
    font-size: 12px;
    color: #666;
    margin-bottom: 8px;
}

/* ==========================================================================
   4. COMPONENTS (Cards, Botones, Firmas y Mensajes)
   ========================================================================== */

/* Cards */
.card {
    background: #fff;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

/* Botones */
.btn-primary, .btn-secondary {
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    width: auto;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    margin-bottom: 10px;
}

.btn-primary {
    background: #1b3f72;
    color: #fff;
}

.btn-primary:hover:not(:disabled) {
    background: #255497;
    box-shadow: 0 4px 12px rgba(27, 63, 114, 0.3);
    transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
    background: #15315a;
    transform: translateY(0);
}

.btn-secondary {
    background: #c0392b;
    color: #fff;
}

.btn-secondary:hover:not(:disabled) {
    background: #e74c3c; 
    box-shadow: 0 4px 12px rgba(192, 57, 43, 0.3);
    transform: translateY(-1px);
}

.btn-secondary:active:not(:disabled) {
    background: #962d22; 
    transform: translateY(0);
}

/* Estado Deshabilitado (Común) */
.btn-primary:disabled, .btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-anadir {
    background: #eef2f7;
    border: 2px dashed #1b3f72;
    color: #1b3f72;
    padding: 10px;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    width: 100%;
    transition: all 0.2s;
    margin-top: 20px;
}

.btn-anadir:hover { background: #dce6f0; }

/* Botón X Estilo de tu imagen */
.btn-eliminar-x {
    background-color: #ff4d4d;
    color: white;
    border: none;
    border-radius: 4px;
    width: 35px;
    height: 35px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.btn-eliminar-x:hover {
    background-color: #e60000;
}

.btn-small {
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid #aaa;
    background: #eee;
    cursor: pointer;
    margin-left: 4px;
}

/* Carga de Archivos / Fotos */
.foto-input-wrapper {
    background: #fff;
    border: 1px solid #eee;
    padding: 10px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.foto-input-wrapper input[type="file"] { display: none; }

.btn-custom-file {
    display: inline-block;
    background: #1b3f72;
    color: white !important;
    padding: 12px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    text-align: center;
    transition: background 0.3s;
    border: none;
}

input[type="file"] {
    background: #f8f9fa;
    border: 2px dashed #1b3f72;
    padding: 15px;
    border-radius: 8px;
    width: 100%;
    cursor: pointer;
    transition: all 0.3s ease;
}

.preview-thumb {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
    display: none; 
}

/* Firma Digital */
.signature-wrapper {
    border: 1px solid #ccc;
    border-radius: 6px;
    padding: 8px;
    background: #fafafa;
    margin-top: 10px;
}

.signature-title {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
}

canvas {
    border: 1px solid #aaa;
    border-radius: 4px;
    width: 100%;
    height: 150px;
    touch-action: none;
    background: #fff;
}

.signature-buttons {
    margin-top: 4px;
    text-align: right;
}

/* Alertas y Estados */
.status {
    margin-top: 10px;
    font-size: 13px;
}

.status.ok { color: green; }
.status.error { color: red; }

.mensaje-gps {
    display: flex;
    align-items: center;
    gap: 12px;
    background-color: #fff3cd; 
    border: 1px solid #ffeeba;
    border-left: 5px solid #ffc107; 
    padding: 12px 15px;
    border-radius: 6px;
    margin-top: 20px;
    margin-bottom: 20px;
    color: #856404;
    font-size: 13px;
    line-height: 1.4;
}

.mensaje-gps-icono {
    font-size: 20px;
    filter: drop-shadow(0px 2px 2px rgba(0,0,0,0.1));
}

/* ==========================================================================
   5. ANIMATIONS & RESPONSIVE
   ========================================================================== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 600px) {
    .col-3, .col-6, .col-4 { 
        flex: 0 0 100%; 
    }
}

/* Responsivo para móviles */
@media (max-width: 600px) {
    .grid-tecnicos {
        grid-template-columns: 1fr;
    }
}