/* 基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #0a0e27 0%, #1a1b3c 50%, #2d1b69 100%);
    color: #ffffff;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 头部样式 */
.header {
    background: rgba(10, 14, 39, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
}

.logo {
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(45deg, #64b5f6, #42a5f5, #29b6f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav {
    display: flex;
    gap: 10px;
}

.nav-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    text-decoration: none;
    display: inline-block;
    user-select: none;
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}

.nav-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.nav-btn:hover::before {
    left: 100%;
}

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

.nav-btn:active {
    transform: translateY(0);
    transition: transform 0.1s ease;
}

.nav-btn.active {
    background: linear-gradient(45deg, #2196f3, #21cbf3);
    border-color: transparent;
    box-shadow: 0 4px 15px rgba(33, 150, 243, 0.3);
    transform: translateY(-1px);
    color: #ffffff;
}

.nav-btn.active::before {
    display: none;
}

/* 主要内容样式 */
.main {
    padding: 20px 0;
}

.view {
    display: none;
}

.view.active {
    display: block;
}

.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.view-header h2 {
    font-size: 28px;
    font-weight: 600;
}

/* 概览网格 */
.overview-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
    gap: 20px;
    margin-bottom: 20px;
}

.status-card,
.visualization-card,
.log-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    padding: 25px;
    transition: transform 0.3s ease;
}

.status-card:hover,
.visualization-card:hover,
.log-card:hover {
    transform: translateY(-5px);
}

.status-card h3,
.visualization-card h3,
.log-card h3 {
    font-size: 18px;
    margin-bottom: 20px;
    color: #64b5f6;
}

.status-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.metric {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.metric-label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 5px;
}

.metric-value {
    font-size: 24px;
    font-weight: 700;
    color: #64b5f6;
}

.viz-container,
.full-viz {
    width: 100%;
    height: 300px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    position: relative;
    overflow: hidden;
}

.full-viz {
    height: 600px;
}

/* 控制面板 */
.controls {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.control-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 12px;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.control-btn.active {
    background: linear-gradient(45deg, #2196f3, #21cbf3);
    border-color: transparent;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.control-group label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
}

.control-group input[type="range"] {
    width: 80px;
}

/* 协作网格 */
.collaboration-grid,
.tasks-grid,
.monitoring-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.collaboration-panel,
.tasks-panel,
.monitoring-panel {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    padding: 20px;
    min-height: 300px;
}

.collaboration-panel h3,
.tasks-panel h3,
.monitoring-panel h3 {
    font-size: 16px;
    margin-bottom: 15px;
    color: #64b5f6;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 10px;
}

/* 日志容器 */
.log-container {
    height: 200px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    padding: 10px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.4;
}

.log-entry {
    margin-bottom: 5px;
    padding: 3px 5px;
    border-radius: 3px;
}

.log-entry.info {
    color: #64b5f6;
}

.log-entry.success {
    color: #4caf50;
}

.log-entry.warning {
    color: #ff9800;
}

.log-entry.error {
    color: #f44336;
}

/* 按钮样式 */
.primary-btn,
.secondary-btn {
    padding: 10px 20px;
    border-radius: 25px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    min-height: 44px; /* Minimum touch target size */
    min-width: 44px;
}

.primary-btn {
    background: linear-gradient(45deg, #2196f3, #21cbf3);
    color: white;
    box-shadow: 0 4px 15px rgba(33, 150, 243, 0.3);
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(33, 150, 243, 0.4);
}

.secondary-btn {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 10000;
    justify-content: center;
    align-items: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: rgba(26, 27, 60, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    z-index: 10001;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    z-index: 10002;
}

.modal-header h3 {
    color: #64b5f6;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 5px;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    min-width: 44px;
}

.modal-close:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}

.modal-body {
    padding: 25px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 20px 25px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* 表单样式 */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    font-size: 14px;
    transition: border-color 0.3s ease;
    min-height: 44px; /* Minimum touch target size */
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #64b5f6;
}

.form-group input[type="range"] {
    width: auto;
    min-height: auto;
}

.capabilities {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.capabilities label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    cursor: pointer;
    min-height: 44px; /* Minimum touch target size */
}

.capabilities input[type="checkbox"] {
    width: auto;
    min-height: auto;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .header .container {
        flex-direction: column;
        gap: 15px;
    }

    .nav {
        flex-wrap: wrap;
        justify-content: center;
    }

    .overview-grid,
    .collaboration-grid,
    .tasks-grid,
    .monitoring-grid {
        grid-template-columns: 1fr;
    }

    .view-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

    .controls {
        width: 100%;
        justify-content: flex-start;
    }

    .modal-content {
        width: 95%;
        margin: 20px;
    }
    
    /* Network visualization adjustments */
    #network-graph {
        height: 400px;
    }
    
    /* Task chain visualization adjustments */
    #task-chain-graph {
        height: 400px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    .header .container {
        padding: 10px 15px;
    }
    
    .logo {
        font-size: 20px;
    }
    
    .nav-btn {
        padding: 8px 15px;
        font-size: 13px;
        min-height: 44px;
        min-width: 44px;
    }
    
    .main {
        padding: 15px 0;
    }
    
    .view-header h2 {
        font-size: 24px;
    }
    
    .status-card,
    .visualization-card,
    .log-card {
        padding: 20px;
    }
    
    .status-card h3,
    .visualization-card h3,
    .log-card h3 {
        font-size: 16px;
    }
    
    .metric-value {
        font-size: 20px;
    }
    
    .full-viz {
        height: 400px;
    }
    
    .controls {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .control-group {
        width: 100%;
    }
    
    .control-group input[type="range"] {
        width: 100%;
    }
    
    .collaboration-panel,
    .tasks-panel,
    .monitoring-panel {
        padding: 15px;
    }
    
    .modal-content {
        border-radius: 15px;
        width: 95%;
        max-width: none;
        margin: 10px;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 15px;
    }
    
    .form-group label {
        font-size: 13px;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 13px;
        padding: 8px 12px;
    }
    
    /* Network visualization adjustments */
    #network-graph {
        height: 300px;
    }
    
    /* Task chain visualization adjustments */
    #task-chain-graph {
        height: 300px;
    }
    
    /* Status grid adjustments */
    .status-grid {
        grid-template-columns: 1fr;
    }
    
    /* Performance grid adjustments */
    .performance-grid {
        grid-template-columns: 1fr;
    }
    
    /* Resource grid adjustments */
    .resource-grid {
        grid-template-columns: 1fr;
    }
    
    /* Agent metrics grid adjustments */
    .agent-metrics-grid {
        grid-template-columns: 1fr;
    }
    
    /* Activity feed adjustments */
    .activity-feed {
        max-height: 300px;
    }
    
    /* Task chain visualization section */
    #task-chain-visualization-section {
        margin-top: 20px;
    }
    
    #task-chain-details {
        padding: 12px;
    }
    
    /* Optimize for touch devices */
    .nav-btn,
    .control-btn,
    .btn,
    .modal-close {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Reduce hover effects on touch devices */
    @media (pointer: coarse) {
        .nav-btn:hover,
        .control-btn:hover,
        .btn:hover {
            transform: none;
        }
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 10px;
    }
    
    .header .container {
        padding: 8px 10px;
    }
    
    .logo {
        font-size: 18px;
    }
    
    .nav-btn {
        padding: 6px 12px;
        font-size: 12px;
        border-radius: 20px;
        min-height: 40px;
        min-width: 40px;
    }
    
    .main {
        padding: 10px 0;
    }
    
    .view-header h2 {
        font-size: 20px;
    }
    
    .status-card,
    .visualization-card,
    .log-card {
        padding: 15px;
    }
    
    .status-card h3,
    .visualization-card h3,
    .log-card h3 {
        font-size: 14px;
        margin-bottom: 15px;
    }
    
    .metric-value {
        font-size: 18px;
    }
    
    .full-viz {
        height: 300px;
    }
    
    .capabilities {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        width: 98%;
        margin: 10px;
        border-radius: 12px;
    }
    
    .modal-header h3 {
        font-size: 18px;
    }
    
    .modal-close {
        font-size: 20px;
        width: 30px;
        height: 30px;
        min-height: 30px;
        min-width: 30px;
    }
    
    /* Network visualization adjustments */
    #network-graph {
        height: 250px;
    }
    
    /* Task chain visualization adjustments */
    #task-chain-graph {
        height: 250px;
    }
    
    /* Dashboard section adjustments */
    .dashboard-section {
        padding: 15px;
    }
    
    .dashboard-section h2 {
        font-size: 1.3em;
    }
    
    /* Status info adjustments */
    .status-info h3 {
        font-size: 1.5em;
    }
    
    .status-info p {
        font-size: 0.8em;
    }
    
    /* Metric card adjustments */
    .metric-card h4 {
        font-size: 0.9em;
    }
    
    .metric-value {
        font-size: 1.5em;
    }
    
    /* Task chain details adjustments */
    #task-chain-details {
        padding: 10px;
        margin-top: 15px;
    }
    
    .agent-step-group {
        padding: 6px;
        margin-bottom: 10px;
    }
    
    .agent-step-group h6 {
        font-size: 0.8em;
    }
    
    .agent-step-group ul {
        padding-left: 15px;
    }
    
    .agent-step-group li {
        font-size: 0.8em;
    }
    
    /* Form adjustments for small screens */
    .form-group {
        margin-bottom: 15px;
    }
    
    .form-group label {
        font-size: 12px;
        margin-bottom: 6px;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 12px;
        padding: 8px 10px;
    }
    
    .capabilities label {
        font-size: 12px;
        min-height: 36px;
    }
    
    .primary-btn,
    .secondary-btn {
        padding: 8px 16px;
        font-size: 13px;
        min-height: 40px;
    }
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Mobile device specific styles */
.mobile-device {
    /* Reduce heavy animations on mobile */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

.mobile-device .nav-btn::before {
    display: none;
}

.mobile-device .status-card:hover,
.mobile-device .visualization-card:hover,
.mobile-device .log-card:hover {
    transform: none;
}

/* Adjust for touch devices */
@media (pointer: coarse) {
    .nav-btn,
    .control-btn,
    .btn,
    .modal-close {
        /* Increase touch targets */
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Reduce hover effects on touch devices */
    .nav-btn:hover,
    .control-btn:hover,
    .btn:hover {
        transform: none;
    }
    
    /* Adjust form elements for better touch experience */
    .form-group input,
    .form-group select,
    .form-group textarea {
        min-height: 44px;
    }
    
    .capabilities label {
        min-height: 44px;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.view.active {
    animation: fadeIn 0.5s ease;
}

/* 工具提示 */
.tooltip {
    position: relative;
    cursor: help;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1000;
}

.tooltip:hover::after {
    opacity: 1;
}

/* 数据可视化元素 */
.node {
    cursor: pointer;
    transition: all 0.3s ease;
}

.node:hover {
    stroke-width: 3px;
}

.link {
    stroke: rgba(255, 255, 255, 0.4);
    stroke-width: 1px;
    transition: all 0.3s ease;
}

.link.active {
    stroke: #64b5f6;
    stroke-width: 2px;
}

.force-label {
    font-size: 12px;
    fill: #ffffff;
    text-anchor: middle;
    pointer-events: none;
}

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

.status-indicator.online {
    background: #4caf50;
}

.status-indicator.busy {
    background: #ff9800;
}

.status-indicator.offline {
    background: #f44336;
}

.status-indicator.demo {
    background: #8b5cf6;
}

/* 进度条 */
.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #64b5f6, #42a5f5);
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* Network Graph Container */
#network-graph {
    width: 100%;
    height: 500px;
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
    border: 1px solid rgba(14, 165, 233, 0.3);
    position: relative;
    overflow: hidden;
}

/* Task Chain Graph Container */
#task-chain-graph {
    width: 100%;
    height: 500px;
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
    border: 1px solid rgba(14, 165, 233, 0.3);
    position: relative;
    overflow: hidden;
}

/* Topology Controls */
.topology-controls {
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.topology-controls select {
    padding: 5px;
    border-radius: 4px;
    border: 1px solid #ccc;
    background: white;
    min-width: 150px;
}

.topology-controls button {
    padding: 5px 10px;
    border-radius: 4px;
    background: #2196f3;
    color: white;
    border: none;
    cursor: pointer;
    font-size: 14px;
    min-height: 44px;
    min-width: 44px;
}

.topology-controls button:hover {
    background: #1976d2;
}

/* Mobile-specific adjustments for visualization containers */
@media (max-width: 768px) {
    #network-graph,
    #task-chain-graph {
        height: 350px;
        border-radius: 6px;
    }
    
    .topology-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .topology-controls select,
    .topology-controls button {
        width: 100%;
        margin-bottom: 5px;
        min-width: auto;
        padding: 8px;
        font-size: 14px;
        min-height: 44px;
    }
    
    .topology-controls select {
        background: rgba(255, 255, 255, 0.9);
    }
}

@media (max-width: 480px) {
    #network-graph,
    #task-chain-graph {
        height: 280px;
    }
    
    .topology-controls select,
    .topology-controls button {
        padding: 6px;
        font-size: 13px;
        min-height: 40px;
    }
}