/* ============================================================
   text-diff-checker / style.css
   Prefix: tdc-
   ============================================================ */

.tdc-container {
    max-width: 1000px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* --- Section Cards --- */
.tdc-section {
    background: #fdfdfd;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.07);
    border: 1px solid #eee;
    margin-bottom: 18px;
}

.tdc-section-title {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: #444;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 2px solid #007bff;
}

/* --- Input Area --- */
.tdc-input-wrap {
    position: relative;
    margin-bottom: 14px;
}

.tdc-input-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #555;
    margin-bottom: 6px;
}

.tdc-input-label-old {
    color: #cb2431;
}

.tdc-input-label-new {
    color: #22863a;
}

.tdc-input-actions {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    gap: 6px;
}

.tdc-btn-sm {
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    color: #555;
    transition: all 0.15s;
}

.tdc-btn-sm:hover {
    border-color: #007bff;
    color: #007bff;
}

.tdc-textarea {
    width: 100%;
    height: 180px;
    font-family: "SFMono-Regular", Consolas, "Courier New", monospace;
    font-size: 13px;
    line-height: 1.65;
    padding: 10px 12px;
    border: 1.5px solid #ccc;
    border-radius: 6px;
    resize: vertical;
    tab-size: 4;
    box-sizing: border-box;
    transition: border-color 0.2s;
    color: #222;
    background: #fff;
}

.tdc-textarea:focus {
    border-color: #007bff;
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.tdc-textarea-old:focus {
    border-color: #cb2431;
    box-shadow: 0 0 0 3px rgba(203, 36, 49, 0.1);
}

.tdc-textarea-new:focus {
    border-color: #22863a;
    box-shadow: 0 0 0 3px rgba(34, 134, 58, 0.1);
}

/* --- Options --- */
.tdc-options-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.tdc-option-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #444;
    padding: 6px 12px;
    border: 1.5px solid #ddd;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
    background: #fff;
    white-space: nowrap;
    user-select: none;
}

.tdc-option-label:hover {
    border-color: #007bff;
    color: #007bff;
}

.tdc-option-label:has(input:checked) {
    border-color: #007bff;
    background: #e8f0fe;
    color: #007bff;
}

.tdc-option-label input[type="checkbox"] {
    accent-color: #007bff;
    width: 14px;
    height: 14px;
}

/* --- Compare Button --- */
.tdc-compare-btn {
    display: block;
    width: 100%;
    padding: 14px;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #007bff, #0056d6);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.04em;
}

.tdc-compare-btn:hover {
    background: linear-gradient(135deg, #0069d9, #004aad);
    box-shadow: 0 4px 16px rgba(0, 123, 255, 0.35);
    transform: translateY(-1px);
}

.tdc-compare-btn:active {
    transform: translateY(0);
    box-shadow: none;
}

/* --- Stats Bar --- */
.tdc-stats {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    padding: 12px 16px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 14px;
    border: 1px solid #eee;
    align-items: center;
}

.tdc-stat-item {
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 3px;
}

.tdc-stat-add {
    color: #22863a;
}

.tdc-stat-del {
    color: #cb2431;
}

.tdc-stat-mod {
    color: #e36209;
}

.tdc-stat-eq {
    color: #555;
}

/* --- View Mode & Navigation --- */
.tdc-result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
}

.tdc-mode-toggle {
    display: flex;
    border: 1.5px solid #007bff;
    border-radius: 6px;
    overflow: hidden;
}

.tdc-mode-btn {
    padding: 7px 16px;
    font-size: 12px;
    font-weight: 700;
    color: #007bff;
    background: #fff;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
    border-right: 1px solid #007bff;
}

.tdc-mode-btn:last-child {
    border-right: none;
}

.tdc-mode-btn.active {
    background: #007bff;
    color: #fff;
}

.tdc-nav-btns {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #666;
}

.tdc-nav-btn {
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    transition: all 0.15s;
    color: #444;
}

.tdc-nav-btn:hover:not(:disabled) {
    border-color: #007bff;
    color: #007bff;
}

.tdc-nav-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* --- Diff View --- */
.tdc-diff-view {
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    overflow: hidden;
    font-family: "SFMono-Regular", Consolas, "Courier New", monospace;
    font-size: 13px;
    line-height: 1.55;
}

/* Inline mode */
.tdc-inline-view {}

.tdc-line {
    display: flex;
    border-bottom: 1px solid #f0f0f0;
    min-height: 22px;
}

.tdc-line:last-child {
    border-bottom: none;
}

.tdc-line-num {
    width: 44px;
    min-width: 44px;
    text-align: right;
    padding: 2px 6px;
    color: #bbb;
    font-size: 11px;
    user-select: none;
    flex-shrink: 0;
    border-right: 1px solid #f0f0f0;
    background: #fafbfc;
    line-height: 1.9;
}

.tdc-line-num-pair {
    display: flex;
    flex-shrink: 0;
}

.tdc-line-prefix {
    width: 20px;
    min-width: 20px;
    text-align: center;
    font-weight: 700;
    flex-shrink: 0;
    line-height: 1.9;
    font-size: 12px;
    border-right: 1px solid #f0f0f0;
}

.tdc-line-content {
    flex: 1;
    padding: 2px 10px 2px 8px;
    white-space: pre-wrap;
    word-break: break-all;
    min-width: 0;
}

/* Line types */
.tdc-line-equal .tdc-line-num {
    color: #ccc;
}

.tdc-line-equal .tdc-line-content {
    color: #444;
}

.tdc-line-equal .tdc-line-prefix {
    color: #ccc;
}

.tdc-line-del {
    background: #ffeef0;
}

.tdc-line-del .tdc-line-num {
    background: #ffeef0;
}

.tdc-line-del .tdc-line-prefix {
    color: #cb2431;
    background: #ffd7dc;
}

.tdc-line-del .tdc-line-content {
    color: #24292e;
}

.tdc-line-add {
    background: #e6ffec;
}

.tdc-line-add .tdc-line-num {
    background: #e6ffec;
}

.tdc-line-add .tdc-line-prefix {
    color: #22863a;
    background: #cdffd8;
}

.tdc-line-add .tdc-line-content {
    color: #24292e;
}

/* Char-level highlights */
.tdc-char-del {
    background: #fdb8c0;
    border-radius: 2px;
    padding: 0 1px;
}

.tdc-char-add {
    background: #acf2bd;
    border-radius: 2px;
    padding: 0 1px;
}

/* Flash on jump */
.tdc-line-flash {
    animation: tdc-flash 0.7s ease;
}

@keyframes tdc-flash {
    0% {
        outline: none;
    }

    30% {
        outline: 3px solid #007bff;
        outline-offset: -1px;
    }

    100% {
        outline: none;
    }
}

/* Side-by-side mode */
.tdc-side-view {
    overflow-x: auto;
}

.tdc-side-row {
    display: flex;
    border-bottom: 1px solid #f0f0f0;
    min-height: 22px;
    align-items: stretch;
}

.tdc-side-row:last-child {
    border-bottom: none;
}

/* 各サイドセル */
.tdc-side-cell {
    flex: 1;
    display: flex;
    align-items: flex-start;
    min-width: 0;
    background: #fff;
}

.tdc-side-cell.tdc-line-del {
    background: #ffeef0;
}

.tdc-side-cell.tdc-line-add {
    background: #e6ffec;
}

.tdc-side-empty {
    flex: 1;
    background: #f5f5f5;
}

.tdc-side-num {
    width: 34px;
    min-width: 34px;
    text-align: right;
    padding: 3px 4px 3px 0;
    color: #bbb;
    font-size: 11px;
    user-select: none;
    border-right: 1px solid #f0f0f0;
    background: #fafbfc;
    flex-shrink: 0;
    line-height: 1.7;
}

.tdc-line-del .tdc-side-num {
    background: #ffeef0;
}

.tdc-line-add .tdc-side-num {
    background: #e6ffec;
}

.tdc-side-prefix {
    width: 16px;
    min-width: 16px;
    text-align: center;
    font-weight: 700;
    font-size: 11px;
    flex-shrink: 0;
    line-height: 1.9;
    border-right: 1px solid #f0f0f0;
}

.tdc-prefix-del {
    color: #cb2431;
    background: #ffd7dc;
}

.tdc-prefix-add {
    color: #22863a;
    background: #cdffd8;
}

.tdc-side-text {
    flex: 1;
    padding: 3px 6px;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 13px;
    font-family: "SFMono-Regular", Consolas, "Courier New", monospace;
    min-width: 0;
    line-height: 1.55;
}

.tdc-side-divider {
    width: 2px;
    min-width: 2px;
    background: #e1e4e8;
    flex-shrink: 0;
}

/* No diff message */
.tdc-no-diff {
    text-align: center;
    padding: 40px 20px;
    color: #22863a;
    font-weight: 700;
    font-size: 18px;
}

.tdc-empty-state {
    text-align: center;
    padding: 30px 20px;
    color: #aaa;
    font-size: 14px;
}

/* Security badge */
.tdc-security-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: #22863a;
    background: #e6ffec;
    border: 1px solid #acf2bd;
    border-radius: 4px;
    padding: 4px 10px;
    margin-top: 8px;
    font-weight: 600;
}

/* --- Responsive --- */
@media (max-width: 480px) {
    .tdc-options-row {
        gap: 6px;
    }

    .tdc-option-label {
        font-size: 11px;
        padding: 5px 9px;
    }

    .tdc-result-header {
        flex-direction: column;
        align-items: flex-start;
    }
}