/* CSS代码生成器工具样式 */
.css-generator-tool {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

/* 头部导航样式 */
.tool-header {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.navbar-dark .navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
}

.navbar-dark .nav-link {
    font-weight: 500;
    transition: all 0.3s ease;
}

.navbar-dark .nav-link:hover {
    color: #ffffff !important;
    transform: translateY(-2px);
}

/* 主要内容区域 */
.main-content {
    padding: 2rem 0;
}

.text-gradient {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* 统计信息样式 */
.stat-item {
    background: #ffffff;
    border-radius: 16px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.stat-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.stat-value {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.875rem;
    color: #6c757d;
    font-weight: 500;
}

/* 工具栏样式 */
.toolbar-section {
    background: #ffffff;
    border-radius: 20px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.category-tabs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.category-tab {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 0.75rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #495057;
    cursor: pointer;
    transition: all 0.3s ease;
}

.category-tab:hover {
    border-color: #667eea;
    color: #667eea;
    transform: translateY(-2px);
}

.category-tab.active {
    background: #667eea;
    border-color: #667eea;
    color: white;
}

/* 配置面板样式 */
.config-panel {
    background: #ffffff;
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}

.config-section {
    margin-bottom: 2rem;
}

.config-section h6 {
    font-weight: 600;
    color: #495057;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e9ecef;
}

.config-group {
    margin-bottom: 1.25rem;
}

.config-group label {
    font-weight: 500;
    color: #495057;
    margin-bottom: 0.5rem;
}

.form-select,
.form-control {
    border-radius: 8px;
    border: 1px solid #dee2e6;
    transition: all 0.3s ease;
}

.form-select:focus,
.form-control:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

.btn-group .btn {
    border-radius: 8px;
    font-weight: 500;
}

.btn-check:checked + .btn {
    background-color: #667eea;
    border-color: #667eea;
}

.btn-check:checked + .btn:hover {
    background-color: #5a67d8;
    border-color: #5a67d8;
}

.form-check {
    margin-bottom: 0.5rem;
}

.form-check-input:checked {
    background-color: #667eea;
    border-color: #667eea;
}

.form-range {
    margin-bottom: 0.5rem;
}

.form-range::-webkit-slider-thumb {
    background: #667eea;
}

.form-range::-moz-range-thumb {
    background: #667eea;
}

/* 配置操作按钮 */
.config-actions {
    border-top: 2px solid #e9ecef;
    padding-top: 1.5rem;
    margin-top: 2rem;
}

/* 代码面板样式 */
.code-panel {
    background: #ffffff;
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.code-section,
.preview-section,
.analysis-section {
    margin-bottom: 2rem;
}

.code-section h5,
.preview-section h5,
.analysis-section h5 {
    font-weight: 600;
    color: #495057;
    margin-bottom: 1rem;
}

/* 代码编辑器样式 */
.code-editor {
    border: 1px solid #e9ecef;
    border-radius: 12px;
    overflow: hidden;
}

.code-header {
    background: #f8f9fa;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: between;
    align-items: center;
}

.code-actions {
    display: flex;
    gap: 0.5rem;
}

.code-textarea {
    border: none;
    border-radius: 0;
    font-family: 'JetBrains Mono', 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.875rem;
    line-height: 1.5;
    resize: vertical;
    background: #2d3748;
    color: #e2e8f0;
}

.code-textarea:focus {
    box-shadow: none;
    background: #1a202c;
}

/* 预览容器样式 */
.preview-container {
    border: 2px dashed #e9ecef;
    border-radius: 12px;
    padding: 2rem;
    min-height: 200px;
    background: #f8f9fa;
    transition: all 0.3s ease;
}

.preview-container.desktop {
    max-width: 100%;
}

.preview-container.tablet {
    max-width: 768px;
    margin: 0 auto;
}

.preview-container.mobile {
    max-width: 375px;
    margin: 0 auto;
}

.preview-content {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* 代码分析样式 */
.analysis-section {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 1.5rem;
}

.analysis-item {
    background: white;
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.analysis-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.analysis-label {
    font-size: 0.75rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
}

.analysis-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #667eea;
}

/* 保存的代码片段样式 */
.saved-snippets-section {
    margin-top: 2rem;
}

.saved-snippets-section .card {
    border: none;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.snippets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.snippet-card {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 1rem;
    transition: all 0.3s ease;
    cursor: pointer;
}

.snippet-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.snippet-header {
    display: flex;
    justify-content: between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.snippet-title {
    font-weight: 600;
    color: #495057;
    font-size: 0.875rem;
}

.snippet-category {
    background: #667eea;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.snippet-preview {
    background: #2d3748;
    color: #e2e8f0;
    padding: 0.75rem;
    border-radius: 6px;
    font-family: 'JetBrains Mono', 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.75rem;
    line-height: 1.4;
    margin-bottom: 0.75rem;
    max-height: 100px;
    overflow-y: auto;
}

.snippet-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: #6c757d;
}

.snippet-actions {
    display: flex;
    gap: 0.5rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.snippet-card:hover .snippet-actions {
    opacity: 1;
}

.snippet-action-btn {
    background: none;
    border: none;
    color: #6c757d;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.snippet-action-btn:hover {
    background: #e9ecef;
    color: #495057;
}

.snippet-action-btn.delete:hover {
    background: #dc3545;
    color: white;
}

/* 空状态样式 */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #6c757d;
    grid-column: 1 / -1;
}

.empty-state i {
    font-size: 3rem;
    color: #dee2e6;
    margin-bottom: 1rem;
}

.empty-state h6 {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #495057;
}

.empty-state p {
    font-size: 0.875rem;
    margin: 0;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .main-content {
        padding: 1rem 0;
    }

    .toolbar-section {
        padding: 1rem;
        margin-bottom: 1.5rem;
    }

    .category-tabs {
        gap: 0.25rem;
    }

    .category-tab {
        padding: 0.5rem 0.75rem;
        font-size: 0.75rem;
    }

    .config-panel {
        padding: 1rem;
        margin-bottom: 1.5rem;
    }

    .code-panel {
        padding: 1rem;
    }

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

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

    .preview-container.tablet,
    .preview-container.mobile {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .display-5 {
        font-size: 2rem;
    }

    .lead {
        font-size: 1rem;
    }

    .config-group label {
        font-size: 0.875rem;
    }

    .form-control,
    .form-select {
        font-size: 0.875rem;
    }

    .btn-group .btn {
        font-size: 0.75rem;
        padding: 0.5rem 0.75rem;
    }

    .code-textarea {
        font-size: 0.75rem;
    }

    .analysis-value {
        font-size: 1.25rem;
    }
}

/* 深色主题支持 */
@media (prefers-color-scheme: dark) {
    .css-generator-tool {
        background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    }

    .toolbar-section,
    .config-panel,
    .code-panel {
        background: #2d3748;
        color: #e2e8f0;
    }

    .config-section h6,
    .code-section h5,
    .preview-section h5,
    .analysis-section h5 {
        color: #e2e8f0;
        border-color: #718096;
    }

    .form-select,
    .form-control {
        background: #4a5568;
        border-color: #718096;
        color: #e2e8f0;
    }

    .form-select:focus,
    .form-control:focus {
        background: #2d3748;
        border-color: #667eea;
    }

    .config-group label {
        color: #a0aec0;
    }

    .category-tab {
        background: #4a5568;
        border-color: #718096;
        color: #e2e8f0;
    }

    .category-tab:hover {
        border-color: #667eea;
        color: #667eea;
    }

    .code-editor {
        border-color: #718096;
    }

    .code-header {
        background: #4a5568;
        border-color: #718096;
    }

    .preview-container {
        background: #4a5568;
        border-color: #718096;
    }

    .preview-content {
        background: #2d3748;
    }

    .analysis-section {
        background: #4a5568;
    }

    .analysis-item {
        background: #2d3748;
    }

    .saved-snippets-section .card {
        background: #2d3748;
        color: #e2e8f0;
    }

    .snippet-card {
        background: #4a5568;
        border-color: #718096;
    }

    .snippet-title {
        color: #e2e8f0;
    }

    .snippet-preview {
        background: #1a202c;
        color: #e2e8f0;
    }

    .empty-state h6 {
        color: #e2e8f0;
    }

    .stat-item {
        background: #2d3748;
    }

    .stat-label {
        color: #a0aec0;
    }
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    .form-select,
    .form-control,
    .category-tab,
    .code-editor,
    .preview-container {
        border: 2px solid #000;
    }

    .config-panel,
    .code-panel,
    .toolbar-section {
        border: 2px solid #000;
    }
}

/* 减少动画偏好支持 */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* 打印样式 */
@media print {
    .toolbar-section,
    .config-actions,
    .snippet-actions {
        display: none !important;
    }

    .config-panel,
    .code-panel,
    .saved-snippets-section {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #000;
    }

    .snippet-card {
        break-inside: avoid;
    }
}