/* ============================================
   梅陇中学论坛 - B站风格主题
   主色：哔哩哔哩粉 #FB7299 / 蓝 #00AEEC
   ============================================ */

:root {
    --bili-pink: #fb7299;
    --bili-pink-hover: #ff85a2;
    --bili-pink-soft: #fff0f6;
    --bili-blue: #00aeec;
    --bili-blue-hover: #00c0ff;
    --bili-blue-soft: #e5f6fd;
    --bg-page: #f1f2f3;
    --bg-card: #ffffff;
    --bg-soft: #f7f8fa;
    --border: #e3e5e7;
    --text-1: #18191c;
    --text-2: #61666d;
    --text-3: #9499a0;
    --danger: #ff4757;
    --radius: 12px;
    --radius-sm: 8px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg-page);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 20px;
    color: var(--text-1);
    background-image: radial-gradient(circle at 12% 0%, rgba(251, 114, 153, 0.08), transparent 42%),
                      radial-gradient(circle at 88% 100%, rgba(0, 174, 236, 0.08), transparent 42%);
}

a { color: var(--bili-blue); }

/* ---- 滚动条 ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; border-radius: 10px; }
::-webkit-scrollbar-thumb { background: #d0d3d6; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #b8bcc0; }

/* ---- 通用宽屏容器 ---- */
.app-wrapper {
    display: flex;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 8px 28px rgba(0, 0, 0, 0.06);
    border: 1px solid var(--border);
    overflow: hidden;
    min-height: 85vh;
    max-height: calc(100vh - 40px);
    height: auto;
}

/* ---- 左侧边栏（通用） ---- */
.sidebar {
    width: 260px;
    min-width: 260px;
    background: var(--bg-soft);
    border-right: 1px solid var(--border);
    padding: 16px 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    height: 100%;
    max-height: 85vh;
}
.sidebar-header {
    padding: 0 16px 12px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.sidebar-header h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--bili-pink);
    display: flex;
    align-items: center;
    gap: 6px;
}
.sidebar-nav {
    padding: 8px 0;
    flex: 1;
}
.sidebar-nav a {
    display: flex;
    align-items: center;
    padding: 9px 16px;
    color: var(--text-2);
    text-decoration: none;
    font-size: 0.95rem;
    transition: background 0.15s, color 0.15s;
    border-radius: var(--radius-sm);
    margin: 0 8px;
    gap: 8px;
}
.sidebar-nav a:hover {
    background: #e9eaec;
    color: var(--bili-blue);
}
.sidebar-nav a.active {
    background: var(--bili-pink-soft);
    color: var(--bili-pink);
    font-weight: 600;
}
.sidebar-nav .badge {
    margin-left: auto;
    background: var(--bili-pink);
    color: #fff;
    border-radius: 50%;
    padding: 0px 6px;
    font-size: 0.7rem;
    line-height: 18px;
    min-width: 18px;
    text-align: center;
}

/* ---- 右侧主内容 ---- */
.main-content {
    flex: 1;
    padding: 20px 24px;
    overflow-y: auto;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
}
.main-content .page-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-1);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.main-content .actions {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-left: auto;
}

/* ---- 通用按钮 ---- */
.btn-primary {
    background: var(--bili-pink);
    color: #fff;
    border: none;
    padding: 6px 18px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(251, 114, 153, 0.28);
}
.btn-primary:hover {
    background: var(--bili-pink-hover);
    transform: translateY(-1px);
}
.btn-secondary {
    background: var(--bg-page);
    color: var(--text-2);
    border: 1px solid var(--border);
    padding: 6px 18px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s;
}
.btn-secondary:hover {
    background: #e9eaec;
    color: var(--bili-blue);
    border-color: #d3d5d8;
}
.btn-danger {
    background: rgba(255, 71, 87, 0.1);
    color: var(--danger);
    border: 1px solid rgba(255, 71, 87, 0.18);
    padding: 6px 18px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s;
}
.btn-danger:hover {
    background: var(--danger);
    color: #fff;
}
.btn-sm {
    padding: 3px 12px;
    font-size: 0.8rem;
}

/* ---- 表单 ---- */
.form-group {
    margin-bottom: 16px;
}
.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-1);
    font-size: 0.95rem;
}
.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-soft);
    font-family: inherit;
    font-size: 1rem;
    color: var(--text-1);
    transition: border 0.2s, background 0.2s, box-shadow 0.2s;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--bili-blue);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(0, 174, 236, 0.12);
}

/* ---- 头像 ---- */
.avatar-img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border);
}
.avatar-sm {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

/* ---- 状态提示 ---- */
.error {
    background: rgba(255, 71, 87, 0.1);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--danger);
    margin-bottom: 10px;
}
.success {
    background: rgba(0, 174, 236, 0.1);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--bili-blue);
    margin-bottom: 10px;
}

/* ---- 列表项 ---- */
.list-item {
    background: var(--bg-soft);
    border: 1px solid var(--border);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    transition: 0.15s;
}
.list-item:hover {
    background: #fff;
    border-color: #d3d5d8;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}
.list-item .title {
    font-weight: 600;
    color: var(--text-1);
}
.list-item .meta {
    font-size: 0.8rem;
    color: var(--text-2);
    margin-top: 2px;
}
.list-item .actions {
    margin-top: 6px;
    display: flex;
    gap: 6px;
}

/* ---- 通知条目 ---- */
.notif-item {
    background: var(--bg-soft);
    border: 1px solid var(--border);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
}
.notif-item.unread {
    border-left: 4px solid var(--bili-pink);
    background: var(--bili-pink-soft);
}
.notif-item .notif-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ---- 聊天布局 ---- */
.chat-contact {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: 0.15s;
}
.chat-contact:hover {
    background: #e9eaec;
}
.chat-contact.active {
    background: var(--bili-blue-soft);
}
.chat-contact .name {
    font-weight: 600;
}
.chat-contact .last-msg {
    font-size: 0.8rem;
    color: var(--text-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0;
}
.chat-message {
    margin-bottom: 8px;
    max-width: 75%;
    padding: 8px 14px;
    border-radius: 12px;
    background: var(--bg-page);
    color: var(--text-1);
}
.chat-message.sent {
    margin-left: auto;
    background: var(--bili-pink);
    color: #fff;
}
.chat-message .time {
    font-size: 0.7rem;
    color: var(--text-3);
    margin-top: 2px;
    display: block;
}
.chat-message.sent .time {
    color: rgba(255, 255, 255, 0.7);
}

/* ---- 独立页面卡片（登录 / 注册 / 私信） ---- */
.container {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px 28px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.06);
}
.container h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--bili-pink);
    margin-bottom: 8px;
    text-align: center;
}
.container h2 {
    font-weight: 600;
    color: var(--text-1);
}

/* ---- 一键三连特效 ---- */
.sanlian-btn {
    background: linear-gradient(135deg, #fb7299, #ff9db8);
    color: #fff;
    border: none;
    padding: 6px 18px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.9rem;
    box-shadow: 0 3px 12px rgba(251, 114, 153, 0.4);
    transition: transform 0.15s, box-shadow 0.2s;
}
.sanlian-btn:hover {
    transform: translateY(-1px) scale(1.04);
    box-shadow: 0 6px 18px rgba(251, 114, 153, 0.5);
}
.sanlian-btn:active {
    transform: scale(0.94);
}

.sanlian-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 99999;
    overflow: hidden;
}
.sanlian-particle {
    position: fixed;
    font-size: 26px;
    will-change: transform, opacity;
    animation: sanlian-fly 1.1s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}
@keyframes sanlian-fly {
    0%   { transform: translate(0, 0) scale(0.3) rotate(0deg); opacity: 0; }
    15%  { opacity: 1; }
    100% { transform: translate(var(--tx), var(--ty)) scale(1.1) rotate(var(--rot)); opacity: 0; }
}
.sanlian-burst {
    position: fixed;
    font-size: 54px;
    animation: sanlian-pop 0.9s ease-out forwards;
}
@keyframes sanlian-pop {
    0%   { transform: translate(-50%, -50%) scale(0.2); opacity: 0; }
    40%  { transform: translate(-50%, -50%) scale(1.3); opacity: 1; }
    70%  { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    100% { transform: translate(-50%, -150%) scale(0.9); opacity: 0; }
}
.sanlian-toast {
    position: fixed;
    left: 50%;
    bottom: 15%;
    transform: translateX(-50%) translateY(20px);
    background: linear-gradient(135deg, #fb7299, #ff9db8);
    color: #fff;
    padding: 10px 26px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 1rem;
    box-shadow: 0 8px 24px rgba(251, 114, 153, 0.45);
    opacity: 0;
    z-index: 100000;
    pointer-events: none;
    animation: sanlian-toast-in 0.35s ease-out forwards, sanlian-toast-out 0.4s ease-in 1.4s forwards;
}
@keyframes sanlian-toast-in {
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
@keyframes sanlian-toast-out {
    to { opacity: 0; transform: translateX(-50%) translateY(-16px); }
}

/* ---- 投币 ---- */
.coin-btn {
    background: linear-gradient(135deg, #ffb347, #ffcc70);
    color: #7a4a00;
    border: none;
    padding: 6px 18px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.9rem;
    box-shadow: 0 3px 12px rgba(255, 179, 71, 0.4);
    transition: transform 0.15s, box-shadow 0.2s;
}
.coin-btn:hover {
    transform: translateY(-1px) scale(1.04);
    box-shadow: 0 6px 18px rgba(255, 179, 71, 0.5);
}
.coin-btn:active {
    transform: scale(0.94);
}
.coin-hint {
    font-size: 0.8rem;
    color: var(--text-2);
    margin-top: 8px;
}

/* ---- 历史记录下拉 ---- */
.history-wrap { position: relative; }
.history-panel {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    width: 240px;
    max-height: 320px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    padding: 6px;
    z-index: 1000;
}
.history-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-3);
    padding: 4px 8px 6px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 4px;
}
.history-head a { color: var(--bili-blue); }
.history-item {
    display: block;
    padding: 7px 8px;
    border-radius: 6px;
    color: var(--text-1);
    text-decoration: none;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.history-item:hover { background: var(--bg-page); color: var(--bili-pink); }
.history-empty { padding: 12px 8px; text-align: center; color: var(--text-3); font-size: 0.85rem; }

/* ---- 投币选择菜单 ---- */
.coin-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    padding: 6px;
    z-index: 1000;
    min-width: 120px;
}
.coin-menu button {
    display: block;
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    padding: 7px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-1);
}
.coin-menu button:hover { background: #fff5e6; color: #b8860b; }

/* ---- 未读消息红点 ---- */
.msg-dot {
    display: inline-block;
    min-width: 16px;
    height: 16px;
    padding: 0 5px;
    margin-left: 4px;
    background: #ff4757;
    color: #fff;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    vertical-align: middle;
}

/* ---- 外观设置面板 ---- */
.lg-settings-btn {
    position: fixed;
    right: 18px;
    bottom: 18px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
    font-size: 20px;
    cursor: pointer;
    z-index: 100001;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s;
}
.lg-settings-btn:hover { transform: scale(1.08) rotate(20deg); }

.lg-settings-panel {
    position: fixed;
    right: 18px;
    bottom: 72px;
    width: 232px;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 14px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25);
    padding: 12px 14px;
    z-index: 100001;
    display: none;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
.lg-settings-panel.open { display: block; }
.lg-set-title { font-weight: 700; color: #18191c; margin-bottom: 8px; }
.lg-set-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 0;
    font-size: 0.88rem;
    color: #18191c;
}
.lg-set-row input[type="color"] {
    width: 42px;
    height: 24px;
    border: none;
    background: none;
    padding: 0;
    cursor: pointer;
}
.lg-set-toggle input { width: 18px; height: 18px; cursor: pointer; }
.lg-set-reset {
    width: 100%;
    margin-top: 8px;
    padding: 6px 0;
    border-radius: 20px;
    border: 1px solid #e3e5e7;
    background: #f1f2f3;
    color: #18191c;
    cursor: pointer;
    font-size: 0.85rem;
}
.lg-set-reset:hover { background: #e6e8ea; }

/* ---- 响应式 ---- */
@media (max-width: 768px) {
    body { padding: 8px; align-items: flex-start; }
    .app-wrapper {
        flex-direction: column;
        min-height: 90vh;
        max-height: none;
        border-radius: var(--radius-sm);
    }
    .sidebar {
        width: 100%;
        min-width: unset;
        border-right: none;
        border-bottom: 1px solid var(--border);
        max-height: 200px;
        overflow-y: auto;
    }
    .main-content {
        padding: 12px 16px;
        max-height: none;
    }
    .chat-message {
        max-width: 90%;
    }
}
