/**
 * Text Diff Tool Styles
 * 텍스트 비교기 전용 스타일
 *
 * @package Zipper
 */

/* ===== 메인 레이아웃 ===== */
.td-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ===== 옵션 바 ===== */
.td-options-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px 16px;
    background: #fff;
    border: 1px solid #e8e4dc;
    border-radius: 10px;
}

.td-options-left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.td-option-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.td-option-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #d4af37;
    cursor: pointer;
}

.td-option-item label {
    font-size: 13px;
    color: #2d2a26;
    cursor: pointer;
    user-select: none;
}

.td-compare-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, #d4af37 0%, #b8860b 100%);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.td-compare-btn:hover {
    background: linear-gradient(135deg, #e5c04b 0%, #c9971c 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.3);
}

.td-compare-btn:active {
    transform: translateY(0);
}

/* ===== 입력 영역 (2컬럼) ===== */
.td-input-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.td-input-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.td-input-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 4px;
}

.td-input-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 600;
    color: #2d2a26;
}

.td-input-label i {
    color: #d4af37;
}

.td-input-label.modified i {
    color: #3498db;
}

.td-input-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.td-upload-btn,
.td-clear-btn,
.td-sample-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 500;
    color: #5f5a56;
    background: #faf9f7;
    border: 1px solid #e8e4dc;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.td-upload-btn:hover,
.td-clear-btn:hover,
.td-sample-btn:hover {
    border-color: #d4af37;
    color: #d4af37;
}

.td-upload-btn i,
.td-clear-btn i,
.td-sample-btn i {
    font-size: 12px;
}

.td-textarea-wrapper {
    position: relative;
}

.td-textarea {
    width: 100%;
    height: 200px;
    padding: 12px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.5;
    color: #2d2a26;
    background: #faf9f7;
    border: 1px solid #e8e4dc;
    border-radius: 8px;
    resize: vertical;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.td-textarea:focus {
    outline: none;
    border-color: #d4af37;
    box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.1);
    background: #fff;
}

.td-textarea::placeholder {
    color: #a09a94;
}

.td-textarea.original:focus {
    border-color: #d4af37;
}

.td-textarea.modified:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.1);
}

.td-char-count {
    position: absolute;
    bottom: 8px;
    right: 12px;
    font-size: 11px;
    color: #a09a94;
    pointer-events: none;
}

/* ===== 통계 영역 ===== */
.td-stats-section {
    display: none;
    padding: 12px 16px;
    background: #fff;
    border: 1px solid #e8e4dc;
    border-radius: 10px;
}

.td-stats-section.visible {
    display: block;
}

.td-stats-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.td-stats-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 600;
    color: #2d2a26;
}

.td-stats-title i {
    color: #d4af37;
}

.td-nav-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
}

.td-nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 500;
    color: #5f5a56;
    background: #faf9f7;
    border: 1px solid #e8e4dc;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.td-nav-btn:hover:not(:disabled) {
    border-color: #d4af37;
    color: #d4af37;
}

.td-nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.td-nav-info {
    font-size: 12px;
    color: #5f5a56;
    padding: 0 8px;
}

.td-stats-grid {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.td-stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #faf9f7;
    border-radius: 6px;
}

.td-stat-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 14px;
}

.td-stat-icon.added {
    background: rgba(39, 174, 96, 0.15);
    color: #27ae60;
}

.td-stat-icon.removed {
    background: rgba(231, 76, 60, 0.15);
    color: #e74c3c;
}

.td-stat-icon.modified {
    background: rgba(241, 196, 15, 0.15);
    color: #f39c12;
}

.td-stat-icon.unchanged {
    background: rgba(108, 117, 125, 0.15);
    color: #6c757d;
}

.td-stat-info {
    display: flex;
    flex-direction: column;
}

.td-stat-value {
    font-size: 16px;
    font-weight: 700;
    color: #2d2a26;
    line-height: 1;
}

.td-stat-label {
    font-size: 11px;
    color: #5f5a56;
    margin-top: 2px;
}

/* ===== 결과 영역 (Side-by-side) ===== */
.td-result-section {
    display: none;
}

.td-result-section.visible {
    display: block;
}

.td-result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.td-result-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 600;
    color: #2d2a26;
}

.td-result-title i {
    color: #d4af37;
}

.td-result-actions {
    display: flex;
    gap: 8px;
}

.td-copy-btn,
.td-reset-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 500;
    color: #5f5a56;
    background: #faf9f7;
    border: 1px solid #e8e4dc;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.td-copy-btn:hover,
.td-reset-btn:hover {
    border-color: #d4af37;
    color: #d4af37;
}

/* Side-by-side 뷰 */
.td-diff-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    border: 1px solid #e8e4dc;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
}

.td-diff-panel {
    display: flex;
    flex-direction: column;
}

.td-diff-panel.original {
    border-right: 1px solid #e8e4dc;
}

.td-diff-panel-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 12px;
    background: #faf9f7;
    border-bottom: 1px solid #e8e4dc;
    font-size: 13px;
    font-weight: 600;
    color: #5f5a56;
}

.td-diff-panel-header i {
    color: #d4af37;
}

.td-diff-panel.modified .td-diff-panel-header i {
    color: #3498db;
}

.td-diff-content {
    flex: 1;
    max-height: 400px;
    overflow-y: auto;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
}

.td-diff-line {
    display: flex;
    min-height: 21px;
    border-bottom: 1px solid #f0ede8;
}

.td-diff-line:last-child {
    border-bottom: none;
}

.td-line-number {
    flex-shrink: 0;
    width: 40px;
    padding: 2px 8px;
    text-align: right;
    font-size: 11px;
    color: #a09a94;
    background: #faf9f7;
    border-right: 1px solid #e8e4dc;
    user-select: none;
}

.td-line-content {
    flex: 1;
    padding: 2px 10px;
    white-space: pre-wrap;
    word-break: break-all;
    color: #2d2a26;
}

/* 줄 상태별 스타일 */
.td-diff-line.added {
    background: rgba(39, 174, 96, 0.1);
}

.td-diff-line.added .td-line-number {
    background: rgba(39, 174, 96, 0.15);
    color: #27ae60;
}

.td-diff-line.added .td-line-content {
    color: #27ae60;
}

.td-diff-line.removed {
    background: rgba(231, 76, 60, 0.1);
}

.td-diff-line.removed .td-line-number {
    background: rgba(231, 76, 60, 0.15);
    color: #e74c3c;
}

.td-diff-line.removed .td-line-content {
    color: #e74c3c;
    text-decoration: line-through;
}

.td-diff-line.modified {
    background: rgba(241, 196, 15, 0.08);
}

.td-diff-line.modified .td-line-number {
    background: rgba(241, 196, 15, 0.15);
    color: #f39c12;
}

.td-diff-line.empty {
    background: #f5f4f2;
}

.td-diff-line.empty .td-line-number {
    background: #f0ede8;
}

.td-diff-line.empty .td-line-content {
    color: #a09a94;
}

/* 현재 차이점 하이라이트 */
.td-diff-line.current {
    outline: 2px solid #d4af37;
    outline-offset: -2px;
    z-index: 1;
    position: relative;
}

/* 단어 단위 하이라이트 (줄 내부) */
.td-word-added {
    background: rgba(39, 174, 96, 0.25);
    padding: 1px 2px;
    border-radius: 2px;
}

.td-word-removed {
    background: rgba(231, 76, 60, 0.25);
    padding: 1px 2px;
    border-radius: 2px;
    text-decoration: line-through;
}

/* 동일 텍스트 메시지 */
.td-identical-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: #27ae60;
}

.td-identical-message i {
    font-size: 48px;
    margin-bottom: 12px;
}

.td-identical-message p {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.td-identical-message span {
    font-size: 13px;
    color: #5f5a56;
    margin-top: 4px;
}

/* 스크롤 동기화 */
.td-diff-content.synced {
    scroll-behavior: auto;
}

/* ===== 대기 상태 ===== */
.td-waiting {
    text-align: center;
    padding: 40px 20px;
    color: #a09a94;
    background: #faf9f7;
    border: 1px dashed #e8e4dc;
    border-radius: 10px;
}

.td-waiting i {
    font-size: 48px;
    margin-bottom: 12px;
    display: block;
}

.td-waiting p {
    font-size: 14px;
    margin: 0;
}

/* ===== 면책조항 ===== */
.td-disclaimer {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    background: rgba(108, 117, 125, 0.08);
    border-radius: 8px;
    margin-top: 16px;
}

.td-disclaimer i {
    color: #6c757d;
    font-size: 16px;
    flex-shrink: 0;
    margin-top: 1px;
}

.td-disclaimer-text {
    font-size: 12px;
    color: #5f5a56;
    line-height: 1.5;
}

/* 숨김 유틸리티 */
.td-hidden {
    display: none !important;
}

/* ===== 반응형 - 태블릿 ===== */
@media (max-width: 900px) {
    .td-options-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .td-options-left {
        justify-content: center;
    }

    .td-compare-btn {
        width: 100%;
        justify-content: center;
    }

    .td-input-section {
        gap: 12px;
    }

    .td-textarea {
        height: 180px;
    }

    .td-stats-grid {
        justify-content: center;
    }
}

/* ===== 반응형 - 모바일 ===== */
@media (max-width: 768px) {
    .td-input-section {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .td-diff-container {
        grid-template-columns: 1fr;
    }

    .td-diff-panel.original {
        border-right: none;
        border-bottom: 1px solid #e8e4dc;
    }

    .td-diff-content {
        max-height: 250px;
    }

    .td-textarea {
        height: 160px;
    }

    .td-stats-header {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }

    .td-nav-buttons {
        justify-content: center;
    }

    .td-result-header {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }

    .td-result-actions {
        justify-content: center;
    }

    .td-input-header {
        flex-direction: column;
        gap: 8px;
        align-items: stretch;
    }

    .td-input-actions {
        justify-content: flex-end;
    }
}

/* ===== 반응형 - 작은 모바일 ===== */
@media (max-width: 480px) {
    .td-options-left {
        flex-direction: column;
        gap: 8px;
    }

    .td-option-item {
        justify-content: center;
    }

    .td-stats-grid {
        flex-direction: column;
        gap: 8px;
    }

    .td-stat-item {
        justify-content: center;
    }

    .td-line-number {
        width: 32px;
        padding: 2px 4px;
        font-size: 10px;
    }

    .td-line-content {
        padding: 2px 6px;
        font-size: 12px;
    }

    .td-nav-buttons {
        flex-wrap: wrap;
    }

    .td-input-actions {
        flex-wrap: wrap;
        gap: 4px;
    }

    .td-upload-btn,
    .td-clear-btn,
    .td-sample-btn {
        padding: 5px 8px;
        font-size: 11px;
    }
}
