/**
 * Regex Tester Styles
 * 정규식 테스터 전용 스타일
 *
 * @package Zipper
 */

/* 정규식 입력 영역 */
.regex-input-area {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    align-items: stretch;
}

.regex-pattern-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    background: #faf9f7;
    border: 1px solid #e8e4dc;
    border-radius: 10px;
    padding: 0 16px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.regex-pattern-wrap:focus-within {
    border-color: #d4af37;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
}

.regex-pattern-wrap.error {
    border-color: #dc3232;
    background: #fef6f6;
}

.regex-delimiter {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 18px;
    color: #d4af37;
    font-weight: 600;
}

.regex-pattern-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 14px 8px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 15px;
    color: #2d2a26;
    outline: none;
}

.regex-pattern-input::placeholder {
    color: #8c8579;
}

/* 플래그 선택 */
.regex-flags {
    display: flex;
    gap: 6px;
    padding: 8px 12px;
    background: #faf9f7;
    border: 1px solid #e8e4dc;
    border-radius: 10px;
}

.flag-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e8e4dc;
    border-radius: 6px;
    background: #fff;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 14px;
    font-weight: 600;
    color: #5f5a56;
    cursor: pointer;
    transition: all 0.2s;
}

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

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

.flag-btn[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 8px;
    background: #2d2a26;
    color: #fff;
    font-size: 11px;
    border-radius: 4px;
    white-space: nowrap;
    z-index: 10;
}

/* 치환 입력 영역 */
.replace-input-area {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    align-items: center;
}

.replace-input-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    background: #faf9f7;
    border: 1px solid #e8e4dc;
    border-radius: 10px;
    padding: 0 16px;
    transition: border-color 0.2s;
}

.replace-input-wrap:focus-within {
    border-color: #d4af37;
}

.replace-label {
    font-size: 13px;
    color: #5f5a56;
    margin-right: 12px;
    white-space: nowrap;
}

.replace-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 14px 0;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 15px;
    color: #2d2a26;
    outline: none;
}

.replace-input::placeholder {
    color: #8c8579;
}

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

.replace-btn:hover {
    background: linear-gradient(135deg, #e5c158 0%, #d4af37 100%);
    transform: translateY(-1px);
}

/* 테스트 텍스트 영역 */
.test-text-area {
    margin-bottom: 20px;
}

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

.test-text-label {
    font-size: 14px;
    font-weight: 600;
    color: #2d2a26;
}

.test-text-actions {
    display: flex;
    gap: 8px;
}

.text-action-btn {
    padding: 6px 12px;
    background: transparent;
    border: 1px solid #e8e4dc;
    border-radius: 6px;
    font-size: 13px;
    color: #5f5a56;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
}

.text-action-btn:hover {
    background: #faf9f7;
    border-color: #d4af37;
    color: #d4af37;
}

/* 하이라이트 영역 */
.highlight-container {
    position: relative;
    border: 1px solid #e8e4dc;
    border-radius: 10px;
    overflow: hidden;
}

.highlight-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 16px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 14px;
    line-height: 1.6;
    color: transparent;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow: auto;
    pointer-events: none;
    background: #faf9f7;
}

.highlight-backdrop mark {
    background: rgba(212, 175, 55, 0.3);
    color: transparent;
    border-radius: 2px;
    padding: 1px 0;
}

.highlight-backdrop mark.current {
    background: rgba(212, 175, 55, 0.6);
}

.test-textarea {
    position: relative;
    width: 100%;
    height: 200px;
    padding: 16px;
    border: none;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 14px;
    line-height: 1.6;
    color: #2d2a26;
    background: transparent;
    resize: vertical;
    outline: none;
    z-index: 1;
}

.test-textarea::placeholder {
    color: #8c8579;
}

/* 결과 영역 */
.result-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    border-bottom: 1px solid #e8e4dc;
    padding-bottom: 0;
}

.result-tab {
    padding: 12px 20px;
    background: transparent;
    border: none;
    font-size: 14px;
    font-weight: 500;
    color: #5f5a56;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.result-tab:hover {
    color: #d4af37;
}

.result-tab.active {
    color: #d4af37;
    border-bottom-color: #d4af37;
}

.result-tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: #e8e4dc;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    margin-left: 6px;
}

.result-tab.active .result-tab-badge {
    background: #d4af37;
    color: #fff;
}

.result-panel {
    display: none;
    background: #faf9f7;
    border-radius: 10px;
    padding: 16px;
    max-height: 300px;
    overflow-y: auto;
}

.result-panel.active {
    display: block;
}

/* 매치 결과 */
.match-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

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

.match-index {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #d4af37;
    color: #fff;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 600;
}

.match-content {
    flex: 1;
    min-width: 0;
}

.match-value {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 14px;
    color: #2d2a26;
    background: rgba(212, 175, 55, 0.1);
    padding: 4px 8px;
    border-radius: 4px;
    word-break: break-all;
    margin-bottom: 6px;
}

.match-info {
    font-size: 12px;
    color: #5f5a56;
}

.match-info span {
    margin-right: 12px;
}

/* 그룹 결과 */
.group-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

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

.group-name {
    flex-shrink: 0;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 13px;
    color: #d4af37;
    font-weight: 600;
    min-width: 80px;
}

.group-value {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 13px;
    color: #2d2a26;
    background: rgba(212, 175, 55, 0.1);
    padding: 4px 8px;
    border-radius: 4px;
    word-break: break-all;
}

/* 정규식 설명 */
.explanation-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

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

.explanation-token {
    flex-shrink: 0;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 14px;
    color: #d4af37;
    font-weight: 600;
    min-width: 60px;
    background: rgba(212, 175, 55, 0.1);
    padding: 4px 8px;
    border-radius: 4px;
    text-align: center;
}

.explanation-desc {
    font-size: 13px;
    color: #2d2a26;
    line-height: 1.5;
}

/* 치환 결과 */
.replace-result {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 14px;
    line-height: 1.6;
    color: #2d2a26;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* 예제 템플릿 영역 */
.templates-section {
    margin-bottom: 20px;
}

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

.templates-title {
    font-size: 14px;
    font-weight: 600;
    color: #2d2a26;
}

.templates-toggle {
    padding: 6px 12px;
    background: transparent;
    border: 1px solid #e8e4dc;
    border-radius: 6px;
    font-size: 13px;
    color: #5f5a56;
    cursor: pointer;
    transition: all 0.2s;
}

.templates-toggle:hover {
    border-color: #d4af37;
    color: #d4af37;
}

.templates-grid {
    display: none;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}

.templates-grid.active {
    display: grid;
}

.template-item {
    padding: 12px;
    background: #fff;
    border: 1px solid #e8e4dc;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.template-item:hover {
    border-color: #d4af37;
    box-shadow: 0 2px 8px rgba(212, 175, 55, 0.15);
}

.template-name {
    font-size: 13px;
    font-weight: 600;
    color: #2d2a26;
    margin-bottom: 4px;
}

.template-pattern {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 12px;
    color: #d4af37;
    word-break: break-all;
}

/* 통계 영역 */
.regex-stats {
    display: flex;
    gap: 16px;
    padding: 16px;
    background: #faf9f7;
    border-radius: 10px;
    margin-bottom: 20px;
}

.regex-stat {
    flex: 1;
    text-align: center;
}

.regex-stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #d4af37;
    margin-bottom: 4px;
}

.regex-stat-label {
    font-size: 13px;
    color: #5f5a56;
}

/* 에러 메시지 */
.regex-error {
    display: none;
    padding: 12px 16px;
    background: rgba(220, 50, 50, 0.1);
    border: 1px solid rgba(220, 50, 50, 0.3);
    border-radius: 8px;
    color: #dc3232;
    font-size: 14px;
    margin-bottom: 16px;
}

.regex-error.active {
    display: flex;
    align-items: center;
    gap: 10px;
}

.regex-error i {
    font-size: 18px;
}

/* 빈 상태 */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #8c8579;
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 14px;
}

/* Responsive */
@media (max-width: 768px) {
    .regex-input-area {
        flex-direction: column;
    }

    .regex-flags {
        justify-content: center;
    }

    .replace-input-area {
        flex-direction: column;
    }

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

    .result-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .result-tab {
        padding: 10px 14px;
        white-space: nowrap;
    }

    .regex-stats {
        flex-wrap: wrap;
    }

    .regex-stat {
        min-width: calc(50% - 8px);
    }

    .templates-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .test-textarea {
        height: 150px;
        font-size: 13px;
    }

    .highlight-backdrop {
        font-size: 13px;
    }

    .regex-pattern-input {
        font-size: 14px;
    }

    .match-item {
        flex-direction: column;
        gap: 8px;
    }

    .match-index {
        align-self: flex-start;
    }
}
