.finalizar-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px;
    text-align: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 15px;
    color: white;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.finalizar-titulo {
    font-size: 2.5rem;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    animation: fadeInDown 1s ease-out;
}

.finalizar-mensaje {
    font-size: 1.2rem;
    margin-bottom: 40px;
    line-height: 1.6;
    opacity: 0.9;
    animation: fadeInUp 1s ease-out 0.3s both;
}

.finalizar-botones {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 400px;
    margin: 0 auto;
}

.finalizar-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 15px 25px;
    font-size: 1.1rem;
    font-weight: bold;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    animation: fadeInUp 1s ease-out 0.6s both;
}

.finalizar-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.finalizar-btn:active {
    transform: translateY(-1px);
}

#modificarBtn:hover {
    background: rgba(52, 152, 219, 0.8);
}

#vistaPreviaBtn:hover {
    background: rgba(155, 89, 182, 0.8);
}

#generarDocumentoBtn:hover {
    background: rgba(46, 204, 113, 0.8);
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (min-width: 768px) {
    .finalizar-botones {
        flex-direction: row;
        justify-content: center;
        max-width: 100%;
    }
    
    .finalizar-btn {
        flex: 1;
        max-width: 200px;
    }
}

.finalizar-container::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4);
    border-radius: 15px;
    z-index: -1;
    animation: gradientShift 3s ease infinite;
    opacity: 0.7;
}

@keyframes gradientShift {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(180deg); }
}

.mensaje-estado {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 15px;
    margin: 20px 0;
    backdrop-filter: blur(5px);
}

.mensaje-estado.success {
    border-left: 4px solid #2ecc71;
}

.mensaje-estado.error {
    border-left: 4px solid #e74c3c;
}

.mensaje-estado.info {
    border-left: 4px solid #3498db;
}

.historial-container {
    max-width: 1200px;
    margin: 0 auto;
}

.historial-container .finalizar-botones {
    margin-top: 50px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.historial-container #paginacionContainer {
    margin-bottom: 40px;
}

.historial-row {
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
}

.historial-row:hover {
    background-color: #e3f2fd !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.historial-row.seleccionada {
    background-color: #4caf50 !important;
    color: white !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
}

.historial-row.seleccionada td {
    color: white !important;
    font-weight: 500;
}

.historial-row.seleccionada:hover {
    background-color: #45a049 !important;
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(76, 175, 80, 0.5);
}

#llenarFormularioBtn {
    position: relative;
    overflow: hidden;
}

#llenarFormularioBtn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s;
}

#llenarFormularioBtn:hover::before {
    left: 100%;
}

.instrucciones-historial {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border: 2px solid #2196f3;
    border-radius: 12px;
    padding: 16px;
    margin: 20px 0;
    position: relative;
    overflow: hidden;
}

.instrucciones-historial::before {
    content: '💡';
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 24px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: translateY(-50%) scale(1); }
    50% { transform: translateY(-50%) scale(1.1); }
}

.historial-table {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

.historial-table th {
    background: linear-gradient(135deg, #2196f3 0%, #1976d2 100%);
    color: white;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 1px;
    border: none;
}

.loading-row {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

@media (max-width: 768px) {
    .historial-container {
        padding: 10px;
    }
    
    .historial-table {
        font-size: 12px;
    }
    
    .historial-table th,
    .historial-table td {
        padding: 8px 4px;
    }
    
    .finalizar-botones {
        flex-direction: column;
        gap: 15px;
    }
}

#paginacionContainer {
    background: #f8f9fa;
    border-radius: 12px;
    margin-top: 20px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

#paginacionControles {
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-top: 2px solid #007bff;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.pagina-numero {
    min-width: 40px;
    height: 40px;
    border: 1px solid #007bff;
    background: white;
    color: #007bff;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.pagina-numero:hover {
    background: #007bff;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,123,255,0.3);
}

.pagina-numero.pagina-activa {
    background: #007bff;
    color: white;
    box-shadow: 0 2px 6px rgba(0,123,255,0.4);
    transform: translateY(-1px);
}

.pagina-numero.pagina-activa:hover {
    background: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,123,255,0.5);
}

#paginacionControles button {
    font-family: inherit;
    transition: all 0.2s ease;
}

#paginacionControles button:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

#paginacionControles button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

#irAPagina {
    width: 60px;
    height: 32px;
    text-align: center;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

#irAPagina:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0,123,255,0.25);
}

#botonIrAPagina {
    height: 32px;
    background: #28a745;
    color: white;
    border: none;
    padding: 0 12px;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

#botonIrAPagina:hover {
    background: #218838;
}

#paginacionContainer + .finalizar-botones,
.finalizar-botones:has([onclick*="location.reload"]) {
    margin-top: 40px !important;
}

#paginacionContainer {
    margin-bottom: 30px;
}

@media (max-width: 768px) {
    #paginacionControles {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }
    
    #paginacionControles > div {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .pagina-numero {
        min-width: 35px;
        height: 35px;
        font-size: 12px;
    }
    
    #paginacionControles button {
        padding: 6px 12px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    #paginacionControles {
        padding: 10px;
        gap: 10px;
    }
    
    #paginacionControles > div:nth-child(2) {
        order: 3;
        margin-top: 10px;
    }
    
    .pagina-numero {
        min-width: 30px;
        height: 30px;
        font-size: 11px;
    }
}

@keyframes paginaFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#paginacionContainer {
    animation: paginaFadeIn 0.3s ease-out;
}

[title] {
    position: relative;
}

[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 5px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    margin-bottom: 5px;
    opacity: 0;
    animation: tooltipFadeIn 0.2s ease-out 0.5s forwards;
}

@keyframes tooltipFadeIn {
    to {
        opacity: 1;
    }
}
