/* ====== Catiflytek 全局样式 — 与查询系统统一 ====== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

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

:root {
    --bg: #f8f9fa;
    --surface: #ffffff;
    --text: #1a1d23;
    --text-secondary: #6b7280;
    --border: #e5e7eb;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #dbeafe;
    --success: #10b981;
    --success-bg: #d1fae5;
    --success-text: #065f46;
    --danger: #ef4444;
    --danger-bg: #fee2e2;
    --danger-text: #991b1b;
    --warning: #f59e0b;
    --warning-bg: #fef3c7;
    --warning-text: #92400e;
    --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.05);
    --shadow: 0 1px 3px 0 rgba(0,0,0,0.1), 0 1px 2px 0 rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    --radius: 12px;
    --radius-sm: 8px;
    --sidebar-width: 240px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* ====== 背景纹理 ====== */
.bg-layer {
    position: fixed; inset: 0; pointer-events: none; z-index: 0;
}
.bg-dots {
    background-image: radial-gradient(circle at 1px 1px, rgba(0,0,0,0.04) 1px, transparent 0);
    background-size: 24px 24px;
}
.bg-grad {
    background:
        radial-gradient(circle at 20% 50%, rgba(37,99,235,0.06) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(16,185,129,0.04) 0%, transparent 50%);
}

/* ====== 导航栏 ====== */
.navbar {
    position: sticky; top: 0; z-index: 100;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    display: flex; align-items: center; justify-content: space-between;
    height: 56px;
    box-shadow: var(--shadow-sm);
}
.navbar .logo {
    font-size: 18px; font-weight: 700; color: var(--text); text-decoration: none;
    display: flex; align-items: center; gap: 8px;
}
.navbar .logo .dot { color: var(--primary); }
.nav-links { display: flex; gap: 4px; align-items: center; }
.nav-links a, .nav-links .nav-user {
    color: var(--text-secondary); text-decoration: none;
    padding: 6px 14px; border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 500; transition: all .15s;
}
.nav-links a:hover { background: var(--bg); color: var(--text); }
.nav-links .btn-primary-nav {
    background: var(--primary); color: #fff;
}
.nav-links .btn-primary-nav:hover { background: var(--primary-hover); color: #fff; }
.nav-links .btn-outline-nav {
    border: 1.5px solid var(--border);
}
.nav-links .nav-user { cursor: default; }

/* ====== 容器 ====== */
.container { position: relative; z-index: 1; max-width: 1100px; margin: 0 auto; padding: 24px 16px; }

/* ====== 卡片 ====== */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 16px;
}
.card-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 20px; padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.card-header h3 { font-size: 17px; font-weight: 600; color: var(--text); }

/* ====== 表单 ====== */
.form-group { margin-bottom: 14px; }
.form-group label {
    display: block; font-size: 13px; font-weight: 500; margin-bottom: 5px; color: var(--text);
}
.form-control {
    width: 100%; padding: 9px 13px;
    border: 1.5px solid var(--border); border-radius: var(--radius-sm);
    font-size: 14px; font-family: inherit; transition: all .15s;
    background: var(--surface); color: var(--text);
}
.form-control:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}
textarea.form-control { resize: vertical; min-height: 90px; }

/* ====== 按钮 ====== */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 18px; border: none; border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: none;
    transition: all .15s; font-family: inherit; line-height: 1.4;
}
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; transform: translateY(-1px); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; transform: translateY(-1px); }
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--text-secondary); background: var(--bg); }
.btn-block { width: 100%; justify-content: center; }

/* ====== 表格 ====== */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
table th {
    text-align: left; padding: 10px 14px;
    font-size: 12px; font-weight: 600; color: var(--text-secondary);
    text-transform: uppercase; letter-spacing: .025em;
    border-bottom: 1px solid var(--border); background: var(--bg);
}
table td { padding: 12px 14px; border-bottom: 1px solid var(--border); }
table tr:hover { background: var(--bg); }

/* ====== 徽章 ====== */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 4px 10px; border-radius: 9999px;
    font-size: 12px; font-weight: 500;
}
.badge-success { background: var(--success-bg); color: var(--success-text); }
.badge-danger { background: var(--danger-bg); color: var(--danger-text); }
.badge-warning { background: var(--warning-bg); color: var(--warning-text); }
.badge-info { background: var(--primary-light); color: var(--primary); }
.badge-muted { background: #f3f4f6; color: #6b7280; }

/* ====== 提示 ====== */
.alert {
    padding: 10px 14px; border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 500; margin-bottom: 16px;
}
.alert-success { background: var(--success-bg); color: var(--success-text); border: 1px solid var(--success); }
.alert-danger { background: var(--danger-bg); color: var(--danger-text); border: 1px solid var(--danger); }
.alert-warning { background: var(--warning-bg); color: var(--warning-text); border: 1px solid var(--warning); }
.alert-info { background: var(--primary-light); color: var(--primary); border: 1px solid var(--primary); }

/* ====== 登录/注册 ====== */
.auth-page {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    position: relative; padding: 16px;
}
.auth-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 36px 32px;
    width: 100%; max-width: 400px;
    box-shadow: var(--shadow-lg);
    position: relative; z-index: 1;
    animation: slideUp .4s ease;
}
.auth-card .auth-icon {
    width: 56px; height: 56px; background: var(--primary-light); border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    font-size: 24px; margin: 0 auto 16px;
}
.auth-card h2 { text-align: center; font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.auth-card .subtitle { text-align: center; color: var(--text-secondary); font-size: 14px; margin-bottom: 24px; }
.auth-card .footer-link { text-align: center; margin-top: 16px; font-size: 13px; color: var(--text-secondary); }
.auth-card .footer-link a { color: var(--primary); text-decoration: none; font-weight: 500; }

/* ====== 管理后台布局 ====== */
.admin-layout { display: flex; min-height: calc(100vh - 56px); }
.admin-sidebar {
    width: var(--sidebar-width); background: var(--surface);
    border-right: 1px solid var(--border);
    position: fixed; left: 0; top: 56px; bottom: 0;
    z-index: 50; padding: 12px 8px; display: flex; flex-direction: column;
}
.admin-sidebar a {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 14px; border-radius: var(--radius-sm);
    color: var(--text-secondary); text-decoration: none;
    font-size: 14px; font-weight: 500; transition: all .15s;
}
.admin-sidebar a:hover { background: var(--bg); color: var(--text); }
.admin-sidebar a.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.admin-content { flex: 1; margin-left: var(--sidebar-width); padding: 24px; }

/* ====== 统计卡片 ====== */
.stats-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px; margin-bottom: 24px;
}
.stat-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 20px;
    box-shadow: var(--shadow-sm); text-align: center;
}
.stat-card .stat-icon { font-size: 28px; margin-bottom: 8px; }
.stat-card .stat-value { font-size: 28px; font-weight: 700; color: var(--primary); }
.stat-card .stat-label { font-size: 12px; color: var(--text-secondary); margin-top: 2px; text-transform: uppercase; letter-spacing: .025em; }

/* ====== 搜索 ====== */
.search-box {
    display: flex; gap: 8px; margin-bottom: 16px;
}
.search-box .form-control { max-width: 320px; }

/* ====== 查询页 ====== */
.search-hero {
    text-align: center; padding: 40px 20px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 50%, #1e40af 100%);
    border-radius: var(--radius); color: #fff;
    margin-bottom: 24px; box-shadow: var(--shadow-lg);
    position: relative; overflow: hidden;
}
.search-hero::before {
    content: ''; position: absolute; inset: 0;
    background: radial-gradient(circle at 30% 40%, rgba(255,255,255,.1) 0%, transparent 60%);
    pointer-events: none;
}
.search-hero h1 { font-size: 28px; font-weight: 700; margin-bottom: 8px; position: relative; }
.search-hero p { opacity: .85; font-size: 14px; margin-bottom: 20px; position: relative; }
.search-form {
    display: flex; gap: 8px; max-width: 560px; margin: 0 auto; position: relative;
}
.search-form input {
    flex: 1; padding: 12px 18px; border: none; border-radius: var(--radius-sm);
    font-size: 15px; font-family: inherit; box-shadow: var(--shadow);
}
.search-form input:focus { outline: 2px solid rgba(255,255,255,.5); }
.search-form button {
    padding: 12px 28px; border: none; border-radius: var(--radius-sm);
    background: var(--success); color: #fff;
    font-size: 15px; font-weight: 600; cursor: pointer;
    font-family: inherit; box-shadow: var(--shadow);
    transition: all .15s;
}
.search-form button:hover { background: #059669; transform: translateY(-1px); }
.results-count { font-size: 14px; color: var(--text-secondary); margin-bottom: 16px; }
.results-count a { color: var(--primary); text-decoration: none; font-weight: 500; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-secondary); }
.empty-state .icon { font-size: 56px; margin-bottom: 12px; opacity: .5; }
.empty-state p { font-size: 15px; }
.personnel-grid { display: grid; gap: 12px; }
.personnel-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 20px 24px; box-shadow: var(--shadow-sm);
    display: flex; align-items: center; gap: 20px;
    transition: all .2s;
}
.personnel-card:hover {
    box-shadow: var(--shadow-lg); border-color: var(--primary-light);
    transform: translateX(4px);
}
.personnel-card .avatar {
    width: 52px; height: 52px; border-radius: 50%; flex-shrink: 0;
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-size: 20px; font-weight: 700; box-shadow: var(--shadow);
}
.personnel-card .info { flex: 1; }
.personnel-card .info h3 { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.personnel-card .info .title { font-size: 13px; color: var(--primary); font-weight: 500; margin-bottom: 6px; }
.personnel-card .info .contact { font-size: 12px; color: var(--text-secondary); display: flex; flex-wrap: wrap; gap: 12px; }
.personnel-card .info .contact span { white-space: nowrap; }
.department-badge {
    padding: 5px 14px; background: var(--primary-light); color: var(--primary);
    border-radius: 9999px; font-size: 12px; font-weight: 600;
    white-space: nowrap; flex-shrink: 0;
}

/* ====== 服务卡片（首页） ====== */
.services-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px;
}
.service-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 28px; text-align: center; box-shadow: var(--shadow-sm);
    transition: all .2s; text-decoration: none; color: var(--text);
    position: relative; z-index: 1;
}
.service-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--primary); }
.service-card .icon { font-size: 40px; margin-bottom: 12px; }
.service-card h3 { font-size: 17px; font-weight: 600; margin-bottom: 6px; }
.service-card p { font-size: 13px; color: var(--text-secondary); }

/* ====== 模态框 ====== */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.45);
    display: flex; align-items: center; justify-content: center;
    z-index: 200; opacity: 0; visibility: hidden; transition: all .2s;
    padding: 16px;
}
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); width: 100%; max-width: 480px;
    box-shadow: var(--shadow-lg);
    transform: scale(.95); transition: transform .2s;
}
.modal-overlay.active .modal { transform: scale(1); }
.modal-header {
    padding: 16px 20px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-body { padding: 20px; }
.modal-footer {
    padding: 12px 20px; border-top: 1px solid var(--border);
    display: flex; justify-content: flex-end; gap: 8px;
}

/* ====== 页脚 ====== */
.footer { position: relative; z-index: 1; text-align: center; padding: 20px; color: var(--text-secondary); font-size: 12px; }

/* ====== 比赛列表页 ====== */
.comp-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 20px 24px;
    box-shadow: var(--shadow-sm); margin-bottom: 12px;
    display: flex; align-items: center; justify-content: space-between;
    transition: all .15s;
}
.comp-card:hover { box-shadow: var(--shadow-lg); }
.comp-info h3 { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.comp-info .meta { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.comp-info .rules { font-size: 12px; color: var(--text-secondary); background: var(--bg); padding: 8px 12px; border-radius: var(--radius-sm); margin-top: 8px; line-height: 1.5; }

.tabs { display: flex; gap: 4px; margin-bottom: 20px; }
.tabs .tab {
    padding: 7px 18px; border-radius: 9999px; font-size: 13px; font-weight: 500;
    cursor: pointer; border: 1.5px solid var(--border); background: var(--surface);
    color: var(--text-secondary); transition: all .15s; font-family: inherit;
}
.tabs .tab.active { background: var(--primary-light); color: var(--primary); border-color: var(--primary-light); }

/* ====== 动画 ====== */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes bounceIn {
    0% { transform: scale(.3); opacity: 0; }
    50% { transform: scale(1.05); }
    70% { transform: scale(.9); }
    100% { transform: scale(1); opacity: 1; }
}

/* ====== 响应式 ====== */
@media (max-width: 768px) {
    .services-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .admin-layout { flex-direction: column; }
    .admin-sidebar {
        position: relative; top: auto; width: 100%;
        flex-direction: row; gap: 4px; padding: 8px 12px; overflow-x: auto;
        border-right: none; border-bottom: 1px solid var(--border);
    }
    .admin-sidebar a { white-space: nowrap; font-size: 12px; }
    .admin-content { margin-left: 0; }
    .comp-card { flex-direction: column; gap: 12px; align-items: flex-start; }
    .personnel-card { flex-direction: column; text-align: center; padding: 20px 16px; }
    .personnel-card .info .contact { justify-content: center; }
    .search-hero h1 { font-size: 22px; }
    .search-hero { padding: 28px 16px; border-radius: var(--radius-sm); }
    .search-form { flex-direction: column; }
    .search-form button { width: 100%; }
}
@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .search-box { flex-direction: column; }
    .search-box .form-control { max-width: 100%; }
}
