/* ============================================================
   浙狮应急委 - 全站统一公共样式
   色彩体系 | 字体 | 卡片 | 按钮 | 表单 | 布局
   ============================================================ */

/* ===== CSS变量 ===== */
:root {
    --primary: #0F4C81;
    --primary-dark: #0A3A63;
    --secondary: #36A2EB;
    --orange: #FF7D3B;
    --danger: #E74C3C;
    --success: #27AE60;
    --bg-light: #F5F7FA;
    --border: #DCE1E8;
    --text: #333333;
    --text-muted: #777777;
    --white: #FFFFFF;
    --radius: 8px;
    --radius-sm: 4px;
    --shadow: 0 2px 8px rgba(15,76,129,0.1);
    --shadow-hover: 0 4px 16px rgba(15,76,129,0.18);
    --max-width: 1200px;
    --font-family: 'Microsoft YaHei', 'PingFang SC', 'Helvetica Neue', Arial, sans-serif;
}

/* ===== 全局重置 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    color: var(--text);
    background-color: var(--bg-light);
    font-size: 14px;
    line-height: 1.6;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s;
}
a:hover {
    color: var(--secondary);
}

img {
    max-width: 100%;
    height: auto;
}

/* ===== 版心 ===== */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 15px;
}

/* ===== 标题装饰 ===== */
.section-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 20px;
    padding-left: 14px;
    border-left: 4px solid var(--primary);
    line-height: 1.3;
}
.section-title.orange {
    border-left-color: var(--orange);
}

/* ===== 卡片 ===== */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    border: none;
    transition: all 0.3s ease;
}
.card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}
.card-img {
    border-radius: var(--radius);
    overflow: hidden;
}
.card-img.avatar {
    width: 50%;
    max-width: 150px;
    aspect-ratio: 3/4;
    object-fit: cover;
    border-radius: 4px;
    display: block;
}
.card-img.avatar-square {
    width: 100%;
    aspect-ratio: 1/1;
    object-fit: cover;
    border-radius: var(--radius);
}
.card-img.activity {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    border-radius: var(--radius);
}
.card-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 8px;
    line-height: 1.3;
}
.card-text {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.6;
}
.card-small {
    padding: 15px;
}

/* ===== 按钮 ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
    border: 1px solid transparent;
    text-decoration: none;
    line-height: 1;
}
.btn:active {
    transform: scale(0.97);
}

.btn-lg { height: 42px; padding: 0 28px; font-size: 16px; }
.btn-md { height: 36px; padding: 0 20px; }
.btn-sm { height: 30px; padding: 0 14px; font-size: 12px; }

.btn-primary {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}
.btn-primary:hover {
    background: var(--secondary);
    border-color: var(--secondary);
    color: var(--white);
}

.btn-outline {
    background: var(--white);
    color: var(--primary);
    border-color: var(--primary);
}
.btn-outline:hover {
    background: var(--primary);
    color: var(--white);
}

.btn-danger {
    background: var(--white);
    color: var(--danger);
    border-color: var(--danger);
}
.btn-danger:hover {
    background: var(--danger);
    color: var(--white);
}

.btn-orange {
    background: var(--orange);
    color: var(--white);
    border-color: var(--orange);
}
.btn-orange:hover {
    background: #e86d2e;
    color: var(--white);
}

.btn-disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ===== 表单 ===== */
.form-group {
    margin-bottom: 16px;
}
.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 6px;
}
.form-label .required {
    color: var(--danger);
    margin-left: 2px;
}
.form-input,
.form-select,
.form-textarea {
    width: 100%;
    height: 38px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--text);
    background: var(--white);
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
    font-family: var(--font-family);
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(15,76,129,0.1);
}
.form-textarea {
    height: auto;
    min-height: 80px;
    padding: 10px 12px;
    resize: vertical;
}
.form-input.error {
    border-color: var(--danger);
}
.form-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}
.form-error {
    font-size: 12px;
    color: var(--danger);
    margin-top: 4px;
}

/* 单选框/复选框组 */
.radio-group, .checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    padding: 8px 0;
}
.radio-group label, .checkbox-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    cursor: pointer;
}
.radio-group input[type="radio"],
.checkbox-group input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

/* 文件上传 */
.upload-box {
    position: relative;
    width: 120px;
    height: 120px;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
    transition: border-color 0.2s;
    background: var(--bg-light);
}
.upload-box:hover {
    border-color: var(--primary);
}
.upload-box input[type="file"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}
.upload-box .upload-icon {
    font-size: 28px;
    color: var(--text-muted);
}
.upload-box .upload-text {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}
.upload-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 上传成功提示 */
.upload-success {
    display: none;
    color: #27AE60;
    font-size: 12px;
    margin-top: 4px;
    align-items: center;
    gap: 4px;
}
.upload-success.show {
    display: inline-flex;
}

/* ===== 导航 ===== */
.navbar {
    background: var(--primary);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: 60px;
}
.navbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}
.navbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--white);
    font-size: 20px;
    font-weight: 700;
    text-decoration: none;
}
.navbar-brand img {
    height: 36px;
}
.navbar-nav {
    display: flex;
    align-items: center;
    gap: 0;
    list-style: none;
}
.navbar-nav a {
    color: rgba(255,255,255,0.85);
    padding: 0 18px;
    height: 60px;
    display: flex;
    align-items: center;
    font-size: 15px;
    transition: color 0.2s, background 0.2s;
    text-decoration: none;
}
.navbar-nav a:hover,
.navbar-nav a.active {
    color: var(--white);
    background: rgba(255,255,255,0.1);
}

/* 移动端菜单按钮 */
.navbar-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}
.navbar-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--white);
    border-radius: 2px;
    transition: 0.3s;
}

/* ===== 底部 ===== */
.footer {
    background: var(--primary-dark);
    color: rgba(255,255,255,0.7);
    padding: 30px 0;
    margin-top: 40px;
    text-align: center;
    font-size: 13px;
}

/* ===== 分页 ===== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 4px;
    list-style: none;
    margin-top: 20px;
}
.pagination .page-item {}
.pagination .page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 14px;
    text-decoration: none;
    transition: all 0.2s;
}
.pagination .page-link:hover {
    border-color: var(--primary);
    color: var(--primary);
}
.pagination .active .page-link {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}
.pagination .disabled .page-link {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===== 状态标签 ===== */
.tag {
    display: inline-block;
    padding: 2px 10px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
}
.tag-primary { background: rgba(54,162,235,0.15); color: var(--secondary); }
.tag-success { background: rgba(39,174,96,0.15); color: var(--success); }
.tag-danger { background: rgba(231,76,60,0.15); color: var(--danger); }
.tag-warning { background: rgba(255,125,59,0.15); color: var(--orange); }
.tag-default { background: rgba(119,119,119,0.1); color: var(--text-muted); }

/* ===== 弹窗 ===== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}
.modal-overlay.show {
    display: flex;
}
.modal-box {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    padding: 24px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}
.modal-box .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.modal-box .modal-title {
    font-size: 18px;
    font-weight: 700;
}
.modal-box .modal-close {
    width: 30px;
    height: 30px;
    border: none;
    background: none;
    font-size: 22px;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}
.modal-box .modal-close:hover {
    background: var(--bg-light);
    color: var(--text);
}
.modal-box .modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

/* ===== 提示框 ===== */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 14px;
}
.alert-success {
    background: rgba(39,174,96,0.1);
    color: var(--success);
    border: 1px solid rgba(39,174,96,0.2);
}
.alert-danger {
    background: rgba(231,76,60,0.1);
    color: var(--danger);
    border: 1px solid rgba(231,76,60,0.2);
}
.alert-info {
    background: rgba(54,162,235,0.1);
    color: var(--secondary);
    border: 1px solid rgba(54,162,235,0.2);
}

/* ===== 加载动画 ===== */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== 三列卡片网格 ===== */
.card-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}
@media (max-width: 992px) {
    .card-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 576px) {
    .card-grid {
        grid-template-columns: 1fr;
    }
}
/* 手机端强制三列（用于推荐会员等） */
.card-grid-mobile-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}
@media (max-width: 576px) {
    .card-grid-mobile-3 {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }
    .card-grid-mobile-3 .card {
        padding: 8px 4px;
    }
    .card-grid-mobile-3 .card-title {
        font-size: 12px;
    }
    .card-grid-mobile-3 .tag {
        font-size: 10px;
        padding: 1px 4px;
    }
    .card-grid-mobile-3 .card-img.avatar {
        margin: 6px auto !important;
    }
    .card-grid-mobile-3 [style*="font-size:13px"] {
        font-size: 11px !important;
    }
}

/* 固定三列网格（首页推荐成员专用，全设备3列） */
.card-grid-fixed-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}
@media (max-width: 768px) {
    .card-grid-fixed-3 {
        gap: 10px;
    }
    .card-grid-fixed-3 .card {
        padding: 14px 8px;
    }
    .card-grid-fixed-3 .card-title {
        font-size: 14px;
    }
    .card-grid-fixed-3 [style*="font-size:13px"] {
        font-size: 12px !important;
    }
    .card-grid-fixed-3 .tag {
        font-size: 11px;
        padding: 1px 6px;
    }
}
@media (max-width: 480px) {
    .card-grid-fixed-3 {
        gap: 6px;
    }
    .card-grid-fixed-3 .card {
        padding: 10px 4px;
    }
    .card-grid-fixed-3 .card-title {
        font-size: 13px;
    }
    .card-grid-fixed-3 [style*="font-size:13px"] {
        font-size: 11px !important;
    }
    .card-grid-fixed-3 .tag {
        font-size: 10px;
        padding: 1px 4px;
    }
    .card-grid-fixed-3 .card-img.avatar {
        margin: 6px auto !important;
    }
}

/* ===== 五列卡片网格（成员页） ===== */
.card-grid-5 {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
}
.card-grid-5 .member-id {
    font-size: 11px;
    color: #999;
    margin-bottom: 2px;
}
@media (max-width: 992px) {
    .card-grid-5 {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }
    .card-grid-5 .card {
        padding: 14px 10px;
    }
}
@media (max-width: 576px) {
    .card-grid-5 {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }
    .card-grid-5 .card {
        padding: 8px 4px;
    }
    .card-grid-5 .member-name {
        font-size: 12px;
    }
    .card-grid-5 .member-position,
    .card-grid-5 .member-team {
        font-size: 11px;
    }
    .card-grid-5 .member-id {
        font-size: 10px;
    }
}

/* ===== 响应式导航 ===== */
@media (max-width: 992px) {
    .navbar-toggle {
        display: flex;
        z-index: 1001;
    }
    #birthdaySlider {
        justify-content: center;
    }
    .navbar-nav {
        display: none;
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        background: var(--primary);
        flex-direction: column;
        padding: 10px 0;
        z-index: 1000;
    }
    .navbar-nav.show {
        display: flex;
    }
    .navbar-nav a {
        height: 44px;
        padding: 0 20px;
    }
    .section-title {
        font-size: 18px;
    }
}

/* ===== 头像强制竖版长方形 ===== */
.card-grid img[style*="border-radius"] {
    aspect-ratio: 3/4 !important;
    object-fit: cover !important;
    border-radius: 4px !important;
}

/* ===== 工具类 ===== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mt-30 { margin-top: 30px; }
.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }
.mb-30 { margin-bottom: 30px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.gap-10 { gap: 10px; }
.gap-15 { gap: 15px; }
.w-full { width: 100%; }

/* ===== 图片查看器 ===== */
.image-viewer {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.9);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
}
.image-viewer .iv-close {
    position: absolute;
    top: 16px;
    right: 20px;
    color: #fff;
    font-size: 36px;
    cursor: pointer;
    z-index: 10;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.8;
}
.image-viewer .iv-close:hover { opacity: 1; }
.image-viewer .iv-hint {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255,255,255,0.5);
    font-size: 13px;
    z-index: 10;
}
.image-viewer .iv-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 90%;
    height: 90%;
    overflow: hidden;
}
.image-viewer .iv-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    cursor: grab;
    transition: none;
    user-select: none;
    -webkit-user-drag: none;
}

/* ===== 日夜切换按钮 ===== */
.night-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: rgba(255,255,255,0.85);
    font-size: 22px;
    line-height: 1;
    display: flex;
    align-items: center;
    transition: color 0.2s;
    margin-left: 8px;
}
.night-toggle:hover {
    color: var(--white);
}

/* ===== 夜间模式 ===== */
body.night-mode {
    --primary: #1a1a2e !important;
    --primary-dark: #16213e !important;
    --bg-light: #1a1a2e !important;
    --border: #2a2a4a !important;
    --text: #e0e0e0 !important;
    --text-muted: #999 !important;
    --white: #222 !important;
    --shadow: 0 2px 8px rgba(0,0,0,0.3) !important;
    --shadow-hover: 0 4px 16px rgba(0,0,0,0.4) !important;
    background: #1a1a2e;
}
body.night-mode .navbar {
    background: #16213e;
}
body.night-mode .footer {
    background: #0d1117;
}
body.night-mode .card {
    background: #222 !important;
}
body.night-mode .form-input,
body.night-mode .form-select {
    background: #222;
    color: var(--text);
    border-color: #2a2a4a;
}
body.night-mode .upload-box {
    background: #222;
}
body.night-mode table td {
    background: #222;
}
body.night-mode table th {
    background: #1a1a2e;
}
body.night-mode .table-wrap {
    background: #222;
}
body.night-mode .form-page {
    background: #222;
}
body.night-mode .upload-success {
    color: #4caf50;
}
body.night-mode a {
    color: var(--secondary);
}
