/* ========== 全局重置与字体 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', sans-serif;
    background: #f0f2f7;
    color: #1a1f36;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========== 登录页专属背景 ========== */
body.login-page {
    background: #0b0f1c;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.bg-glow {
    position: fixed;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.15;
    pointer-events: none;
    z-index: 0;
}

.glow-1 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, #c9a84c 0%, transparent 70%);
    top: -200px;
    right: -150px;
    animation: floatGlow 8s ease-in-out infinite;
}

.glow-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, #4a6fa5 0%, transparent 70%);
    bottom: -180px;
    left: -120px;
    animation: floatGlow 10s ease-in-out infinite reverse;
}

@keyframes floatGlow {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(30px, -30px) scale(1.1); }
}

.login-card {
    position: relative;
    z-index: 1;
    display: flex;
    max-width: 960px;
    width: 100%;
    min-height: 540px;
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 40px 80px rgba(0, 0, 0, 0.4), 0 20px 40px rgba(0, 0, 0, 0.3);
}

.card-left {
    width: 44%;
    background: linear-gradient(160deg, #131a2e 0%, #1a2645 40%, #1e3050 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 50px 30px;
    position: relative;
    overflow: hidden;
}

.card-left::before {
    content: '';
    position: absolute;
    top: -80px;
    right: -80px;
    width: 300px;
    height: 300px;
    border: 1px solid rgba(201, 168, 76, 0.1);
    border-radius: 50%;
    pointer-events: none;
}

.card-left::after {
    content: '';
    position: absolute;
    bottom: -60px;
    left: -60px;
    width: 220px;
    height: 220px;
    border: 1px solid rgba(201, 168, 76, 0.06);
    border-radius: 50%;
    pointer-events: none;
}

.brand-content {
    text-align: center;
    position: relative;
    z-index: 1;
}

.logo-wrapper {
    width: 90px;
    height: 90px;
    margin: 0 auto 28px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(201, 168, 76, 0.25);
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.4s ease;
    position: relative;
}

.logo-wrapper::after {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 30px;
    border: 1px solid rgba(201, 168, 76, 0.08);
    pointer-events: none;
}

.logo-wrapper:hover {
    border-color: rgba(201, 168, 76, 0.5);
    box-shadow: 0 0 40px rgba(201, 168, 76, 0.08);
}

.logo-wrapper .logo-img {
    width: 64%;
    height: 64%;
    object-fit: contain;
}

.logo-placeholder {
    color: #c9a84c;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-placeholder svg {
    width: 48px;
    height: 48px;
}

.system-name {
    font-size: 2rem;
    font-weight: 500;
    color: #f0e6d3;
    letter-spacing: 6px;
    margin-bottom: 16px;
}

.divider-line {
    width: 40px;
    height: 1px;
    background: linear-gradient(90deg, transparent, #c9a84c, transparent);
    margin: 0 auto 16px;
}

.system-sub {
    font-size: 0.95rem;
    color: rgba(200, 190, 170, 0.7);
    font-weight: 300;
    letter-spacing: 2px;
    margin-bottom: 8px;
}

.system-desc {
    font-size: 0.8rem;
    color: rgba(200, 190, 170, 0.4);
    font-weight: 300;
    letter-spacing: 3px;
}

.card-right {
    flex: 1;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 50px 45px;
}

.login-form-wrapper {
    width: 100%;
    max-width: 360px;
}

.form-header {
    margin-bottom: 36px;
}

.form-title {
    font-size: 1.7rem;
    font-weight: 600;
    color: #0f172a;
    letter-spacing: -0.3px;
    margin-bottom: 6px;
}

.form-subtitle {
    font-size: 0.9rem;
    color: #94a3b8;
    font-weight: 400;
}

.form-group {
    margin-bottom: 22px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #475569;
    font-size: 0.85rem;
    letter-spacing: 0.3px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 14px;
    color: #94a3b8;
    pointer-events: none;
}

.input-wrapper input {
    width: 100%;
    padding: 13px 14px 13px 42px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    font-size: 0.95rem;
    font-family: inherit;
    background: #f8fafc;
    transition: all 0.25s ease;
    color: #1e293b;
}

.input-wrapper input::placeholder {
    color: #cbd5e1;
}

.input-wrapper input:focus {
    outline: none;
    border-color: #b49450;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(180, 148, 80, 0.1), 0 2px 8px rgba(0,0,0,0.04);
}

.btn-login {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #1a2645 0%, #1e3050 100%);
    color: #f0e6d3;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    letter-spacing: 2px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 8px;
    position: relative;
    overflow: hidden;
}

.btn-login::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent 0%, rgba(201, 168, 76, 0.1) 100%);
    opacity: 0;
    transition: opacity 0.3s;
}

.btn-login:hover {
    background: linear-gradient(135deg, #1f2f52 0%, #243a60 100%);
    box-shadow: 0 8px 24px rgba(26, 38, 69, 0.35);
    transform: translateY(-1px);
}

.btn-login:hover::after {
    opacity: 1;
}

.btn-login svg {
    transition: transform 0.3s;
}

.btn-login:hover svg {
    transform: translateX(3px);
}

.error-message {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #b91c1c;
    background: #fef2f2;
    border: 1px solid #fecaca;
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 24px;
    font-size: 0.9rem;
    font-weight: 400;
}

.login-footer {
    margin-top: 28px;
    text-align: center;
    color: #cbd5e1;
    font-size: 0.78rem;
    letter-spacing: 1px;
}

/* ========== 管理端/教师端通用布局 ========== */
.admin-wrapper,
.teacher-wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: #0f172a;
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    box-shadow: 2px 0 30px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease;
}

.sidebar .sidebar-header {
    padding: 32px 20px 24px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar .sidebar-header h3 {
    font-weight: 500;
    font-size: 1.15rem;
    letter-spacing: 1px;
    color: #f1f5f9;
}

.sidebar .sidebar-header small {
    display: block;
    margin-top: 6px;
    color: #94a3b8;
    font-weight: 400;
    font-size: 0.85rem;
}

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

.sidebar .sidebar-nav ul {
    list-style: none;
}

.sidebar .sidebar-nav li {
    margin-bottom: 1px;
}

.sidebar .sidebar-nav a {
    display: flex;
    align-items: center;
    padding: 11px 24px;
    color: #94a3b8;
    text-decoration: none;
    transition: all 0.2s;
    font-size: 0.93rem;
    border-left: 3px solid transparent;
    font-weight: 400;
}

.sidebar .sidebar-nav a:hover {
    background: rgba(255, 255, 255, 0.025);
    color: #e2e8f0;
}

.sidebar .sidebar-nav a.active {
    background: rgba(255, 255, 255, 0.05);
    color: #f1f5f9;
    border-left-color: #c9a84c;
    font-weight: 500;
}

.sidebar .submenu {
    display: none;
    padding-left: 16px;
}

.sidebar .submenu.open {
    display: block;
}

.sidebar .submenu a {
    padding: 10px 24px 10px 44px;
    font-size: 0.88rem;
    color: #94a3b8;
}

.sidebar .submenu a.active {
    color: #f1f5f9;
    border-left-color: #c9a84c;
}

.sidebar .menu-toggle {
    cursor: pointer;
    justify-content: space-between;
}

.sidebar .menu-toggle i {
    font-size: 0.65rem;
    transition: transform 0.2s;
    opacity: 0.6;
}

.sidebar .menu-toggle.open i {
    transform: rotate(90deg);
    opacity: 0.9;
}

.sidebar-footer {
    padding: 20px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-footer a {
    color: #f87171;
    text-decoration: none;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: color 0.2s;
    font-size: 0.93rem;
}

.sidebar-footer a:hover {
    color: #fca5a5;
}

.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 36px 40px;
    background: #f0f2f7;
    min-height: 100vh;
}

.main-content .page-header {
    margin-bottom: 28px;
}

.main-content .page-header h1 {
    font-weight: 600;
    color: #0f172a;
    font-size: 1.85rem;
    letter-spacing: -0.3px;
}

.placeholder-card {
    background: #fff;
    border-radius: 16px;
    padding: 60px 40px;
    text-align: center;
    color: #94a3b8;
    font-size: 1.15rem;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.03);
    border: 1px solid #edf2f7;
}

/* 按钮通用 */
.btn {
    padding: 10px 20px;
    border-radius: 12px;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: none;
    transition: all 0.2s;
}
.btn-primary { background: #1a2645; color: #f0e6d3; }
.btn-primary:hover { background: #243a60; }
.btn-outline { background: #fff; border: 1px solid #e2e8f0; color: #475569; }
.btn-outline:hover { background: #f8fafc; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 5px 10px; font-size: 0.75rem; border-radius: 6px; }

/* 卡片网格 */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}
.entity-card,
.class-card,
.dorm-card,
.alert-card {
    background: #fff;
    border-radius: 14px;
    padding: 16px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.04);
    border: 1px solid #edf2f7;
    transition: all 0.2s;
}
.entity-card:hover,
.class-card:hover,
.dorm-card:hover,
.alert-card:hover {
    box-shadow: 0 8px 20px rgba(0,0,0,0.06);
    transform: translateY(-1px);
}

/* 表格容器 */
.table-container {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.03);
    border: 1px solid #edf2f7;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}
.data-table th,
.data-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.85rem;
    white-space: nowrap;
}
.data-table th {
    background: #f8fafc;
    font-weight: 600;
    color: #475569;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #fafbfc; }

/* 模态框 */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal-dialog {
    background: #fff;
    border-radius: 20px;
    padding: 24px;
    width: 95%;
    max-width: 600px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 30px 60px rgba(0,0,0,0.25);
    animation: modalIn 0.25s;
}
@keyframes modalIn {
    from { opacity: 0; transform: translateY(20px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.form-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.form-row .form-group { flex: 1; min-width: 150px; }
.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #475569;
    font-size: 0.85rem;
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 9px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.9rem;
    background: #f8fafc;
}
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}
.btn-cancel { background: #f1f5f9; border: 1px solid #e2e8f0; color: #475569; }

/* 标签 */
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 5px; }
.tag { background: #edf2f7; padding: 4px 10px; border-radius: 12px; font-size: 0.8rem; display: flex; align-items: center; gap: 4px; }
.tag .remove { cursor: pointer; color: #dc2626; font-weight: bold; }

/* 移动端菜单按钮 */
.menu-toggle-btn {
    display: none;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 200;
    background: #0f172a;
    color: #fff;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    font-size: 1.3rem;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}

/* ========== 响应式设计 (移动端强制适配) ========== */
@media (max-width: 768px) {
    /* 登录页 */
    .login-card {
        flex-direction: column;
        max-width: 400px;
        min-height: auto;
    }
    .card-left {
        width: 100%;
        padding: 36px 24px;
    }
    .card-right {
        padding: 36px 28px;
    }
    .system-name {
        font-size: 1.6rem;
        letter-spacing: 4px;
    }

    /* 侧边栏与主内容 */
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0 !important;
        padding: 20px !important;
        padding-top: 70px !important;
    }

    .menu-toggle-btn {
        display: block;
    }

    /* 卡片网格单列 */
    .cards-grid {
        grid-template-columns: 1fr !important;
    }

    /* 表格容器横向滚动，强制覆盖所有内联样式 */
    .table-container,
    [class*="table"],
    [style*="overflow"] {
        max-width: 100vw !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    .data-table,
    [class*="table"] table {
        min-width: 600px !important; /* 保持合适的最小宽度，确保横向滚动 */
    }

    /* 弹窗全屏化 */
    .modal-overlay {
        padding: 0;
    }
    .modal-dialog {
        width: 100% !important;
        max-width: 100% !important;
        height: 100% !important;
        max-height: 100% !important;
        border-radius: 0 !important;
        padding: 20px !important;
        margin: 0 !important;
    }

    /* 表单行 */
    .form-row {
        flex-direction: column !important;
    }
    .form-row .form-group {
        min-width: 100% !important;
    }

    /* 按钮触摸友好 */
    .btn {
        padding: 12px 16px !important;
        font-size: 0.9rem !important;
    }

    /* 输入框和选择框 */
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px !important; /* 避免 iOS 缩放 */
        padding: 12px 10px !important;
    }

    /* 侧边栏内子菜单 */
    .sidebar .submenu a {
        padding-left: 50px;
    }

    /* 记录卡片（教师端仪表盘） */
    .record-content {
        flex-direction: column !important;
    }
    .record-left {
        border-right: none !important;
        border-bottom: 1px solid #f1f5f9 !important;
    }

    /* 制度细则等左右面板 */
    .rule-container,
    .class-manage-container {
        flex-direction: column !important;
        height: auto !important;
    }
    .left-panel,
    .right-panel {
        width: 100% !important;
        min-height: auto !important;
        max-height: none !important;
    }

    /* 分类卡片 */
    .category-cards {
        gap: 6px !important;
    }
    .category-card {
        padding: 8px 12px !important;
        font-size: 0.8rem !important;
    }

    /* 查询表格 */
    .query-table {
        min-width: 600px !important;
    }

    /* 德育违纪、表扬、查询表格 */
    .data-table {
        min-width: 900px !important; /* 确保所有列可滚动查看 */
    }

    /* 顶部工具条换行 */
    .page-toolbar {
        flex-wrap: wrap !important;
        gap: 10px !important;
    }

    /* 弹窗内部滚动 */
    .modal-dialog {
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
}