/* Enhanced Text Comparator Styles */

/* Controls Panel */
.controls-panel {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    padding: 1.5rem;
    background: var(--bg-body);
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.mode-buttons,
.view-toggle {
    display: flex;
    gap: 0.5rem;
}

.mode-btn,
.view-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-light);
    background: var(--bg-surface);
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.mode-btn:hover,
.view-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.mode-btn.active,
.view-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.options-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

/* Text Areas */
.text-areas-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.text-area-group {
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    height: 100%;
}

.upload-hint {
    font-size: 0.8rem;
    color: var(--text-light);
    font-weight: 400;
    margin-left: 0.5rem;
}

.textarea-wrapper {
    position: relative;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
}

.textarea-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px hsla(var(--hue-primary), 70%, 50%, 0.15);
}

.textarea-wrapper.dragover {
    border-color: var(--primary);
    background: hsla(var(--hue-primary), 70%, 50%, 0.05);
}

.textarea-wrapper.dragover::after {
    content: 'Suelta el archivo aquí';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: backdrop;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--primary);
    pointer-events: none;
    backdrop-filter: blur(2px);
}

.textarea-input {
    min-height: 300px;
    width: 100%;
    padding: 1rem;
    border: none;
    background: transparent;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-main);
    resize: none;
    /* Custom resize handle if needed, or stick to vertical */
    outline: none;
}

/* Custom Scrollbar for Textareas */
.textarea-input::-webkit-scrollbar {
    width: 8px;
}

.textarea-input::-webkit-scrollbar-track {
    background: transparent;
}

.textarea-input::-webkit-scrollbar-thumb {
    background-color: var(--border-light);
    border-radius: 4px;
}

.textarea-input::-webkit-scrollbar-thumb:hover {
    background-color: var(--text-muted);
}

/* Buttons */
.btn-container {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.btn-secondary {
    background: var(--bg-body);
    color: var(--text-muted);
    border: 1px solid var(--border-light);
}

.btn-secondary:hover {
    background: var(--bg-surface);
    color: var(--text-main);
    border-color: var(--border-hover);
}

.btn-icon {
    margin-right: 0.25rem;
}

/* Stats Panel */
.stats-panel {
    display: flex;
    justify-content: center;
    gap: 2rem;
    padding: 1rem;
    background: var(--bg-body);
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.stat-added .stat-value {
    color: #22c55e;
}

.stat-removed .stat-value {
    color: #ef4444;
}

/* Results */
.results-title {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: var(--text-main);
    text-align: left;
    border: none;
    padding: 0;
}

.diff-results {
    background: var(--bg-surface);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    min-height: 100px;
    white-space: pre-wrap;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    line-height: 1.6;
    font-size: 0.95rem;
}

.diff-results .placeholder-text {
    color: var(--text-light);
    font-style: italic;
    text-align: center;
    margin: 2rem 0;
}

.diff-results span.added {
    background-color: rgba(34, 197, 94, 0.2);
    color: #15803d;
    border-radius: 3px;
    padding: 0.1em 0.2em;
}

.diff-results span.removed {
    background-color: rgba(239, 68, 68, 0.2);
    color: #dc2626;
    text-decoration: line-through;
    border-radius: 3px;
    padding: 0.1em 0.2em;
}

body.dark-mode .diff-results span.added {
    background-color: rgba(34, 197, 94, 0.3);
    color: #86efac;
}

body.dark-mode .diff-results span.removed {
    background-color: rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

/* Side by Side View */
.diff-side-by-side {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.diff-pane {
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.diff-pane-header {
    padding: 0.75rem 1rem;
    background: var(--bg-body);
    border-bottom: 1px solid var(--border-light);
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.diff-pane-content {
    padding: 1rem;
    min-height: 150px;
    white-space: pre-wrap;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    line-height: 1.6;
    font-size: 0.95rem;
    max-height: 400px;
    overflow-y: auto;
}

.diff-pane-content .line-removed {
    background-color: rgba(239, 68, 68, 0.15);
    display: block;
    margin: 0 -1rem;
    padding: 0 1rem;
}

.diff-pane-content .line-added {
    background-color: rgba(34, 197, 94, 0.15);
    display: block;
    margin: 0 -1rem;
    padding: 0 1rem;
}

/* Responsive */
@media (max-width: 768px) {
    .text-areas-container {
        grid-template-columns: 1fr;
    }

    .diff-side-by-side {
        grid-template-columns: 1fr;
    }

    .controls-panel {
        flex-direction: column;
    }

    .mode-buttons {
        flex-wrap: wrap;
    }

    .stats-panel {
        gap: 1rem;
    }

    .stat-value {
        font-size: 1.25rem;
    }
}