/* 靶场详情页面专用样式 */

/* 详情页面主体样式 */
.detail-page,
#target-detail-page {
    min-height: 100vh;
    padding-top: 80px;
    /* 继承body的背景，不覆盖 */
}

/* 删除了header样式重定义，使用navigation.css中的样式 */

.detail-container {
    max-width: 1400px;
    width: calc(100% - 4rem);
    margin: 0 auto;
    padding: 0 2rem 2rem 2rem;
}

/* 详情页面头部区域 */
.detail-header {
    background: rgba(26, 31, 54, 0.6);
    border-bottom: 1px solid rgba(90, 122, 138, 0.3);
    padding: 1.5rem 0;
    margin-bottom: 2rem;
    position: relative;
    backdrop-filter: blur(5px);
}

.detail-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #5a7a8a, #8b7aa3, #c9a876);
    z-index: 1;
}

.detail-header-content {
    max-width: 1400px;
    width: calc(100% - 4rem);
    margin: 0 auto;
    padding: 0 2rem;
    position: relative;
    z-index: 2;
}


.detail-header h1 i {
    color: #5a7a8a;
    filter: drop-shadow(0 0 8px rgba(90, 122, 138, 0.6));
    font-size: 2rem;
}

/* 详情页面主内容区域 */
.detail-content {
    display: flex;
    gap: 2rem;
    min-height: 800px;  /* 设置最小高度确保三列对齐 */
    max-height: calc(100vh - 400px);  /* 限制最大高度，避免无限增长 */
    background: transparent;
    position: relative;
    align-items: stretch;  /* 让所有子元素拉伸到相同高度 */
}

.detail-left {
    flex: 0 0 320px;  /* 从400px缩小到320px */
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-self: stretch;  /* 拉伸以匹配容器高度 */
}

.detail-right {
    flex: 1;
    display: flex;
    gap: 2rem;  /* 右侧两列之间的间距 */
    min-width: 0;
    align-items: stretch;  /* 确保右侧的两列高度一致 */
}

/* 右侧分为两列 */
.detail-right-main {
    flex: 0 0 50%;  /* 描述和flag区域占50% */
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-self: stretch;  /* 拉伸以匹配父容器高度 */
}

.detail-right-comments {
    flex: 1;  /* 留言区占剩余空间 */
    display: flex;
    flex-direction: column;
    align-self: stretch;  /* 拉伸以匹配父容器高度 */
    min-height: 0;  /* 关键：允许flexbox正确收缩 */
    overflow: hidden;  /* 防止溢出 */
}

.detail-right-main .detail-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;  /* 移除固定最小高度 */
    overflow: hidden;
}

/* 描述内容样式 - 合并到#description-content */

#description-content p {
    margin-bottom: 1rem;
    text-align: justify;
}

#description-content p:last-child {
    margin-bottom: 0;
}

/* 移除伪元素，使用简单的最小高度方案 */

/* 移除伪元素填充，让文字内容本身填满区域 */

/* 描述区域头部样式 - 正常布局 */
.description-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-shrink: 0;  /* 头部不收缩 */
}

/* 描述项样式 - 恢复框架样式，作为整体容器 */
.detail-item.description-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 0;  /* 允许灵活高度 */
    padding: 1.2rem !important;  /* 恢复padding */
    /* 继承.detail-item的框架样式 */
}

.description-header h3 {
    margin: 0;
    flex: 1;
}

/* 文字内容区域 - 占据剩余空间延伸到底部 */
#description-content {
    line-height: 1.6;
    color: var(--text-color);
    font-size: 0.95rem;
    flex: 1;  /* 占据剩余空间，延伸到容器底部 */
    overflow-y: auto;
    overflow-x: hidden;
    display: block;  /* 改回block布局 */
    box-sizing: border-box;
    padding: 0;
    padding-right: 0.5rem;  /* 为滚动条留出空间 */
    margin: 0;
    background: none;
    border: none;
    min-height: 0;  /* 允许灵活高度 */
    word-break: break-word;
    overflow-wrap: anywhere;
}

.detail-right-main,
.detail-item.description-item,
#description-content {
    min-width: 0;
}

#description-content pre {
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: anywhere;
}

#description-content img,
#description-content video,
#description-content iframe,
#description-content table {
    max-width: 100%;
    display: block;
}

/* 描述区域滚动条样式 */
#description-content::-webkit-scrollbar {
    width: 8px;
}

#description-content::-webkit-scrollbar-track {
    background: rgba(90, 122, 138, 0.1);
    border-radius: 4px;
}

#description-content::-webkit-scrollbar-thumb {
    background: rgba(90, 122, 138, 0.3);
    border-radius: 4px;
    transition: background 0.3s ease;
}

#description-content::-webkit-scrollbar-thumb:hover {
    background: rgba(90, 122, 138, 0.5);
}

#description-content {
    scrollbar-width: thin;
    scrollbar-color: rgba(90, 122, 138, 0.3) rgba(90, 122, 138, 0.1);
}

/* 移除多余的最后元素margin，因为已经通过容器margin处理 */

#description-content h1,
#description-content h2,
#description-content h3,
#description-content h4,
#description-content h5,
#description-content h6 {
    color: #5a7a8a;
    margin-top: 1.5rem;
    margin-bottom: 0.8rem;
    font-weight: 600;
}

#description-content h1 { font-size: 1.4rem; }
#description-content h2 { font-size: 1.25rem; }
#description-content h3 { font-size: 1.15rem; }
#description-content h4 { font-size: 1.05rem; }

#description-content ul,
#description-content ol {
    margin: 1rem 0;
    padding-left: 1.5rem;
}

#description-content li {
    margin-bottom: 0.5rem;
}

#description-content a {
    color: #8b7aa3;
    text-decoration: none;
    border-bottom: 1px dotted #8b7aa3;
    transition: all 0.3s ease;
}

#description-content a:hover {
    color: #c9a876;
    border-bottom-color: #c9a876;
}

#description-content strong,
#description-content b {
    color: #5a7a8a;
    font-weight: 600;
}

#description-content code {
    background: rgba(90, 122, 138, 0.2);
    color: #c9a876;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
}

/* IP地址显示样式 */
.ip-addresses-container {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.ip-address-item {
    display: flex;
    align-items: center;
    background: rgba(90, 122, 138, 0.1);
    padding: 0.6rem 0.8rem;
    border-radius: 6px;
    border: 1px solid rgba(90, 122, 138, 0.2);
    margin-bottom: 0;
}

.ip-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 80px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
}

.ip-label i {
    color: #5a7a8a;
    font-size: 0.9rem;
}

.ip-value {
    flex: 1;
    color: var(--text-color);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    padding: 0.2rem 0.5rem;
    background: rgba(26, 31, 54, 0.5);
    border-radius: 4px;
    border: 1px solid rgba(90, 122, 138, 0.2);
    cursor: pointer;
    user-select: all;
    transition: all 0.3s ease;
    position: relative;
}

.ip-value:hover {
    background: rgba(26, 31, 54, 0.7);
    border-color: rgba(90, 122, 138, 0.4);
}

.ip-value:active {
    background: rgba(90, 122, 138, 0.2);
    transform: scale(0.98);
}

.ip-value.target-ip {
    color: #8b7aa3;
}

.ip-value.vpn-ip {
    color: #c9a876;
}

.ip-value.copied {
    background: rgba(40, 167, 69, 0.3);
    border-color: rgba(40, 167, 69, 0.5);
    color: #28a745;
}

.ip-value::after {
    content: '点击复制';
    position: absolute;
    right: 0.5rem;
    font-size: 0.7rem;
    color: var(--text-secondary);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.ip-value:hover::after {
    opacity: 0.7;
}

.ip-value.copied::after {
    content: '已复制！';
    color: #28a745;
    opacity: 1;
}

/* 详情卡片样式 */
.detail-item {
    background: rgba(26, 31, 54, 0.6);
    border: 1px solid rgba(90, 122, 138, 0.2);
    border-radius: 8px;
    padding: 1.2rem;
    backdrop-filter: blur(3px);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.detail-item:hover {
    border-color: rgba(90, 122, 138, 0.4);
    background: rgba(26, 31, 54, 0.75);
}

/* 左侧卡片最后一个不需要margin-bottom */
.detail-left .detail-item:last-child {
    margin-bottom: 0;
}

/* 左侧靶场操作区域拉伸以填充剩余空间 */
.detail-left .detail-item.lab-buttons {
    flex: 1;
    margin-bottom: 0;
}

.detail-item h3 {
    margin: 0 0 1.2rem 0;
    color: #5a7a8a;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 700;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.detail-item h3 i {
    filter: drop-shadow(0 0 4px rgba(90, 122, 138, 0.4));
    font-size: 1.1rem;
}

/* 头部标题行 */
.header-title-row {
    display: flex;
    align-items: center;
}


.detail-header h1 {
    margin: 0;
    color: var(--text-color);
    font-size: 2.2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    flex: 1;
}



/* 错误页面样式 */
.error-container {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-secondary);
}

.error-container i {
    font-size: 2.5rem;
    color: #bbb;
    margin-bottom: 1rem;
}

.error-container h2 {
    margin: 0.5rem 0;
    font-size: 1.25rem;
    font-weight: 500;
    color: #999;
}

/* 超大屏幕 */
@media (min-width: 1600px) {
    .detail-container {
        max-width: 1600px;
        padding: 0 2.5rem 2.5rem 2.5rem;
    }
    
    .detail-header-content {
        max-width: 1600px;
        padding: 0 2.5rem;
    }
    
    .detail-left {
        flex: 0 0 340px;
    }
    
    .detail-content {
        gap: 2.5rem;
    }
    
    .detail-right {
        gap: 2.5rem;
    }
}

/* 大屏幕 */
@media (min-width: 1200px) and (max-width: 1599px) {
    .detail-container {
        max-width: 1400px;
        padding: 0 2rem 2rem 2rem;
    }
    
    .detail-header-content {
        max-width: 1400px;
        padding: 0 2rem;
    }
    
    .detail-left {
        flex: 0 0 320px;
    }
    
    .detail-content {
        gap: 2rem;
    }
    
    .detail-right {
        gap: 2rem;
    }
}

/* 中等屏幕 */
@media (min-width: 1024px) and (max-width: 1199px) {
    .detail-container {
        max-width: 100%;
        width: calc(100% - 2rem);
        padding: 0 1.5rem 1.5rem 1.5rem;
    }
    
    .detail-header-content {
        width: calc(100% - 2rem);
        padding: 0 1.5rem;
    }
    
    .detail-left {
        flex: 0 0 280px;
    }
    
    .detail-content {
        gap: 1.5rem;
    }
    
    .detail-right {
        gap: 1.5rem;
    }
}

/* 平板屏幕 */
@media (min-width: 769px) and (max-width: 1023px) {
    .detail-container {
        width: calc(100% - 2rem);
        padding: 0 1.5rem 1.5rem 1.5rem;
    }
    
    .detail-header-content {
        width: calc(100% - 2rem);
        padding: 0 1.5rem;
    }
    
    .detail-left {
        flex: 0 0 260px;
    }
    
    .detail-content {
        gap: 1.5rem;
        min-height: auto;  /* 平板上取消最小高度 */
    }
    
    .detail-right {
        flex-direction: column;
        gap: 1.5rem;
    }
    
    .detail-right-main,
    .detail-right-comments {
        flex: none;
        width: 100%;
    }
}

/* 小屏幕和移动端 */
@media (max-width: 768px) {
    .detail-container {
        width: calc(100% - 2rem);
        padding: 0 1rem 1rem 1rem;
    }
    
    .detail-header {
        padding: 1.2rem 0;
        margin-bottom: 1.5rem;
    }
    
    .detail-header-content {
        width: calc(100% - 2rem);
        padding: 0 1rem;
    }
    
    .detail-header h1 {
        font-size: 1.8rem;
    }
    
    .detail-header h1 i {
        font-size: 1.6rem;
    }
    
    .detail-content {
        flex-direction: column;
        gap: 1.5rem;
        min-height: auto;  /* 移动端取消最小高度 */
        max-height: none;  /* 移动端取消最大高度限制 */
    }
    
    .detail-left {
        flex: none;
        width: 100%;
    }
    
    .detail-right {
        flex: none;
        width: 100%;
        flex-direction: column;
        gap: 1.5rem;
    }
    
    .detail-right-main,
    .detail-right-comments {
        flex: none;
        width: 100%;
    }
    
    .detail-right-comments {
        max-height: 600px;  /* 移动端设置留言区固定最大高度 */
    }
    
    .detail-right-main .detail-item {
        flex: 1;
        height: auto;
        min-height: 0;
    }
    
    #description-content {
        flex: 1;
        overflow-y: auto;
        min-height: 0;
        padding: 0;
        margin: 0 1rem 1rem 1rem;
        display: block;
        box-sizing: border-box;
    }
    
    .header-title-row {
        align-items: center;
    }
    
    
    .detail-header h1 {
        font-size: 1.8rem;
    }
}

@media (max-width: 480px) {
    .detail-container {
        width: calc(100% - 1rem);
        padding: 0 0.5rem 0.5rem 0.5rem;
    }
    
    .detail-header {
        padding: 1rem 0;
        margin-bottom: 1rem;
    }
    
    .detail-header-content {
        width: calc(100% - 1rem);
        padding: 0 0.5rem;
    }
    
    .detail-header h1 {
        font-size: 1.4rem;
        gap: 0.5rem;
    }
    
    .detail-header h1 i {
        font-size: 1.3rem;
    }
    
    .detail-content {
        gap: 1rem;
        max-height: none;  /* 小屏幕取消最大高度限制 */
    }
    
    .detail-right .detail-item {
        flex: 1;
        height: auto;
        min-height: 0;
    }
    
    .detail-right-comments {
        max-height: 500px;  /* 小屏幕设置留言区固定最大高度 */
    }
    
    .detail-item.description-item {
        max-height: 400px;  /* 小屏幕进一步限制高度 */
    }
    
    #description-content {
        flex: 1;
        overflow-y: auto;
        min-height: 0;
        padding: 0;
        margin: 0 0.5rem 0.5rem 0.5rem;
        display: block;
        box-sizing: border-box;
    }
    
    .detail-item {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .detail-item.description-item {
        padding: 0 !important;  /* 移动端也确保描述项无padding */
        max-height: 500px;  /* 移动端进一步限制高度 */
    }
    
    .error-container {
        padding: 2rem 1rem;
    }
    
    .error-details {
        margin-left: 0;
        margin-right: 0;
    }
    
    .header-title-row {
        align-items: center;
    }
    
    
    .detail-header h1 {
        font-size: 1.4rem;
        gap: 0.5rem;
    }
}

/* Flag提交区域样式 */
.flag-submission-item {
    padding: 1rem 1.2rem 1rem 1.2rem;
    flex: 0 0 auto !important;  /* 不拉伸，根据内容自适应高度 */
    height: auto !important;
    min-height: auto !important;
}

.flag-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.flag-header h3 {
    margin: 0;
    color: #5a7a8a;
    font-size: 1.2rem;
}

.flag-points-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #ff6b35;
    font-weight: 600;
    font-size: 0.9rem;
}

.flag-points-info i {
    color: #ffd700;
}

.flag-submission-content {
    background: rgba(90, 122, 138, 0.1);
    border-radius: 8px;
    padding: 0.75rem 1rem 0.75rem 1rem;
    border: 1px solid rgba(90, 122, 138, 0.2);
    height: auto;
    min-height: auto;
}

.flag-status-display {
    margin-bottom: 0.75rem;
}

.flag-status-solved {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: linear-gradient(135deg, rgba(40, 167, 69, 0.3), rgba(40, 167, 69, 0.2));
    border: 1px solid rgba(40, 167, 69, 0.4);
    border-radius: 6px;
    color: #28a745;
    font-weight: 600;
}

.flag-status-solved i {
    color: #28a745;
    font-size: 1.2rem;
}

.flag-form {
    display: block;
}

.flag-input-group {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.flag-input-group .form-input {
    flex: 1;
    min-width: 200px;
    padding: 0.75rem 1rem;
    border: 2px solid rgba(90, 122, 138, 0.3);
    border-radius: 6px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: rgba(26, 31, 54, 0.5);
    color: var(--text-color);
}

.flag-input-group .form-input:focus {
    outline: none;
    border-color: #5a7a8a;
    box-shadow: 0 0 0 0.2rem rgba(90, 122, 138, 0.25);
    background: rgba(26, 31, 54, 0.8);
}

.flag-input-group .btn {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    border-radius: 6px;
    white-space: nowrap;
    transition: all 0.3s ease;
}

.flag-input-group .btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.flag-hint {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    padding: 0.75rem;
    background: rgba(90, 122, 138, 0.1);
    border-radius: 4px;
}

.flag-hint i {
    color: #8b7aa3;
    flex-shrink: 0;
}

.flag-result {
    margin-top: 0.75rem;
    padding: 0.75rem;
    border-radius: 6px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    /* 默认为info样式 */
    background: linear-gradient(135deg, rgba(23, 162, 184, 0.3), rgba(23, 162, 184, 0.2));
    border: 1px solid rgba(23, 162, 184, 0.4);
    color: #17a2b8;
}

.flag-result > i {
    color: #17a2b8;
    font-size: 1.2rem;
}

.flag-result.success {
    background: linear-gradient(135deg, rgba(40, 167, 69, 0.3), rgba(40, 167, 69, 0.2));
    border: 1px solid rgba(40, 167, 69, 0.4);
    color: #28a745;
}

.flag-result.success i {
    color: #28a745;
    font-size: 1.2rem;
}

.flag-result.error {
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.3), rgba(220, 53, 69, 0.2));
    border: 1px solid rgba(220, 53, 69, 0.4);
    color: #dc3545;
}

.flag-result.error i {
    color: #dc3545;
    font-size: 1.2rem;
}

.flag-result.info {
    background: linear-gradient(135deg, rgba(23, 162, 184, 0.3), rgba(23, 162, 184, 0.2));
    border: 1px solid rgba(23, 162, 184, 0.4);
    color: #17a2b8;
}

.flag-result.info i {
    color: #17a2b8;
    font-size: 1.2rem;
}

.flag-result-content {
    flex: 1;
}

.flag-result-message {
    margin: 0;
    font-size: 1rem;
}

.flag-result-details {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    opacity: 0.8;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .flag-header {
        flex-direction: column;
        align-items: flex-start;
        margin-bottom: 1rem;
    }
    
    .flag-points-info {
        align-self: flex-end;
    }
    
    .flag-input-group {
        flex-direction: column;
        margin-bottom: 0.75rem;
    }
    
    .flag-input-group .form-input {
        min-width: auto;
    }
    
    .flag-input-group .btn {
        align-self: stretch;
        text-align: center;
    }
    
    .flag-submission-item {
        padding: 0.8rem 1rem 0.8rem 1rem;
        flex: none !important;
        height: auto !important;
        min-height: auto !important;
    }
    
    .flag-submission-content {
        padding: 0.75rem 1rem 0.75rem 1rem;
        height: auto;
        min-height: auto;
    }
}

/* 加载动画 */
.flag-loading {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.flag-loading i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
