import styled from 'styled-components';

// 大屏容器
export const DashboardContainer = styled.div`
  width: 100%;
  height: 100%;
  /* background-color: #020B22; */
  
  color: #fff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  /* padding: 0 20px 20px; */
`;

// 头部标题，高度按设计稿占比自适应（213/2160 ≈ 9.86%）
export const Header = styled.div<{ secondScreen?: boolean; thirdScreen?: boolean }>`
  height: 9.6vh;
  min-height: 50px; // 防止极小屏幕下过小
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: flex-start; // 顶部对齐
  position: relative;
  background: url(${props => props.thirdScreen ? '/layout_header_bg3.png' : props.secondScreen ? '/layout_header_bg2.png' : '/layout_header_bg.png'}) no-repeat center center;
  background-size: 100% 100%;
  /* padding-top: 1.2vh; // 文案整体向上偏移，数值可根据实际视觉微调 */
  
  h1 {
    font-size: 36px;
    font-weight: bold;
    background: linear-gradient(to bottom, #fff, #7e9bcc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 2px;
  }
`;

// 时间显示
export const TimeDisplay = styled.div`
  position: absolute;
  right: 2vw;
  top: 68%;
  transform: translateY(-50%);
  font-size: 1.5vw;
  color: #fff;
`;

// 主内容区，占据剩余高度
export const Content = styled.div`
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  background-image: url('/layout_content_bg.png');
  background-repeat: no-repeat;
  background-size: 100% 100%;
`;

// 内容内层容器，负责grid布局和内边距
export const ContentInner = styled.div`
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(3, 1fr);
  column-gap: 2vw; // 列间距使用响应式单位
  row-gap: 1vw;    // 行间距使用响应式单位，减少垂直占用
  padding: 2.5vw;  // 减少内边距
  padding-top: 1.5vw; // 减少顶部内边距
  box-sizing: border-box;
`;

// 第二屏内容布局，左边上下两块，右边一整块
export const SecondScreenContentInner = styled.div`
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 30px;
  padding: 3.5vw;
  padding-top: 2.5vw;
  box-sizing: border-box;
  
  /* 第一个组件 - 左上 */
  & > div:nth-child(1) {
    grid-row: 1 / 2;
    grid-column: 1 / 2;
  }
  
  /* 第二个组件 - 左下 */
  & > div:nth-child(2) {
    grid-row: 2 / 3;
    grid-column: 1 / 2;
  }
  
  /* 第三个组件 - 右侧整块 */
  & > div:nth-child(3) {
    grid-row: 1 / 3;
    grid-column: 2 / 3;
  }
`;

// 第三屏内容布局，3x3网格布局
export const ThirdScreenContentInner = styled.div`
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  column-gap: 2.5vw; /* 列间距加宽，使用vw自适应 */
  row-gap: 1vw;    /* 行间距，使用vw自适应 */
  padding: 3vw;
  padding-top: 2vw;
  box-sizing: border-box;
`;

// 组件容器
export const ComponentContainer = styled.div`
  width: 100%;
  height: 100%;
  border-radius: 4px;
  position: relative;
`;

// 面板容器
export const PanelContainer = styled.div`
  position: relative;
  border-radius: 4px;

  padding: 15px;
  overflow: hidden;
`;

// 面板标题
export const PanelTitle = styled.div`
  height: 30px;
  display: flex;
  align-items: center;
  margin-bottom: 10px;
  font-size: 16px;
  color: #7e9bcc;
  
  &::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 16px;
    background: #00b4ff;
    margin-right: 8px;
  }
`;

// 图表容器
export const ChartContainer = styled.div`
  width: 100%;
  height: calc(100% - 40px);
`;

// 指标卡片容器
export const MetricsContainer = styled.div`
  display: flex;
  justify-content: space-around;
  align-items: center;
  height: 100%;
`;

// 单个指标卡片
export const MetricCard = styled.div`
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 10px;
  
  .title {
    font-size: 14px;
    color: #7e9bcc;
    margin-bottom: 5px;
  }
  
  .value {
    font-size: 24px;
    font-weight: bold;
    color: #00b4ff;
  }
  
  .change {
    font-size: 12px;
    margin-top: 5px;
    
    &.up {
      color: #f56c6c;
    }
    
    &.down {
      color: #67c23a;
    }
  }
`;

// 环形进度条容器
export const ProgressContainer = styled.div`
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
  
  .progress-value {
    position: absolute;
    font-size: 38px;
    color: #00b4ff;
    font-weight: bold;
  }
`;

// 底部导航，高度按设计稿占比自适应（72/2160 ≈ 3.33%）
export const Footer = styled.div`
  height: 3.33vh;
  min-height: 32px; // 防止极小屏幕下过小
  width: 100%;
  display: flex;
  justify-content: center;
  background: url('/bottomBg.png') no-repeat center center; // 底部背景图
  background-size: 100% 100%; // 背景自适应铺满
  
  .nav-item {
    min-width: 120px;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 180, 255, 0.1);
    border: 1px solid rgba(0, 180, 255, 0.3);
    margin: 0 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
    
    &:hover, &.active {
      background: rgba(0, 180, 255, 0.3);
    }
  }
`; 