/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

body {
    background-color: #000f2d;
    color: #fff;
    min-height: 100vh;
    overflow: hidden;
}

.container {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: 70px 25% 1fr;
    grid-template-areas:
        "header"
        "aside"
        "main";
    height: 100vh;
    padding: 15px;
    gap: 15px;
    position: relative;
}

/* 顶部区域样式 */
header {
    grid-area: header;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    background: linear-gradient(90deg, rgba(8, 29, 71, 0.9), rgba(9, 44, 108, 0.9));
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.header-title h1 {
    font-size: 28px;
    font-weight: bold;
    background: linear-gradient(to right, #75c6ef, #3d9eea, #75c6ef);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 0 10px rgba(77, 171, 247, 0.5);
}

.header-info {
    display: flex;
    align-items: center;
    font-size: 16px;
    color: #a8cdff;
}

/* 主内容区域样式 */
main {
    grid-area: main;
    position: relative;
    background: rgba(6, 23, 58, 0.8);
    border-radius: 8px;
    padding: 15px;
    overflow: hidden;
}

/* 养殖池区域样式 */
.pool-container {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.pool-row {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 12px;
    height: 48%;
}

.corridor {
    height: 30px;
    background: rgba(16, 41, 85, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 4px;
    color: #75c6ef;
    font-size: 16px;
    letter-spacing: 2px;
    margin: 6px 0;
}

.pool {
    background: rgba(14, 36, 77, 0.8);
    border: 1px solid #1e4585;
    border-radius: 8px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: all 0.4s cubic-bezier(0.215, 0.610, 0.355, 1.000);
    overflow: hidden;
    height: 100%;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.pool:hover {
    box-shadow: 0 0 20px rgba(77, 171, 247, 0.6);
    border-color: #3d9eea;
    transform: translateY(-3px) scale(1.02);
    z-index: 10;
}

.pool-header {
    font-size: 15px;
    font-weight: bold;
    text-align: center;
    padding: 5px 0;
    border-bottom: 1px solid #1e4585;
    color: #a8cdff;
    margin-bottom: 8px;
}

.pool-data {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 2px 0;
    flex-grow: 1;
}

.data-card {
    background: rgba(9, 29, 70, 0.5);
    border-radius: 5px;
    padding: 5px 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.data-card:hover {
    background: rgba(16, 41, 85, 0.7);
    transform: translateX(3px);
}

.data-title {
    font-size: 12px;
    color: #75c6ef;
}

.data-value {
    font-size: 14px;
    font-weight: bold;
    color: #fff;
}

.pool-video {
    width: 100%;
    margin-top: 8px;
    height: 60px;
    position: relative;
    border-radius: 6px;
    overflow: hidden;
}

.video-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.video-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
    background-color: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    border: 2px solid #fff;
    transition: all 0.3s ease;
    opacity: 0.8;
}

.video-play-btn:hover {
    transform: translate(-50%, -50%) scale(1.2);
    background-color: rgba(61, 158, 234, 0.8);
    opacity: 1;
}

.video-play-icon {
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 7px 0 7px 12px;
    border-color: transparent transparent transparent #ffffff;
    margin-left: 3px;
}

.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0) 50%);
    pointer-events: none;
}

.video-label {
    position: absolute;
    bottom: 5px;
    left: 8px;
    font-size: 10px;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

/* 视频播放区域 */
.video-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s ease;
}

.video-container.active {
    opacity: 1;
    visibility: visible;
}

.video-close {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 30px;
    color: #fff;
    cursor: pointer;
    z-index: 1001;
    transition: all 0.3s ease;
}

.video-close:hover {
    color: #3d9eea;
    transform: rotate(90deg);
}

#main-video {
    max-width: 90%;
    max-height: 90%;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
    border-radius: 8px;
}

/* 浮动图表 */
.chart-popup {
    position: fixed;
    width: 580px;
    height: 400px;
    background: rgba(8, 29, 71, 0.95);
    border: 1px solid #1e4585;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    z-index: 500;
    padding: 12px;
    overflow: auto;
    transform: scale(0.95);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    max-width: 90vw;
    max-height: 80vh;
}

.chart-popup.active {
    transform: scale(1);
    opacity: 1;
    visibility: visible;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    padding-bottom: 10px;
    border-bottom: 1px solid #1e4585;
    color: #75c6ef;
    position: sticky;
    top: 0;
    background: rgba(8, 29, 71, 0.95);
    z-index: 2;
    padding: 5px 0 10px 0;
}

.chart-close {
    cursor: pointer;
    font-size: 20px;
    transition: all 0.3s ease;
}

.chart-close:hover {
    color: #3d9eea;
    transform: rotate(90deg);
}

/* 图表卡片布局 */
.chart-cards-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding-top: 12px;
    height: calc(100% - 35px);
    overflow-y: auto;
}

.chart-card {
    background: rgba(14, 36, 77, 0.7);
    border-radius: 6px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    height: 165px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.chart-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.3);
}

.chart-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.chart-card-title {
    font-size: 14px;
    font-weight: bold;
    color: #75c6ef;
}

.chart-card-value {
    font-size: 18px;
    font-weight: bold;
    color: #fff;
}

.chart-card-container {
    flex-grow: 1;
    width: 100%;
    height: calc(100% - 28px);
}

/* 异常状态标记 */
.pool.warning {
    border: 2px solid #ff9800;
    animation: warning-pulse 2s infinite alternate;
}

.pool.danger {
    border: 2px solid #f44336;
    animation: danger-pulse 1.5s infinite alternate;
}

@keyframes warning-pulse {
    0% {
        box-shadow: 0 0 5px rgba(255, 152, 0, 0.3);
    }
    100% {
        box-shadow: 0 0 15px rgba(255, 152, 0, 0.7);
    }
}

@keyframes danger-pulse {
    0% {
        box-shadow: 0 0 5px rgba(244, 67, 54, 0.3);
    }
    100% {
        box-shadow: 0 0 20px rgba(244, 67, 54, 0.7);
    }
}

.data-value.warning {
    color: #ff9800;
}

.data-value.danger {
    color: #f44336;
    animation: text-pulse 1s infinite alternate;
}

@keyframes text-pulse {
    0% {
        opacity: 0.8;
    }
    100% {
        opacity: 1;
    }
}

.chart-card.warning .chart-card-value {
    color: #ff9800;
}

.chart-card.danger .chart-card-value {
    color: #f44336;
    animation: text-pulse 1s infinite alternate;
}

/* 右侧边栏样式 - 现在变成顶部区域 */
aside {
    grid-area: aside;
    display: flex;
    flex-direction: column;
    background: rgba(6, 23, 58, 0.8);
    border-radius: 8px;
    overflow: hidden;
}

.sidebar-container {
    height: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 15px;
    padding: 15px;
    overflow: hidden;
}

.sidebar-card {
    background: rgba(14, 36, 77, 0.7);
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s ease;
    height: 100%;
}

.sidebar-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.sidebar-card h3 {
    color: #75c6ef;
    font-size: 16px;
    margin-bottom: 10px;
    border-bottom: 1px solid #1e4585;
    padding-bottom: 5px;
}

.system-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    flex-grow: 1;
    overflow: hidden;
}

.stat-item {
    display: flex;
    flex-direction: column;
    background: rgba(8, 29, 71, 0.6);
    padding: 8px;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.stat-item:hover {
    background: rgba(16, 41, 85, 0.8);
    transform: translateX(3px);
}

.stat-label {
    font-size: 13px;
    color: #a8cdff;
}

.stat-value {
    font-size: 18px;
    font-weight: bold;
    color: #fff;
}

.task-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
    overflow-y: auto;
}

.task-list::-webkit-scrollbar {
    width: 5px;
}

.task-list::-webkit-scrollbar-track {
    background: transparent;
}

.task-list::-webkit-scrollbar-thumb {
    background-color: #1e4585;
    border-radius: 3px;
}

.task-item {
    background: rgba(8, 29, 71, 0.6);
    padding: 8px;
    border-radius: 6px;
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    align-items: center;
    transition: all 0.3s ease;
}

.task-item:hover {
    background: rgba(16, 41, 85, 0.8);
    transform: translateX(3px);
}

.task-item.active {
    background: rgba(28, 82, 151, 0.3);
    border-left: 3px solid #3d9eea;
    animation: active-task 2s infinite alternate;
}

@keyframes active-task {
    0% {
        background: rgba(28, 82, 151, 0.3);
    }
    100% {
        background: rgba(28, 82, 151, 0.5);
    }
}

.task-item.completed {
    background: rgba(14, 36, 77, 0.4);
}

.task-pool {
    font-weight: bold;
    color: #a8cdff;
}

.task-time {
    font-size: 14px;
    color: #fff;
}

.task-feed {
    display: flex;
    flex-direction: column;
}

.feed-amount {
    color: #fff;
    font-weight: bold;
}

.feed-remain {
    font-size: 12px;
    color: #a8cdff;
}

.task-status {
    text-align: right;
    font-size: 14px;
    color: #75c6ef;
}

.task-status.active {
    color: #4CAF50;
}

.logic-explanation {
    font-size: 13px;
    color: #a8cdff;
    line-height: 1.4;
    flex-grow: 1;
    overflow-y: auto;
}

.logic-explanation::-webkit-scrollbar {
    width: 5px;
}

.logic-explanation::-webkit-scrollbar-track {
    background: transparent;
}

.logic-explanation::-webkit-scrollbar-thumb {
    background-color: #1e4585;
    border-radius: 3px;
}

.logic-explanation ol {
    margin-left: 20px;
    margin-top: 8px;
}

.logic-explanation li {
    margin-bottom: 6px;
}

/* 响应式调整 */
@media screen and (max-width: 1600px) {
    .pool-row {
        grid-template-columns: repeat(6, 1fr);
    }
    
    .sidebar-container {
        grid-template-columns: 1fr 1fr 1fr 1fr;
    }
    
    .chart-popup {
        width: 520px;
        height: 380px;
    }
}

@media screen and (max-width: 1200px) {
    .container {
        grid-template-rows: 70px 30% 1fr;
    }
    
    .pool-row {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .sidebar-container {
        grid-template-columns: 1fr 1fr;
        overflow-y: auto;
    }
    
    .chart-popup {
        width: 480px;
        height: 360px;
    }
}

@media screen and (max-width: 768px) {
    .container {
        grid-template-rows: 70px 40% 1fr;
    }
    
    .sidebar-container {
        grid-template-columns: 1fr;
        overflow-y: auto;
    }
    
    .pool-row {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .chart-popup {
        width: 90vw;
        height: 80vh;
    }
}

/* 确保图表不超出窗口边界 */
.chart-popup.top-right {
    top: 10px;
    right: 10px;
}

.chart-popup.top-left {
    top: 10px;
    left: 10px;
}

.chart-popup.bottom-right {
    bottom: 10px;
    right: 10px;
}

.chart-popup.bottom-left {
    bottom: 10px;
    left: 10px;
}

/* 图表容器滚动条 */
.chart-cards-container::-webkit-scrollbar {
    width: 6px;
}

.chart-cards-container::-webkit-scrollbar-track {
    background: transparent;
}

.chart-cards-container::-webkit-scrollbar-thumb {
    background-color: #1e4585;
    border-radius: 3px;
} 