/* SQL格式化工具样式 */
.sql-formatter-tool {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* SQL语法高亮样式 */
.sql-syntax-highlight {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 1rem;
    overflow-x: auto;
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.sql-syntax-keyword {
    color: #0066cc;
    font-weight: bold;
}

.sql-syntax-function {
    color: #ff6600;
    font-weight: bold;
}

.sql-syntax-string {
    color: #009900;
}

.sql-syntax-number {
    color: #cc00cc;
}

.sql-syntax-comment {
    color: #999999;
    font-style: italic;
}

.sql-syntax-operator {
    color: #666666;
}

.sql-syntax-table {
    color: #006699;
    font-weight: bold;
}

.sql-syntax-column {
    color: #333333;
}

.sql-syntax-error {
    background-color: #ffebee;
    color: #c62828;
    padding: 2px 4px;
    border-radius: 3px;
}

.sql-syntax-type {
    color: #9c27b0;
    font-weight: bold;
}

.sql-syntax-variable {
    color: #795548;
}

.sql-syntax-parameter {
    color: #e91e63;
}

.sql-syntax-alias {
    color: #ff9800;
    font-style: italic;
}

/* 验证状态样式 */
.sql-validation-success {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    color: #155724;
    border: 1px solid #c3e6cb;
    border-radius: 8px;
    padding: 1rem 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 4px rgba(40, 167, 69, 0.1);
}

.sql-validation-error {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    padding: 1rem 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 4px rgba(220, 53, 69, 0.1);
}

.sql-validation-warning {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    color: #856404;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    padding: 1rem 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 4px rgba(255, 193, 7, 0.1);
}

/* 格式统计样式 */
.sql-format-stats {
    background: linear-gradient(135deg, #e2e3e5 0%, #d6d8db 100%);
    color: #383d41;
    border-radius: 8px;
    padding: 1rem 1.5rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.sql-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin-top: 0.5rem;
}

.sql-stat-item {
    text-align: center;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 6px;
}

.sql-stat-value {
    font-size: 1.2rem;
    font-weight: bold;
    color: #0066cc;
}

.sql-stat-label {
    font-size: 0.8rem;
    color: #666666;
    margin-top: 0.25rem;
}

/* 统计卡片样式 */
.stat-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 1px solid #dee2e6;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.2);
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: #0066cc;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.9rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* 错误列表样式 */
.sql-error-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sql-error-item {
    background: rgba(255, 255, 255, 0.5);
    border-left: 4px solid #dc3545;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border-radius: 0 4px 4px 0;
}

.sql-error-line {
    font-weight: bold;
    color: #dc3545;
}

.sql-error-message {
    color: #721c24;
    margin-top: 0.25rem;
}

.sql-error-position {
    font-size: 0.8rem;
    color: #666666;
    margin-top: 0.25rem;
}

/* SQL分析样式 */
.sql-analysis {
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.sql-analysis-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.sql-analysis-item {
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #007bff;
}

.sql-analysis-title {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.5rem;
}

.sql-analysis-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #007bff;
}

.sql-analysis-description {
    font-size: 0.8rem;
    color: #6c757d;
    margin-top: 0.25rem;
}

/* 数据库方言选择样式 */
.sql-dialect-selector {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.sql-dialect-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.5rem;
}

.sql-dialect-item {
    background: #ffffff;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    padding: 0.75rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.sql-dialect-item:hover {
    border-color: #007bff;
    background: #e3f2fd;
}

.sql-dialect-item.active {
    border-color: #007bff;
    background: #007bff;
    color: white;
}

.sql-dialect-icon {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.sql-dialect-name {
    font-weight: 600;
    font-size: 0.9rem;
}

/* 格式化选项样式 */
.sql-options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.sql-option-group {
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.sql-option-group h6 {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #dee2e6;
}

.sql-option {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
}

.sql-option:last-child {
    margin-bottom: 0;
}

.sql-option input[type="checkbox"] {
    margin-right: 0.5rem;
}

.sql-option input[type="radio"] {
    margin-right: 0.5rem;
}

.sql-option label {
    margin-bottom: 0;
    cursor: pointer;
    user-select: none;
}

/* 工具栏样式 */
.sql-toolbar {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 0.75rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.sql-toolbar .btn {
    min-width: 80px;
}

.sql-toolbar-divider {
    width: 1px;
    height: 24px;
    background: #dee2e6;
    margin: 0 0.5rem;
}

/* 性能指标样式 */
.sql-performance {
    background: #e8f5e8;
    border: 1px solid #28a745;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.sql-performance-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.sql-performance-item {
    text-align: center;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 6px;
}

.sql-performance-label {
    font-size: 0.8rem;
    color: #155724;
    margin-bottom: 0.25rem;
}

.sql-performance-value {
    font-size: 1.2rem;
    font-weight: bold;
    color: #28a745;
}

.sql-performance-unit {
    font-size: 0.7rem;
    color: #6c757d;
}

/* 复杂度分析样式 */
.sql-complexity {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.sql-complexity-level {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: bold;
    margin-right: 0.5rem;
}

.sql-complexity-low {
    background: #d4edda;
    color: #155724;
}

.sql-complexity-medium {
    background: #fff3cd;
    color: #856404;
}

.sql-complexity-high {
    background: #f8d7da;
    color: #721c24;
}

.sql-complexity-very-high {
    background: #f5c6cb;
    color: #721c24;
}

/* 建议提示样式 */
.sql-suggestions {
    background: #e2e3e5;
    border: 1px solid #adb5bd;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.sql-suggestion-item {
    background: rgba(255, 255, 255, 0.7);
    border-left: 4px solid #007bff;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border-radius: 0 4px 4px 0;
}

.sql-suggestion-type {
    font-weight: bold;
    color: #007bff;
    margin-bottom: 0.25rem;
}

.sql-suggestion-text {
    color: #495057;
    font-size: 0.9rem;
}

/* 拖拽区域样式 */
.sql-drop-zone {
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    color: #6c757d;
    transition: all 0.3s ease;
    cursor: pointer;
}

.sql-drop-zone:hover {
    border-color: #007bff;
    background: #f8f9fa;
}

.sql-drop-zone.dragover {
    border-color: #007bff;
    background: #e3f2fd;
    color: #0066cc;
}

.sql-drop-zone-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #6c757d;
}

.sql-drop-zone-text {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.sql-drop-zone-hint {
    font-size: 0.9rem;
    color: #868e96;
}

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

.sql-status-valid {
    background: #28a745;
    box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.3);
}

.sql-status-invalid {
    background: #dc3545;
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.3);
}

.sql-status-warning {
    background: #ffc107;
    box-shadow: 0 0 0 2px rgba(255, 193, 7, 0.3);
}

.sql-status-processing {
    background: #17a2b8;
    box-shadow: 0 0 0 2px rgba(23, 162, 184, 0.3);
    animation: pulse 1s infinite;
}

/* 动画效果 */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(23, 162, 184, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(23, 162, 184, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(23, 162, 184, 0);
    }
}

.sql-loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* 按钮组样式 */
.sql-button-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.sql-button-group .btn {
    min-width: 100px;
}

/* 文本区域增强样式 */
.form-control.font-monospace {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
}

.sql-input-enhanced {
    position: relative;
}

.sql-input-enhanced textarea {
    padding-right: 80px;
}

.sql-input-actions {
    position: absolute;
    right: 10px;
    top: 10px;
    display: flex;
    gap: 0.5rem;
}

.sql-input-actions .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .sql-button-group {
        flex-direction: column;
    }

    .sql-button-group .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .sql-options-grid {
        grid-template-columns: 1fr;
    }

    .sql-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .sql-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .sql-toolbar-divider {
        width: auto;
        height: 1px;
        margin: 0.5rem 0;
    }

    .sql-dialect-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stat-card {
        margin-bottom: 0.5rem;
        padding: 1rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .sql-stats-grid {
        grid-template-columns: 1fr;
    }

    .sql-option-group {
        padding: 0.75rem;
    }

    .sql-drop-zone {
        padding: 1rem;
    }

    .sql-drop-zone-icon {
        font-size: 2rem;
    }

    .sql-syntax-highlight {
        font-size: 12px;
    }

    .stat-value {
        font-size: 1.2rem;
    }
}

/* 深色主题支持 */
@media (prefers-color-scheme: dark) {
    .sql-formatter-tool {
        background: #1a1a1a;
        color: #e9ecef;
    }

    .sql-syntax-highlight {
        background: #2d3748;
        border-color: #4a5568;
        color: #e9ecef;
    }

    .sql-validation-success {
        background: linear-gradient(135deg, #2d5a3d 0%, #22543d 100%);
        color: #9ae6b4;
        border-color: #22543d;
    }

    .sql-validation-error {
        background: linear-gradient(135deg, #5a2d2d 0%, #542d2d 100%);
        color: #feb2b2;
        border-color: #542d2d;
    }

    .sql-validation-warning {
        background: linear-gradient(135deg, #5a5a2d 0%, #54542d 100%);
        color: #faf089;
        border-color: #54542d;
    }

    .sql-format-stats {
        background: linear-gradient(135deg, #2d3748 0%, #4a5568 100%);
        color: #e2e8f0;
    }

    .sql-option-group {
        background: #2d3748;
        border-color: #4a5568;
        color: #e9ecef;
    }

    .sql-toolbar {
        background: #2d3748;
        border-color: #4a5568;
    }

    .sql-drop-zone {
        background: #2d3748;
        border-color: #4a5568;
        color: #a0aec0;
    }

    .sql-drop-zone:hover {
        border-color: #63b3ed;
        background: #2b6cb0;
        color: #bee3f8;
    }

    .sql-drop-zone.dragover {
        border-color: #63b3ed;
        background: #2b6cb0;
        color: #bee3f8;
    }

    .stat-card {
        background: linear-gradient(135deg, #2d3748 0%, #4a5568 100%);
        border-color: #4a5568;
        color: #e9ecef;
    }

    .sql-dialect-item {
        background: #2d3748;
        border-color: #4a5568;
        color: #e9ecef;
    }

    .sql-dialect-item:hover {
        border-color: #63b3ed;
        background: #2b6cb0;
    }
}