/* ============================================================
   赴山海赛事系统 — 统一设计系统
   现代浅色风格 · 藏青品牌色
   ============================================================ */

/* ---------- 设计变量 ---------- */
:root {
    /* 品牌色 */
    --c-primary: #8B1635;
    --c-primary-dark: #641329;
    --c-primary-soft: #F7DDE4;
    --c-accent: #D98FA8;

    /* 语义色 */
    --c-success: #16a34a;
    --c-success-soft: #e8f7ee;
    --c-danger: #dc2626;
    --c-danger-soft: #fdeaea;
    --c-warning: #b45309;
    --c-warning-soft: #fdf3e0;
    --c-info: #2563eb;
    --c-info-soft: #e8f0fe;

    /* 中性色 */
    --c-text: #1f2937;
    --c-text-muted: #6b7280;
    --c-text-faint: #9ca3af;
    --c-border: #e5e7eb;
    --c-border-light: #f0f1f5;
    --c-bg: #FFF1F3;
    --c-surface: #ffffff;

    /* 队伍色(正方/反方) */
    --c-affirmative: #2563eb;
    --c-affirmative-soft: #e8f0fe;
    --c-negative: #dc2626;
    --c-negative-soft: #fdeaea;

    /* 几何 */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-pill: 999px;

    /* 阴影 */
    --shadow-sm: 0 1px 3px rgba(16, 24, 40, .08);
    --shadow-md: 0 4px 12px rgba(16, 24, 40, .10);
    --shadow-lg: 0 12px 28px rgba(16, 24, 40, .16);

    /* 字体 */
    --font-base: -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
                 "Microsoft YaHei", "微软雅黑", sans-serif;

    --header-h: 62px;
}

/* ---------- Reset ---------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-base);
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    min-height: 100vh;
    color: var(--c-text);
    background: var(--c-bg);
    line-height: 1.6;
    font-size: 15px;
}

img {
    max-width: 100%;
    display: block;
}

a {
    color: var(--c-primary);
    text-decoration: none;
    transition: color .2s;
}

a:hover {
    color: var(--c-accent);
}

ul, ol {
    list-style: none;
}

h1, h2, h3, h4 {
    color: var(--c-text);
    line-height: 1.35;
    font-weight: 700;
}

/* ============================================================
   顶部导航
   ============================================================ */
.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    height: var(--header-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 28px;
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 1px 0 var(--c-border), 0 2px 12px rgba(16, 24, 40, .05);
}

.site-header .left-group {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.site-header .logo {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 18px;
    font-weight: 800;
    color: var(--c-primary);
    white-space: nowrap;
}

.site-header .logo svg {
    width: 26px;
    height: 26px;
    flex: none;
}

.site-header nav {
    flex: 1;
}

.site-header nav ul {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
}

.site-header nav a {
    display: inline-block;
    padding: 7px 16px;
    border-radius: var(--radius-pill);
    color: var(--c-text-muted);
    font-weight: 500;
    transition: all .2s;
}

.site-header nav a:hover {
    color: var(--c-primary);
    background: var(--c-primary-soft);
}

.site-header nav a.active {
    color: #fff;
    background: var(--c-primary);
}

.site-header nav a.profile-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-left: 10px;
    color: var(--c-primary);
    background: var(--c-primary-soft);
    font-weight: 600;
}

.site-header nav a.profile-link:hover {
    background: #F2C9D6;
}

.site-header .menu-toggle {
    display: none;
    width: 38px;
    height: 38px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    cursor: pointer;
    color: var(--c-primary);
    align-items: center;
    justify-content: center;
}

.site-header .menu-toggle svg {
    width: 24px;
    height: 24px;
}

.site-header .menu-toggle:hover {
    background: var(--c-primary-soft);
}

@media (max-width: 768px) {
    .site-header {
        padding: 0 16px;
    }

    .site-header nav {
        display: none;
        position: absolute;
        top: var(--header-h);
        left: 0;
        right: 0;
        background: #fff;
        box-shadow: var(--shadow-md);
        border-top: 1px solid var(--c-border-light);
    }

    .site-header nav.active {
        display: block;
    }

    .site-header nav ul {
        flex-direction: column;
        align-items: stretch;
        padding: 10px 14px;
        gap: 2px;
    }

    .site-header nav a {
        display: block;
        padding: 11px 16px;
        border-radius: var(--radius-sm);
        font-size: 16px;
    }

    .site-header nav a.profile-link {
        margin: 6px 0 0;
    }

    .site-header .menu-toggle {
        display: inline-flex;
    }
}

/* ============================================================
   页面主体容器
   ============================================================ */
.page-main {
    max-width: 1080px;
    margin: 28px auto 56px;
    padding: 0 16px;
}

.page-card {
    background: var(--c-surface);
    border: 1px solid var(--c-border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 28px;
}

@media (max-width: 768px) {
    .page-main {
        margin-top: 18px;
    }

    .page-card {
        padding: 18px;
    }
}

/* 区块标题 */
.section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    margin: 0 0 16px;
}

.section-title::before {
    content: "";
    width: 4px;
    height: 20px;
    border-radius: 4px;
    background: linear-gradient(180deg, var(--c-primary), var(--c-accent));
    flex: none;
}

.section-title .title-extra {
    margin-left: auto;
    font-size: 14px;
    font-weight: 400;
}

.page-head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

.page-head h2 {
    font-size: 24px;
    color: var(--c-primary);
}

/* ============================================================
   按钮
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 20px;
    border: none;
    border-radius: var(--radius-pill);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
    text-decoration: none;
    line-height: 1.4;
    user-select: none;
    white-space: nowrap;
}

.btn:disabled {
    opacity: .55;
    cursor: not-allowed;
}

.btn svg {
    width: 16px;
    height: 16px;
}

.btn-primary {
    background: var(--c-primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(139, 22, 53, .30);
}

.btn-primary:hover {
    background: var(--c-primary-dark);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(139, 22, 53, .38);
}

.btn-success {
    background: var(--c-success);
    color: #fff;
}

.btn-success:hover {
    background: #15803d;
    color: #fff;
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--c-danger);
    color: #fff;
}

.btn-danger:hover {
    background: #b91c1c;
    color: #fff;
    transform: translateY(-1px);
}

.btn-ghost {
    background: transparent;
    color: var(--c-primary);
    border: 1.5px solid var(--c-border);
}

.btn-ghost:hover {
    background: var(--c-primary-soft);
    border-color: var(--c-primary);
}

.btn-soft {
    background: var(--c-primary-soft);
    color: var(--c-primary);
}

.btn-soft:hover {
    background: #F2C9D6;
    color: var(--c-primary-dark);
}

.btn-danger-soft {
    background: var(--c-danger-soft);
    color: var(--c-danger);
}

.btn-danger-soft:hover {
    background: #fbd5d5;
    color: #b91c1c;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
}

.btn-lg {
    padding: 12px 28px;
    font-size: 16px;
}

.btn-block {
    width: 100%;
}

/* 文字链式删除/编辑按钮 */
.link-danger {
    color: var(--c-danger);
    font-weight: 500;
}

.link-danger:hover {
    color: #b91c1c;
}

/* ============================================================
   卡片
   ============================================================ */
.card {
    background: var(--c-surface);
    border: 1px solid var(--c-border-light);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 20px;
    transition: transform .2s, box-shadow .2s, border-color .2s;
}

.card-hover:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: #F0C7D4;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 18px;
    margin-top: 18px;
}

.card h3 {
    font-size: 17px;
    margin-bottom: 10px;
}

.card h3 a {
    color: var(--c-text);
}

.card h3 a:hover {
    color: var(--c-primary);
}

.card p {
    color: var(--c-text-muted);
    font-size: 14px;
    margin: 6px 0;
}

.card p b, .card p strong {
    color: var(--c-text);
    font-weight: 600;
}

.card .card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

/* 卡片顶部色条 */
.card-top-line {
    position: relative;
    overflow: hidden;
}

.card-top-line::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--c-primary), var(--c-accent));
}

/* ============================================================
   徽章
   ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 12px;
    border-radius: var(--radius-pill);
    font-size: 12.5px;
    font-weight: 600;
    white-space: nowrap;
}

.badge::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.badge-primary   { background: var(--c-primary-soft);  color: var(--c-primary); }
.badge-success   { background: var(--c-success-soft);  color: var(--c-success); }
.badge-danger    { background: var(--c-danger-soft);   color: var(--c-danger); }
.badge-warning   { background: var(--c-warning-soft);  color: var(--c-warning); }
.badge-info      { background: var(--c-info-soft);     color: var(--c-info); }
.badge-muted     { background: #f0f1f5;                color: var(--c-text-muted); }

/* 赛事/辩论状态 */
.badge-upcoming  { background: var(--c-warning-soft);  color: var(--c-warning); }
.badge-ongoing   { background: var(--c-success-soft);  color: var(--c-success); }
.badge-finished  { background: #f0f1f5;                color: var(--c-text-muted); }

/* ============================================================
   表格
   ============================================================ */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--c-border-light);
    background: var(--c-surface);
    -webkit-overflow-scrolling: touch;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    min-width: 480px;
}

.table thead th {
    background: var(--c-primary-soft);
    color: var(--c-primary);
    font-weight: 600;
    text-align: center;
    padding: 11px 14px;
    white-space: nowrap;
    border-bottom: 1px solid var(--c-border);
}

.table tbody td {
    padding: 10px 14px;
    text-align: center;
    border-bottom: 1px solid var(--c-border-light);
    color: var(--c-text);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table tbody tr:nth-child(even) {
    background: #FFF9FB;
}

.table tbody tr:hover {
    background: var(--c-primary-soft);
}

/* 排行榜名次列 */
.rank-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-weight: 700;
    font-size: 13px;
    background: #f0f1f5;
    color: var(--c-text-muted);
}

.rank-num.rank-1 { background: #fde68a; color: #92400e; }
.rank-num.rank-2 { background: #e5e7eb; color: #4b5563; }
.rank-num.rank-3 { background: #fcd9b6; color: #9a3412; }

/* ============================================================
   表单
   ============================================================ */
.form-group {
    margin-top: 14px;
}

.form-group > label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 14px;
    color: var(--c-text);
}

.form-control {
    width: 100%;
    padding: 10px 13px;
    border: 1.5px solid var(--c-border);
    border-radius: var(--radius-sm);
    font-size: 14.5px;
    color: var(--c-text);
    background: #fff;
    transition: border-color .2s, box-shadow .2s;
    outline: none;
}

.form-control:focus {
    border-color: var(--c-primary);
    box-shadow: 0 0 0 3px rgba(139, 22, 53, .12);
}

textarea.form-control {
    resize: vertical;
    min-height: 84px;
}

select.form-control {
    cursor: pointer;
}

.form-hint {
    font-size: 12.5px;
    color: var(--c-text-faint);
    margin-top: 5px;
}

.form-hint.form-hint-error {
    color: var(--c-danger);
}

/* ============================================================
   模态框
   (兼容两种打开方式: .open 类 或 JS 设置 display:block/flex)
   ============================================================ */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(15, 23, 42, .55);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    overflow-y: auto;
    padding: 0 16px;
    justify-content: center;
    align-items: flex-start;
}

.modal.open {
    display: flex;
}

.modal-content {
    background: #fff;
    margin: 7vh auto 48px;
    padding: 26px 26px 22px;
    border-radius: var(--radius-lg);
    width: 520px;
    max-width: 100%;
    max-height: 86vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    position: relative;
    animation: modalIn .28s cubic-bezier(.2, .8, .3, 1);
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(-16px) scale(.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-content h3 {
    margin-bottom: 16px;
    padding-right: 30px;
    color: var(--c-primary);
    font-size: 18px;
}

.modal-close {
    position: absolute;
    right: 14px;
    top: 14px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: #f0f1f5;
    color: var(--c-text-muted);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    transition: all .2s;
}

.modal-close:hover {
    background: var(--c-danger-soft);
    color: var(--c-danger);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

/* ============================================================
   消息提示条
   ============================================================ */
.msg-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 11px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 16px;
}

.msg-banner.msg-error {
    background: var(--c-danger-soft);
    color: var(--c-danger);
}

.msg-banner.msg-success {
    background: var(--c-success-soft);
    color: var(--c-success);
}

/* ============================================================
   空状态
   ============================================================ */
.empty-state {
    text-align: center;
    padding: 42px 16px;
    color: var(--c-text-faint);
    font-size: 14.5px;
}

.empty-state svg {
    width: 52px;
    height: 52px;
    margin: 0 auto 12px;
    opacity: .5;
}

/* ============================================================
   队伍卡片 / 成员列表 / 正反方面板
   ============================================================ */
.team-card {
    background: #FFF9FB;
    border: 1px solid var(--c-border-light);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    box-shadow: var(--shadow-sm);
}

.team-card + .team-card {
    margin-top: 14px;
}

.team-card .team-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.team-card .team-head h3 {
    font-size: 16.5px;
    color: var(--c-primary);
    margin: 0;
}

.team-icon-btn {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    transition: all .2s;
    line-height: 1;
}

.team-icon-btn.add-btn {
    background: var(--c-success-soft);
    color: var(--c-success);
}

.team-icon-btn.add-btn:hover {
    background: #d1f0dd;
    transform: scale(1.06);
}

.team-icon-btn.remove-btn {
    background: var(--c-danger-soft);
    color: var(--c-danger);
}

.team-icon-btn.remove-btn:hover {
    background: #fbd5d5;
    transform: scale(1.06);
}

.member-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.member-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #fff;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-pill);
    padding: 5px 14px;
    font-size: 13.5px;
    color: var(--c-text);
    transition: all .2s;
}

.member-chip a {
    color: inherit;
}

.member-chip a:hover {
    color: var(--c-primary);
}

.member-chip.chip-leader {
    background: var(--c-primary-soft);
    border-color: #E9B9C8;
    color: var(--c-primary);
    font-weight: 600;
}

/* 正方/反方/评委 面板 */
.side-box {
    border-radius: var(--radius-md);
    padding: 16px 18px;
    border: 1.5px solid transparent;
}

.side-box h4 {
    font-size: 14px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 7px;
}

.side-box.side-yes {
    background: var(--c-affirmative-soft);
    border-color: #bcd2fb;
}

.side-box.side-yes h4 { color: var(--c-affirmative); }

.side-box.side-no {
    background: var(--c-negative-soft);
    border-color: #f6c6c6;
}

.side-box.side-no h4 { color: var(--c-negative); }

.side-box.side-jud {
    background: var(--c-primary-soft);
    border-color: #E9B9C8;
}

.side-box.side-jud h4 { color: var(--c-primary); }

/* 模态框内确认/取消按钮对 */
.confirm-btn {
    padding: 8px 22px;
    border: none;
    border-radius: var(--radius-pill);
    background: var(--c-success);
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all .2s;
    white-space: nowrap;
}

.confirm-btn:hover {
    background: #15803d;
}

.cancel-btn {
    padding: 8px 22px;
    border: none;
    border-radius: var(--radius-pill);
    background: #e5e7eb;
    color: var(--c-text-muted);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all .2s;
    white-space: nowrap;
}

.cancel-btn:hover {
    background: #d1d5db;
    color: var(--c-text);
}

/* ============================================================
   分步进度(admin 计分台)
   ============================================================ */
.steps {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin: 18px 0;
}

.step {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 14px;
    border-radius: var(--radius-pill);
    font-size: 13px;
    font-weight: 600;
    background: #f0f1f5;
    color: var(--c-text-faint);
    white-space: nowrap;
    transition: all .2s;
}

.step.step-done {
    background: var(--c-success-soft);
    color: var(--c-success);
}

.step.step-active {
    background: var(--c-primary);
    color: #fff;
    box-shadow: 0 2px 10px rgba(139, 22, 53, .35);
}

.step-arrow {
    color: var(--c-text-faint);
    font-size: 12px;
}

/* ============================================================
   头像
   ============================================================ */
.avatar {
    width: 84px;
    height: 84px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #fff;
    box-shadow: var(--shadow-md);
    background: var(--c-primary-soft);
}

/* ============================================================
   页脚
   ============================================================ */
.site-footer {
    text-align: center;
    padding: 26px 16px 34px;
    color: var(--c-text-faint);
    font-size: 13px;
}

/* ============================================================
   工具类
   ============================================================ */
.text-muted   { color: var(--c-text-muted) !important; }
.text-faint   { color: var(--c-text-faint) !important; }
.text-primary { color: var(--c-primary) !important; }
.text-danger  { color: var(--c-danger) !important; }
.text-success { color: var(--c-success) !important; }

.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 8px !important; }
.mt-2 { margin-top: 16px !important; }
.mt-3 { margin-top: 24px !important; }
.mb-1 { margin-bottom: 8px !important; }
.mb-2 { margin-bottom: 16px !important; }
.mb-3 { margin-bottom: 24px !important; }

.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.inline-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* 滚动条美化 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-thumb {
    background: #DCC2CB;
    border-radius: 8px;
}

::-webkit-scrollbar-thumb:hover {
    background: #C69FB0;
}

::-webkit-scrollbar-track {
    background: transparent;
}
