/* ============================================================
   成绩查询系统 — 全局样式
   简约商务风格 | 白色主调 | 响应式
   ============================================================ */

/* --- Reset --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
    font-size: 14px;
    color: #333;
    background: #f5f5f5;
}

a {
    color: #409eff;
    text-decoration: none;
}
a:hover {
    color: #338eef;
}

/* --- Login Page --- */
.login-page {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.login-header {
    padding: 20px 50px;
    background: #fff;
    border-bottom: 1px solid #eee;
}

.login-header .logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 22px;
    font-weight: bold;
    color: #333;
}

.logo-img {
    height: 36px;
    width: auto;
    max-width: 180px;
    object-fit: contain;
    display: block;
}

.sidebar-logo-img {
    height: 32px;
    width: auto;
    max-width: 140px;
    object-fit: contain;
    display: block;
}

.login-body {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 120px;
    position: relative;
    min-height: 60vh;
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
}

.login-body.has-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.35);
    z-index: 0;
}

.login-body .login-box {
    position: relative;
    z-index: 1;
}

.login-box {
    width: 400px;
    background: #fff;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 0 15px rgba(0,0,0,0.08);
}

.login-box h2 {
    font-size: 24px;
    margin-bottom: 30px;
    text-align: center;
    color: #333;
}

.login-footer {
    height: 60px;
    line-height: 60px;
    text-align: center;
    font-size: 13px;
    color: #999;
    background: #fff;
    border-top: 1px solid #eee;
}

/* --- Admin Layout --- */
.admin-wrapper {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 220px;
    background: #fff;
    border-right: 1px solid #eee;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: width 0.3s;
}

.sidebar .sidebar-header {
    height: 60px;
    display: flex;
    align-items: center;
    padding: 0 20px;
    border-bottom: 1px solid #eee;
    font-size: 18px;
    font-weight: bold;
    color: #333;
    gap: 8px;
}

.sidebar .sidebar-header .logo-icon {
    width: 32px;
    height: 32px;
    background: #409eff;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 16px;
    font-weight: bold;
}

.sidebar .nav {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0;
}

.sidebar .nav .nav-title {
    padding: 10px 20px 5px;
    font-size: 12px;
    color: #999;
    text-transform: uppercase;
}

.sidebar .nav a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: #666;
    font-size: 14px;
    gap: 10px;
    transition: all 0.2s;
}

.sidebar .nav a:hover {
    background: #f0f7ff;
    color: #409eff;
}

.sidebar .nav a.active {
    background: #ecf5ff;
    color: #409eff;
    border-right: 3px solid #409eff;
}

.sidebar .nav a .nav-icon {
    width: 20px;
    text-align: center;
    font-size: 16px;
}

/* Main Area */
.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
.main-header {
    height: 60px;
    background: #fff;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    flex-shrink: 0;
}

.main-header .header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.main-header .header-left .toggle-btn {
    display: none;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #666;
    padding: 4px;
}

.main-header .header-left .breadcrumb {
    font-size: 14px;
    color: #999;
}

.main-header .header-left .breadcrumb span {
    color: #333;
}

.main-header .header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.main-header .header-right .user-info {
    font-size: 14px;
    color: #666;
}

.main-header .header-right .user-info strong {
    color: #333;
}

/* Dark mode toggle */
.dark-toggle {
    background: none;
    border: 1px solid #eee;
    border-radius: 4px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 14px;
    color: #666;
    transition: all 0.2s;
}

.dark-toggle:hover {
    border-color: #409eff;
    color: #409eff;
}

/* Content */
.main-content {
    flex: 1;
    padding: 20px 24px;
    overflow-y: auto;
    background: #f5f5f5;
}

/* --- Cards & Panels --- */
.card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0,0,0,0.04);
    margin-bottom: 20px;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 {
    font-size: 16px;
    color: #333;
}

.card-body {
    padding: 20px;
}

/* --- Dashboard Stats --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.stat-card {
    background: #fff;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 0 10px rgba(0,0,0,0.04);
}

.stat-card .stat-number {
    font-size: 28px;
    font-weight: bold;
    color: #409eff;
}

.stat-card .stat-label {
    font-size: 13px;
    color: #999;
    margin-top: 4px;
}

/* --- Forms --- */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    color: #666;
    font-weight: normal;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    height: 38px;
    padding: 0 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    color: #333;
    background: #fff;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #409eff;
}

.form-group textarea {
    height: auto;
    padding: 10px 12px;
    resize: vertical;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    padding: 0 16px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    background: #fff;
    color: #333;
    gap: 4px;
}

.btn:hover {
    border-color: #409eff;
    color: #409eff;
}

.btn-primary {
    background: #409eff;
    border-color: #409eff;
    color: #fff;
}
.btn-primary:hover {
    background: #338eef;
    border-color: #338eef;
    color: #fff;
}

.btn-success {
    background: #67c23a;
    border-color: #67c23a;
    color: #fff;
}
.btn-success:hover {
    background: #5daf34;
    border-color: #5daf34;
    color: #fff;
}

.btn-danger {
    background: #f56c6c;
    border-color: #f56c6c;
    color: #fff;
}
.btn-danger:hover {
    background: #e06060;
    border-color: #e06060;
    color: #fff;
}

.btn-warning {
    background: #e6a23c;
    border-color: #e6a23c;
    color: #fff;
}
.btn-warning:hover {
    background: #d49433;
    border-color: #d49433;
    color: #fff;
}

.btn-sm {
    height: 30px;
    padding: 0 10px;
    font-size: 13px;
}

.btn-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* --- Table --- */
.table-wrapper {
    overflow-x: auto;
}

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

table th, table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid #eee;
    white-space: nowrap;
}

table th {
    background: #fafafa;
    font-weight: 600;
    color: #666;
    font-size: 13px;
}

table tr:hover {
    background: #f8fbff;
}

table td .actions {
    display: flex;
    gap: 6px;
}

/* --- Toolbar (search + buttons above table) --- */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.toolbar .search-box {
    display: flex;
    gap: 8px;
    align-items: center;
}

.toolbar .search-box input {
    height: 36px;
    padding: 0 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    width: 220px;
}

.toolbar .search-box input:focus {
    border-color: #409eff;
    outline: none;
}

/* --- Pagination --- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 20px 0;
    flex-wrap: wrap;
}

.pagination .page-info {
    font-size: 13px;
    color: #999;
    margin-right: 12px;
}

.pagination .page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    color: #666;
    background: #fff;
    transition: all 0.2s;
}

.pagination .page-btn:hover {
    border-color: #409eff;
    color: #409eff;
}

.pagination .page-btn.active {
    background: #409eff;
    border-color: #409eff;
    color: #fff;
}

/* --- Modal / Overlay --- */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal-box {
    background: #fff;
    border-radius: 8px;
    width: 500px;
    max-width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 16px;
}

.modal-header .close-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #999;
    padding: 0 4px;
}

.modal-header .close-btn:hover {
    color: #333;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 12px 20px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* --- Alert / Message --- */
.alert {
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 16px;
    font-size: 14px;
}

.alert-success {
    background: #f0f9eb;
    color: #67c23a;
    border: 1px solid #e1f3d8;
}

.alert-danger {
    background: #fef0f0;
    color: #f56c6c;
    border: 1px solid #fde2e2;
}

.alert-warning {
    background: #fdf6ec;
    color: #e6a23c;
    border: 1px solid #faecd8;
}

.alert-info {
    background: #f4f8ff;
    color: #409eff;
    border: 1px solid #e6f0ff;
}

/* --- Confirm Dialog --- */
.confirm-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.confirm-overlay.active {
    display: flex;
}

.confirm-box {
    background: #fff;
    border-radius: 8px;
    width: 380px;
    max-width: 90vw;
    padding: 30px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.confirm-box .confirm-icon {
    font-size: 48px;
    color: #e6a23c;
    margin-bottom: 12px;
}

.confirm-box .confirm-text {
    font-size: 15px;
    color: #333;
    margin-bottom: 24px;
}

.confirm-box .confirm-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
}

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-state .empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

/* --- Subject Tags (grade sheet) --- */
.subject-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 12px;
    background: #ecf5ff;
    color: #409eff;
    margin: 2px;
}

/* --- Responsive --- */
@media (max-width: 1024px) {
    .sidebar {
        width: 64px;
    }
    .sidebar .sidebar-header span,
    .sidebar .nav a span,
    .sidebar .nav .nav-title {
        display: none;
    }
    .sidebar .nav a {
        justify-content: center;
        padding: 12px;
    }
    .sidebar-logo-img {
        max-width: 40px;
        height: 28px;
    }
    .logo-img {
        height: 28px;
        max-width: 120px;
    }
    .login-header .logo {
        font-size: 18px;
    }
    .login-body {
        padding-right: 60px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -220px;
        top: 0;
        bottom: 0;
        z-index: 900;
        width: 220px;
        transition: left 0.3s;
    }
    .sidebar.open {
        left: 0;
    }
    .sidebar .sidebar-header span,
    .sidebar .nav a span,
    .sidebar .nav .nav-title {
        display: inline;
    }
    .sidebar .nav a {
        justify-content: flex-start;
        padding: 12px 20px;
    }
    .main-header .header-left .toggle-btn {
        display: block;
    }
    .main-content {
        padding: 16px;
    }
    
    .login-header {
        padding: 16px 20px;
    }
    .login-header .logo {
        font-size: 16px;
        gap: 8px;
    }
    .logo-img {
        height: 24px;
        max-width: 100px;
    }
.login-body {
        padding: 20px;
        justify-content: center;
        min-height: 50vh;
    }
    .login-box {
        width: 100%;
        max-width: 400px;
    }
    .form-row {
        grid-template-columns: 1fr;
    }
    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    .toolbar .search-box {
        flex-direction: column;
    }
    .toolbar .search-box input {
        width: 100%;
    }
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .login-header {
        padding: 12px 16px;
    }
    .logo-img {
        height: 20px;
        max-width: 80px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
    .main-header {
        padding: 0 12px;
    }
    .main-header .header-right .user-info {
        display: none;
    }
}

/* --- Footer --- */
.footer {
    text-align: center;
    padding: 16px 24px;
    font-size: 13px;
    color: #999;
    background: #fff;
    border-top: 1px solid #eee;
    flex-shrink: 0;
}

.footer .footer-beian {
    color: #999;
    text-decoration: none;
}
.footer .footer-beian:hover {
    color: #409eff;
}

[data-theme="dark"] .footer {
    background: #16213e;
    border-top-color: #2a2a4a;
    color: #666;
}
[data-theme="dark"] .footer .footer-beian {
    color: #666;
}
[data-theme="dark"] .footer .footer-beian:hover {
    color: #409eff;
}
