/* 系统架构设计师知识库 - 共享样式文件 */

/* 自定义样式 */
.knowledge-card {
    transition: all 0.3s ease;
}

.knowledge-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.search-highlight {
    background-color: #fef08a;
    padding: 0 2px;
    border-radius: 2px;
}

.sidebar-transition {
    transition: transform 0.3s ease;
}

@media (max-width: 768px) {
    .sidebar-hidden {
        transform: translateX(-100%);
    }
    
    /* 移动端架构图改进 */
    .architecture-diagram .flex {
        flex-direction: column !important;
    }
    
    .architecture-diagram .text-gray-400 {
        transform: rotate(90deg);
        margin: 0.5rem 0;
    }
    
    /* 移动端组件图改进 */
    .component-diagram .grid {
        grid-template-columns: 1fr !important;
        gap: 1rem;
    }
    
    /* 图表容器响应式 */
    .chart-container {
        padding: 1rem !important;
    }
}

@media (max-width: 480px) {
    .chart-container {
        padding: 0.5rem !important;
    }
    
    .knowledge-card {
        padding: 1rem !important;
    }
    
    /* 超小屏幕优化 */
    .architecture-diagram {
        min-width: auto !important;
        padding: 1rem !important;
    }
    
    .architecture-diagram .min-w-32 {
        min-width: auto !important;
        width: 100%;
    }
    
    .architecture-diagram .space-x-4 > * + * {
        margin-left: 0 !important;
        margin-top: 1rem;
    }
}

.progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(to right, #4f46e5, #7c3aed);
    z-index: 9999;
    transition: width 0.3s ease;
}

.floating-nav {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 40;
}

.floating-nav a {
    display: block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #e5e7eb;
    margin: 8px 0;
    transition: all 0.3s ease;
}

.floating-nav a.active {
    background: #4f46e5;
    transform: scale(1.2);
}

.floating-nav a:hover {
    background: #6366f1;
    transform: scale(1.1);
}

/* 标签页样式 */
.tab-container {
    margin-bottom: 2rem;
}

.tab-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid #e5e7eb;
}

.tab-button {
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-weight: 500;
    color: #6b7280;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.tab-button:hover {
    color: #4f46e5;
    border-bottom-color: #4f46e5;
}

.tab-button.active {
    color: #4f46e5;
    border-bottom-color: #4f46e5;
    background: #f3f4f6;
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 架构图表样式 */
.architecture-layer {
    position: relative;
    padding: 1rem;
    margin: 0.5rem 0;
    border-radius: 0.5rem;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-left: 4px solid #4f46e5;
}

.architecture-layer::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    background: #4f46e5;
    border-radius: 50%;
}

.component-box {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1rem;
    text-align: center;
    transition: all 0.3s ease;
}

.component-box:hover {
    border-color: #4f46e5;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.1);
}

.component-box.primary {
    border-color: #4f46e5;
    background: #eef2ff;
}

.component-box.secondary {
    border-color: #10b981;
    background: #ecfdf5;
}

.component-box.tertiary {
    border-color: #f59e0b;
    background: #fffbeb;
}

/* 案例研究样式 */
.case-study {
    border-left: 4px solid #4f46e5;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

.case-header {
    background: #4f46e5;
    color: white;
    padding: 1rem;
    border-radius: 0.5rem 0.5rem 0 0;
    margin: -1.5rem -1.5rem 1rem -1.5rem;
}

/* 代码块样式 */
.code-block {
    background: #1f2937;
    color: #f9fafb;
    padding: 1rem;
    border-radius: 0.5rem;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    overflow-x: auto;
}

.code-block .keyword {
    color: #60a5fa;
}

.code-block .string {
    color: #34d399;
}

.code-block .comment {
    color: #9ca3af;
    font-style: italic;
}

/* 架构模式卡片 */
.pattern-card {
    border: 2px solid #e5e7eb;
    border-radius: 0.75rem;
    padding: 1.5rem;
    background: white;
    transition: all 0.3s ease;
}

.pattern-card:hover {
    border-color: #4f46e5;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(79, 70, 229, 0.1);
}

.pattern-card.mvc {
    border-left-color: #ef4444;
    border-left-width: 4px;
}

.pattern-card.mvp {
    border-left-color: #10b981;
    border-left-width: 4px;
}

.pattern-card.mvvm {
    border-left-color: #f59e0b;
    border-left-width: 4px;
}

.pattern-card.layered {
    border-left-color: #8b5cf6;
    border-left-width: 4px;
}

/* 性能指标样式 */
.metric-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 0.75rem;
    padding: 1.5rem;
    text-align: center;
}

.metric-value {
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.metric-label {
    font-size: 0.875rem;
    opacity: 0.9;
}

/* 响应式表格 */
.responsive-table {
    overflow-x: auto;
}

.responsive-table table {
    min-width: 600px;
    width: 100%;
}

/* 安全架构样式 */
.security-layer {
    position: relative;
    padding: 1rem;
    margin: 0.5rem 0;
    border-radius: 0.5rem;
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border-left: 4px solid #dc2626;
    transition: all 0.3s ease;
}

.security-layer:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.1);
}

.security-layer::before {
    content: '🔒';
    position: absolute;
    left: -12px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    background: #dc2626;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.threat-level-high {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border-left-color: #dc2626;
}

.threat-level-medium {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border-left-color: #f59e0b;
}

.threat-level-low {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border-left-color: #22c55e;
}

.security-metric {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    color: white;
    border-radius: 0.75rem;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
}

.security-metric:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(220, 38, 38, 0.2);
}

/* 性能架构样式 */
.performance-layer {
    position: relative;
    padding: 1rem;
    margin: 0.5rem 0;
    border-radius: 0.5rem;
    background: linear-gradient(135deg, #fff7ed 0%, #fed7aa 100%);
    border-left: 4px solid #ea580c;
    transition: all 0.3s ease;
}

.performance-layer:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(234, 88, 12, 0.1);
}

.performance-layer::before {
    content: '⚡';
    position: absolute;
    left: -12px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    background: #ea580c;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.performance-metric {
    background: linear-gradient(135deg, #ea580c 0%, #c2410c 100%);
    color: white;
    border-radius: 0.75rem;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
}

.performance-metric:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(234, 88, 12, 0.2);
}

.performance-good {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border-left-color: #22c55e;
}

.performance-warning {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border-left-color: #f59e0b;
}

.performance-critical {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border-left-color: #dc2626;
}

/* 图表容器增强 */
.chart-container {
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.chart-container:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

/* 交互式表格 */
.interactive-table {
    overflow: hidden;
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.interactive-table table {
    width: 100%;
    border-collapse: collapse;
}

.interactive-table th {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: white;
    padding: 1rem;
    text-align: left;
    font-weight: 600;
}

.interactive-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e5e7eb;
    transition: background-color 0.2s ease;
}

.interactive-table tr:hover td {
    background-color: #f8fafc;
}

.interactive-table tr:last-child td {
    border-bottom: none;
}

/* 状态指示器 */
.status-indicator {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-high {
    background-color: #fee2e2;
    color: #dc2626;
}

.status-medium {
    background-color: #fef3c7;
    color: #d97706;
}

.status-low {
    background-color: #dcfce7;
    color: #16a34a;
}

/* 动画效果 */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.pulse-animation {
    animation: pulse 2s infinite;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-in-up {
    animation: slideInUp 0.6s ease-out;
}

/* 打印样式 */
@media print {
    .sidebar, .floating-nav, #back-to-top, nav {
        display: none !important;
    }

    main {
        margin-left: 0 !important;
        padding: 1rem !important;
    }

    .knowledge-card, .chart-container {
        break-inside: avoid;
        box-shadow: none !important;
        border: 1px solid #e5e7eb !important;
    }

    .security-layer, .performance-layer {
        break-inside: avoid;
    }
}
