/* 基础样式重置 - 与之前页面保持一致 */
* {
    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;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* 悬浮导航栏 - 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;
    backdrop-filter: blur(10px);
}

/* 导航链接悬停效果 */
body > a:not([href='/xsx']):hover {
    background-color: #f39c12;
    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;
}

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;
    background-color: #f39c12;
}

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

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(2.2rem, 5vw, 3.2rem);
    color: #2c3e50;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    letter-spacing: 1px;
    padding-bottom: 15px;
    border-bottom: 3px solid #f39c12;
    max-width: 90%;
    text-align: center;
    position: relative;
}

/* 添加留言图标到标题 */
h1::before {
    content: "💬 ";
    margin-right: 10px;
}

/* 表单容器样式 */
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;
    border-top: 5px solid #f39c12;
}

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

/* 文本域样式 */
textarea {
    width: 100%;
    min-height: 200px;
    padding: clamp(16px, 2.5vw, 20px);
    border: 2px solid #e0e6ed;
    border-radius: 12px;
    font-size: clamp(1rem, 2vw, 1.1rem);
    transition: all 0.3s ease;
    background-color: #f9fbfd;
    color: #2c3e50;
    outline: none;
    resize: vertical;
    line-height: 1.6;
    font-family: inherit;
}

textarea:focus {
    border-color: #f39c12;
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(243, 156, 18, 0.2);
}

textarea::placeholder {
    color: #95a5a6;
    font-style: italic;
}

/* 文本域悬停效果 */
textarea:hover {
    border-color: #f39c12;
    background-color: #fff;
}

/* 提交按钮样式 */
input[type="submit"] {
    display: block;
    width: 100%;
    padding: clamp(16px, 2.5vw, 20px);
    background: linear-gradient(to right, #f39c12, #e67e22);
    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(20px, 3vw, 30px);
    box-shadow: 0 6px 15px rgba(243, 156, 18, 0.3);
    letter-spacing: 1px;
}

input[type="submit"]:hover {
    background: linear-gradient(to right, #e67e22, #f39c12);
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(243, 156, 18, 0.4);
}

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

/* 添加按钮图标 */
input[type="submit"]::before {
    content: "📨 ";
    margin-right: 8px;
}

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

/* 响应式设计 */
@media (max-width: 768px) {
    body {
        padding-top: 90px;
    }
    
    /* 导航栏在小屏幕上垂直堆叠 */
    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: 2rem;
    }
    
    form {
        padding: 20px;
        margin: 20px;
    }
    
    textarea {
        min-height: 180px;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    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.8rem;
    }
}

/* 动画效果 */
@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;
    }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(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;
    animation-fill-mode: both;
}

/* 文本域焦点时的动画 */
textarea:focus {
    animation: pulse 0.5s ease;
}

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

/* 添加当前页面指示器 */
body > a[href='/comment']: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;
}

/* 添加占位符样式 */
::placeholder {
    color: #95a5a6;
    font-style: italic;
}

/* 移动端优化 - 小屏幕手机 */
@media (max-width: 480px) {
    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.8rem;
        margin-top: 80px;
    }
    
    form {
        padding: 18px;
    }
    
    textarea {
        padding: 14px;
        min-height: 150px;
        font-size: 1rem;
    }
    
    input[type="submit"] {
        padding: 16px;
        font-size: 1.1rem;
    }
}

/* 添加页面背景装饰点 */
body::after {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(243, 156, 18, 0.05) 0%, transparent 20%),
        radial-gradient(circle at 90% 30%, rgba(52, 152, 219, 0.05) 0%, transparent 20%),
        radial-gradient(circle at 50% 80%, rgba(46, 204, 113, 0.05) 0%, transparent 20%);
    z-index: -1;
    pointer-events: none;
}

/* 添加平滑滚动效果 */
html {
    scroll-behavior: smooth;
}

/* 添加表单成功/错误状态 */
form.success {
    border-color: #2ecc71;
    animation: pulseSuccess 0.5s ease;
}

form.error {
    border-color: #e74c3c;
    animation: pulseError 0.5s ease;
}

@keyframes pulseSuccess {
    0%, 100% { box-shadow: 0 12px 35px rgba(0, 0, 0, 0.1); }
    50% { box-shadow: 0 12px 35px rgba(46, 204, 113, 0.3); }
}

@keyframes pulseError {
    0%, 100% { box-shadow: 0 12px 35px rgba(0, 0, 0, 0.1); }
    50% { box-shadow: 0 12px 35px rgba(231, 76, 60, 0.3); }
}

/* ========= 移动端折叠/展开按钮样式 ========= */
.nav-toggle-btn {
    display: none;
    position: fixed;
    top: 5px;
    left: 10px;
    z-index: 1002;
    width: 44px;
    height: 44px;
    background: #f39c12;
    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: #e67e22;
    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: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);
    }
}
