/* ========================================= */
/* === ESTILOS PARA DIFF REVISIONS ======== */
/* ========================================= */

/* Contenedor principal de diff */
.diff-header,
.diff-controls,
.diff-responsive-table-wrapper {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Header de diff */
.diff-header {
    border-left: 4px solid var(--bs-primary);
}

.diff-header label {
    font-size: 0.7rem;
    font-weight: 600;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
    display: block;
}

/* Navegación entre cambios */
.diff-navigation {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.diff-navigation__link a {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    background: var(--bs-primary);
    color: #ffffff !important;
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.diff-navigation__link a:hover {
    background: var(--bs-secondary);
    transform: translateY(-1px);
}

.diff-navigation__link a::before {
    margin-right: 0.5rem;
}

.diff-navigation__link.prev-link a::before {
    content: "←";
}

.diff-navigation__link.next-link a::before {
    content: "→";
}

/* Sección de comparación */
.diff-revision {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

.diff-revision__items {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.diff-revision__items-group {
    flex: 1;
    min-width: 200px;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.diff-revision__items-group:first-child {
    border-left: 3px solid #dc3545;
}

.diff-revision__items-group:last-child {
    border-left: 3px solid #28a745;
}

.diff-revision__item {
    margin-bottom: 0.5rem;
}

.diff-revision__item:last-child {
    margin-bottom: 0;
}

.diff-revision__item-date a {
    font-weight: 600;
    color: var(--bs-primary);
    text-decoration: none;
    font-size: 1rem;
}

.diff-revision__item-date a:hover {
    color: var(--bs-secondary);
}

.diff-revision__item-author {
    font-size: 0.85rem;
    color: #6c757d;
}

.diff-revision__item-author a {
    color: #6c757d;
}

.diff-revision__item-message {
    font-size: 0.8rem;
    color: #495057;
    background: #fff;
    padding: 0.5rem;
    border-radius: 4px;
    margin-top: 0.5rem;
    border: 1px dashed #dee2e6;
}

/* Controles (Diseño y Filtro) */
.diff-controls {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
    flex-wrap: wrap;
}

.diff-controls__item {
    flex: 0 0 auto;
}

.diff-controls__item label {
    font-size: 0.7rem;
    font-weight: 600;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
    display: block;
}

/* Dropbuttons */
.diff-controls .dropbutton-wrapper {
    margin: 0;
}

.diff-controls .dropbutton-widget {
    border-radius: 6px;
    overflow: hidden;
}

.diff-controls .dropbutton li a {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

/* Tabla de diferencias */
.diff-responsive-table-wrapper {
    padding: 0;
    overflow: hidden;
}

.diff-responsive-table-wrapper .table-responsive {
    margin: 0;
}

table.diff {
    margin: 0;
    border-collapse: collapse;
}

table.diff thead th {
    background: linear-gradient(135deg, var(--bs-primary) 0%, #0a3d62 100%) !important;
    color: #ffffff !important;
    padding: 1rem 1.5rem;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: none;
    letter-spacing: normal;
    border: none;
}

table.diff thead th:first-child {
    border-radius: 12px 0 0 0;
}

table.diff thead th:last-child {
    border-radius: 0 12px 0 0;
}

table.diff thead th a {
    color: #ffffff !important;
    text-decoration: none;
}

table.diff thead th a:hover {
    color: rgba(255, 255, 255, 0.8) !important;
}

/* Nombre del campo */
table.diff td.field-name {
    background: #e9ecef !important;
    font-weight: 600;
    color: var(--bs-primary);
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    border-bottom: 1px solid #dee2e6;
}

/* Celdas de diferencia */
table.diff td {
    padding: 0.75rem 1rem;
    vertical-align: top;
    border-bottom: 1px solid #f1f3f5;
}

/* Marcador de cambio (-/+) */
table.diff .diff-marker {
    width: 30px;
    text-align: center;
    font-weight: bold;
    font-size: 1rem;
}

table.diff .diff-marker.diff-deletedline {
    background: #ffeef0 !important;
    color: #cb2431;
}

table.diff .diff-marker.diff-addedline {
    background: #e6ffed !important;
    color: #22863a;
}

/* Contenido eliminado */
table.diff .diff-deletedline {
    background: #ffeef0 !important;
}

table.diff .diff-deletedline .diffchange {
    background: #fdb8c0;
    padding: 2px 4px;
    border-radius: 3px;
    text-decoration: line-through;
}

/* Contenido añadido */
table.diff .diff-addedline {
    background: #e6ffed !important;
}

table.diff .diff-addedline .diffchange {
    background: #acf2bd;
    padding: 2px 4px;
    border-radius: 3px;
}

/* Imágenes en diff */
table.diff img {
    border-radius: 8px;
    border: 2px solid #dee2e6;
    max-width: 100px;
}

/* Hover en filas */
table.diff tbody tr:hover td:not(.field-name) {
    background: rgba(85, 197, 185, 0.05) !important;
}

/* Responsive */
@media (max-width: 768px) {

    .diff-navigation,
    .diff-controls,
    .diff-revision__items {
        flex-direction: column;
        gap: 1rem;
    }

    .diff-revision__items-group {
        min-width: 100%;
    }

    table.diff thead th {
        padding: 0.75rem;
        font-size: 0.75rem;
    }

    table.diff td {
        padding: 0.5rem;
        font-size: 0.85rem;
    }
}