* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 成功提示框 */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 30px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    z-index: 9999;
    opacity: 0;
    transition: all 0.4s ease;
    font-size: 15px;
    font-weight: 500;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    background: #f5f5f5;
    min-height: 100vh;
    color: #333;
}

/* 顶部标题栏 */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-align: center;
    padding: 40px 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header h1 {
    font-size: 32px;
    margin-bottom: 10px;
    font-weight: 600;
}

.header .subtitle {
    font-size: 16px;
    opacity: 0.9;
}

/* 主容器 - 三栏布局 */
.main-container {
    max-width: 1400px;
    margin: 20px auto;
    display: grid;
    grid-template-columns: 280px 1fr 280px;
    gap: 20px;
    padding: 0 20px;
}

/* 左侧边栏 */
.sidebar-left {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
}

/* 中间内容区 */
.main-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
}

/* 右侧边栏 */
.sidebar-right {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
}

/* 小组件通用样式 */
.widget {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.widget h3 {
    font-size: 16px;
    color: #333;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #667eea;
    font-weight: 600;
}

/* 统计组件 */
.stats-widget {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.stats-widget h3 {
    color: white;
    border-bottom-color: rgba(255,255,255,0.3);
}

.stats-content {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255,255,255,0.2);
}

.stat-item:last-child {
    border-bottom: none;
}

.stat-label {
    font-size: 14px;
    opacity: 0.9;
}

.stat-value {
    font-size: 20px;
    font-weight: bold;
}

/* 快捷链接 */
.quick-links {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.quick-links a {
    padding: 12px 16px;
    background: #f8f9fa;
    border-radius: 8px;
    color: #333;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
}

.quick-links a:hover {
    background: #e9ecef;
    transform: translateX(5px);
    color: #667eea;
}

/* 公告组件 */
.notice-widget {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.notice-widget h3 {
    color: white;
    border-bottom-color: rgba(255,255,255,0.3);
}

.notice-content p {
    font-size: 14px;
    line-height: 1.8;
    margin-bottom: 10px;
}

/* 广告位组件 */
.ad-widget {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    text-align: center;
    overflow: hidden;
    padding: 0;
}

.ad-widget h3 {
    color: white;
    border-bottom-color: rgba(255,255,255,0.3);
    margin: 20px 20px 15px;
}

.ad-widget img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 0;
    box-shadow: none;
}

.ad-widget a {
    display: block;
    overflow: hidden;
    margin: 0;
    padding: 0;
    width: 100%;
}

.ad-widget a img {
    width: 100%;
    height: auto;
    display: block;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 0;
}

.ad-widget iframe {
    max-width: 100%;
    border: none;
    margin: 0;
    padding: 0;
    display: block;
    width: 100%;
}

.ad-placeholder {
    padding: 30px 20px;
    margin: 20px;
    background: rgba(255,255,255,0.2);
    border-radius: 8px;
    border: 2px dashed rgba(255,255,255,0.5);
}

.ad-placeholder span {
    display: block;
    font-size: 18px;
    margin-bottom: 5px;
}

.ad-placeholder small {
    font-size: 12px;
    opacity: 0.8;
}

/* 热门留言 */
.hot-messages {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.hot-message-item {
    padding: 12px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    border-left: 3px solid #667eea;
}

.hot-message-item:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    transform: translateX(3px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

.hot-message-title {
    font-size: 14px;
    color: #333;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.hot-rank {
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
    margin-right: 8px;
}

.hot-rank.rank-1 {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
}

.hot-rank.rank-2 {
    background: linear-gradient(135deg, #c0c0c0 0%, #e0e0e0 100%);
}

.hot-rank.rank-3 {
    background: linear-gradient(135deg, #cd7f32 0%, #e67e22 100%);
}

.loading-small {
    text-align: center;
    color: #999;
    font-size: 13px;
    padding: 20px;
}

/* 公告信息 */
.announcement-widget h3 {
    color: #667eea;
}

.announcement-content {
    padding: 10px 0;
}

.announcement-text {
    color: #555;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 10px;
}

.announcement-image {
    width: 100%;
    border-radius: 8px;
    display: block;
    margin-top: 10px;
}

/* 简介模块 */
.intro-widget h3 {
    color: #667eea;
}

.intro-content {
    padding: 10px 0;
}

.intro-text {
    color: #555;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 10px;
}

.intro-image {
    width: 100%;
    border-radius: 8px;
    display: block;
    margin-top: 10px;
}

/* 使用提示列表 */
.tips-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.tips-list li {
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
    color: #666;
    display: flex;
    align-items: center;
}

.tips-list li:before {
    content: '💡';
    margin-right: 10px;
    font-size: 16px;
}

.tips-list li:last-child {
    border-bottom: none;
}

/* 表单容器 */
.form-container {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

#message {
    width: 100%;
    min-height: 120px;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    resize: vertical;
    transition: border-color 0.3s;
}

#message:focus {
    outline: none;
    border-color: #667eea;
}

.tools {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.tool-btn {
    padding: 10px 16px;
    background: #f8f9fa;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 24px;
    transition: all 0.3s;
    display: inline-block;
}

.tool-btn:hover {
    background: #e9ecef;
    transform: scale(1.1);
}

.image-preview {
    margin-left: auto;
}

.image-preview img {
    max-width: 100px;
    max-height: 100px;
    border-radius: 8px;
    object-fit: cover;
    display: block;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.remove-image {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #dc3545;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(220, 53, 69, 0.3);
}

.emoji-panel {
    display: none;
    grid-template-columns: repeat(8, 1fr);
    gap: 8px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 15px;
}

.emoji-panel.show {
    display: grid;
}

.emoji-panel .emoji {
    font-size: 28px;
    cursor: pointer;
    text-align: center;
    padding: 8px;
    border-radius: 5px;
    transition: background 0.2s, transform 0.2s;
}

.emoji-panel .emoji:hover {
    background: #e9ecef;
    transform: scale(1.2);
}

.submit-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    user-select: none;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.submit-btn:active {
    transform: translateY(0);
}

.submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

/* 留言列表区域 */
.messages-section {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.section-title {
    font-size: 18px;
    color: #333;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #667eea;
    font-weight: 600;
}

.messages {
    max-height: 800px;
    overflow-y: auto;
    padding: 10px;
    background: #fafafa;
    border-radius: 8px;
}

/* 隐藏滚动条 */
.messages::-webkit-scrollbar {
    width: 0;
    display: none;
}

.messages {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.empty {
    text-align: center;
    color: #999;
    padding: 60px 20px;
    font-size: 15px;
}

.no-links {
    text-align: center;
    color: #999;
    padding: 30px;
    font-size: 14px;
}

/* 留言项 */
.message-item {
    padding: 15px 0;
    border-bottom: 1px solid #e8e8e8;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-item:last-child {
    border-bottom: none;
}

.msg-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.msg-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #667eea;
    flex-shrink: 0;
    display: block;
}

.msg-info {
    display: flex;
    flex-direction: column;
}

.username {
    font-weight: 600;
    color: #667eea;
    font-size: 15px;
}

.time {
    color: #999;
    font-size: 13px;
}

.msg-content {
    color: #555;
    font-size: 15px;
    line-height: 1.7;
    word-wrap: break-word;
}

.msg-image {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    margin: 10px auto 0;
    display: block;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-left: auto;
    margin-right: auto;
}

.msg-blocked {
    background: #fee2e2;
    color: #dc3545;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    font-weight: 500;
    border: 1px dashed #dc3545;
}

/* 留言底部操作栏 */
.msg-actions {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #f0f0f0;
}

.msg-action {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    color: #666;
    cursor: pointer;
    transition: color 0.2s;
    padding: 5px 10px;
    border-radius: 5px;
    background: transparent;
    border: none;
    -webkit-tap-highlight-color: transparent;
}

.msg-action:hover {
    color: #667eea;
    background: #f0f4ff;
}

.msg-action.liked {
    color: #ff4757;
}

.msg-action-icon {
    font-size: 16px;
}

.msg-action-count {
    font-weight: 500;
}

/* 回复区域 */
.replies-section {
    margin-top: 12px;
    padding-left: 20px;
    border-left: 3px solid #667eea;
    background: #f8f9fa;
    border-radius: 0 8px 8px 0;
    padding: 12px 15px;
}

.reply-item {
    padding: 10px 0;
    border-bottom: 1px solid #e8e8e8;
}

.reply-item:last-child {
    border-bottom: none;
}

.reply-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.reply-username {
    font-weight: 600;
    font-size: 14px;
}

.reply-username.admin {
    color: #667eea;
}

.reply-username.admin::after {
    content: ' [官方]';
    font-size: 11px;
    background: #667eea;
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    margin-left: 5px;
}

.reply-username.guest {
    color: #555;
}

.reply-time {
    color: #999;
    font-size: 12px;
}

.reply-content {
    color: #555;
    font-size: 14px;
    line-height: 1.6;
    word-wrap: break-word;
}

.reply-content .reply-to {
    color: #667eea;
    font-weight: 500;
}

.reply-blocked {
    color: #dc3545;
    font-size: 13px;
    padding: 8px;
    background: rgba(220, 53, 69, 0.1);
    border-radius: 5px;
}

/* 嵌套回复 */
.nested-replies {
    margin-left: 20px;
    margin-top: 10px;
    padding-left: 15px;
    border-left: 2px solid #ddd;
    background: white;
    border-radius: 0 6px 6px 0;
}

/* 折叠/展开回复 */
.reply-collapse {
    margin-top: 8px;
    padding: 6px 12px;
    background: #e9ecef;
    border-radius: 4px;
    font-size: 13px;
    color: #667eea;
    cursor: pointer;
    text-align: center;
    transition: background 0.2s;
}

.reply-collapse:hover {
    background: #dde2e6;
}

.nested-replies.collapsed {
    display: none;
}

.device-badge {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 3px;
    margin-left: 8px;
}

.device-mobile {
    background: #e3f2fd;
    color: #1976d2;
}

.device-desktop {
    background: #f3e5f5;
    color: #7b1fa2;
}

/* 回复输入框 */
.reply-input-container {
    margin-top: 10px;
    display: none;
}

.reply-input-container.show {
    display: block;
}

.reply-input {
    width: 100%;
    min-height: 80px;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    resize: vertical;
    transition: border-color 0.3s;
    font-family: inherit;
}

.reply-input:focus {
    outline: none;
    border-color: #667eea;
}

.reply-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 10px;
}

.reply-btn {
    padding: 8px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.reply-btn-submit {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.reply-btn-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.3);
}

.reply-btn-cancel {
    background: #f8f9fa;
    color: #666;
}

.reply-btn-cancel:hover {
    background: #e9ecef;
}

/* 加载更多提示 */
.load-more {
    text-align: center;
    padding: 20px;
    color: #667eea;
    cursor: pointer;
    font-size: 14px;
    display: none;
}

.load-more.show {
    display: block;
}

.load-more:hover {
    color: #5568d3;
}

.loading {
    display: none;
    text-align: center;
    padding: 20px;
    color: #999;
    font-size: 14px;
}

.loading.show {
    display: block;
}

.blocked-image-placeholder {
    background: #fff3f3;
    border: 2px dashed #ff4444;
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    color: #ff4444;
    font-size: 16px;
    font-weight: 600;
    margin: 10px auto 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    margin-left: auto;
    margin-right: auto;
}

.msg-deleted {
    color: #dc3545;
    font-size: 14px;
    font-style: italic;
    padding: 10px;
    background: transparent;
    border: none;
    border-radius: 0;
}

.deleted-notice {
    color: #dc3545;
    font-size: 14px;
    font-weight: 600;
    padding: 12px 15px;
    background: rgba(220, 53, 69, 0.1);
    border-radius: 8px;
    border-left: 4px solid #dc3545;
    margin-bottom: 15px;
    text-align: center;
}

/* 友情链接 */
.footer-links {
    margin-top: 30px;
    padding-top: 20px;
}

.footer-links h3 {
    font-size: 14px;
    color: #666;
    margin-bottom: 15px;
    font-weight: 500;
    text-align: center;
}

.footer-links .links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    align-items: center;
}

.footer-links .links a {
    color: #667eea;
    text-decoration: none;
    font-size: 13px;
    padding: 6px 12px;
    border: none;
    background: transparent;
    transition: all 0.3s;
}

.footer-links .links a:hover {
    color: #667eea;
    text-decoration: underline;
    background: transparent;
    transform: none;
    box-shadow: none;
}

/* 页脚 */
.footer {
    text-align: center;
    padding: 40px 20px;
    color: #999;
    font-size: 14px;
    margin-top: 20px;
}

.footer p {
    margin: 5px 0;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .main-container {
        grid-template-columns: 1fr 280px;
        max-width: 1000px;
    }

    .sidebar-left {
        display: none;
    }
}

/* 手机底部导航 */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    padding: 10px 0;
    border-top: 1px solid #e0e0e0;
}

.mobile-nav-item {
    flex: 1;
    text-align: center;
    padding: 12px 10px;
    text-decoration: none;
    color: #666;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
    position: relative;
}

.mobile-nav-item.active {
    color: #667eea;
}

.mobile-nav-item.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 3px;
    background: #667eea;
    border-radius: 2px;
}

.mobile-nav-item:hover {
    background: #f8f9fa;
    color: #667eea;
}

/* 手机端显示底部导航 */
@media (max-width: 768px) {
    .mobile-bottom-nav {
        display: flex;
    }

    /* 隐藏左侧边栏导航（手机端） */
    .nav-widget {
        display: none;
    }

    .main-container {
        padding-bottom: 70px; /* 为底部导航留出空间 */
    }

    .footer {
        padding-bottom: 80px;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 30px 15px;
    }

    .header h1 {
        font-size: 24px;
    }

    .header .subtitle {
        font-size: 14px;
    }

    .main-container {
        padding: 0 10px;
        margin: 10px auto;
        display: flex;
        flex-direction: column;
        width: 100% !important;
        max-width: none !important;
    }

    .sidebar-left {
        display: flex;
        order: 3;
        width: 100%;
    }

    .main-content {
        display: flex;
        order: 1;
        width: 100%;
    }

    .sidebar-right {
        display: none;
    }

    .form-container {
        padding: 20px 15px;
        width: 100%;
    }

    .submit-btn {
        padding: 18px;
        font-size: 18px;
        position: relative;
        z-index: 10;
    }

    .messages-section {
        padding: 15px;
        width: 100%;
    }

    .messages {
        width: 100%;
    }

    .emoji-panel {
        grid-template-columns: repeat(4, 1fr);
    }

    .image-preview {
        margin: 10px 0;
        width: 100%;
        position: relative;
        display: flex;
        justify-content: center;
        align-items: center;
    }

    .image-preview img {
        max-width: 150px;
        max-height: 150px;
    }

    .remove-image {
        position: absolute;
        top: -10px !important;
        right: -10px !important;
        width: 30px !important;
        height: 30px !important;
        font-size: 18px !important;
        z-index: 100;
        background: #dc3545 !important;
        color: white !important;
        border-radius: 50% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        cursor: pointer !important;
        box-shadow: 0 2px 8px rgba(220, 53, 69, 0.4) !important;
    }
}
