/**
 * Text Replacer Styles
 * Find and Replace Tool Styles (2-Column Layout)
 *
 * @package Zipper
 */

/* ===== 2-Column Layout (Desktop) ===== */
.tr-main-layout {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 20px;
    align-items: start;
}

.tr-input-col {
    position: sticky;
    top: 20px;
}

.tr-result-col {
    min-width: 0;
}

/* ===== Input Section ===== */
.tr-input-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    background: #fff;
    border: 1px solid #e8e4dc;
    border-radius: 10px;
}

.tr-input-title {
    font-size: 14px;
    font-weight: 600;
    color: #2d2a26;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tr-input-title i {
    color: #d4af37;
}

/* File Upload Area */
.tr-file-upload {
    border: 2px dashed #e8e4dc;
    border-radius: 8px;
    padding: 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: #faf9f7;
}

.tr-file-upload:hover,
.tr-file-upload.dragover {
    border-color: #d4af37;
    background: rgba(212, 175, 55, 0.05);
}

.tr-file-upload i {
    font-size: 24px;
    color: #a09a94;
    margin-bottom: 6px;
}

.tr-file-upload p {
    font-size: 12px;
    color: #5f5a56;
    margin: 0;
}

.tr-file-upload .tr-file-types {
    font-size: 10px;
    color: #a09a94;
    margin-top: 4px;
}

.tr-file-input {
    display: none;
}

.tr-file-name {
    display: none;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: rgba(212, 175, 55, 0.1);
    border-radius: 6px;
    font-size: 12px;
    color: #2d2a26;
}

.tr-file-name.active {
    display: flex;
}

.tr-file-name i {
    color: #d4af37;
}

.tr-file-name .tr-file-remove {
    margin-left: auto;
    cursor: pointer;
    color: #a09a94;
    transition: color 0.2s;
}

.tr-file-name .tr-file-remove:hover {
    color: #e74c3c;
}

/* Text Input Area */
.tr-textarea-wrap {
    position: relative;
}

.tr-textarea {
    width: 100%;
    min-height: 100px;
    padding: 12px;
    font-size: 13px;
    font-family: inherit;
    line-height: 1.5;
    border: 1px solid #e8e4dc;
    border-radius: 6px;
    background: #faf9f7;
    color: #2d2a26;
    resize: vertical;
    transition: border-color 0.2s, box-shadow 0.2s;
}

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

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

.tr-char-count {
    position: absolute;
    bottom: 8px;
    right: 10px;
    font-size: 10px;
    color: #a09a94;
}

/* Find/Replace Input */
.tr-search-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 12px;
    border-top: 1px solid #e8e4dc;
}

.tr-search-title {
    font-size: 13px;
    font-weight: 600;
    color: #2d2a26;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tr-search-title i {
    color: #d4af37;
}

.tr-input-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tr-input-group label {
    font-size: 12px;
    font-weight: 600;
    color: #5f5a56;
}

.tr-input-group input {
    padding: 10px 12px;
    font-size: 14px;
    border: 1px solid #e8e4dc;
    border-radius: 6px;
    background: #faf9f7;
    color: #2d2a26;
    transition: border-color 0.2s, box-shadow 0.2s;
    width: 100%;
}

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

.tr-input-group input::placeholder {
    color: #a09a94;
}

/* Search Options */
.tr-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 8px;
}

.tr-option-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: #faf9f7;
    border: 1px solid #e8e4dc;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 11px;
    color: #5f5a56;
}

.tr-option-item:hover {
    border-color: #d4af37;
}

.tr-option-item.active {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.15) 0%, rgba(184, 134, 11, 0.15) 100%);
    border-color: #d4af37;
    color: #b8860b;
}

.tr-option-item input {
    display: none;
}

.tr-option-item i {
    font-size: 12px;
}

/* Undo/Redo Button Area */
.tr-history-actions {
    display: flex;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid #e8e4dc;
}

.tr-btn-history {
    flex: 1;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid #e8e4dc;
    border-radius: 6px;
    background: #fff;
    color: #5f5a56;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

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

.tr-btn-history:disabled {
    background: #faf9f7;
    color: #c0bab3;
    cursor: not-allowed;
    border-color: #e8e4dc;
}

.tr-btn-history i {
    font-size: 12px;
}

/* Button Area */
.tr-actions {
    display: flex;
    gap: 8px;
    padding-top: 8px;
}

.tr-btn {
    flex: 1;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.tr-btn-find {
    background: #faf9f7;
    border: 1px solid #e8e4dc;
    color: #2d2a26;
}

.tr-btn-find:hover {
    border-color: #d4af37;
    color: #d4af37;
}

.tr-btn-replace {
    background: linear-gradient(135deg, #d4af37 0%, #b8860b 100%);
    color: #fff;
}

.tr-btn-replace:hover {
    background: linear-gradient(135deg, #b8860b 0%, #996515 100%);
}

.tr-btn-replace:disabled {
    background: #e8e4dc;
    color: #a09a94;
    cursor: not-allowed;
}

/* Bottom Action Buttons */
.tr-bottom-actions {
    display: flex;
    gap: 8px;
    padding-top: 8px;
}

.tr-btn-secondary {
    flex: 1;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid #e8e4dc;
    border-radius: 6px;
    background: #fff;
    color: #5f5a56;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.tr-btn-secondary:hover {
    border-color: #d4af37;
    color: #d4af37;
}

.tr-btn-secondary i {
    font-size: 12px;
}

/* ===== Result Area ===== */

/* Waiting State */
.tr-waiting {
    text-align: center;
    padding: 60px 20px;
    color: #a09a94;
    background: #faf9f7;
    border: 1px dashed #e8e4dc;
    border-radius: 10px;
}

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

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

.tr-waiting .tr-waiting-hint {
    font-size: 12px;
    color: #a09a94;
    margin-top: 8px;
}

/* Result Statistics */
.tr-stats {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.tr-stat-item {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: #fff;
    border: 1px solid #e8e4dc;
    border-radius: 8px;
}

.tr-stat-item.found {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.1) 0%, rgba(184, 134, 11, 0.1) 100%);
    border-color: rgba(212, 175, 55, 0.3);
}

.tr-stat-item.replaced {
    background: linear-gradient(135deg, rgba(39, 174, 96, 0.1) 0%, rgba(39, 174, 96, 0.05) 100%);
    border-color: rgba(39, 174, 96, 0.3);
}

.tr-stat-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 16px;
}

.tr-stat-item.found .tr-stat-icon {
    background: rgba(212, 175, 55, 0.15);
    color: #d4af37;
}

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

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

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

.tr-stat-item.found .tr-stat-value {
    color: #d4af37;
}

.tr-stat-item.replaced .tr-stat-value {
    color: #27ae60;
}

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

/* Preview/Result Area */
.tr-preview-section {
    background: #fff;
    border: 1px solid #e8e4dc;
    border-radius: 10px;
    overflow: hidden;
}

.tr-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #faf9f7;
    border-bottom: 1px solid #e8e4dc;
}

.tr-preview-title {
    font-size: 13px;
    font-weight: 600;
    color: #2d2a26;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tr-preview-title i {
    color: #d4af37;
}

.tr-preview-actions {
    display: flex;
    gap: 6px;
}

.tr-preview-btn {
    padding: 6px 10px;
    font-size: 11px;
    font-weight: 500;
    border: 1px solid #e8e4dc;
    border-radius: 4px;
    background: #fff;
    color: #5f5a56;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
}

.tr-preview-btn:hover {
    border-color: #d4af37;
    color: #d4af37;
}

.tr-preview-content {
    padding: 16px;
    max-height: 400px;
    overflow-y: auto;
    font-size: 14px;
    line-height: 1.6;
    color: #2d2a26;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Highlight Styles */
.tr-highlight {
    background: rgba(212, 175, 55, 0.3);
    color: #2d2a26;
    padding: 1px 2px;
    border-radius: 2px;
}

.tr-highlight-replaced {
    background: rgba(39, 174, 96, 0.3);
    color: #2d2a26;
    padding: 1px 2px;
    border-radius: 2px;
    text-decoration: none;
}

/* Before/After Comparison */
.tr-diff {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tr-diff-old {
    background: rgba(231, 76, 60, 0.15);
    color: #c0392b;
    text-decoration: line-through;
    padding: 1px 2px;
    border-radius: 2px;
}

.tr-diff-new {
    background: rgba(39, 174, 96, 0.2);
    color: #27ae60;
    padding: 1px 2px;
    border-radius: 2px;
}

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

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

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

/* Hidden */
.tr-hidden {
    display: none !important;
}

/* ===== Responsive - Tablet ===== */
@media (max-width: 900px) {
    .tr-main-layout {
        grid-template-columns: 300px 1fr;
        gap: 16px;
    }

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

/* ===== Responsive - Mobile ===== */
@media (max-width: 768px) {
    .tr-main-layout {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .tr-input-col {
        position: static;
    }

    .tr-input-section {
        padding: 14px;
    }

    .tr-textarea {
        min-height: 80px;
    }

    .tr-options {
        flex-direction: column;
        align-items: stretch;
    }

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

    .tr-stats {
        flex-direction: row;
        gap: 8px;
    }

    .tr-stat-item {
        padding: 10px;
    }

    .tr-stat-value {
        font-size: 18px;
    }

    .tr-preview-content {
        max-height: 300px;
        padding: 12px;
    }
}

/* ===== Responsive - Small Mobile ===== */
@media (max-width: 480px) {
    .tr-history-actions {
        flex-direction: row;
    }

    .tr-actions {
        flex-direction: column;
    }

    .tr-bottom-actions {
        flex-direction: column;
    }

    .tr-stat-item {
        padding: 8px;
    }

    .tr-stat-icon {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    .tr-stat-value {
        font-size: 16px;
    }

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

    .tr-preview-actions {
        justify-content: flex-end;
    }
}
