/* Variables de Color */
:root {
    --primary-color: #1a365d;
    --primary-hover: #2b6cb0;
    --secondary-color: #edf2f7;
    --secondary-text: #4a5568;
    --accent-color: #3182ce;
    --bg-body: #f7fafc;
    --bg-card: #ffffff;
    --border-color: #e2e8f0;
    --error-color: #e53e3e;
    --success-color: #38a169;
}

/* Reset y Estilos Base */
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', sans-serif; background-color: var(--bg-body); color: #2d3748; padding: 20px 15px; line-height: 1.5; }

/* Contenedor Principal (La Tarjeta) */
.card { 
    background: var(--bg-card); padding: 35px 30px; border-radius: 12px; 
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05), 0 4px 10px rgba(0, 0, 0, 0.03); 
    max-width: 950px; margin: 0 auto; border: 1px solid rgba(255,255,255,0.5);
}

/* Encabezado y Logotipo */
.header-brand { text-align: center; margin-bottom: 30px; padding-bottom: 20px; border-bottom: 1px solid var(--border-color); }
.logo-placeholder { 
    display: inline-block; background: linear-gradient(135deg, var(--primary-color), var(--primary-hover)); 
    color: white; padding: 10px 25px; border-radius: 8px; font-weight: 700; font-size: 1.2em; 
    letter-spacing: 1px; margin-bottom: 15px; 
}
h2 { color: var(--primary-color); font-size: 1.6em; font-weight: 600; }
.subtitle { color: var(--secondary-text); font-size: 0.95em; margin-top: 5px; }

/* Estructura del Formulario */
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; margin-bottom: 25px; }
.form-group { display: flex; flex-direction: column; position: relative; }
label { font-size: 0.85em; font-weight: 600; margin-bottom: 8px; color: var(--secondary-text); text-transform: uppercase; letter-spacing: 0.5px; }

/* Inputs Modernos con estado Focus */
input, select { 
    padding: 12px 15px; border: 1px solid var(--border-color); border-radius: 6px; 
    font-size: 1em; width: 100%; background-color: #fff; color: #2d3748; transition: all 0.3s ease; 
}
input:focus, select:focus { outline: none; border-color: var(--accent-color); box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.15); }
input::placeholder { color: #a0aec0; }

/* Estados de Error */
input.error, select.error { border-color: var(--error-color); background-color: #fff5f5; }
input.error:focus { box-shadow: 0 0 0 3px rgba(229, 62, 62, 0.15); }
.msg-error { color: var(--error-color); font-size: 0.8em; margin-top: 5px; font-weight: 500; display: none; }

/* Botones de Acción Globales */
.btn-group { grid-column: 1 / -1; display: flex; gap: 15px; margin-top: 15px; }
button { 
    flex: 1; padding: 14px; border: none; border-radius: 6px; font-size: 1.05em; font-weight: 600; 
    cursor: pointer; transition: all 0.2s ease; color: white; display: flex; justify-content: center; align-items: center; gap: 8px;
}
.btn-primario { background-color: var(--primary-color); box-shadow: 0 4px 6px rgba(26, 54, 93, 0.2); }
.btn-primario:hover:not(:disabled) { background-color: var(--primary-hover); transform: translateY(-1px); box-shadow: 0 6px 8px rgba(26, 54, 93, 0.25); }
.btn-primario:disabled { background-color: #a0aec0; cursor: not-allowed; box-shadow: none; transform: none; }
.btn-secundario { background-color: var(--secondary-color); color: var(--secondary-text); border: 1px solid var(--border-color); }
.btn-secundario:hover { background-color: #e2e8f0; color: #2d3748; }

/* Tabla de Resultados Elegante */
.table-container { margin-top: 40px; display: none; width: 100%; border-radius: 8px; overflow: hidden; border: 1px solid var(--border-color); }
table { width: 100%; border-collapse: collapse; background-color: white; }
th, td { padding: 15px 12px; text-align: left; border-bottom: 1px solid var(--border-color); font-size: 0.9em; vertical-align: middle; }
th { background-color: var(--secondary-color); color: var(--primary-color); font-weight: 600; text-transform: uppercase; font-size: 0.8em; letter-spacing: 0.5px; }
tr:hover td { background-color: #f7fafc; }

/* Badges (Pastillas de estado) */
.badge { padding: 6px 12px; border-radius: 20px; font-size: 0.85em; font-weight: 600; display: inline-block; text-align: center; }
.badge.aceptado { background-color: #c6f6d5; color: #22543d; }
.badge.rechazado { background-color: #fed7d7; color: #822727; }

/* Botones de Descarga en la Tabla */
/* =========================================
   1. ESTILOS GLOBALES (ESCRITORIO)
   ========================================= */
/* =========================================
   1. ESTILOS DE ESCRITORIO (PANTALLA GRANDE)
   ========================================= */

/* Botones de Descarga en la Tabla (Tu Diseño Original) */
.acciones-container { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-accion { 
    padding: 8px 12px; font-size: 0.8em; font-weight: 600; border-radius: 4px; border: none; 
    color: white; cursor: pointer; transition: filter 0.2s, transform 0.1s; box-shadow: 0 2px 4px rgba(0,0,0,0.1); flex: 1; text-align: center;
}
.btn-accion:hover { filter: brightness(110%); transform: translateY(-1px); }
.btn-accion:active { transform: translateY(0); }
.bg-pdf { background-color: #e53e3e; } 
.bg-xml { background-color: #dd6b20; } 
.bg-doc { background-color: #3182ce; }
.bg-email { background-color: #805ad5; } 

/* Modales */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(26, 32, 44, 0.8); backdrop-filter: blur(4px); display: none; align-items: center; justify-content: center; z-index: 1000; }
.modal-content { background: white; padding: 30px; border-radius: 12px; width: 90%; max-width: 420px; text-align: center; box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04); }
.modal-content h3 { color: var(--primary-color); margin-bottom: 10px; font-size: 1.4em; }
.modal-content p { color: var(--secondary-text); font-size: 0.95em; margin-bottom: 20px; }
.modal-botones { display: flex; gap: 15px; margin-top: 20px; }

/* Animación para el icono de carga */
.spin { animation: spin 1s linear infinite; } 
@keyframes spin { 100% { transform: rotate(360deg); } }

/* =========================================
   PIE DE PÁGINA (FIRMA)
   ========================================= */
.footer-creditos {
    text-align: center;
    margin-top: 30px;
    padding-bottom: 20px;
    color: var(--secondary-text);
    font-size: 0.85em;
    line-height: 1.6;
}

.footer-creditos p {
    margin: 0;
}

.firma-autor {
    margin-top: 5px !important;
    font-size: 0.9em;
    opacity: 0.8;
}

.firma-autor strong {
    color: var(--primary-color);
    letter-spacing: 0.5px;
}

/* Ajustes Responsive para Móviles */
@media screen and (max-width: 768px) {
    .card { padding: 20px 15px; border-radius: 8px; border: none; box-shadow: 0 4px 6px rgba(0,0,0,0.05); }
    .grid-form { gap: 15px; }
    .btn-group { flex-direction: column; }
    
    table thead { display: none; }
    .table-container { border: none; background: transparent; }
    table, tbody, tr, td { display: block; width: 100%; }
    tr { margin-bottom: 20px; border: 1px solid var(--border-color); border-radius: 8px; padding: 5px; background-color: #fff; box-shadow: 0 2px 5px rgba(0,0,0,0.02); }
    td { text-align: right; padding: 12px 10px 12px 45%; position: relative; border-bottom: 1px solid #f0f4f8; min-height: 45px; display: flex; align-items: center; justify-content: flex-end; }
    td:last-child { border-bottom: none; flex-direction: column; align-items: stretch; padding: 15px 10px; background-color: #f8fafc; border-radius: 0 0 8px 8px; }
    
    td::before { content: attr(data-label); position: absolute; left: 12px; width: 40%; text-align: left; font-weight: 600; color: var(--secondary-text); font-size: 0.85em; text-transform: uppercase; }
    
    /* LA CURITA: Separamos el texto ACCIONES de los botones en el celular */
    td:last-child::before { 
        position: relative; 
        left: 0; 
        display: block; 
        width: 100%; 
        margin-bottom: 10px; 
    }

    /* Tu Diseño Original de Botones para Móvil */
    .acciones-container { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
    .acciones-container .bg-email { grid-column: 1 / -1; } 
}

/* 🚀 EFECTO PULSO PARA BOTÓN DE ATENCIÓN (Tamaño normal y parpadeo fuerte) */
.btn-pulso-atencion {
    position: relative;
    background: linear-gradient(135deg, #f6ad55, #d69e2e) !important; 
    color: white !important;
    border: none !important;
    padding: 10px 20px !important; /* Tamaño normal, ya no es gigante */
    border-radius: 6px !important; /* Mismo borde que tus botones estándar */
    font-size: 0.95em !important; /* Tamaño de letra estándar */
    font-weight: 700 !important;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: transform 0.2s, filter 0.2s !important;
    animation: pulso-llamativo 1.2s infinite !important; /* Parpadeo rápido y constante */
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
}

/* Efecto al pasar el ratón (Hover) */
.btn-pulso-atencion:hover {
    transform: translateY(-2px); /* Pequeño saltito */
    filter: brightness(1.1); /* Se ilumina un poco */
    /* Ya no detenemos la animación, seguirá parpadeando */
}

/* El motor del latido */
@keyframes pulso-llamativo {
    0% { box-shadow: 0 0 0 0 rgba(214, 158, 46, 0.9); } /* Inicia fuerte */
    70% { box-shadow: 0 0 0 12px rgba(214, 158, 46, 0); } /* Se expande rápido */
    100% { box-shadow: 0 0 0 0 rgba(214, 158, 46, 0); }
}