/* ===== 基础页面布局样式 ===== */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;           /* 最小高度为整个视口高度 */
    overflow-x: hidden;          /* 隐藏水平滚动条 */
    margin: 0;
    padding: 0;
}

body.has-results {
    /* 检测结果出现后的样式 - 可在此添加特殊样式 */
}

.page-section {
    flex: 1;                     /* 占据剩余空间 */
}

.page-footer {
    margin-top: auto;            /* 页脚自动推到底部 */
}

/* ===== 检测框区域样式 ===== */
.banner-seo-check {
    padding: 0;
    flex: 1;                     /* 占据剩余空间 */
    display: flex;
   /* align-items: center;          垂直居中 */
    justify-content: center;     /* 水平居中 */
    transition: all 0.5s ease-in-out; /* 过渡动画 */
    
    /* 高度设置 - 可根据需要调整这些数值 */
    min-height: 300px;           /* 最小高度 */
    height: 70vh;                /* 视口高度的70% */
    max-height: 880px;           /* 最大高度限制 */
}

/* 检测结果出现后，检测框上移到顶部 */
body.has-results .banner-seo-check {
    flex: 0 0 auto;              /* 取消flex扩展 */
    height: auto;                /* 自动高度 */
    min-height: min-content;     /* 最小高度为内容高度 */
    align-items: flex-start;     /* 顶部对齐 */
    padding-top: 15px;           /* 顶部内边距 */
}

/* 检测框背景容器 */
.banner-seo-check .wrap {
    width: 100%;
    height: 100%;                /* 100%高度 */
    display: flex;
    align-items: center;         /* 垂直居中 */
    justify-content: center;     /* 水平居中 */
    background-size: cover;      /* 背景图片覆盖 */
    background-position: center; /* 背景图片居中 */
    transition: all 0.5s ease-in-out; /* 过渡动画 */
    position: relative;
}

/* 检测结果出现后的背景容器 */
body.has-results .banner-seo-check .wrap {
    height: auto;                /* 自动高度 */
    min-height: min-content;     /* 最小高度为内容高度 */
    align-items: flex-start;     /* 顶部对齐 */
    padding: 15px 0;             /* 上下内边距 */
}

/* 检测框内容容器 */
.banner-seo-check .container {
    width: 100%;
    max-width: 100%;             /* 最大宽度100% */
    padding: 0 15px;             /* 左右内边距 */
}

.banner-seo-check .row {
    margin: 0;                   /* 移除默认边距 */
}

.banner-seo-check .col-lg-8 {
    padding: 0;                  /* 移除默认内边距 */
}

/* ===== 标题区域样式 ===== */
.title-wrapper {
    position: relative;
    min-height: 80px;            /* 最小高度 */
    display: flex;
    align-items: center;         /* 垂直居中 */
    justify-content: center;     /* 水平居中 */
    margin-bottom: 2rem;         /* 底部外边距 */
}

/* Logo容器样式 */
.logo-container {
    transition: all 0.3s ease-in-out; /* 过渡动画 */
    margin-bottom: 2rem;         /* Logo底部外边距 */
}

/* 文字标题样式 */
.text-title {
    display: none;               /* 初始隐藏 */
    transition: all 0.3s ease-in-out; /* 过渡动画 */
    margin: 0;
    
    /* 文字标题的具体样式 - 可调整这些数值 */
    font-size: clamp(1.8rem, 4vw, 2.5rem); /* 响应式字体大小 */
    line-height: 1;            /* 行高 */
    margin-top: 5px;             /* 顶部外边距 - 控制文字距离顶部距离 */
    margin-bottom: 1.5rem !important; /* 底部外边距 - 控制文字与表单间距 */
    padding: 5px 0;              /* 上下内边距 */
}

/* 初始状态：显示Logo，隐藏文字 */
.logo-container {
    display: block;
}

.text-title {
    display: none;
}

/* 检测结果状态：隐藏Logo，显示文字 */
body.has-results .logo-container {
    display: none;
}

body.has-results .text-title {
    display: block;
    
    /* 结果状态下进一步调整 - 可调整这些数值 */
    margin-top: 8px;             /* 调整顶部距离 */
    margin-bottom: 1.2rem !important; /* 调整与表单间距 */
}

/* ===== 表单样式 ===== */
.banner-seo-check form {
    position: relative;
    max-width: 600px;            /* 表单最大宽度 */
    margin: 0 auto;              /* 水平居中 */
}

.banner-seo-check .form-control {
    padding-right: 120px;        /* 右侧内边距，为按钮留空间 */
    height: 50px;                /* 输入框高度 */
    border-radius: 25px;         /* 圆角边框 */
    font-size: 16px;             /* 字体大小 */
    max-width: 100%;             /* 最大宽度100% */
}

.banner-seo-check .btn-success {
    position: absolute;          /* 绝对定位 */
    right: 5px;                  /* 距离右侧5px */
    top: 5px;                    /* 距离顶部5px */
    height: 40px;                /* 按钮高度 */
    border-radius: 20px;         /* 圆角边框 */
    padding: 0 20px;             /* 内边距 */
    font-size: 14px;             /* 字体大小 */
}

/* ===== 检测结果区域样式 ===== */
.result-section {
    opacity: 0;                  /* 初始透明度为0（隐藏） */
    transform: translateY(20px); /* 初始位置下移20px */
    transition: all 0.5s ease-in-out; /* 过渡动画 */
    display: none;               /* 初始隐藏 */
    flex: 1;                     /* 占据剩余空间 */
    /* 关键修改：初始背景透明，与检测框背景融合 */
    background: transparent;
}

/* 显示结果时动画 */
body.has-results .result-section {
    opacity: 1;                  /* 完全显示 */
    transform: translateY(0);    /* 恢复到正常位置 */
    display: block;              /* 显示块元素 */
    /* 关键修改：检测结果出现后恢复白色背景 */
    background: white;
}

/* 结果容器样式 */
.result-container {
    /* 关键修改：初始背景透明 */
    background: transparent;
    border-radius: 8px;          /* 圆角边框 */
    padding: 20px;               /* 内边距 */
    margin: 20px auto;           /* 外边距，水平居中 */
    box-shadow: none;            /* 初始无阴影 */
    max-width: 1200px;           /* 最大宽度 */
    transition: all 0.5s ease-in-out; /* 添加过渡动画 */
}

/* 检测结果出现后的结果容器样式 */
body.has-results .result-container {
    background: white;           /* 恢复白色背景 */
    box-shadow: 0 3px 10px rgba(0,0,0,0.1); /* 恢复阴影效果 */
}

/* ===== 端口网格样式 ===== */
.port-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr); /* 5列网格 */
    gap: 8px;                    /* 网格间距 */
    margin: 15px 0;              /* 上下外边距 */
}

.port-item {
    /* 关键修改：初始背景半透明，与检测框背景融合 */
    background: rgba(248, 249, 250, 0.9); /* 半透明背景 */
    border-radius: 6px;          /* 圆角边框 */
    padding: 10px;               /* 内边距 */
    text-align: center;          /* 文字居中 */
    border: 2px solid rgba(233, 236, 239, 0.7); /* 半透明边框 */
    transition: all 0.3s ease;   /* 过渡动画 */
    min-height: 60px;            /* 最小高度 */
    display: flex;
    flex-direction: column;
    justify-content: center;     /* 垂直居中 */
}

/* 检测结果出现后的端口项样式 */
body.has-results .port-item {
    background: #f8f9fa;         /* 恢复不透明背景 */
    border: 2px solid #e9ecef;   /* 恢复不透明边框 */
}

/* 端口开放状态样式 */
.port-item.port-open {
    background: rgba(212, 237, 218, 0.9); /* 半透明绿色背景 */
    border-color: rgba(195, 230, 203, 0.7); /* 半透明绿色边框 */
    color: #155724;              /* 绿色文字 */
}

body.has-results .port-item.port-open {
    background: #d4edda;         /* 恢复不透明绿色背景 */
    border-color: #c3e6cb;       /* 恢复不透明绿色边框 */
}

/* 端口关闭状态样式 */
.port-item.port-closed {
    background: rgba(248, 215, 218, 0.9); /* 半透明红色背景 */
    border-color: rgba(245, 198, 203, 0.7); /* 半透明红色边框 */
    color: #721c24;              /* 红色文字 */
}

body.has-results .port-item.port-closed {
    background: #f8d7da;         /* 恢复不透明红色背景 */
    border-color: #f5c6cb;       /* 恢复不透明红色边框 */
}

/* 端口数字样式 */
.port-number {
    font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Verdana', sans-serif;
    font-size: 18px;             /* 字体大小 */
    font-weight: 800;            /* 字体粗细 */
    font-style: italic;          /* 斜体 */
    text-shadow: 1px 1px 1px rgba(0,0,0,0.2); /* 文字阴影 */
    margin-bottom: 3px;          /* 底部外边距 */
}

.port-status {
    font-size: 18px;             /* 字体大小 */
    font-weight: bold;           /* 粗体 */
    margin-bottom: 3px;          /* 底部外边距 */
}

.port-latency {
    font-size: 11px;             /* 小字体 */
    color: #6c757d;              /* 灰色文字 */
}

/* ===== 状态信息样式 ===== */
.status-info {
    /* 关键修改：初始背景半透明 */
    background: rgba(248, 249, 250, 0.9); /* 半透明背景 */
    border-radius: 8px;          /* 圆角边框 */
    padding: 15px;               /* 内边距 */
    margin: 10px 0;              /* 上下外边距 */
    transition: all 0.3s ease;   /* 添加过渡动画 */
}

/* 检测结果出现后的状态信息样式 */
body.has-results .status-info {
    background: #f8f9fa;         /* 恢复不透明背景 */
}

.status-row {
    display: flex;
    justify-content: center;     /* 水平居中 */
    gap: 10px;                   /* 元素间距 */
    margin-bottom: 10px;         /* 底部外边距 */
    flex-wrap: nowrap;           /* 不换行 */
}

.status-item {
    padding: 8px 15px;           /* 内边距 */
    border-radius: 20px;         /* 圆角边框 */
    font-weight: bold;           /* 粗体 */
    font-size: 12px;             /* 字体大小 */
    min-width: 100px;            /* 最小宽度 */
    text-align: center;          /* 文字居中 */
    white-space: nowrap;         /* 不换行 */
}

/* 良好状态样式 */
.status-good { 
    background: #28a745;         /* 绿色背景 */
    color: white;                /* 白色文字 */
}

/* 警告状态样式 */
.status-warning { 
    background: #ffc107;         /* 黄色背景 */
    color: #212529;              /* 深色文字 */
}

/* 异常状态样式 */
.status-bad { 
    background: #dc3545;         /* 红色背景 */
    color: white;                /* 白色文字 */
}

.info-details {
    text-align: center;          /* 文字居中 */
    color: #6c757d;              /* 灰色文字 */
    line-height: 1.6;            /* 行高 */
    margin-bottom: 8px;          /* 底部外边距 */
    font-size: 13px;             /* 字体大小 */
}

.footer-text {
    font-size: 12px;             /* 小字体 */
    color: #495057;              /* 深灰色文字 */
    text-align: center;          /* 文字居中 */
    margin-top: 8px;             /* 顶部外边距 */
}

/* ===== 加载动画样式 ===== */
.loader {
    display: none;               /* 初始隐藏 */
    text-align: center;          /* 文字居中 */
    padding: 20px;               /* 内边距 */
    /* 关键修改：加载动画背景半透明 */
    background: rgba(255, 255, 255, 0.9); /* 半透明白色背景 */
    border-radius: 8px;          /* 圆角边框 */
    margin: 20px 0;              /* 上下外边距 */
}

.loader .spinner-border {
    width: 2rem;                 /* 宽度 */
    height: 2rem;                /* 高度 */
}

.loader p {
    margin-top: 10px;            /* 顶部外边距 */
    font-size: 14px;             /* 字体大小 */
}

/* ===== 手机端响应式样式 ===== */
@media (max-width: 768px) {
    /* 隐藏手机端的footer */
    .page-footer {
        display: none;
    }
    
    /* 手机端初始状态适配 */
    .banner-seo-check {
        align-items: flex-start; /* 顶部对齐 */
        padding-top: 20px;       /* 顶部内边距 */
    }
    
    .banner-seo-check .wrap {
        align-items: flex-start; /* 顶部对齐 */
        height: auto;            /* 自动高度 */
        min-height: calc(100vh - 100px); /* 计算剩余高度 */
    }
    
    /* 标题包装器手机端调整 */
    .title-wrapper {
        min-height: 60px;        /* 减小最小高度 */
        margin-bottom: 1.5rem;   /* 减小底部外边距 */
    }
    
    /* Logo手机端调整 */
    .pi-logo {
        width: 250px !important; /* 固定宽度 */
    }
    
    /* 检测结果出现后手机端适配 */
    body.has-results .banner-seo-check {
        padding-top: 15px;       /* 顶部内边距 */
        min-height: auto;        /* 自动最小高度 */
    }
    
    body.has-results .banner-seo-check .wrap {
        min-height: auto;        /* 自动最小高度 */
    }
    
    /* 手机端：5行2列网格布局 */
    .port-grid {
        grid-template-columns: repeat(2, 1fr); /* 2列网格 */
        grid-auto-rows: auto;    /* 自动行高 */
        gap: 5px;                /* 减小间距 */
    }
    
    .port-item {
        display: flex;
        flex-direction: row;     /* 水平布局 */
        align-items: center;     /* 垂直居中 */
        justify-content: space-between; /* 两端对齐 */
        padding: 8px 10px;       /* 内边距 */
        min-height: 40px;        /* 减小最小高度 */
        text-align: left;        /* 文字左对齐 */
    }
    
    .port-info {
        display: flex;
        align-items: center;     /* 垂直居中 */
        gap: 8px;                /* 元素间距 */
        flex: 1;                 /* 占据剩余空间 */
    }
    
    /* 手机端端口数字字体 */
    .port-number {
        font-size: 16px;         /* 字体大小 */
        margin-bottom: 0;        /* 移除底部外边距 */
        min-width: 45px;         /* 最小宽度 */
    }
    
    .port-status {
        font-size: 16px;         /* 字体大小 */
        margin-bottom: 0;        /* 移除底部外边距 */
        min-width: 20px;         /* 最小宽度 */
        text-align: center;      /* 文字居中 */
    }
    
    .port-latency {
        font-size: 11px;         /* 字体大小 */
        min-width: 35px;         /* 最小宽度 */
        text-align: right;       /* 文字右对齐 */
    }
    
    /* 手机端状态信息一行显示 */
    .status-row {
        gap: 5px;                /* 减小间距 */
        overflow-x: auto;        /* 水平滚动 */
        padding-bottom: 5px;     /* 底部内边距 */
    }
    
    .status-item {
        padding: 6px 10px;       /* 内边距 */
        font-size: 11px;         /* 字体大小 */
        min-width: 80px;         /* 最小宽度 */
        flex-shrink: 0;          /* 禁止收缩 */
    }
    
    /* 手机端其他样式调整 */
    .result-container {
        padding: 12px;           /* 减小内边距 */
        margin: 5px auto;        /* 减小外边距 */
    }
    
    .status-info {
        padding: 10px;           /* 减小内边距 */
        margin: 8px 0;           /* 减小外边距 */
    }
    
    .info-details {
        font-size: 12px;         /* 字体大小 */
        line-height: 1.5;        /* 行高 */
    }
    
    .footer-text {
        font-size: 11px;         /* 字体大小 */
    }
}

/* ===== 超小屏幕适配（小于400px） ===== */
@media (max-width: 400px) {
    .status-row {
        gap: 3px;                /* 进一步减小间距 */
    }
    
    .status-item {
        padding: 5px 8px;        /* 减小内边距 */
        font-size: 10px;         /* 减小字体大小 */
        min-width: 70px;         /* 减小最小宽度 */
    }
    
    .port-item {
        padding: 6px 8px;        /* 减小内边距 */
    }
    
    .port-number {
        font-size: 14px;         /* 减小字体大小 */
        min-width: 40px;         /* 减小最小宽度 */
    }
    
    .port-status {
        font-size: 14px;         /* 减小字体大小 */
    }
    
    .port-latency {
        font-size: 10px;         /* 减小字体大小 */
        min-width: 30px;         /* 减小最小宽度 */
    }
}

/* ===== 通用样式 ===== */
/* 确保内容不会溢出 */
.banner-seo-check * {
    box-sizing: border-box;      /* 盒模型计算方式 */
}

/* 防止内容溢出导致滚动条 */
html, body {
    overflow: auto;              /* 自动滚动 */
}

.banner-seo-check {
    overflow: visible;           /* 内容可见 */
}


/* ===== 翻译组件样式 ===== */
#translate {
    display: flex;
    align-items: center;
    margin-left: 15px;
}

/* 针对动态生成的select元素 */
#translate .translateSelectLanguage {
    border: 1px solid #dee2e6 !important;
    border-radius: 20px !important;
    padding: 6px 15px !important;
    background: #f8f9fa !important;
    color: #495057 !important;
    font-size: 14px !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    outline: none !important;
    min-width: 140px !important;
    height: 36px !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236c757d' d='M6 8.5L1.5 4h9L6 8.5z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    background-size: 12px !important;
    padding-right: 35px !important;
}

/* 悬停效果 */
#translate .translateSelectLanguage:hover {
    background: #e9ecef !important;
    border-color: #adb5bd !important;
    transform: translateY(-1px);
}

/* 焦点状态 */
#translate .translateSelectLanguage:focus {
    border-color: #667eea !important;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1) !important;
}

/* 选项样式 */
#translate .translateSelectLanguage option {
    background: white !important;
    color: #495057 !important;
    padding: 8px 12px !important;
}

/* 手机端适配 */
@media (max-width: 768px) {
    #translate {
        margin: 10px 0 !important;
        justify-content: center !important;
        width: 100% !important;
    }
    
    #translate .translateSelectLanguage {
        min-width: 120px !important;
        font-size: 13px !important;
        padding: 5px 12px !important;
        padding-right: 30px !important;
        height: 34px !important;
    }
}