/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
}

body {
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8f0 100%);
    color: #333;
    min-height: 100vh;
    padding-top: 100px;
    line-height: 1.6;
}

/* 悬浮导航栏 - 现在有9个链接（包括article和xsx） */
body > a:not([href='/xsx']) {
    display: inline-block;
    position: fixed;
    top: 0;
    z-index: 1000;
    text-decoration: none;
    padding: 10px 8px;
    font-weight: 600;
    font-size: 0.8rem;
    color: #fff;
    background-color: rgba(52, 73, 94, 0.95);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    text-align: center;
}

/* 导航链接悬停效果 */
body > a:not([href='/xsx']):hover {
    background-color: #9b59b6;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

/* 为每个导航链接定位 - 8个左侧导航链接（xsx单独处理） */
body > a[href='/']:not([href='/xsx']) {
    left: 0;
    width: 8%;
    min-width: 60px;
}

body > a[href='/publicShare']:not([href='/xsx']) {
    left: 8%;
    width: 12%;
    min-width: 90px;
}

body > a[href='/article']:not([href='/xsx']) {
    left: 20%;
    width: 8%;
    min-width: 65px;
}

body > a[href='/chat']:not([href='/xsx']) {
    left: 28%;
    width: 10%;
    min-width: 80px;
}

body > a[href='/tools']:not([href='/xsx']) {
    left: 38%;
    width: 8%;
    min-width: 65px;
    background-color: #9b59b6;
}

body > a[href='/login']:not([href='/xsx']) {
    left: 46%;
    width: 7%;
    min-width: 60px;
}

body > a[href='/signUp']:not([href='/xsx']) {
    left: 53%;
    width: 7%;
    min-width: 60px;
}

body > a[href='/comment']:not([href='/xsx']) {
    left: 60%;
    width: 12%;
    min-width: 90px;
}

/* xsx图片链接单独处理，固定在右上角 */
body > a[href='/xsx'] {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 1001;
    width: 55px;
    height: 45px;
    background: transparent;
    border: none;
    padding: 0;
}

body > a[href='/xsx'] img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    margin: 0;
    border-radius: 0;
    border: none;
    box-shadow: none;
}

body > a[href='/xsx'] img:hover {
    transform: none;
    animation: none;
}

/* 主标题 */
h1 {
    margin: 30px auto 40px;
    font-size: clamp(2rem, 4.5vw, 3rem);
    color: #2c3e50;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    letter-spacing: 1px;
    padding-bottom: 15px;
    border-bottom: 3px solid #9b59b6;
    max-width: 90%;
    text-align: center;
}

/* 表单样式 */
form {
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 16px;
    padding: clamp(25px, 4vw, 40px);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 700px;
    margin: 30px auto;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

form:hover {
    transform: translateY(-5px);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.15);
}

/* 表单元素容器 */
form > *:not(div) {
    display: block;
    margin-bottom: clamp(20px, 3vw, 30px);
    width: 100%;
}

/* 文件上传区域样式 */
input[type="file"] {
    padding: clamp(15px, 2.5vw, 20px);
    border: 2px dashed #9b59b6;
    border-radius: 12px;
    background-color: rgba(155, 89, 182, 0.05);
    font-size: clamp(1rem, 2vw, 1.1rem);
    color: #2c3e50;
    cursor: pointer;
    transition: all 0.3s ease;
}

input[type="file"]:hover {
    background-color: rgba(155, 89, 182, 0.1);
    border-color: #8e44ad;
}

input[type="file"]::file-selector-button {
    background: linear-gradient(to right, #9b59b6, #8e44ad);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    margin-right: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
}

input[type="file"]::file-selector-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(155, 89, 182, 0.3);
}

/* 文件大小限制提示 */
form > *:nth-child(1) {
    font-size: clamp(0.9rem, 1.8vw, 1.1rem);
    color: #e74c3c;
    font-weight: 600;
    margin-bottom: 15px;
    text-align: center;
    display: block;
}

/* 质量选择器样式 */
form > *:nth-child(2) {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    font-size: clamp(1.1rem, 2.2vw, 1.3rem);
    color: #34495e;
    margin-bottom: clamp(20px, 3vw, 30px);
}

/* 质量输入框样式 */
input[type="text"] {
    flex: 1;
    min-width: 200px;
    padding: clamp(12px, 2vw, 16px) clamp(15px, 2.5vw, 20px);
    border: 2px solid #e0e6ed;
    border-radius: 10px;
    font-size: clamp(1rem, 2vw, 1.1rem);
    transition: all 0.3s ease;
    background-color: #f9fbfd;
    color: #2c3e50;
    margin-left: 15px;
}

input[type="text"]:focus {
    outline: none;
    border-color: #9b59b6;
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(155, 89, 182, 0.2);
}

/* 提交按钮样式 */
input[type="submit"] {
    display: block;
    width: 100%;
    padding: clamp(16px, 2.5vw, 20px);
    background: linear-gradient(to right, #9b59b6, #3498db);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: clamp(1.2rem, 2.5vw, 1.4rem);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: clamp(10px, 2vw, 20px);
    box-shadow: 0 6px 15px rgba(155, 89, 182, 0.3);
    letter-spacing: 1px;
}

input[type="submit"]:hover {
    background: linear-gradient(to right, #3498db, #9b59b6);
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(155, 89, 182, 0.4);
}

input[type="submit"]:active {
    transform: translateY(1px);
}

/* 空div的隐藏 */
div:empty {
    display: none;
}

/* 响应式设计 */
@media (max-width: 768px) {
    body {
        padding-top: 90px;
    }
        /* 移动端强制隐藏随笔链接 */
    body > a[href='/essay'] {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }
    
    /* 导航栏在小屏幕上垂直堆叠 */
    body > a:not([href='/xsx']) {
        position: fixed;
        display: block;
        width: 100% !important;
        left: 0 !important;
        top: auto;
        padding: 8px 10px;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        font-size: 0.8rem;
    }
    
    /* 为每个导航链接设置垂直位置 - 8个链接（不包括xsx） */
    body > a[href='/']:not([href='/xsx']) {
        top: 0;
    }
    
    body > a[href='/publicShare']:not([href='/xsx']) {
        top: 38px;
    }
    
    body > a[href='/article']:not([href='/xsx']) {
        top: 76px;
    }
    
    body > a[href='/chat']:not([href='/xsx']) {
        top: 114px;
    }
    
    body > a[href='/tools']:not([href='/xsx']) {
        top: 152px;
    }
    
    body > a[href='/login']:not([href='/xsx']) {
        top: 190px;
    }
    
    body > a[href='/signUp']:not([href='/xsx']) {
        top: 228px;
    }
    
    body > a[href='/comment']:not([href='/xsx']) {
        top: 266px;
    }
    
    /* xsx图片链接在移动端调整位置 */
    body > a[href='/xsx'] {
        position: fixed;
        top: 0;
        right: 0;
        width: 50px;
        height: 40px;
    }
    
    h1 {
        margin-top: 84px;
        font-size: 1.8rem;
    }
    
    form {
        padding: 20px;
        margin: 20px;
    }
    
    form > *:nth-child(2) {
        flex-direction: column;
        align-items: flex-start;
    }
    
    input[type="text"] {
        width: 100%;
        margin-left: 0;
        margin-top: 10px;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
        /* 移动端强制隐藏随笔链接 */
    body > a[href='/essay'] {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }
    body > a:not([href='/xsx']) {
        font-size: 0.75rem;
        padding: 10px 5px;
    }
    
    body > a[href='/publicShare']:not([href='/xsx']),
    body > a[href='/comment']:not([href='/xsx']) {
        font-size: 0.7rem;
    }
    
    h1 {
        font-size: 2.5rem;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

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

h1, form {
    animation: fadeIn 0.8s ease-out;
}

body > a:not([href='/xsx']) {
    animation: slideInFromTop 0.5s ease-out;
}

form {
    animation-delay: 0.2s;
}

/* 添加装饰元素 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: linear-gradient(to right, #9b59b6, #3498db, #2ecc71, #f39c12);
    z-index: 1001;
}

/* 质量范围提示 */
.quality-hint {
    display: block;
    width: 100%;
    text-align: center;
    color: #7f8c8d;
    font-size: 0.9rem;
    margin-top: -15px;
    margin-bottom: 20px;
}

/* 工具特色图标 */
h1::before {
    content: "🛠️ ";
}

/* 添加当前页面指示器 */
body > a[href='/tools']:not([href='/xsx'])::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 50%;
    height: 3px;
    background-color: #fff;
    border-radius: 3px 3px 0 0;
}

/* 移动端优化 - 小屏幕手机 */
@media (max-width: 480px) {
        /* 移动端强制隐藏随笔链接 */
    body > a[href='/essay'] {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }
    body > a:not([href='/xsx']) {
        font-size: 0.7rem;
        padding: 6px 10px;
        height: 32px;
    }
    
    body > a[href='/']:not([href='/xsx']) {
        top: 0;
    }
    
    body > a[href='/publicShare']:not([href='/xsx']) {
        top: 32px;
    }
    
    body > a[href='/article']:not([href='/xsx']) {
        top: 64px;
    }
    
    body > a[href='/chat']:not([href='/xsx']) {
        top: 96px;
    }
    
    body > a[href='/tools']:not([href='/xsx']) {
        top: 128px;
    }
    
    body > a[href='/login']:not([href='/xsx']) {
        top: 160px;
    }
    
    body > a[href='/signUp']:not([href='/xsx']) {
        top: 192px;
    }
    
    body > a[href='/comment']:not([href='/xsx']) {
        top: 224px;
    }
    
    body > a[href='/xsx'] {
        width: 40px;
        height: 32px;
    }
    
    h1 {
        font-size: 1.6rem;
        margin-top: 80px;
    }
}

/* 添加文件大小提示样式 */
form > *:nth-child(1)::before {
    content: "⚠️ ";
    margin-right: 5px;
}

/* ========= 移动端折叠/展开按钮样式 ========= */
.nav-toggle-btn {
    display: none;
    position: fixed;
    top: 5px;
    left: 10px;
    z-index: 1002;
    width: 44px;
    height: 44px;
    background: #9b59b6;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.nav-toggle-btn:hover {
    background: #8e44ad;
    transform: scale(1.02);
}

/* 移动端显示按钮 */
@media (max-width: 768px) {
    .nav-toggle-btn {
        display: block;
    }
}

/* 小屏手机适配 */
@media (max-width: 480px) {
    .nav-toggle-btn {
        width: 38px;
        height: 38px;
        font-size: 24px;
        top: 3px;
        left: 8px;
    }
}

/* ========= 移动端折叠/展开功能（默认展开，可收缩） ========= */
@media (max-width: 768px) {
        /* 移动端强制隐藏随笔链接 */
    body > a[href='/essay'] {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }
    /* 导航栏默认展开状态 */
    body > a:not([href='/xsx']) {
        transform: translateX(0);
        opacity: 1;
        visibility: visible;
        transition: transform 0.3s ease, opacity 0.3s ease, visibility 0.3s;
    }
    
    /* 收缩状态：点击按钮后隐藏 */
    body.nav-collapsed > a:not([href='/xsx']) {
        transform: translateX(-100%);
        opacity: 0;
        visibility: hidden;
    }
}

/* ========= 桌面端：鼠标放在"文章"上时展开显示"随笔"链接 ========= */
@media (min-width: 769px) {
    /* 默认隐藏随笔导航项 */
    body > a[href='/essay'] {
        display: none !important;
        opacity: 0;
        visibility: hidden;
        position: fixed;
        top: 38px;
        left: 20%;
        width: 8%;
        min-width: 60px;
        background-color: rgba(52, 73, 94, 0.98);
        backdrop-filter: blur(12px);
        border-radius: 0 0 8px 8px;
        border-top: 1px solid rgba(255, 255, 255, 0.2);
        height: 40px;
        line-height: 40px;
        padding: 0 6px;
        font-size: 0.75rem;
        text-align: center;
        z-index: 999;
        transition: all 0.3s cubic-bezier(0.2, 0.9, 0.4, 1.1);
        transform: translateY(-10px);
        pointer-events: none;
    }
    
    /* 当鼠标悬浮在"文章"链接上时，显示"随笔"链接 */
    body > a[href='/article']:hover ~ a[href='/essay'],
    body > a[href='/article']:hover + a[href='/essay'] {
        display: inline-block !important;
        opacity: 1 !important;
        visibility: visible !important;
        transform: translateY(0) !important;
        pointer-events: auto !important;
    }
    
    /* 当鼠标移动到"随笔"链接上时，保持展开状态 */
    body > a[href='/essay']:hover {
        display: inline-block !important;
        opacity: 1 !important;
        visibility: visible !important;
        transform: translateY(0) !important;
        pointer-events: auto !important;
        background-color: #e67e22;
    }
    
    /* 文章链接悬浮时改变背景色 */
    body > a[href='/article']:hover {
        background-color: #e67e22;
    }
    
    /* 随笔链接悬停效果 */
    body > a[href='/essay']:hover {
        background-color: #e67e22 !important;
        transform: translateY(2px);
    }
}

/* 动画 */
@keyframes essayDropdownIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
