/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-blue: #0066ff;
    --secondary-blue: #0099ff;
    --light-blue: #e6f2ff;
    --dark-blue: #003d99;
    --white: #ffffff;
    --light-gray: #f5f7fa;
    --border-gray: #e0e6ed;
    --text-dark: #2c3e50;
    --text-gray: #5a6c7d;
    --success: #00c853;
    --warning: #ffa726;
    --shadow: 0 4px 20px rgba(0, 102, 255, 0.1);
    --shadow-hover: 0 8px 30px rgba(0, 102, 255, 0.2);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #e6f2ff 0%, #ffffff 100%);
    color: var(--text-dark);
    min-height: 100vh;
    padding: 20px;
    overflow-x: hidden;
}

.container {
    max-width: 1800px;
    margin: 0 auto;
    position: relative;
}

.main-title {
    text-align: center;
    color: var(--primary-blue);
    font-size: 2.5rem;
    margin-bottom: 40px;
    text-shadow: 2px 2px 4px rgba(0, 102, 255, 0.1);
    animation: fadeInDown 0.8s ease-out;
}

.sub-title{
    text-align:right;
    color:rgb(24, 129, 190);
}

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

/* 控制面板 */
.control-panel {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
    animation: fadeInDown 0.8s ease-out;
}

.control-btn {
    background: linear-gradient(135deg, var(--primary-blue), var(--secondary-blue));
    color: var(--white);
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(0, 102, 255, 0.3);
    transition: all 0.3s ease;
}

.control-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 102, 255, 0.4);
}

.control-btn.paused {
    background: linear-gradient(135deg,rgb(218, 50, 24),rgb(247, 48, 3));
}

.control-icon {
    font-size: 1.2rem;
}

.control-hint {
    color: var(--text-gray);
    font-size: 0.9rem;
    padding: 8px 16px;
    background: var(--light-blue);
    border-radius: 20px;
}

.visualization-area {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 30px;
    position: relative;
    z-index: 1;
}

.section {
    background: var(--white);
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 24px;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    animation: fadeInUp 0.8s ease-out;
    animation-fill-mode: both;
}

.section:nth-child(1) { animation-delay: 0.1s; }
.section:nth-child(2) { animation-delay: 0.2s; }
.section:nth-child(3) { animation-delay: 0.3s; }

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

.section:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--light-blue);
}

.section-header h2 {
    color: var(--primary-blue);
    font-size: 1.5rem;
    font-weight: 600;
}

.badge {
    background: linear-gradient(135deg, var(--primary-blue), var(--secondary-blue));
    color: var(--white);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(0, 102, 255, 0.3);
}

/* 前端区域样式 */
.component-display {
    background: var(--light-gray);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    min-height: 200px;
    flex-grow: 1;
}

.ui-demo h3 {
    color: var(--text-dark);
    margin-bottom: 20px;
    font-size: 1.1rem;
}

/* 按钮容器 */
.button-container {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
}

.api-button {
    flex: 1;
    max-width: 200px;
    padding: 16px 24px;
    background: linear-gradient(135deg, var(--primary-blue), var(--secondary-blue));
    color: var(--white);
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 102, 255, 0.3);
}

.api-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 102, 255, 0.4);
}

.api-button:active {
    transform: translateY(0);
}

.button-icon {
    font-size: 1.3rem;
}

/* 数据渲染区域 */
.data-display {
    margin-top: 20px;
    background: var(--white);
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid var(--border-gray);
    transition: all 0.3s ease;
}

.data-display.has-data {
    border-color: var(--primary-blue);
    box-shadow: 0 0 15px rgba(0, 102, 255, 0.2);
}

.data-header {
    background: linear-gradient(135deg, var(--primary-blue), var(--secondary-blue));
    color: var(--white);
    padding: 10px 15px;
    font-weight: 600;
    font-size: 0.95rem;
}

.data-content {
    padding: 15px;
    max-height: 200px;
    overflow-y: auto;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.85rem;
}

.data-placeholder {
    color: var(--text-gray);
    text-align: center;
    padding: 20px;
    font-style: italic;
}

.data-item {
    background: var(--light-blue);
    padding: 8px 12px;
    margin: 5px 0;
    border-radius: 6px;
    border-left: 3px solid var(--primary-blue);
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.data-item strong {
    color: var(--dark-blue);
}

.data-item span {
    color: var(--text-gray);
}

/* 后端代码区域 */
.code-display {
    background: #1e1e1e;
    padding: 0;
    overflow: hidden;
}

.code-header {
    background: #2d2d2d;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #404040;
}

.code-file {
    color: #bbb;
    font-size: 0.9rem;
}

.code-dots {
    display: flex;
    gap: 8px;
}

.code-dots span {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.code-dots span:nth-child(1) { background: #ff5f56; }
.code-dots span:nth-child(2) { background: #ffbd2e; }
.code-dots span:nth-child(3) { background: #27c93f; }

pre {
    margin: 0;
    padding: 20px;
    overflow-x: auto;
    max-height: 400px;
}

code {
    color: #d4d4d4;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
}

/* 代码高亮 */
code .keyword { color: #ff79c6 !important; font-weight: bold; } /* 粉色关键字 */
code .string { color: #f1fa8c !important; } /* 黄色字符串 */
code .comment { color: #6272a4 !important; font-style: italic; } /* 蓝灰色注释 */
code .function { color: #50fa7b !important; } /* 绿色函数名 */
code .decorator { color: #bd93f9 !important; font-weight: bold; } /* 紫色装饰器 */
code .builtin { color: #8be9fd !important; } /* 青色内置函数 */
code .number { color: #bd93f9 !important; } /* 紫色数字 */
code .variable { color: #ffb86c !important; } /* 橙色变量 */

/* 控制台区域 */
.console-area {
    background: #1a1a1a;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.2);
}

.console-header {
    background: #2d2d2d;
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #404040;
}

.console-header span {
    color: #bbb;
    font-size: 0.9rem;
    font-weight: 600;
}

.clear-btn {
    background: transparent;
    border: 1px solid #555;
    color: #bbb;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.clear-btn:hover {
    background: #555;
    color: var(--white);
}

.console-content {
    padding: 12px;
    height: 150px;
    overflow-y: auto;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.85rem;
}

.console-line {
    padding: 4px 8px;
    margin: 2px 0;
    border-left: 3px solid transparent;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.console-line.info {
    color: #4fc3f7;
    border-left-color: #4fc3f7;
}

.console-line.success {
    color: #81c784;
    border-left-color: #81c784;
}

.console-line.request {
    color: #ffb74d;
    border-left-color: #ffb74d;
}

.console-line.error {
    color: #e57373;
    border-left-color: #e57373;
}

.console-line .timestamp {
    color: #888;
    margin-right: 8px;
}

/* 数据库区域 */
.database-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    flex-grow: 1;
}

.table-wrapper {
    background: var(--light-gray);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.table-wrapper.highlight {
    box-shadow: 0 0 20px rgba(0, 153, 255, 0.6);
    transform: scale(1.02);
}

.table-header {
    background: linear-gradient(135deg, var(--primary-blue), var(--secondary-blue));
    color: var(--white);
    padding: 12px 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.table-icon {
    font-size: 1.2rem;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
}

.data-table thead {
    background: var(--light-blue);
}

.data-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: var(--dark-blue);
    border-bottom: 2px solid var(--primary-blue);
}

.data-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border-gray);
    color: var(--text-gray);
}

.data-table tbody tr {
    transition: background 0.2s ease;
}

.data-table tbody tr:hover {
    background: var(--light-blue);
}

.data-table tbody tr.highlight-row {
    background: #fffde7;
    animation: pulse 0.6s ease-in-out;
}

@keyframes pulse {
    0%, 100% { background: var(--white); }
    50% { background: #fff9c4; }
}

.status-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

.status-badge.active {
    background: #c8e6c9;
    color: #2e7d32;
}

.status-badge.inactive {
    background: #ffccbc;
    color: #d84315;
}

.status-badge.warning {
    background: #fff9c4;
    color: #f57f17;
}

/* 动画层 */
.animation-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

.flow-particle {
    animation: flowAnimation 1.5s ease-in-out;
}

@keyframes flowAnimation {
    0% {
        opacity: 0;
        r: 2;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        r: 4;
    }
}

/* 响应式设计 */
@media (max-width: 1400px) {
    .visualization-area {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .section {
        max-width: 900px;
        margin: 0 auto;
    }
}

/* 滚动条样式 */
.console-content::-webkit-scrollbar,
pre::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.console-content::-webkit-scrollbar-track,
pre::-webkit-scrollbar-track {
    background: #1a1a1a;
}

.console-content::-webkit-scrollbar-thumb,
pre::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 4px;
}

.console-content::-webkit-scrollbar-thumb:hover,
pre::-webkit-scrollbar-thumb:hover {
    background: #777;
}

/* 加载动画 */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.loading {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--white);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
