/* ==================== 全局基础 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 启用全局平滑滚动 */
html {
    scroll-behavior: smooth;
}

/* ==================== 主题变量 ==================== */
[data-theme="light"] {
    --bg: #f5f7fb;
    --card-bg: white;
    --text: #2b2d42;
    --text-secondary: #8d99ae;
    --border: #e9ecef;
    --input-bg: white;
    --reply-bg: #f8f9fa;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-hover: 0 4px 16px rgba(0,0,0,0.12);
}

[data-theme="dark"] {
    --bg: #1a1a2e;
    --card-bg: #16213e;
    --text: #eee;
    --text-secondary: #aaa;
    --border: #2a2a4a;
    --input-bg: #0f3460;
    --reply-bg: #1a1a3e;
    --shadow: 0 2px 8px rgba(0,0,0,0.4);
    --shadow-hover: 0 4px 16px rgba(0,0,0,0.6);
}

/* ==================== 基础样式 ==================== */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    padding: 20px;
    transition: background 0.4s ease, color 0.3s ease;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 900px;
    margin: 0 auto;
}

/* ==================== 卡片 ==================== */
.card {
    margin-bottom: 10px;
    overflow: hidden;
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: var(--shadow);
    transition: box-shadow 0.3s ease, transform 0.2s ease, background 0.3s ease;
}

.card:hover {
    box-shadow: var(--shadow-hover);
}

.card-header {
    padding: 16px 20px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 1.2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    transition: background 0.3s ease, border-color 0.3s ease;
}

.card-body {
    padding: 20px;
}

/* ==================== 表单元素 ==================== */
input, textarea {
    width: 100%;
    padding: 12px;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    font-size: 0.9rem;
    background: var(--input-bg);
    color: var(--text);
    transition: border-color 0.25s ease, box-shadow 0.25s ease, background 0.3s ease;
}

input:focus, textarea:focus {
    outline: none;
    border-color: #4361ee;
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.15);
}

/* ==================== 按钮 ==================== */
button, .btn {
    background: #4361ee;
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 30px;
    font-size: 0.85rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), 
                background 0.25s ease, 
                box-shadow 0.25s ease;
    will-change: transform;
}

button:hover {
    background: #3a56d4;
    transform: scale(1.02) translateY(-1px);
    box-shadow: 0 4px 12px rgba(67, 97, 238, 0.3);
}

button:active {
    transform: scale(0.98);
}

button:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* ==================== 固定按钮 ==================== */
.write-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: #4361ee;
    color: white;
    border: none;
    padding: 14px 24px;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(67, 97, 238, 0.3);
    z-index: 999;
    display: flex;
    gap: 8px;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), 
                box-shadow 0.3s ease;
    will-change: transform;
}

.write-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(67, 97, 238, 0.4);
}

.back-to-top {
    position: fixed;
    bottom: 30px;
    left: 30px;
    background: var(--card-bg);
    color: #4361ee;
    border: 1px solid var(--border);
    padding: 12px 16px;
    border-radius: 50px;
    cursor: pointer;
    z-index: 999;
    display: none;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), 
                background 0.3s ease,
                box-shadow 0.3s ease;
    will-change: transform;
}

.back-to-top:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-hover);
}

.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    padding: 8px 12px;
    border-radius: 30px;
    cursor: pointer;
    z-index: 999;
    font-size: 0.8rem;
    transition: transform 0.25s ease, background 0.3s ease, box-shadow 0.25s ease;
}

.theme-toggle:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-hover);
}

/* ==================== 搜索、排序、分页 ==================== */
.search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.search-bar input {
    flex: 1;
}

.sort-bar {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-bottom: 20px;
}

.sort-bar a {
    text-decoration: none;
    padding: 5px 12px;
    border-radius: 30px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.8rem;
    transition: all 0.2s ease;
    will-change: transform;
}

.sort-bar a:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-hover);
}

.sort-bar a.active {
    background: #4361ee;
    color: white;
    border-color: #4361ee;
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.pagination a, .pagination span {
    padding: 6px 12px;
    border-radius: 30px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    text-decoration: none;
    color: #4361ee;
    font-size: 0.8rem;
    transition: all 0.2s ease;
    will-change: transform;
}

.pagination a:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.pagination .current {
    background: #4361ee;
    color: white;
    border-color: #4361ee;
}

.pagination-jump {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: 15px;
}

.pagination-jump input {
    width: 60px;
    padding: 6px;
    text-align: center;
}

/* ==================== 留言条目 ==================== */
.message-item {
    border-bottom: 1px solid var(--border);
    padding: 18px 0px;
    position: relative;
    transition: background 0.2s ease;
}

.admin-message {
  /*  background: url('https://www.nocss.xyz/uploads/2026/06/IMG_5091.gif');*/
    background-repeat: no-repeat;
    background-position: bottom right;
    background-size: 150px 72px;
    margin: 0 -20px;
    padding: 18px 20px;
    border-radius: 0px;
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* ==================== 徽章、标签 ==================== */
.nickname {
    font-weight: 700;
    color: #4361ee;
}

.grade {
    background: #7f8ed1;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.7rem;
    color: white;
    transition: background 0.3s ease;
}

.admin-title {
    background: #ff2700;
    color: white;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.65rem;
}

.location-badge {
    background: #e9ecef;
    color: #495057;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.7rem;
    margin-left: 5px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: background 0.3s ease;
}

.pinned-badge {
    background: #ffd166;
    color: #856404;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.7rem;
    margin-left: 8px;
}

/* ==================== 元信息 ==================== */
.meta {
    color: var(--text-secondary);
    font-size: 0.7rem;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ==================== 内容折叠 ==================== */
.content-wrapper {
    position: relative;
}

.content-short {
    max-height: 150px;
    overflow: hidden;
    position: relative;
    transition: max-height 0.4s ease;
}

.content-short::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(transparent, var(--card-bg));
    pointer-events: none;
    transition: background 0.3s ease;
}

.content-full {
    max-height: none !important;
}

.read-more-btn {
    background: none;
    border: none;
    color: #4361ee;
    cursor: pointer;
    font-size: 0.8rem;
    padding: 4px 0;
    margin-top: 4px;
    display: inline-block;
    transition: color 0.2s ease, transform 0.2s ease;
}

.read-more-btn:hover {
    text-decoration: underline;
    background: none;
    transform: translateX(4px);
}

/* ==================== 操作按钮 ==================== */
.actions {
    display: flex;
    gap: 12px;
    margin-top: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.like-btn, .reply-link, .edit-btn, .delete-btn, .report-btn, .share-btn {
    background: var(--reply-bg);
    border: none;
    padding: 5px 12px;
    border-radius: 30px;
    font-size: 0.8rem;
    cursor: pointer;
    color: var(--text);
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), 
                background 0.25s ease,
                color 0.25s ease,
                box-shadow 0.25s ease;
    will-change: transform;
}

.like-btn:hover, .reply-link:hover, .edit-btn:hover, .delete-btn:hover, .report-btn:hover, .share-btn:hover {
    transform: scale(1.05) translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.share-btn:hover {
    background: #28a745;
    color: white;
}

/* ==================== 回复区域 ==================== */
.replies {
    margin-top: 15px;
    background: var(--reply-bg);
    border-radius: 16px;
    padding: 12px;
    transition: background 0.3s ease;
}

.replies-scroll {
    max-height: 200px;
    overflow-y: auto;
    padding-right: 6px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* 自定义滚动条样式（提升视觉体验） */
.replies-scroll::-webkit-scrollbar {
    width: 6px;
}
.replies-scroll::-webkit-scrollbar-track {
    background: transparent;
}
.replies-scroll::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}
.replies-scroll::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

.reply-item {
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s ease;
}

.reply-item:hover {
    background: rgba(67, 97, 238, 0.03);
}

.reply-meta {
    color: var(--text-secondary);
    font-size: 0.65rem;
    margin-left: 8px;
}

.reply-content {
    font-size: 0.85rem;
    margin-top: 4px;
    padding-left: 8px;
}

.admin-badge {
    background: #ff2700;
    color: white;
    padding: 0px 5px;
    border-radius: 10px;
    font-size: 0.6rem;
    margin-left: 5px;
}

.reply-to-link {
    color: #4361ee;
    font-size: 0.65rem;
    cursor: pointer;
    margin-left: 8px;
    transition: color 0.2s ease;
}

.reply-to-link:hover {
    color: #2a3faa;
    text-decoration: underline;
}

/* ==================== 回复表单 ==================== */
.reply-info {
    background: var(--border);
    padding: 8px 12px;
    border-radius: 30px;
    margin-bottom: 12px;
    transition: background 0.3s ease;
}

.reply-form {
    margin-top: 15px;
    display: none;
}

/* ==================== 图片懒加载 ==================== */
.message-image {
    margin-top: 12px;
}

.message-image img {
    max-width: 80%;
    max-height: 230px;
    border-radius: 12px;
    cursor: pointer;
    background: #f0f0f0;
    transition: opacity 0.4s ease, transform 0.3s ease;
}

.message-image img:hover {
    transform: scale(1.02);
}

.lazy-img {
    opacity: 0;
    transition: opacity 0.4s ease;
    background: #f0f0f0;
}

.lazy-img.loaded {
    opacity: 1;
}

/* ==================== 图片模态框 ==================== */
.image-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    z-index: 10000;
    cursor: pointer;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.image-modal.show {
    display: flex;
    opacity: 1;
}

.image-modal img {
    max-width: 90%;
    max-height: 90%;
    border-radius: 8px;
    object-fit: contain;
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.image-modal.show img {
    transform: scale(1);
}

/* ==================== 底部 ==================== */
footer {
    text-align: center;
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 30px;
    transition: color 0.3s ease;
}

/* ==================== 表单定位 ==================== */
#messageForm {
    scroll-margin-top: 80px;
}

/* ==================== 等待提示 ==================== */
.wait-tip {
    background: #fff3cd;
    border-left: 3px solid #ffc107;
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-size: 0.85rem;
    color: #856404;
    transition: background 0.3s ease;
}

/* ==================== Toast 通知 ==================== */
.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: var(--card-bg);
    border-radius: 20px;
    padding: 24px 32px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
    z-index: 9999;
    text-align: center;
    max-width: 350px;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    border-top: 4px solid #4361ee;
}

.toast.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.toast.success {
    border-top-color: #06d6a0;
}

.toast.error {
    border-top-color: #ef476f;
}

.toast button {
    margin-top: 16px;
    padding: 8px 20px;
}

.toast-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 9998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.toast-overlay.show {
    opacity: 1;
}

/* ==================== 动画 ==================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes flashHighlight {
    0% {
        background-color: rgba(255, 235, 59, 0.3);
    }
    50% {
        background-color: rgba(255, 235, 59, 0.8);
    }
    100% {
        background-color: rgba(255, 235, 59, 0);
    }
}

.highlight-flash {
    animation: flashHighlight 1.5s ease-in-out 3;
    border-radius: 12px;
    transition: background-color 0.2s;
}

/* ==================== 响应式 ==================== */
@media (max-width: 640px) {
    body {
        padding: 12px;
    }
    .write-btn {
        bottom: 20px;
        right: 20px;
        padding: 10px 18px;
    }
    .back-to-top {
        bottom: 20px;
        left: 20px;
    }
}

/* ==================== 编辑/举报表单 ==================== */
.edit-form, .report-form {
    display: none;
    margin-top: 12px;
}

.input-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
}

.input-wrapper input {
    width: 100%;
    padding-right: 70px;
    box-sizing: border-box;
}

.fill-btn {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    padding: 4px 10px;
    background: #ffc0cb;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.2s ease, transform 0.2s ease;
}

.fill-btn:hover {
    background: #e0e0e0;
    transform: translateY(-50%) scale(1.05);
}

/* ==================== 文本框背景图（原有功能保留） ==================== */
textarea[name="content"] {
    background-image: url('https://www.nocss.xyz/uploads/2026/06/IMG_5095.gif');
    background-repeat: no-repeat;
    background-position: bottom right;
    background-size: 120px 60px;
    height: 180px;
}

/* ==================== 链接 ==================== */
a {
    color: #4361ee;
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    text-decoration: underline;
}

/* ==================== IP信息 ==================== */
.user-ip-info {
    background: #eef2f5;
    border-radius: 8px;
    font-size: 0.8rem;
    color: #2c3e50;
    margin-bottom: 15px;
    border-left: 3px solid #4361ee;
    padding: 8px 12px;
    transition: background 0.3s ease, border-color 0.3s ease;
}

[data-theme="dark"] .user-ip-info {
    background: #1a2a4a;
    color: #ccc;
}

/* ==================== 楼层水印 ==================== */
.floor-watermark {
    position: absolute;
    bottom: 15px;
    right: 16px;
    font-size: 0.6rem;
    font-weight: bold;
    color: rgba(0, 0, 0, 0.58);
    pointer-events: none;
    user-select: none;
    z-index: 1;
}

[data-theme="dark"] .floor-watermark {
    color: rgba(255, 255, 255, 0.08);
}

/* ==================== 设备信息（图标颜色） ==================== */
.device-info {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.7rem;
    color: var(--text-secondary);
}
.device-info i {
    font-size: 0.8rem;
}
.device-info .fa-windows { color: #00a4ef; }
.device-info .fa-apple { color: #555; }
.device-info .fa-android { color: #3ddc84; }
.device-info .fa-linux { color: #fcc624; }
.device-info .fa-chrome { color: #4285f4; }
.device-info .fa-firefox { color: #ff9400; }
.device-info .fa-edge { color: #0078d7; }
.device-info .fa-safari { color: #0066cc; }
.device-info .fa-opera { color: #ff1b2d; }

[data-theme="dark"] .device-info .fa-apple { color: #aaa; }

/* ========== 国家公祭日灰色界面 ========== */
html.gray-mode {
    filter: grayscale(100%);
    -webkit-filter: grayscale(100%);
}

/* ========== 管理员 Markdown 内容样式 ========== */
.admin-markdown-content {
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--text);
}

/* 标题 */
.admin-markdown-content h1,
.admin-markdown-content h2,
.admin-markdown-content h3,
.admin-markdown-content h4,
.admin-markdown-content h5,
.admin-markdown-content h6 {
    margin: 1.2em 0 0.6em 0;
    font-weight: 700;
    line-height: 1.3;
}
.admin-markdown-content h1 { font-size: 1.8rem; border-bottom: 2px solid var(--border); padding-bottom: 0.3em; }
.admin-markdown-content h2 { font-size: 1.5rem; }
.admin-markdown-content h3 { font-size: 1.25rem; }

/* 段落 */
.admin-markdown-content p {
    margin: 0.8em 0;
}

/* 列表 */
.admin-markdown-content ul,
.admin-markdown-content ol {
    margin: 0.8em 0;
    padding-left: 1.8em;
}
.admin-markdown-content li {
    margin: 0.3em 0;
}

/* 代码块 */
.admin-markdown-content pre {
    background: var(--reply-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 16px;
    overflow-x: auto;
    font-size: 0.9rem;
    line-height: 1.5;
}
.admin-markdown-content code {
    background: var(--reply-bg);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
    font-family: 'Courier New', monospace;
}
.admin-markdown-content pre code {
    background: transparent;
    padding: 0;
}

/* 引用块 */
.admin-markdown-content blockquote {
    margin: 0.8em 0;
    padding: 0.5em 1em;
    border-left: 4px solid #4361ee;
    background: var(--reply-bg);
    border-radius: 0 8px 8px 0;
    color: var(--text-secondary);
}

/* 链接 */
.admin-markdown-content a {
    color: #4361ee;
    text-decoration: underline;
}
.admin-markdown-content a:hover {
    color: #2a3faa;
}

/* 表格（如果启用 Extra） */
.admin-markdown-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 1em 0;
}
.admin-markdown-content th,
.admin-markdown-content td {
    border: 1px solid var(--border);
    padding: 6px 10px;
    text-align: left;
}
.admin-markdown-content th {
    background: var(--reply-bg);
    font-weight: 600;
}

/* 图片 */
.admin-markdown-content img {
    max-width: 100%;
    border-radius: 8px;
    margin: 0.5em 0;
}
/* 管理员回复样式 */
.reply-item-admin {
    background: #f0f7ff !important;
    border-left: 4px solid #4361ee !important;
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 10px;
}

.admin-reply-badge {
    background: #4361ee;
    color: #fff;
    font-size: 11px;
    padding: 2px 10px;
    border-radius: 12px;
    margin-left: 8px;
    display: inline-block;
    vertical-align: middle;
}