﻿/* 基础样式重置 */
* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f8f9fa;
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

.container-fluid {
    padding: 10px;
    max-width: 1200px;
    margin: 0 auto;
}

/* 页面加载动画 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.3s ease;
}

.loading-spinner {
    text-align: center;
    color: white;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255,255,255,0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-spinner p {
    font-size: 16px;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* 头部区域 */
.header-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.header-content {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    width: 100%;
}

.title-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
    width: 100%;
    text-align: center;
}

.main-title {
    font-size: 28px;
    font-weight: 600;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    text-align: center;
    width: 100%;
}

.subtitle {
    font-size: 16px;
    font-weight: 400;
    margin: 0;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    text-align: center;
    width: 100%;
    opacity: 0.9;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.2);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 14px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-ready {
    background-color: #28a745;
    animation: pulse 2s infinite;
}

.status-editing {
    background-color: #ffc107;
    animation: pulse 1s infinite;
}

.status-error {
    background-color: #dc3545;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.tool-link {
    color: #fff;
    text-decoration: none;
    font-size: 14px;
    padding: 8px 16px;
    background: rgba(255,255,255,0.2);
    border-radius: 20px;
    transition: all 0.3s ease;
}

.tool-link:hover {
    background: rgba(255,255,255,0.3);
    color: #fff;
    text-decoration: none;
}

.mode-selector {
    display: flex;
    justify-content: center;
    width: 100%;
}

.run-btn {
    margin-top: 15px;
    padding: 12px 30px;
    font-size: 16px;
    border-radius: 25px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.run-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.btn-icon {
    font-size: 14px;
}

.shortcut-hint {
    font-size: 12px;
    opacity: 0.8;
    margin-left: 8px;
}

/* 输入区域 */
.input-section {
    background: white;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border: 1px solid #e9ecef;
    transition: all 0.3s ease;
}

.input-section:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.section-label {
    font-size: 18px;
    font-weight: 600;
    color: #495057;
    margin: 0;
}

.section-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* 按钮样式 */
.btn {
    border-radius: 6px;
    font-size: 12px;
    padding: 6px 12px;
    transition: all 0.3s ease;
    border: 1px solid #dee2e6;
    cursor: pointer;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.btn.active, .btn:active {
    background-color: #007bff;
    border-color: #007bff;
    color: white;
}

.option-buttons, .decode-buttons, .replace-mode-buttons, .newline-buttons {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.copy-link {
    color: #007bff;
    text-decoration: none;
    font-size: 12px;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.copy-link:hover {
    background: #e9ecef;
    color: #0056b3;
    text-decoration: none;
    transform: translateY(-1px);
}

.copy-icon {
    font-size: 14px;
}

.decode-btn, .output-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
}

/* 文本输入区域 */
.form-control {
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 12px;
    font-size: 14px;
    transition: all 0.3s ease;
    resize: vertical;
    word-break: break-all;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

.form-control:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,0.25);
    outline: none;
}

.regex-input {
    font-size: 16px;
    font-weight: 500;
    background: #f8f9fa;
}

.text-input, .replace-input, .output-input {
    min-height: 120px;
    background: #fafbfc;
}

.output-input {
    background: #f1f3f4;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

/* 帮助区域 */
.help-section {
    margin: 30px 0;
    text-align: center;
}

.help-btn {
    padding: 10px 20px;
    border-radius: 25px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 auto;
    transition: all 0.3s ease;
}

.help-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.help-icon {
    font-size: 16px;
}

.help-content {
    margin-top: 20px;
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.help-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    max-width: 300px;
    text-align: left;
}

.help-card h4 {
    margin: 0 0 15px 0;
    color: #495057;
    font-size: 16px;
}

.help-card ul {
    margin: 0;
    padding-left: 20px;
}

.help-card li {
    margin-bottom: 8px;
    font-size: 14px;
}

kbd {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 3px;
    padding: 2px 6px;
    font-size: 12px;
    font-family: monospace;
}

/* 页脚 */
.footer {
    text-align: center;
    padding: 20px;
    margin-top: 30px;
}

.language-switch a {
    color: #6c757d;
    text-decoration: none;
    margin: 0 10px;
    padding: 5px 10px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.language-switch a:hover {
    color: #007bff;
    background: #f8f9fa;
    text-decoration: none;
}

/* 触摸优化 */
@media (hover: none) and (pointer: coarse) {
    .btn {
        min-height: 44px;
        min-width: 44px;
        padding: 12px 16px;
    }
    
    .copy-link {
        min-height: 44px;
        padding: 12px 16px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    
    .form-control {
        min-height: 44px;
        padding: 15px;
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container-fluid {
        padding: 5px;
    }
    
    .header-section {
        padding: 15px;
        margin-bottom: 15px;
    }
    
    .header-content {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    
    .title-section {
        flex-direction: column;
        gap: 10px;
    }
    
    .main-title {
        font-size: 24px;
    }
    
    .input-section {
        padding: 15px;
        margin-bottom: 15px;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .section-controls {
        width: 100%;
        justify-content: flex-start;
    }
    
    .option-buttons, .decode-buttons, .replace-mode-buttons, .newline-buttons {
        flex-wrap: wrap;
        gap: 3px;
    }
    
    .btn {
        font-size: 11px;
        padding: 4px 8px;
    }
    
    .form-control {
        font-size: 14px;
        padding: 10px;
    }
    
    .regex-input {
        font-size: 14px;
    }
    
    .text-input, .replace-input, .output-input {
        min-height: 100px;
    }
    
    .help-content {
        flex-direction: column;
        align-items: center;
    }
    
    .help-card {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .main-title {
        font-size: 20px;
    }
    
    .input-section {
        padding: 10px;
    }
    
    .section-label {
        font-size: 16px;
    }
    
    .btn {
        font-size: 10px;
        padding: 3px 6px;
    }
    
    .form-control {
        font-size: 13px;
        padding: 8px;
    }
    
    .text-input, .replace-input, .output-input {
        min-height: 80px;
    }
    
    .run-btn {
        padding: 10px 20px;
        font-size: 14px;
    }
    
    .shortcut-hint {
        display: none;
    }
}

/* 状态指示器 */
.status-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 8px;
}

.status-success {
    background-color: #28a745;
}

.status-error {
    background-color: #dc3545;
}

.status-warning {
    background-color: #ffc107;
}

/* 加载动画 */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* 成功状态 */
.success-flash {
    animation: successFlash 0.6s ease-in-out;
}

@keyframes successFlash {
    0% { background-color: #d4edda; }
    100% { background-color: transparent; }
}

/* 错误状态 */
.error-flash {
    animation: errorFlash 0.6s ease-in-out;
}

@keyframes errorFlash {
    0% { background-color: #f8d7da; }
    100% { background-color: transparent; }
}

/* 语言切换按钮特殊样式 */
.language-switch-nav .nav-link {
    background: rgba(255,255,255,0.2) !important;
    border: 1px solid rgba(255,255,255,0.3) !important;
    border-radius: 20px !important;
    margin: 0 5px !important;
    padding: 12px 20px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    transition: all 0.3s ease !important;
    font-size: 0.9rem !important;
}

.language-switch-nav .nav-link:hover {
    background: rgba(255,255,255,0.3) !important;
    border-color: rgba(255,255,255,0.5) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(0,0,0,0.2) !important;
}

.language-switch-nav .nav-icon {
    font-size: 1.1em !important;
    margin-right: 8px !important;
}

/* 移动端语言切换按钮样式 */
@media (max-width: 991px) {
    .language-switch-nav .nav-link {
        background: rgba(255,255,255,0.15) !important;
        border: 1px solid rgba(255,255,255,0.25) !important;
        border-radius: 15px !important;
        margin: 8px 0 !important;
        padding: 16px 20px !important;
        font-weight: 600 !important;
        text-align: center !important;
    }
    
    .language-switch-nav .nav-link:hover {
        background: rgba(255,255,255,0.25) !important;
        transform: none !important;
        box-shadow: 0 4px 15px rgba(0,0,0,0.2) !important;
    }
}