/* ===== 全局样式 ===== */
:root {
    --primary-green: #2d8659;
    --light-green: #4CAF50;
    --dark-green: #1b5e3f;
    --success-green: #52c41a;
    --bg-light: #f0f7f4;
    --bg-white: #ffffff;
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --border-color: #d5e8df;
    --shadow-sm: 0 2px 8px rgba(45, 134, 89, 0.08);
    --shadow-md: 0 4px 16px rgba(45, 134, 89, 0.12);
    --shadow-lg: 0 8px 24px rgba(45, 134, 89, 0.15);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #f0f7f4 0%, #e8f5e9 100%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* ===== 顶部导航栏 ===== */
.header {
    background: linear-gradient(135deg, var(--primary-green) 0%, var(--dark-green) 100%);
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 70px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
    font-size: 22px;
    font-weight: 600;
}

.logo i {
    font-size: 28px;
}

.tabs {
    display: flex;
    gap: 8px;
}

.tab-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid transparent;
    color: rgba(255, 255, 255, 0.85);
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.tab-btn.active {
    background: white;
    color: var(--primary-green);
    border-color: white;
}

/* ===== 主内容区 ===== */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px 20px;
}

.tab-content {
    display: none;
    animation: fadeIn 0.4s ease;
}

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

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

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

.page-header h2 {
    font-size: 28px;
    color: var(--primary-green);
    display: flex;
    align-items: center;
    gap: 12px;
}

.current-time {
    background: white;
    padding: 10px 20px;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    font-weight: 600;
    color: var(--primary-green);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.demo-time {
    background: linear-gradient(135deg, #ffc107 0%, #ff9800 100%);
    padding: 10px 20px;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    font-weight: 700;
    color: white;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: pulse 2s ease-in-out infinite;
}

.demo-time::before {
    content: '⏱️';
    font-size: 20px;
}

.demo-speed {
    font-size: 12px;
    opacity: 0.9;
    font-weight: 500;
}

/* ===== 任务提醒栏 ===== */
.task-notification {
    background: linear-gradient(135deg, #fff3cd 0%, #ffe69c 100%);
    border-left: 4px solid #ffc107;
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
    color: #856404;
    box-shadow: var(--shadow-sm);
    animation: slideDown 0.4s ease;
}

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

.task-notification i {
    font-size: 20px;
}

/* ===== 实时监控页面 ===== */
.monitor-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 25px;
}

.sensor-card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.sensor-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--light-green);
    transform: translateY(-2px);
}

.sensor-card h3 {
    color: var(--primary-green);
    margin-bottom: 20px;
    font-size: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sensor-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.sensor-item:last-child {
    border-bottom: none;
}

.sensor-label {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
    font-size: 14px;
}

.sensor-label i {
    width: 20px;
    text-align: center;
    color: var(--primary-green);
}

.sensor-value {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary-green);
}

.sensor-unit {
    font-size: 13px;
    color: var(--text-secondary);
    margin-left: 3px;
}

/* ===== 设备管理页面 ===== */
.devices-main-container {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 25px;
    min-height: calc(100vh - 220px);
}

.devices-left {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: var(--shadow-sm);
}

.devices-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
}

.device-card {
    background: linear-gradient(135deg, #f8fffe 0%, #f0f9f6 100%);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.device-card:hover {
    border-color: var(--light-green);
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
}

.device-status {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--success-green);
    box-shadow: 0 0 8px rgba(82, 196, 26, 0.6);
}

.device-status.offline {
    background: #d9d9d9;
    box-shadow: none;
}

.device-icon {
    width: 50px;
    height: 50px;
    background: var(--primary-green);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    margin-bottom: 15px;
}

.device-card h4 {
    color: var(--primary-green);
    font-size: 16px;
    margin-bottom: 8px;
}

.device-meta {
    display: flex;
    gap: 15px;
    font-size: 13px;
    color: var(--text-secondary);
}

.device-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* 右侧任务状态面板 */
.devices-right {
    position: sticky;
    top: 100px;
    max-height: calc(100vh - 120px);
}

.task-status-panel {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.task-status-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

.task-status-header h3 {
    color: var(--primary-green);
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.current-task-section,
.next-task-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.current-task-section h4,
.next-task-section h4 {
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.current-task-section h4 i {
    color: var(--success-green);
}

.next-task-section h4 i {
    color: #ffc107;
}

.task-display-card {
    background: linear-gradient(135deg, #f8fffe 0%, #f0f9f6 100%);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    padding: 20px;
    transition: all 0.3s ease;
}

.task-display-card.empty {
    text-align: center;
    padding: 40px 20px;
    background: var(--bg-light);
    border-style: dashed;
}

.task-display-card.empty i {
    font-size: 32px;
    color: var(--border-color);
    margin-bottom: 10px;
    display: block;
}

.task-display-card.empty p {
    font-size: 13px;
    color: var(--text-secondary);
}

.task-display-card.active {
    border-color: var(--success-green);
    background: linear-gradient(135deg, #f6ffed 0%, #d9f7be 100%);
    animation: pulse 2s ease-in-out infinite;
}

.task-display-time {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-green);
    margin-bottom: 10px;
}

.task-display-device {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 5px;
    font-size: 16px;
}

.task-display-action {
    font-size: 14px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.task-display-action i {
    color: var(--primary-green);
}

.task-display-duration {
    display: inline-block;
    background: var(--primary-green);
    color: white;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    margin-left: 8px;
}

.task-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    padding-top: 15px;
    border-top: 2px solid var(--border-color);
}

.stat-item {
    text-align: center;
    padding: 15px;
    background: var(--bg-light);
    border-radius: 8px;
}

.stat-label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.stat-value {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-green);
}

/* 任务管理弹窗 */
.modal-large {
    max-width: 900px;
}

.manage-modal-header {
    margin-bottom: 20px;
}

.task-list-full {
    max-height: 500px;
    overflow-y: auto;
    padding-right: 10px;
}

.task-list-item {
    background: linear-gradient(135deg, #f8fffe 0%, #f0f9f6 100%);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.task-list-item:hover {
    border-color: var(--light-green);
    box-shadow: var(--shadow-sm);
}

.task-list-item-info {
    flex: 1;
}

.task-list-time {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-green);
    margin-bottom: 5px;
}

.task-list-device {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 3px;
}

.task-list-action {
    font-size: 14px;
    color: var(--text-secondary);
}

.task-list-actions {
    display: flex;
    gap: 8px;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 5px;
    color: var(--text-secondary);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: var(--bg-light);
    color: var(--primary-green);
}

.btn-icon.delete:hover {
    background: #fff1f0;
    color: #ff4d4f;
}

.empty-task-list {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-secondary);
}

.empty-task-list i {
    font-size: 64px;
    color: var(--border-color);
    margin-bottom: 20px;
}

.empty-task-list p {
    font-size: 14px;
    margin-bottom: 20px;
}

/* ===== 按钮样式 ===== */
.btn-primary, .btn-secondary, .btn-control {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-green) 0%, var(--dark-green) 100%);
    color: white;
}

.btn-primary:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.btn-secondary {
    background: #f5f5f5;
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.btn-control {
    background: white;
    color: var(--primary-green);
    border: 2px solid var(--primary-green);
    flex: 1;
}

.btn-control:hover {
    background: var(--primary-green);
    color: white;
}

.btn-small {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    background: var(--primary-green);
    color: white;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-small:hover {
    background: var(--dark-green);
    box-shadow: var(--shadow-sm);
}

/* ===== 弹窗样式 ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 2px solid var(--border-color);
}

.modal-header h3 {
    color: var(--primary-green);
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.btn-close:hover {
    background: var(--bg-light);
    color: var(--primary-green);
}

.modal-body {
    padding: 25px;
}

.device-info {
    background: var(--bg-light);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-weight: 500;
}

.form-input {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-green);
    box-shadow: 0 0 0 3px rgba(45, 134, 89, 0.1);
}

.current-tasks {
    margin-top: 25px;
}

.current-tasks h4 {
    color: var(--primary-green);
    margin-bottom: 15px;
    font-size: 16px;
}

#currentTasksList {
    max-height: 200px;
    overflow-y: auto;
}

.task-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: var(--bg-light);
    border-radius: 6px;
    margin-bottom: 8px;
}

.task-item:last-child {
    margin-bottom: 0;
}

.task-item-info {
    flex: 1;
}

.task-time {
    font-weight: 600;
    color: var(--primary-green);
}

.task-action {
    font-size: 13px;
    color: var(--text-secondary);
}

.btn-delete-task {
    background: #ff4d4f;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
}

.btn-delete-task:hover {
    background: #ff7875;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 20px 25px;
    border-top: 2px solid var(--border-color);
}

/* ===== 算法演示页面 ===== */
.algorithm-container {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 25px;
    min-height: calc(100vh - 220px);
}

.visualization-panel {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: var(--shadow-sm);
}

.algo-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
}

.algo-tab-btn {
    background: none;
    border: none;
    padding: 10px 20px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-secondary);
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.algo-tab-btn:hover {
    color: var(--primary-green);
}

.algo-tab-btn.active {
    color: var(--primary-green);
    border-bottom-color: var(--primary-green);
}

.algo-view {
    display: none;
}

.algo-view.active {
    display: block;
    animation: fadeIn 0.4s ease;
}

.algo-description {
    background: var(--bg-light);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 25px;
    border-left: 4px solid var(--primary-green);
}

.algo-description h3 {
    color: var(--primary-green);
    margin-bottom: 10px;
    font-size: 18px;
}

.algo-description p {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.8;
}

.heap-visualization, .array-visualization {
    min-height: 400px;
    padding: 20px;
}

/* 最小堆节点样式 */
.heap-tree {
    position: relative;
    width: 100%;
    min-width: 1000px;
    min-height: 500px;
    padding: 20px;
    overflow-x: auto;
}

.heap-node {
    background: linear-gradient(135deg, var(--light-green) 0%, var(--primary-green) 100%);
    color: white;
    padding: 15px;
    border-radius: 10px;
    width: 120px;
    text-align: center;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
    position: absolute;
    z-index: 1;
}

.heap-node.highlight {
    animation: pulse 0.6s ease;
    box-shadow: 0 0 20px rgba(76, 175, 80, 0.8);
}

.heap-node.removing {
    animation: fadeOut 0.6s ease;
    background: linear-gradient(135deg, #ff4d4f 0%, #ff7875 100%);
}

.heap-node.empty {
    background: transparent;
    border: 3px dashed var(--border-color);
    animation: blink 1s ease-in-out;
}

.heap-node-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
}

.heap-node-empty i {
    font-size: 32px;
    color: var(--border-color);
}

.heap-node-empty span {
    font-size: 12px;
}

.heap-node.will-move {
    animation: glow 0.8s ease-in-out;
    background: linear-gradient(135deg, #1890ff 0%, #40a9ff 100%);
}

.heap-node.just-moved {
    animation: slideIn 0.6s ease;
    background: linear-gradient(135deg, var(--success-green) 0%, var(--light-green) 100%);
}

.heap-node.comparing-children {
    background: linear-gradient(135deg, #ffc107 0%, #ff9800 100%);
    animation: pulse 0.6s ease;
}

.heap-node.smaller-child {
    background: linear-gradient(135deg, #722ed1 0%, #9254de 100%);
    animation: glow 0.8s ease-in-out;
}

.heap-node.comparing {
    background: linear-gradient(135deg, #ffc107 0%, #ff9800 100%);
}

.heap-node.swapping {
    background: linear-gradient(135deg, #ffc107 0%, #ff9800 100%);
    animation: shake 0.5s ease;
}

.heap-node-badge {
    position: absolute;
    top: -10px;
    right: -10px;
    background: #722ed1;
    color: white;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(114, 46, 209, 0.4);
    white-space: nowrap;
    z-index: 10;
}

/* 操作提示框样式 - 优化版：固定占位，柔和风格 */
.operation-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 15px;
    margin-bottom: 15px;
    min-height: 36px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s ease;
    opacity: 0;
    visibility: hidden;
}

/* 有内容时显示 */
.operation-hint.active {
    opacity: 1;
    visibility: visible;
}

.operation-hint.compare {
    background: rgba(255, 193, 7, 0.12);
    color: #f57c00;
    border: 1px solid rgba(255, 152, 0, 0.3);
}

.operation-hint.swap {
    background: rgba(244, 67, 54, 0.12);
    color: #d32f2f;
    border: 1px solid rgba(244, 67, 54, 0.3);
}

.operation-hint.select {
    background: rgba(156, 39, 176, 0.12);
    color: #7b1fa2;
    border: 1px solid rgba(156, 39, 176, 0.3);
}

.operation-hint .hint-icon {
    font-size: 16px;
    display: flex;
    align-items: center;
}

.operation-hint .hint-text {
    text-align: center;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-5px);
    }
    75% {
        transform: translateX(5px);
    }
}

@keyframes fadeOut {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0.3;
        transform: scale(0.8);
    }
}

@keyframes blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes glow {
    0%, 100% {
        box-shadow: var(--shadow-md);
    }
    50% {
        box-shadow: 0 0 30px rgba(24, 144, 255, 0.8);
    }
}

@keyframes slideIn {
    0% {
        transform: translateY(-30px);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

.heap-node-time {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 5px;
}

.heap-node-device {
    font-size: 12px;
    opacity: 0.9;
}

/* 数组可视化样式 */
.array-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.array-item {
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.array-item.highlight {
    border-color: var(--light-green);
    background: linear-gradient(135deg, #f0f9f6 0%, #e8f5e9 100%);
    animation: pulse 0.6s ease;
}

.array-item.checking {
    background: #fff3cd;
    border-color: #ffc107;
}

.array-item.is-min {
    border-color: #722ed1;
    background: linear-gradient(135deg, #f9f0ff 0%, #efdbff 100%);
}

.array-item.new-min {
    border-color: var(--success-green);
    background: linear-gradient(135deg, #f6ffed 0%, #d9f7be 100%);
    animation: pulse 0.6s ease;
}

.array-item-info {
    flex: 1;
}

.array-item-time {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary-green);
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 5px;
}

.array-item-device {
    font-size: 14px;
    color: var(--text-secondary);
}

.array-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.array-badge.current-min {
    background: #722ed1;
    color: white;
}

.array-badge.new-min {
    background: var(--success-green);
    color: white;
    animation: pulse 0.6s ease;
}

.array-badge.found {
    background: var(--light-green);
    color: white;
}

/* 右侧步骤面板 */
.steps-panel {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 100px;
    max-height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
}

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

.steps-header h3 {
    color: var(--primary-green);
    font-size: 18px;
}

.step-counter {
    background: var(--primary-green);
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.control-buttons {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.steps-list {
    flex: 1;
    overflow-y: auto;
    padding-right: 5px;
}

.step-item {
    background: var(--bg-light);
    border-left: 3px solid var(--border-color);
    padding: 12px 15px;
    border-radius: 6px;
    margin-bottom: 10px;
    font-size: 14px;
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

.step-item.active {
    background: linear-gradient(135deg, #e8f5e9 0%, #f0f9f6 100%);
    border-left-color: var(--primary-green);
    color: var(--primary-green);
    font-weight: 500;
    box-shadow: var(--shadow-sm);
}

.step-item.completed {
    opacity: 0.6;
}

/* 自定义滚动条 */
.steps-list::-webkit-scrollbar,
#currentTasksList::-webkit-scrollbar {
    width: 6px;
}

.steps-list::-webkit-scrollbar-track,
#currentTasksList::-webkit-scrollbar-track {
    background: var(--bg-light);
    border-radius: 3px;
}

.steps-list::-webkit-scrollbar-thumb,
#currentTasksList::-webkit-scrollbar-thumb {
    background: var(--primary-green);
    border-radius: 3px;
}

.steps-list::-webkit-scrollbar-thumb:hover,
#currentTasksList::-webkit-scrollbar-thumb:hover {
    background: var(--dark-green);
}

/* ===== 性能对比模态框 ===== */
.modal-performance {
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
}

.btn-performance-trigger {
    background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
    color: white;
}

.btn-performance-trigger:hover {
    background: linear-gradient(135deg, #1976D2 0%, #1565C0 100%);
    color: white;
}

.btn-insert-task {
    background: linear-gradient(135deg, #9C27B0 0%, #7B1FA2 100%);
    color: white;
}

.btn-insert-task:hover {
    background: linear-gradient(135deg, #7B1FA2 0%, #6A1B9A 100%);
    color: white;
}

/* ===== 模式切换 ===== */
.mode-switch {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    padding: 15px;
    background: var(--bg-light);
    border-radius: 10px;
    border: 2px solid var(--border-color);
}

.mode-btn {
    flex: 1;
    padding: 10px 15px;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.mode-btn:hover {
    border-color: var(--primary-green);
    color: var(--primary-green);
    transform: translateY(-1px);
}

.mode-btn.active {
    background: linear-gradient(135deg, var(--primary-green) 0%, var(--dark-green) 100%);
    color: white;
    border-color: var(--primary-green);
    box-shadow: 0 4px 12px rgba(45, 134, 89, 0.3);
}

.mode-btn.active:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(45, 134, 89, 0.4);
}

/* ===== 设备任务信息 ===== */
.device-tasks-info {
    margin-top: 10px;
    font-size: 13px;
    color: var(--primary-green);
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.queued-badge {
    background: var(--primary-green);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
}

/* ===== 设备任务模态框 ===== */
.modal-device-tasks {
    max-width: 600px;
    max-height: 80vh;
}

.device-tasks-tip {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    border-left: 4px solid var(--primary-green);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.device-tasks-tip i {
    font-size: 20px;
    color: var(--primary-green);
    margin-top: 2px;
}

.device-tasks-tip p {
    margin: 0;
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 14px;
}

.device-tasks-list {
    max-height: 400px;
    overflow-y: auto;
}

.device-task-item {
    background: var(--bg-light);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 12px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.device-task-item.in-queue {
    border-color: var(--primary-green);
    background: linear-gradient(135deg, #f1f8f4 0%, #e8f5e9 100%);
}

.device-task-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.device-task-time {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-green);
}

.device-task-status {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 600;
}

.device-task-status.not-queued {
    background: #e0e0e0;
    color: #666;
}

.device-task-status.queued {
    background: var(--primary-green);
    color: white;
}

.device-task-action {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 10px;
}

.device-task-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.device-task-duration {
    font-size: 13px;
    color: var(--text-secondary);
}

.btn-add-to-queue {
    padding: 6px 15px;
    background: linear-gradient(135deg, var(--primary-green) 0%, var(--dark-green) 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-add-to-queue:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(45, 134, 89, 0.3);
}

.btn-add-to-queue:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.btn-remove-from-queue {
    padding: 6px 15px;
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-remove-from-queue:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 152, 0, 0.3);
}

/* ===== 插入任务模态框 ===== */
.modal-insert-task {
    max-width: 500px;
}

.insert-task-form {
    background: var(--bg-light);
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    font-size: 14px;
}

.form-group input[type="time"],
.form-group input[type="text"] {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s ease;
    font-family: inherit;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-green);
    box-shadow: 0 0 0 3px rgba(45, 134, 89, 0.1);
}

.btn-insert {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, var(--primary-green) 0%, var(--dark-green) 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(45, 134, 89, 0.3);
}

.btn-insert:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(45, 134, 89, 0.4);
}

.insert-tip {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border-left: 4px solid #2196F3;
    padding: 15px;
    border-radius: 8px;
}

.insert-tip i {
    font-size: 20px;
    color: #2196F3;
    margin-top: 2px;
}

.insert-tip p {
    margin: 0;
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 14px;
}

.algo-complexity-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 25px;
}

.complexity-card {
    background: var(--bg-light);
    padding: 20px;
    border-radius: 10px;
    border-left: 4px solid var(--primary-green);
}

.complexity-card:last-child {
    border-left-color: #ff9800;
}

.complexity-card h4 {
    margin: 0 0 15px 0;
    color: var(--text-primary);
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.complexity-card p {
    margin: 8px 0;
    color: var(--text-secondary);
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.complexity-card code {
    background: white;
    color: var(--primary-green);
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    font-size: 13px;
}

.complexity-card:last-child code {
    color: #ff9800;
}

.performance-controls {
    background: var(--bg-light);
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 25px;
}

.control-group {
    margin-bottom: 25px;
}

.control-group label {
    display: block;
    font-weight: 600;
    font-size: 16px;
    color: var(--text-primary);
    margin-bottom: 15px;
}

.range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 5px;
}

.performance-controls input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: #e0e0e0;
    outline: none;
    -webkit-appearance: none;
    margin-bottom: 10px;
    position: relative;
}

.performance-controls input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-green);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(45, 134, 89, 0.4);
    transition: all 0.3s ease;
}

.performance-controls input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 3px 10px rgba(45, 134, 89, 0.6);
}

.performance-controls input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-green);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(45, 134, 89, 0.4);
    transition: all 0.3s ease;
}

.performance-controls input[type="range"]::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 3px 10px rgba(45, 134, 89, 0.6);
}

#taskCountValue {
    display: inline-block;
    min-width: 50px;
    font-weight: 700;
    font-size: 20px;
    color: var(--primary-green);
}

.btn-performance {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, var(--primary-green) 0%, var(--dark-green) 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(45, 134, 89, 0.3);
}

.btn-performance:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(45, 134, 89, 0.4);
}

.btn-performance:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.performance-results {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.performance-tip {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-secondary);
    padding: 30px 20px;
    text-align: center;
}

.performance-tip i {
    font-size: 24px;
    color: var(--primary-green);
}

.perf-summary {
    display: flex;
    justify-content: center;
    margin-bottom: 25px;
}

.perf-stat-card {
    background: linear-gradient(135deg, var(--primary-green) 0%, var(--dark-green) 100%);
    color: white;
    padding: 15px 30px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(45, 134, 89, 0.3);
}

.perf-label {
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 5px;
}

.perf-value {
    font-size: 32px;
    font-weight: 700;
}

.perf-comparison {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
}

.perf-algo-result {
    flex: 1;
    background: var(--bg-light);
    border-radius: 10px;
    padding: 20px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.perf-algo-result.heap-result {
    border-color: var(--primary-green);
}

.perf-algo-result.array-result {
    border-color: #ff9800;
}

.perf-algo-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border-color);
}

.perf-algo-header i {
    font-size: 20px;
}

.heap-result .perf-algo-header i {
    color: var(--primary-green);
}

.array-result .perf-algo-header i {
    color: #ff9800;
}

.perf-algo-header h4 {
    margin: 0;
    font-size: 16px;
    color: var(--text-primary);
}

.perf-metrics {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.perf-metric {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

.metric-label {
    font-size: 14px;
    color: var(--text-secondary);
}

.metric-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.metric-value.complexity {
    font-family: 'Courier New', monospace;
    background: white;
    padding: 4px 12px;
    border-radius: 6px;
    color: var(--primary-green);
    font-weight: 700;
}

.perf-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 24px;
}

.perf-improvement {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.improvement-card {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    padding: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.improvement-card i {
    font-size: 32px;
    opacity: 0.9;
}

.improvement-content {
    flex: 1;
}

.improvement-label {
    font-size: 13px;
    opacity: 0.9;
    margin-bottom: 5px;
}

.improvement-value {
    font-size: 24px;
    font-weight: 700;
}

.perf-conclusion {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border-left: 4px solid #2196F3;
    padding: 20px;
    border-radius: 8px;
    display: flex;
    align-items: flex-start;
    gap: 15px;
}

.perf-conclusion i {
    font-size: 24px;
    color: #2196F3;
    margin-top: 2px;
}

.perf-conclusion p {
    margin: 0;
    color: var(--text-primary);
    line-height: 1.6;
}

.perf-conclusion strong {
    color: var(--primary-green);
}

/* ===== 响应式设计 ===== */
@media (max-width: 1200px) {
    .algorithm-container {
        grid-template-columns: 1fr;
    }
    
    .steps-panel {
        position: static;
        max-height: none;
    }

    .devices-main-container {
        grid-template-columns: 1fr;
    }

    .devices-right {
        position: static;
        max-height: 500px;
    }
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }
    
    .tabs {
        width: 100%;
        flex-wrap: wrap;
    }
    
    .tab-btn {
        flex: 1;
        min-width: 100px;
        justify-content: center;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .monitor-grid {
        grid-template-columns: 1fr;
    }
    
    .devices-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        width: 95%;
        margin: 20px;
    }

    .perf-comparison {
        flex-direction: column;
    }

    .perf-divider {
        transform: rotate(90deg);
        margin: 10px 0;
    }

    .perf-improvement {
        grid-template-columns: 1fr;
    }

    .modal-performance {
        width: 95%;
        max-width: 95%;
    }

    .algo-complexity-info {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .logo {
        font-size: 18px;
    }
    
    .logo i {
        font-size: 22px;
    }
    
    .tab-btn {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .page-header h2 {
        font-size: 22px;
    }
}
