/* ============================================================
   高校数据系统 - 全局样式（简约清爽风格）
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: "Source Han Sans SC", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    color: #333;
    background: #f5f7fa;
}

a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; outline: none; font-family: inherit; background: none; }
ul, ol { list-style: none; }
input, select, textarea { font-family: inherit; outline: none; border: none; }

/* ============================================================
   Layout
   ============================================================ */
.layout { display: flex; flex-direction: column; height: 100vh; }

.admin-layout .layout-body { padding-top: 56px; }

.layout-body { display: flex; flex: 1; overflow: hidden; }

/* ============================================================
   Topbar（仅后台）
   ============================================================ */
.topbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 56px;
    background: #fff;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 100;
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-right { display: flex; align-items: center; gap: 16px; }

.sidebar-toggle {
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 6px;
    color: #666;
    transition: background 0.15s;
}
.sidebar-toggle:hover { background: #f0f0f0; color: #1677ff; }
.sidebar-toggle svg { width: 20px; height: 20px; }

.topbar-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.topbar-link {
    font-size: 13px;
    color: #666;
    transition: color 0.15s;
}
.topbar-link:hover { color: #1677ff; }

.topbar-user {
    font-size: 13px;
    color: #666;
    display: flex; align-items: center; gap: 8px;
}

.role-tag {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}
.role-admin { background: #fff7e6; color: #fa8c16; }
.role-user  { background: #f0f5ff; color: #1677ff; }

/* ============================================================
   Sidebar
   ============================================================ */
.sidebar {
    width: 220px;
    min-width: 220px;
    background: #fff;
    border-right: 1px solid #eee;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    transition: width 0.2s, min-width 0.2s;
}

.sidebar-logo {
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 18px;
    font-size: 17px;
    font-weight: 700;
    color: #1677ff;
    letter-spacing: 0.5px;
    white-space: nowrap;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 0;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: #d9d9d9; border-radius: 2px; }

.sidebar-footer {
    height: 48px;
    display: flex;
    align-items: center;
    padding: 0 12px 0 18px;
    font-size: 13px;
    color: #666;
    border-top: 1px solid #eee;
    flex-shrink: 0;
    gap: 8px;
}
.footer-text {
    flex: 1;
    cursor: pointer;
    transition: color 0.15s;
}
.footer-text:hover { color: #1677ff; }

.sidebar-footer > svg { width: 18px; height: 18px; color: #999; flex-shrink: 0; }
.sidebar-footer:hover > svg { color: #1677ff; }

.logout-link {
    display: flex; align-items: center; gap: 8px;
    flex: 1; cursor: pointer;
    color: inherit;
}
.logout-link:hover { color: #1677ff; }
.logout-link svg { width: 18px; height: 18px; flex-shrink: 0; }

/* Navigation Group */
.nav-group { margin-bottom: 4px; }
.nav-group-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 20px 8px 18px;
    font-size: 10px;
    color: #999;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}
.nav-group-title svg {
    width: 12px;
    height: 12px;
    color: #bbb;
    transition: transform 0.2s;
}
.nav-group-title:hover { color: #666; }
.nav-group.collapsed .nav-group-title svg { transform: rotate(-90deg); }
.nav-group.collapsed .nav-submenu { display: none; }

.nav-submenu { display: flex; flex-direction: column; }
.nav-sub-item {
    display: flex;
    align-items: center;
    height: 40px;
    padding: 0 20px 0 18px;
    font-size: 13px;
    color: #666;
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
}
.nav-sub-item:hover { color: #1677ff; background: #f5f7fa; }
.nav-sub-item .nav-icon {
    width: 18px;
    height: 18px;
    margin-right: 10px;
    flex-shrink: 0;
    color: #999;
    transition: color 0.15s;
}
.nav-sub-item:hover .nav-icon { color: #1677ff; }
.nav-sub-item.active {
    color: #1677ff;
    background: #f0f5ff;
    font-weight: 500;
}
.nav-sub-item.active .nav-icon { color: #1677ff; }

.badge-premium {
    background: linear-gradient(135deg, #fadb14, #fa8c16);
    color: #fff;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
}

/* ============================================================
   Main Content
   ============================================================ */
.main {
    flex: 1;
    overflow-y: auto;
    background: #f5f7fa;
    padding: 20px;
}
.main::-webkit-scrollbar { width: 6px; }
.main::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }

.main-empty {
    display: flex;
    align-items: center;
    justify-content: center;
}

.welcome-card {
    background: #fff;
    border-radius: 8px;
    padding: 60px 40px;
    text-align: center;
    color: #333;
    max-width: 600px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.welcome-card h1 {
    font-size: 24px;
    margin-bottom: 12px;
    color: #1677ff;
}
.welcome-card p {
    font-size: 14px;
    color: #666;
    margin-bottom: 28px;
}
.quick-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.content-card {
    background: #fff;
    border-radius: 8px;
    padding: 24px;
    min-height: calc(100vh - 96px);
}

/* ============================================================
   Buttons
   ============================================================ */
.btn-primary {
    height: 36px;
    padding: 0 20px;
    background: #1677ff;
    color: #fff;
    font-size: 14px;
    border-radius: 6px;
    font-weight: 500;
    transition: background 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.btn-primary:hover { background: #4096ff; }

.btn-secondary {
    height: 36px;
    padding: 0 20px;
    background: #fff;
    color: #1677ff;
    font-size: 14px;
    border-radius: 6px;
    font-weight: 500;
    border: 1px solid #1677ff;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
}
.btn-secondary:hover { background: #f0f5ff; }

.btn-ghost {
    height: 36px;
    padding: 0 20px;
    background: transparent;
    color: #666;
    font-size: 14px;
    border-radius: 6px;
    border: 1px solid #d9d9d9;
    transition: all 0.2s;
}
.btn-ghost:hover { color: #1677ff; border-color: #1677ff; }

.btn-danger {
    height: 36px;
    padding: 0 20px;
    background: #ff4d4f;
    color: #fff;
    font-size: 14px;
    border-radius: 6px;
    transition: background 0.2s;
}
.btn-danger:hover { background: #ff7875; }

.btn-sm { height: 28px; padding: 0 12px; font-size: 12px; }

/* ============================================================
   Toolbar
   ============================================================ */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}
.toolbar-left { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.toolbar-right { display: flex; align-items: center; gap: 12px; }

.search-box {
    width: 280px;
    height: 36px;
    background: #f5f7fa;
    border-radius: 6px;
    display: flex;
    align-items: center;
    padding: 0 12px;
    gap: 8px;
    transition: background 0.2s;
}
.search-box:focus-within { background: #eef1f5; }
.search-box svg { width: 16px; height: 16px; color: #bbb; flex-shrink: 0; }
.search-box input {
    flex: 1;
    background: transparent;
    font-size: 13px;
    color: #333;
}
.search-box input::placeholder { color: #bbb; }

/* ============================================================
   Table
   ============================================================ */
.table-wrapper { overflow-x: auto; }
table {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto;
}
thead th {
    background: #fafafa;
    padding: 12px 16px;
    text-align: left;
    font-size: 13px;
    color: #666;
    font-weight: 500;
    white-space: nowrap;
    border-bottom: 1px solid #eee;
}
tbody td {
    padding: 14px 16px;
    font-size: 14px;
    color: #333;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}
tbody tr:hover td { background: #fafbfc; }
tbody tr:last-child td { border-bottom: none; }

.td-name { font-weight: 500; color: #333; }
.td-time { color: #999; font-size: 13px; }

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    padding: 2px 8px;
    border-radius: 4px;
}
.status-badge.success { background: #f6ffed; color: #52c41a; }
.status-badge.error   { background: #fff1f0; color: #ff4d4f; }
.status-badge.warning { background: #fffbe6; color: #faad14; }
.status-badge.info    { background: #f0f5ff; color: #1677ff; }
.status-dot {
    width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0;
}
.status-badge.success .status-dot { background: #52c41a; }
.status-badge.error .status-dot   { background: #ff4d4f; }
.status-badge.warning .status-dot { background: #faad14; }
.status-badge.info .status-dot    { background: #1677ff; }

.td-actions { display: flex; align-items: center; gap: 12px; }
.td-actions a, .td-actions .action-link {
    font-size: 13px; color: #1677ff; cursor: pointer;
    transition: color 0.15s;
}
.td-actions a:hover, .td-actions .action-link:hover { color: #4096ff; }

/* ============================================================
   Pagination
   ============================================================ */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 20px;
    padding-top: 20px;
}
.pagination-left {
    display: flex; align-items: center; gap: 12px;
    font-size: 13px; color: #999;
}
.pagination-right { display: flex; align-items: center; gap: 6px; }
.page-btn {
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    font-size: 13px;
    color: #666;
    background: #fff;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
}
.page-btn:hover { color: #1677ff; border-color: #1677ff; }
.page-btn.active { background: #1677ff; color: #fff; border-color: #1677ff; }
.page-btn.disabled {
    color: #d9d9d9; cursor: not-allowed; pointer-events: none;
}

/* ============================================================
   Form
   ============================================================ */
.form-group { margin-bottom: 18px; }
.form-group label {
    display: block;
    font-size: 13px;
    color: #666;
    margin-bottom: 6px;
    font-weight: 500;
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    font-size: 14px;
    color: #333;
    transition: border-color 0.2s;
    background: #fafafa;
}
.form-group textarea { height: auto; padding: 10px 12px; resize: vertical; min-height: 80px; }
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: #1677ff;
    background: #fff;
    box-shadow: 0 0 0 2px rgba(22,119,255,0.1);
}
.form-group input::placeholder,
.form-group textarea::placeholder { color: #bbb; }

.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }

.form-actions {
    margin-top: 24px;
    display: flex;
    gap: 12px;
}

/* ============================================================
   Modal (登录弹窗 / 错误页)
   ============================================================ */
.modal-mask {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}
.modal-mask.show { opacity: 1; pointer-events: auto; }

.modal-box {
    background: #fff;
    border-radius: 12px;
    width: 420px;
    max-width: calc(100vw - 32px);
    padding: 32px 36px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    transform: translateY(-20px);
    transition: transform 0.2s;
    position: relative;
}
.modal-mask.show .modal-box { transform: translateY(0); }

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 20px;
    text-align: center;
}

.modal-close {
    position: absolute;
    top: 14px; right: 16px;
    width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: #bbb; font-size: 20px;
    transition: color 0.2s;
}
.modal-close:hover { color: #666; }

.modal-actions {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.modal-tip {
    text-align: center;
    font-size: 13px;
    color: #999;
    margin-top: 16px;
}
.modal-tip a { color: #1677ff; }
.modal-tip a:hover { text-decoration: underline; }

/* ============================================================
   Toast
   ============================================================ */
.toast {
    position: fixed;
    top: 40px;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: #fff;
    padding: 10px 24px;
    border-radius: 6px;
    font-size: 14px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    z-index: 99999;
}
.toast.show { opacity: 1; }
.toast.success { background: #52c41a; }
.toast.error { background: #ff4d4f; }

/* ============================================================
   Loading
   ============================================================ */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px;
    color: #999;
    font-size: 14px;
}
.loading::before {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #1677ff;
    border-top-color: transparent;
    border-radius: 50%;
    margin-right: 8px;
    animation: spin 0.8s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================================
   Iframe Main
   ============================================================ */
.main-iframe {
    width: 100%;
    height: calc(100vh - 96px);
    border: 0;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

/* ============================================================
   Responsive: 自动折叠
   ============================================================ */
@media (max-width: 1400px) {
    .sidebar { width: 56px; min-width: 56px; }
    .sidebar-logo { font-size: 0; padding: 0; }
    .sidebar-footer { flex-direction: column; height: auto; padding: 8px 0; gap: 4px; font-size: 0; }
    .sidebar-footer > svg { margin: 0; }
    .footer-text { display: none; }
    .nav-group-title { justify-content: center; padding: 10px 0; font-size: 0; color: transparent; }
    .nav-group-title svg { display: none; }
    .nav-sub-item { justify-content: center; padding: 0; font-size: 0; }
    .nav-sub-item .nav-icon { margin-right: 0; }
    .badge-premium { display: none; }
}

/* Mobile (仅折叠到图标) */
@media (max-width: 768px) {
    .topbar { padding: 0 12px; }
    .topbar-title { font-size: 14px; }
    .main { padding: 12px; }
}