/* Contenedor Principal */
.wt-dashboard-container {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    max-width: 900px;
    margin: 0 auto;
    color: #333;
}

/* Tarjeta de Formulario (Glassmorphism sutil) */
.wt-add-form-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 32px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.wt-add-form-card:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.wt-add-form-card h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #1a202c;
    font-size: 1.25rem;
    font-weight: 600;
}

/* Formularios */
.wt-form-group {
    margin-bottom: 16px;
}

.wt-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #4a5568;
    font-size: 0.9rem;
}

.wt-form-group input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.wt-form-group input:focus {
    outline: none;
    border-color: #3182ce;
    box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.2);
}

/* Botones */
.wt-btn {
    display: inline-block;
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    border: none;
}

.wt-btn-primary {
    background-color: #3182ce;
    color: white;
}

.wt-btn-primary:hover {
    background-color: #2b6cb0;
}

.wt-btn-primary:active {
    transform: translateY(1px);
}

/* Grid de Tarjetas */
.wt-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

/* Tarjetas Individuales */
.wt-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease;
}

.wt-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.wt-card-header {
    background: #f7fafc;
    padding: 16px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.wt-card-header h4 {
    margin: 0;
    font-size: 1.1rem;
    color: #2d3748;
}

.wt-card-header h4 a {
    color: inherit;
    text-decoration: none;
}

.wt-card-header h4 a:hover {
    color: #3182ce;
}

.wt-badge {
    background: #c6f6d5;
    color: #22543d;
    padding: 4px 8px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.wt-card-body {
    padding: 16px;
}

.wt-text-small {
    font-size: 0.875rem;
    color: #4a5568;
    margin-bottom: 8px;
    margin-top: 0;
}

.wt-truncate {
    display: inline-block;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: bottom;
}

code {
    background: #edf2f7;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    color: #d53f8c;
}

/* Previsualización del Diff */
.wt-diff-preview {
    margin-top: 16px;
    border-top: 1px dashed #e2e8f0;
    padding-top: 12px;
}

.wt-diff-content {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 10px;
    font-size: 0.8rem;
    max-height: 200px;
    overflow-y: auto;
}

/* Estilos para el difflib de Python */
.wt-diff-content table.diff {
    font-family: Courier, monospace;
    border: none;
    width: 100%;
}
.wt-diff-content td.diff_header {
    background-color: #e0e0e0;
    padding: 0 5px;
    border-right: 1px solid #bbc;
}
.wt-diff-content td.diff_next {
    background-color: #c0c0c0;
}
.wt-diff-content span.diff_add {
    background-color: #aaffaa; /* Verde claro */
    text-decoration: none;
}
.wt-diff-content span.diff_chg {
    background-color: #ffff77; /* Amarillo */
}
.wt-diff-content span.diff_sub {
    background-color: #ffaaaa; /* Rojo claro */
    text-decoration: line-through;
}

/* Alertas */
.wt-alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 24px;
    font-weight: 500;
}

.wt-alert-success {
    background-color: #f0fff4;
    color: #276749;
    border: 1px solid #c6f6d5;
}

.wt-alert-info {
    background-color: #ebf8ff;
    color: #2b6cb0;
    border: 1px solid #bee3f8;
}

.wt-alert-warning {
    background-color: #fffff0;
    color: #975a16;
    border: 1px solid #fefcbf;
}

.wt-alert-error {
    background-color: #fff5f5;
    color: #c53030;
    border: 1px solid #fed7d7;
}

.wt-empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #718096;
    background: #f7fafc;
    border-radius: 8px;
    border: 1px dashed #cbd5e0;
}

/* Modal (Popup) */
.wt-modal {
    display: none;
    position: fixed;
    z-index: 999999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
}

.wt-modal-content {
    background-color: #fefefe;
    margin: 2vh auto;
    padding: 20px;
    border: 1px solid #888;
    width: 96%;
    max-width: 1600px;
    height: 96vh; /* Ocupa el 96% de la altura de la pantalla */
    display: flex;
    flex-direction: column;
    border-radius: 8px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    position: relative;
    animation: wt-modal-show 0.3s ease-out;
    box-sizing: border-box;
}

.wt-modal-content h2 {
    margin-top: 0;
    margin-bottom: 5px;
    font-size: 1.3rem; /* Cabecera más pequeña */
}

.wt-modal-content > p {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

@keyframes wt-modal-show {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.wt-modal-close {
    color: #a0aec0;
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    z-index: 10;
}

.wt-modal-close:hover,
.wt-modal-close:focus {
    color: #333;
    text-decoration: none;
}

.wt-diff-full {
    overflow: auto; /* Permite scroll vertical y horizontal independiente */
    flex-grow: 1; /* Hace que el contenedor de código ocupe todo el espacio restante */
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 0;
}

.wt-diff-content-simple {
    background: #f7fafc;
    padding: 10px;
    border-radius: 6px;
    font-size: 0.85rem;
    color: #4a5568;
    border: 1px solid #edf2f7;
}

.wt-btn-secondary {
    background-color: #edf2f7;
    color: #4a5568;
    border: 1px solid #e2e8f0;
    font-size: 0.85rem;
    padding: 8px 16px;
    margin-top: 10px;
}

.wt-btn-secondary:hover {
    background-color: #e2e8f0;
    color: #2d3748;
}

/* ==== AGRUPACIÓN POR DOMINIOS ==== */
.wt-domain-group {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    margin-bottom: 24px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.wt-domain-header {
    background: #f8fafc;
    padding: 16px 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.wt-domain-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #2d3748;
    display: flex;
    align-items: center;
    gap: 8px;
}

.wt-badge-gray {
    background: #edf2f7;
    color: #4a5568;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 600;
}

.wt-grid-domain {
    padding: 20px;
    background: #fafbfc;
}

.wt-truncate-header {
    display: inline-block;
    max-width: 250px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
}

.wt-actions-row {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    align-items: center;
}

.wt-btn-outline {
    background-color: transparent;
    color: #3182ce;
    border: 1px solid #3182ce;
    font-size: 0.85rem;
    padding: 8px 16px;
    margin-top: 10px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}

.wt-btn-outline:hover {
    background-color: #ebf8ff;
}

/* ==== WAYBACK MACHINE (TIMELINE) ==== */
#wt-history-container {
    overflow-y: auto;
    flex-grow: 1;
    padding-right: 15px;
}

.wt-timeline {
    position: relative;
    width: 100%; /* Ocupa todo el ancho disponible del popup */
    margin: 0;
    padding-top: 20px;
    padding-bottom: 40px;
}

.wt-timeline::after {
    content: '';
    position: absolute;
    width: 2px;
    background-color: #e2e8f0;
    top: 0;
    bottom: 0;
    left: 20px;
    margin-left: -1px;
}

.wt-timeline-item {
    padding: 10px 40px;
    position: relative;
    background-color: inherit;
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 30px;
}

.wt-timeline-dot {
    position: absolute;
    width: 16px;
    height: 16px;
    right: auto;
    left: 12px;
    background-color: #fff;
    border: 4px solid #3182ce;
    top: 15px;
    border-radius: 50%;
    z-index: 1;
}

.wt-timeline-date {
    font-size: 1rem;
    color: #4a5568;
    margin-bottom: 10px;
}

.wt-timeline-content {
    background-color: white;
    position: relative;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.wt-color-gray {
    color: #a0aec0;
}

/* ==== ESTILOS DEL DIFF HTML (FORMATO GITHUB) ==== */
table.diff {
    font-family: Consolas, Monaco, "Courier New", monospace !important;
    font-size: 13px !important;
    border-collapse: collapse;
    width: 100%;
    margin-top: 10px;
    line-height: 1.5;
    background: #fff;
}

table.diff th, table.diff td {
    padding: 3px 8px; /* Padding más compacto */
    border: 1px solid #e2e8f0;
    vertical-align: top;
    word-wrap: break-word;
    white-space: pre-wrap;
}

/* Columnas de números y cabeceras */
table.diff .diff_header,
table.diff tbody th {
    background: #f8fafc;
    color: #a0aec0;
    text-align: right;
    width: 1%;
    user-select: none;
    border-right: 1px solid #cbd5e0;
}

table.diff td.diff_next {
    background: #f8fafc;
    width: 1%;
    text-align: center;
}

/* Colores de Diff (Líneas completas) */
table.diff td.diff_add {
    background-color: #e6ffec !important; /* Verde claro */
    color: #1a7f37;
}

table.diff td.diff_sub {
    background-color: #ffebe9 !important; /* Rojo claro */
    color: #cf222e;
}

table.diff td.diff_chg {
    background-color: #fff8c5 !important; /* Amarillo claro */
    color: #9a6700;
}

/* Diferencias en línea (caracteres específicos dentro de la línea) */
span.diff_add {
    background-color: #abf2bc !important; /* Verde más intenso */
    font-weight: 600;
    padding: 0 2px;
    border-radius: 2px;
}

span.diff_sub {
    background-color: #ffb1af !important; /* Rojo más intenso */
    text-decoration: line-through;
    font-weight: 600;
    padding: 0 2px;
    border-radius: 2px;
}

span.diff_chg {
    background-color: #ffdf5d !important; /* Amarillo más intenso */
    font-weight: 600;
    padding: 0 2px;
    border-radius: 2px;
}
