﻿/* ============================================================
   cosmo-fishy 蓝色主题样式
   所有样式与 HTML 结构匹配，支持响应式
   ============================================================ */

/* ---------- 全局重置 ---------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

body {
    background: linear-gradient(145deg, #eef6ff 0%, #d9e9fa 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

/* ---------- 主容器 ---------- */
.app-wrapper {
    width: 100%;
    max-width: 1300px;
    min-height: 90vh;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 40px;
    box-shadow: 0 20px 40px -12px rgba(0, 40, 80, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.5);
    padding: 1.5rem 2rem 1rem;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
}

/* ---------- 登录页面 ---------- */
#loginPage {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    flex: 1;
    min-height: 60vh;
}
#loginPage .card {
    max-width: 400px;
    width: 100%;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(4px);
    border-radius: 28px;
    padding: 2.5rem 2rem;
    box-shadow: 0 8px 24px rgba(0, 30, 60, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.6);
    text-align: center;
}
#loginPage .card h2 {
    font-size: 1.8rem;
    color: #0e3d6b;
    margin-bottom: 0.5rem;
}
#loginPage .card p {
    color: #1f5a8a;
    margin-bottom: 1.5rem;
}
#loginPage .card input {
    width: 100%;
    padding: 0.8rem 1.2rem;
    border-radius: 16px;
    border: 1px solid #c6ddf5;
    font-size: 1rem;
    background: white;
    margin-bottom: 1rem;
    transition: 0.2s;
}
#loginPage .card input:focus {
    outline: none;
    border-color: #1f7ad0;
    box-shadow: 0 0 0 3px rgba(31, 122, 208, 0.15);
}
#loginPage .card button {
    width: 100%;
    padding: 0.8rem;
    background: linear-gradient(135deg, #1a6bc4, #0f4e8a);
    color: white;
    border: none;
    border-radius: 30px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
    box-shadow: 0 2px 8px rgba(0, 50, 100, 0.2);
}
#loginPage .card button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 60, 120, 0.3);
}
#loginError {
    color: #b13e3e;
    margin-top: 0.8rem;
    font-size: 0.9rem;
    min-height: 1.5rem;
}

/* ---------- 主应用布局 ---------- */
#mainApp {
    display: none;   /* 默认隐藏，登录后显示 */
    flex-direction: column;
    flex: 1;
}

/* ---------- 顶部标题 ---------- */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 0.8rem;
    border-bottom: 2px solid rgba(30, 100, 180, 0.15);
    margin-bottom: 1.2rem;
    flex-wrap: wrap;
}
.app-header .logo {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(135deg, #1a6bc4, #0f4a8a);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}
.app-header .user-info {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    background: rgba(255, 255, 255, 0.5);
    padding: 0.3rem 1rem 0.3rem 1.2rem;
    border-radius: 40px;
    border: 1px solid #b0ceff;
    font-size: 0.9rem;
    color: #0a3a6a;
}
.app-header .user-info .avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #1f6ec4;
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.8rem;
}
.btn-logout {
    background: transparent;
    border: none;
    color: #c44545;
    font-weight: 600;
    cursor: pointer;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.8rem;
    transition: 0.2s;
}
.btn-logout:hover {
    background: #ffe5e5;
}

/* ---------- 主体（侧边栏 + 内容） ---------- */
.app-body {
    display: flex;
    flex: 1;
    gap: 1.5rem;
    min-height: 60vh;
}

/* ---------- 左侧导航 ---------- */
.sidebar {
    width: 200px;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(4px);
    border-radius: 24px;
    padding: 1.2rem 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.6);
    height: fit-content;
}
.sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.sidebar li {
    margin: 0.2rem 0;
}
.sidebar a {
    display: block;
    padding: 0.7rem 1.2rem;
    border-radius: 14px;
    color: #1a4b7a;
    text-decoration: none;
    font-weight: 500;
    transition: 0.2s;
    cursor: pointer;
}
.sidebar a:hover {
    background: rgba(31, 122, 208, 0.12);
    color: #0a2f55;
}
.sidebar a.active {
    background: rgba(31, 122, 208, 0.2);
    color: #0f4a8a;
    font-weight: 600;
}
.sidebar .hidden {
    display: none;
}

/* ---------- 右侧内容区 ---------- */
.content-area {
    flex: 1;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(4px);
    border-radius: 24px;
    padding: 1.8rem 2rem;
    border: 1px solid rgba(255, 255, 255, 0.6);
    min-height: 400px;
    display: flex;
    flex-direction: column;
}

/* ---------- 页面切换 ---------- */
.page {
    display: none;
    flex-direction: column;
    flex: 1;
    animation: fadeIn 0.25s ease;
}
.page.active {
    display: flex;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---------- 公告 ---------- */
.announcement {
    background: rgba(255, 255, 255, 0.5);
    padding: 0.8rem 1.2rem;
    border-radius: 16px;
    border-left: 4px solid #1f7ad0;
    margin-bottom: 1.5rem;
}
.announcement h2 {
    color: #0e3d6b;
    font-size: 1.4rem;
    margin: 0;
}

/* ---------- 聊天区域 ---------- */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.chat-messages {
    flex: 1;
    overflow-y: auto;
    max-height: 400px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 16px;
    padding: 0.8rem 1rem;
    margin-bottom: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
}
.chat-messages .msg-item {
    padding: 0.4rem 0;
    border-bottom: 1px solid rgba(0, 50, 100, 0.06);
    display: flex;
    gap: 0.5rem;
    align-items: baseline;
}
.chat-messages .msg-item:last-child {
    border-bottom: none;
}
.chat-messages .msg-user {
    font-weight: 600;
    color: #0e3d6b;
    min-width: 60px;
}
.chat-messages .msg-time {
    font-size: 0.7rem;
    color: #4a6f92;
    margin-right: 0.8rem;
}
.chat-messages .msg-content {
    word-break: break-word;
    flex: 1;
}

.chat-input-area {
    display: flex;
    gap: 0.6rem;
    align-items: center;
}
.chat-input-area textarea {
    flex: 1;
    padding: 0.6rem 1rem;
    border-radius: 16px;
    border: 1px solid #c6ddf5;
    resize: none;
    height: 50px;
    background: white;
    transition: 0.2s;
}
.chat-input-area textarea:focus {
    outline: none;
    border-color: #1f7ad0;
    box-shadow: 0 0 0 3px rgba(31, 122, 208, 0.15);
}
.chat-input-area button {
    padding: 0.6rem 1.6rem;
    background: linear-gradient(135deg, #1a6bc4, #0f4e8a);
    color: white;
    border: none;
    border-radius: 30px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
    height: 50px;
    white-space: nowrap;
}
.chat-input-area button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 60, 120, 0.2);
}

/* ---------- 管理后台 ---------- */
#page-admin textarea {
    width: 100%;
    padding: 0.6rem;
    border-radius: 12px;
    border: 1px solid #c6ddf5;
    resize: vertical;
}
#page-admin textarea:focus {
    outline: none;
    border-color: #1f7ad0;
    box-shadow: 0 0 0 3px rgba(31, 122, 208, 0.15);
}
#page-admin button {
    padding: 0.5rem 1.2rem;
    background: linear-gradient(135deg, #1a6bc4, #0f4e8a);
    color: white;
    border: none;
    border-radius: 30px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}
#page-admin button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 60, 120, 0.2);
}
#page-admin .danger {
    background: #b13e3e;
}
#page-admin .danger:hover {
    background: #9a2e2e;
}
#page-admin hr {
    margin: 1.5rem 0;
    border: 0;
    border-top: 1px solid rgba(30, 100, 180, 0.1);
}
#page-admin .invite-item {
    display: flex;
    justify-content: space-between;
    padding: 0.4rem 0;
    border-bottom: 1px solid rgba(0, 50, 100, 0.05);
}

/* ---------- 页脚 ---------- */
.app-footer {
    text-align: center;
    padding: 1rem 0 0.2rem;
    font-size: 0.85rem;
    color: #3d6a94;
    border-top: 1px solid rgba(30, 100, 180, 0.1);
    margin-top: 1rem;
}

/* ---------- 通用工具 ---------- */
.hidden {
    display: none !important;
}
.danger {
    background: #b13e3e !important;
}
.danger:hover {
    background: #9a2e2e !important;
}

/* ---------- 响应式 ---------- */
@media (max-width: 768px) {
    .app-wrapper {
        padding: 1rem;
        border-radius: 24px;
    }
    .app-body {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        padding: 0.5rem;
    }
    .sidebar ul {
        display: flex;
        flex-wrap: wrap;
        gap: 0.3rem;
        justify-content: center;
    }
    .sidebar li {
        margin: 0;
    }
    .sidebar a {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
    .chat-input-area {
        flex-direction: column;
        align-items: stretch;
    }
    .chat-input-area button {
        height: 44px;
    }
    .app-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    .app-header .user-info {
        align-self: flex-start;
    }
    #loginPage .card {
        padding: 1.5rem 1rem;
    }
    .content-area {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .app-wrapper {
        padding: 0.5rem;
        border-radius: 16px;
    }
    .app-header .logo {
        font-size: 1.4rem;
    }
    .sidebar a {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
    .content-area {
        padding: 0.8rem;
    }
    .chat-messages {
        max-height: 250px;
    }
}