.tool-fullwidth {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
}

/* Tool shell */
.text-tool {
    max-width: 100%;
    margin: 0 auto;
}

.text-tool.editor-section,
.editor-section.text-tool {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.text-tool .card:not(.result-card) {
    border: 1px solid var(--color-border, #e5e7eb);
    box-shadow: var(--shadow-sm, 0 1px 3px rgba(0, 0, 0, 0.06));
    border-radius: var(--radius, 12px);
    background: var(--color-surface, #fff);
}

.text-tool .card-body {
    padding: 1.25rem 1.35rem;
}

.text-tool .card-title {
    color: var(--color-text, #1f2937);
    font-weight: 700;
    font-size: 1.05rem;
}

.text-tool .form-control,
.text-tool .form-select,
.text-tool .select-input,
.text-tool textarea {
    border-radius: 8px;
    border: 1px solid var(--color-border, #e5e7eb);
}

.text-tool .form-control:focus,
.text-tool .form-select:focus,
.text-tool textarea:focus {
    border-color: var(--color-primary, #0d9488);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}

.text-tool .btn-primary {
    background: var(--color-primary, #0d9488);
    border-color: var(--color-primary, #0d9488);
}

.text-tool .btn-primary:hover {
    background: var(--color-primary-hover, #0f766e);
    border-color: var(--color-primary-hover, #0f766e);
}

.text-tool .alert {
    border-radius: 10px;
}

[data-theme="dark"] .text-tool .card:not(.result-card) {
    background: var(--color-surface, #1f2937);
    border-color: var(--color-border, #374151);
}

[data-theme="dark"] .text-tool .card-title,
[data-theme="dark"] .text-tool .form-label,
[data-theme="dark"] .text-tool {
    color: var(--color-text, #f9fafb);
}

[data-theme="dark"] .text-tool .text-muted,
[data-theme="dark"] .text-tool .form-text {
    color: var(--color-text-secondary, #9ca3af) !important;
}

[data-theme="dark"] .text-tool .form-control,
[data-theme="dark"] .text-tool .form-select,
[data-theme="dark"] .text-tool textarea {
    background: #111827;
    color: var(--color-text, #f9fafb);
    border-color: var(--color-border, #374151);
}

/* --- tool: text-diff --- */
.diff-tool {
    max-width: 1400px;
    margin: 0 auto;
}

.diff-container {
    height: 500px;
    overflow: hidden;
    position: relative;
    border-radius: 0.375rem;
}

.line-numbers {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 40px;
    background-color: #f8f9fa;
    border-right: 1px solid #dee2e6;
    padding: 8px 8px;
    color: #6c757d;
    font-family: 'Courier New', monospace;
    text-align: right;
    user-select: none;
    pointer-events: none;
    overflow-y: hidden;
    z-index: 2;
    font-size: 12px;
    line-height: 1.5;
}

.diff-textarea {
    font-family: 'Courier New', monospace;
    resize: none;
    white-space: pre;
    overflow-wrap: normal;
    overflow-x: auto;
    overflow-y: auto;
    height: 100% !important;
    padding-left: 50px !important;
    background: transparent !important;
    position: relative;
    z-index: 1;
    font-size: 13px;
    line-height: 1.5;
    border: 1px solid #dee2e6;
}

.diff-overlay {
    position: absolute;
    top: 0;
    left: 50px;
    right: 0;
    bottom: 0;
    pointer-events: none;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 0;
    padding: 6px 12px;
    font-family: 'Courier New', monospace;
    white-space: pre;
    line-height: 1.5;
    font-size: 13px;
}

.diff-line {
    min-height: 1.5em;
    position: relative;
}

.diff-add {
    background-color: rgba(40, 167, 69, 0.1);
    position: relative;
}

.diff-remove {
    background-color: rgba(220, 53, 69, 0.1);
    position: relative;
}

.diff-add::after {
    content: "→";
    position: absolute;
    right: -20px;
    color: #28a745;
    font-weight: bold;
}

.diff-remove::after {
    content: "←";
    position: absolute;
    right: -20px;
    color: #dc3545;
    font-weight: bold;
}

.diff-unchanged {
    background-color: transparent;
}

.diff-result-box {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    padding: 1rem;
    min-height: 200px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.5;
    word-wrap: break-word;
    white-space: pre-wrap;
    overflow-y: auto;
    max-height: 300px;
}

.diff-result-box::-webkit-scrollbar {
    width: 6px;
}

.diff-result-box::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.diff-result-box::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.diff-result-box::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.btn {
    transition: all 0.2s ease-in-out;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.card {
    border: none;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    border-radius: 0.75rem;
}

.card-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    border-radius: 0.75rem 0.75rem 0 0 !important;
}

.alert {
    border-radius: 0.5rem;
    border: none;
}

@media (max-width: 768px) {
    .diff-container {
        height: 300px;
    }
    
    .diff-textarea {
        font-size: 12px;
    }
    
    .diff-result-box {
        font-size: 11px;
        padding: 0.75rem;
    }
    
    .btn {
        margin-bottom: 0.5rem;
    }
}
