/* ============================================
   有群吗 - 加个群吧 主样式表（响应式）
   ============================================ */

/* —— CSS 变量 —— */
:root {
    --primary: #4f80ff;
    --primary-dark: #3a66d9;
    --primary-light: #e8edff;
    --success: #28a745;
    --warning: #ffc107;
    --danger: #dc3545;
    --info: #17a2b8;
    --dark: #333;
    --gray: #6c757d;
    --light-gray: #f5f6fa;
    --border: #e0e0e0;
    --white: #fff;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
    --radius: 12px;
    --radius-sm: 6px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    --max-width: 1200px;
}

/* —— 重置与基础 —— */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-family: var(--font);
    color: var(--dark);
    background: var(--light-gray);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* 阻止部分浏览器自动放大字体 */
input, textarea, select, button {
    font-size: 16px;
}

.container {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 16px;
}

a { color: var(--primary); text-decoration: none; transition: color .2s; }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; height: auto; display: block; }

/* —— 导航栏 —— */
.navbar {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
}
.nav-logo {
    display: flex;
    align-items: center;
}
.nav-logo img {
    height: 36px;
    width: auto;
    display: block;
}
.nav-menu {
    list-style: none;
    display: flex;
    gap: 4px;
    align-items: center;
}
.nav-menu li a {
    display: block;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    color: var(--dark);
    font-size: 0.95rem;
    font-weight: 500;
    transition: background .2s;
}
.nav-menu li a:hover {
    background: var(--primary-light);
    color: var(--primary);
}
.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    z-index: 1001;
}
.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--dark);
    border-radius: 2px;
    transition: .3s;
}

/* —— 主要内容 —— */
.main-content {
    flex: 1;
    padding: 24px 0 48px;
}

/* —— 页脚 —— */
.site-footer {
    background: var(--white);
    border-top: 1px solid var(--border);
    padding: 16px 0;
    text-align: center;
    color: var(--gray);
    font-size: 0.85rem;
}

/* —— 卡片 —— */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 16px;
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.card-header h2, .card-header h3 { font-size: 1.2rem; color: var(--dark); }
/* —— 搜索栏 —— */
.search-section {
    background: linear-gradient(135deg, #4f80ff 0%, #6c5ce7 100%);
    padding: 40px 0;
    text-align: center;
    color: var(--white);
}
.search-section h1 {
    font-size: 1.8rem;
    margin-bottom: 8px;
    font-weight: 700;
}
.search-section p {
    font-size: 1rem;
    opacity: 0.9;
    margin-bottom: 20px;
}
.search-form {
    display: flex;
    max-width: 600px;
    margin: 0 auto;
    gap: 8px;
}
.search-form input[type="text"] {
    flex: 1;
    padding: 12px 18px;
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    outline: none;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}
.search-form button {
    padding: 12px 28px;
    border: none;
    border-radius: 50px;
    background: var(--warning);
    color: var(--dark);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: .2s;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}
.search-form button:hover {
    background: #ffb300;
    transform: translateY(-1px);
}

/* —— 分类标签 —— */
.category-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 20px 0;
}
.category-tab {
    padding: 6px 16px;
    border-radius: 50px;
    background: var(--white);
    border: 1px solid var(--border);
    color: var(--dark);
    font-size: 0.9rem;
    cursor: pointer;
    transition: .2s;
    text-decoration: none;
}
.category-tab:hover, .category-tab.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

/* —— 群列表 —— */
.group-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

@media (min-width: 1024px) {
    .group-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 768px) {
    .group-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
}

@media (max-width: 320px) {
    .group-grid { grid-template-columns: 1fr; }
}

.group-card {
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform .2s, box-shadow .2s;
    display: flex;
    flex-direction: column;
}
.group-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(0,0,0,0.12);
}
.group-card-clickable {
    cursor: pointer;
}
.group-card-img {
    position: relative;
    height: 200px;
    background: var(--light-gray);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    cursor: pointer;
}
.group-card-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform .3s;
}
.group-card-img:hover img {
    transform: scale(1.05);
}
.group-card-body {
    padding: 14px;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.group-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    min-width: 0;
}
.group-title-row h3 {
    font-size: 1rem;
    margin-bottom: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 1;
    min-width: 0;
    line-height: 1.4;
}
.category-badge-inline {
    display: inline-block;
    padding: 2px 10px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 500;
    flex-shrink: 0;
    white-space: nowrap;
}
.group-card-body .group-desc {
    color: var(--gray);
    font-size: 0.85rem;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.group-card-meta {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--gray);
}
.group-card-meta .category-badge {
    display: inline-block;
    padding: 2px 10px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* —— 模态弹窗（二维码查看） —— */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}
.modal-overlay.active {
    display: flex;
}
.modal-content {
    background: var(--white);
    border-radius: var(--radius);
    max-width: 420px;
    width: 100%;
    position: relative;
    overflow: hidden;
}
.modal-content img {
    width: 100%;
    display: block;
}
.modal-close {
    position: absolute;
    top: 8px; right: 8px;
    width: 32px; height: 32px;
    border-radius: 50%;
    background: rgba(0,0,0,0.5);
    color: var(--white);
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s;
}
.modal-close:hover { background: rgba(0,0,0,0.8); }
.modal-info {
    padding: 14px;
}
.modal-info h3 { font-size: 1.1rem; margin-bottom: 4px; }
.modal-info p { color: var(--gray); font-size: 0.9rem; }

/* —— 表单 —— */
.form-group {
    margin-bottom: 16px;
}
.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 0.95rem;
    color: var(--dark);
}
.form-group label .required { color: var(--danger); }
.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: var(--font);
    transition: border-color .2s, box-shadow .2s;
    background: var(--white);
}
.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,128,255,0.15);
    outline: none;
}
textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control { cursor: pointer; }

/* —— 按钮 —— */
.btn {
    display: inline-block;
    padding: 10px 24px;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    text-align: center;
    transition: .2s;
    font-family: var(--font);
    text-decoration: none;
    line-height: 1.4;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--primary); color: var(--white); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: var(--white); }
.btn-success:hover { background: #218838; }
.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover { background: #c82333; }
.btn-warning { background: var(--warning); color: var(--dark); }
.btn-outline {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
}
.btn-outline:hover { background: var(--primary); color: var(--white); }
.btn-sm { padding: 6px 14px; font-size: 0.85rem; }
.btn-block { display: block; width: 100%; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* —— 个人中心编辑表单 —— */
.profile-edit-form {
    margin: 4px 0 12px 0;
    padding: 14px;
    background: var(--light-gray);
    border-radius: var(--radius-sm);
}
.profile-edit-row {
    display: flex;
    gap: 8px;
    align-items: center;
}
.profile-form-group {
    margin-bottom: 10px;
}
.profile-form-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--gray);
    margin-bottom: 4px;
}

/* —— 提示信息 —— */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 0.9rem;
}
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-danger { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-warning { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; }
.alert-info { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }

/* —— 分页 —— */
.pagination {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin: 24px 0;
    flex-wrap: wrap;
}
.page-btn {
    display: inline-block;
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--dark);
    font-size: 0.9rem;
    transition: .2s;
}
.page-btn:hover { background: var(--primary-light); color: var(--primary); }
.page-btn.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

/* —— 状态徽章 —— */
.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 500;
}
.status-pending { background: #fff3cd; color: #856404; }
.status-approved { background: #d4edda; color: #155724; }
.status-rejected { background: #f8d7da; color: #721c24; }

/* —— 登录/注册页 —— */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.auth-box {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: 0 4px 24px rgba(0,0,0,0.12);
    padding: 32px;
    width: 100%;
    max-width: 420px;
}
.auth-box h2 {
    text-align: center;
    margin-bottom: 24px;
    font-size: 1.5rem;
}
.auth-box .auth-links {
    text-align: center;
    margin-top: 16px;
    font-size: 0.9rem;
    color: var(--gray);
}

/* —— 微信登录 —— */
.wx-login-section {
    margin-top: 20px;
}
.divider-text {
    display: flex;
    align-items: center;
    color: var(--gray);
    font-size: 0.8rem;
    margin-bottom: 14px;
}
.divider-text::before,
.divider-text::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border);
}
.divider-text span {
    padding: 0 12px;
}
.wx-login-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 11px 0;
    background: #07c160;
    color: #fff;
    border-radius: 6px;
    font-size: 0.95rem;
    text-decoration: none;
    transition: background 0.2s;
}
.wx-login-btn:hover {
    background: #06ad56;
    color: #fff;
}
.wx-login-btn svg {
    flex-shrink: 0;
}

/* —— 管理后台表格 —— */
.admin-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    min-width: 700px;
}
.admin-table th, .admin-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.admin-table th {
    background: var(--light-gray);
    font-weight: 600;
    white-space: nowrap;
}
.admin-table tr:hover td { background: #fafbfc; }
.admin-table .actions { white-space: nowrap; }
.admin-table .actions a, .admin-table .actions button {
    margin-right: 4px;
}

/* —— 裁剪容器 —— */
.crop-container {
    max-width: 400px;
    margin: 0 auto;
}
.crop-preview {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray);
    position: relative;
    overflow: hidden;
    cursor: pointer;
}
.crop-preview img { max-height: 300px; }
.crop-preview.has-image { border-style: solid; border-color: var(--primary-light); }

/* —— 仪表盘统计 —— */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    text-align: center;
}
.stat-card .stat-num {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}
.stat-card .stat-label {
    color: var(--gray);
    font-size: 0.9rem;
    margin-top: 4px;
}
.stat-card-link {
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card-link:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}

/* —— 筛选栏 —— */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}
.filter-bar a, .filter-bar span {
    padding: 6px 16px;
    border-radius: 50px;
    font-size: 0.85rem;
    border: 1px solid var(--border);
    color: var(--dark);
}
.filter-bar a.active { background: var(--primary); color: var(--white); border-color: var(--primary); }

/* —— 空状态 —— */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--gray);
}
.empty-state svg, .empty-state .empty-icon {
    font-size: 3rem;
    margin-bottom: 12px;
    display: block;
}
.empty-state p { font-size: 1rem; margin-bottom: 8px; }

/* —— 响应式导航 —— */
@media (max-width: 768px) {
    .nav-toggle { display: flex; }
    .nav-menu {
        display: none;
        position: absolute;
        top: 56px;
        left: 0; right: 0;
        background: var(--white);
        flex-direction: column;
        padding: 12px 16px;
        border-bottom: 1px solid var(--border);
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
        gap: 2px;
    }
    .nav-menu.active { display: flex; }
    .nav-menu li a {
        padding: 12px 8px;
        border-radius: var(--radius-sm);
        font-size: 1rem;
    }
    .search-section { padding: 28px 0; }
    .search-section h1 { font-size: 1.4rem; }
    .search-form { flex-direction: column; }
    .search-form input[type="text"] { width: 100%; }
    .search-form button { width: 100%; }
    .auth-box { padding: 24px 20px; }
}

/* —— 自定义分类输入行 —— */
.custom-category-row {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}
.custom-category-row input { flex: 1; }

/* —— 二维码上传区域 —— */
.qrcode-upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    transition: .2s;
    cursor: pointer;
    position: relative;
}
.qrcode-upload-area:hover { border-color: var(--primary); background: var(--primary-light); }
.qrcode-upload-area img { max-height: 250px; margin: 0 auto; }

/* —— 权限复选框组 —— */
.permission-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}
.permission-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: normal !important;
    cursor: pointer;
}

/* —— 邮箱未设置提醒 —— */
.email-reminder {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #fff5f5;
    border: 1px solid #f5c6cb;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 0.9rem;
    color: #721c24;
}
.email-reminder-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}
.email-reminder-link {
    flex-shrink: 0;
    margin-left: auto;
    padding: 5px 14px;
    background: #dc3545;
    color: #fff !important;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s;
}
.email-reminder-link:hover {
    background: #c82333;
    color: #fff !important;
}

/* —— 加载状态 —— */
.loading { opacity: 0.6; pointer-events: none; }

/* —— 详情页 —— */
.detail-breadcrumb {
    padding: 16px 0 12px;
    font-size: 0.88rem;
    color: var(--gray);
}
.detail-breadcrumb a {
    color: var(--gray);
    text-decoration: none;
}
.detail-breadcrumb a:hover { color: var(--primary); }
.detail-breadcrumb span { margin: 0 4px; }
.detail-breadcrumb .active {
    color: var(--dark);
    font-weight: 500;
    margin: 0 4px;
}

/* 居中单列布局 */
.detail-body-center {
    max-width: 560px;
    margin: 0 auto;
    padding: 32px 20px;
    text-align: center;
}

.detail-page-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 24px;
    line-height: 1.4;
    word-break: break-all;
}

/* 二维码居中 */
.detail-qrcode-center {
    margin-bottom: 28px;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.detail-qrcode-center img {
    width: 260px;
    height: 260px;
    border-radius: 8px;
    box-shadow: 0 2px 16px rgba(0,0,0,0.1);
    object-fit: contain;
    display: block;
    margin: 0 auto;
}
.detail-qrcode-tip {
    margin-top: 12px;
    color: var(--gray);
    font-size: 0.9rem;
}

/* 群介绍 */
.detail-desc-center {
    text-align: left;
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 20px;
}
.detail-desc-content {
    color: #444;
    font-size: 0.92rem;
    line-height: 1.8;
    white-space: pre-wrap;
}

/* 发布者 */
.detail-publisher {
    color: var(--gray);
    font-size: 0.88rem;
    margin-bottom: 28px;
}

/* 操作按钮 */
.detail-actions-center {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: nowrap;
}
.detail-actions-center .btn {
    min-width: 0;
    flex: 1;
    max-width: 160px;
    padding: 11px 16px;
}
.btn-poster {
    font-size: 0.82rem !important;
    padding: 11px 14px !important;
    white-space: nowrap !important;
}

/* 响应式 - 手机端优化 */
@media (max-width: 768px) {
    .detail-body-center {
        padding: 20px 18px;
    }
    .detail-page-title {
        font-size: 1.2rem;
        margin-bottom: 20px;
    }
    .detail-qrcode-center img {
        width: 230px;
        height: 230px;
    }
    .detail-desc-center {
        padding: 16px;
        margin-bottom: 18px;
    }
    .detail-desc-content {
        font-size: 0.88rem;
        line-height: 1.75;
    }
    .detail-actions-center .btn {
        min-width: 120px;
        flex: 1;
        max-width: 180px;
    }
}
