/* ============================================================
   ExamSchedule-Management — 统一管理后台样式 (admin.css)
   基于 Material Design 2 蓝色主题，现代化改良
   兼容 Chrome 70+，不使用 :where() / :is()
   ============================================================ */

/* === 基础重置 & 排版 === */
*,
*::before,
*::after {
    box-sizing: border-box;
}

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

body {
    font-family: 'Roboto', 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #f0f4f8;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    color: #1a1a2e;
    -webkit-font-smoothing: antialiased;
}

a,
a:visited,
a:active {
    text-decoration: none !important;
    color: inherit;
}

/* === 导航栏 (毛玻璃效果) === */
.navbar {
    background: rgba(25, 118, 210, 0.85);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    color: #fff;
    padding: 16px 24px;
    display: -webkit-flex;
    display: flex;
    -webkit-align-items: center;
    align-items: center;
    position: relative;
    box-shadow: 0 2px 12px rgba(25, 118, 210, 0.25);
    z-index: 100;
}

.navbar .material-icons {
    margin-right: 8px;
    vertical-align: middle;
}

.navbar .nav-title {
    display: -webkit-inline-flex;
    display: inline-flex;
    -webkit-align-items: center;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    font-weight: 500;
    letter-spacing: 0.3px;
}

/* === 主页按钮 === */
.home-btn {
    background: #fff;
    color: #1976d2 !important;
    border: 1px solid #1976d2;
    border-radius: 8px;
    padding: 7px 18px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    margin-left: 24px;
    display: -webkit-inline-flex;
    display: inline-flex;
    -webkit-align-items: center;
    align-items: center;
    gap: 6px;
    text-decoration: none !important;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.home-btn:hover {
    background: #e3f0fc;
    box-shadow: 0 2px 8px rgba(25, 118, 210, 0.2);
    -webkit-transform: translateY(-1px);
    transform: translateY(-1px);
}

.home-btn:active {
    -webkit-transform: translateY(0);
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* === 返回按钮 (二级导航) === */
.back-btn {
    background: #fff;
    color: #1976d2 !important;
    border: 1px solid #1976d2;
    border-radius: 8px;
    padding: 8px 20px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    margin-bottom: 24px;
    margin-top: 24px;
    margin-right: 16px;
    display: -webkit-inline-flex;
    display: inline-flex;
    -webkit-align-items: center;
    align-items: center;
    gap: 6px;
    text-decoration: none !important;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.back-btn:hover {
    background: #e3f0fc;
    box-shadow: 0 2px 8px rgba(25, 118, 210, 0.15);
    -webkit-transform: translateY(-1px);
    transform: translateY(-1px);
}

/* === 容器 === */
.container {
    max-width: 1100px;
    margin: 40px auto;
    padding: 0 20px;
}

.container-sm {
    max-width: 480px;
    margin: 60px auto;
    padding: 0 20px;
}

.container-md {
    max-width: 820px;
    margin: 40px auto;
    padding: 0 20px;
}

/* === 卡片 === */
.md2-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    padding: 32px 36px;
    display: -webkit-flex;
    display: flex;
    -webkit-flex-direction: column;
    flex-direction: column;
    -webkit-align-items: flex-start;
    align-items: flex-start;
    transition: box-shadow 0.25s ease, -webkit-transform 0.25s ease;
    transition: box-shadow 0.25s ease, transform 0.25s ease;
    transition: box-shadow 0.25s ease, transform 0.25s ease, -webkit-transform 0.25s ease;
    position: relative;
}

.md2-card:hover {
    box-shadow: 0 8px 32px rgba(25, 118, 210, 0.12);
    -webkit-transform: translateY(-2px);
    transform: translateY(-2px);
}

.card-title {
    font-size: 20px;
    font-weight: 500;
    margin-bottom: 8px;
    color: #1976d2;
    display: -webkit-flex;
    display: flex;
    -webkit-align-items: center;
    align-items: center;
    gap: 8px;
}

.card-sub {
    color: #555;
    margin-bottom: 6px;
    font-size: 14px;
}

.card-id {
    color: #888;
    font-size: 13px;
    margin-bottom: 6px;
}

.card-footer {
    font-size: 13px;
    color: #aaa;
    margin-top: 14px;
}

/* === 按钮 === */
.md-btn {
    background: #1976d2;
    color: #fff !important;
    border: none;
    border-radius: 10px;
    padding: 10px 24px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(25, 118, 210, 0.2);
    display: -webkit-inline-flex;
    display: inline-flex;
    -webkit-align-items: center;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    text-decoration: none !important;
    -webkit-user-select: none;
    user-select: none;
    line-height: 1.4;
}

.md-btn:hover {
    background: #1565c0;
    box-shadow: 0 4px 16px rgba(25, 118, 210, 0.3);
    -webkit-transform: translateY(-1px);
    transform: translateY(-1px);
}

.md-btn:active {
    -webkit-transform: translateY(0);
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(25, 118, 210, 0.2);
}

.md-btn .material-icons {
    font-size: 18px;
    vertical-align: middle;
}

/* 按钮变体 */
.md-btn.delete-btn,
.md-btn.danger {
    background: #e53935;
    box-shadow: 0 2px 8px rgba(229, 57, 53, 0.2);
}

.md-btn.delete-btn:hover,
.md-btn.danger:hover {
    background: #b71c1c;
    box-shadow: 0 4px 16px rgba(229, 57, 53, 0.3);
}

.md-btn.secondary {
    background: #5c6bc0;
    box-shadow: 0 2px 8px rgba(92, 107, 192, 0.2);
}

.md-btn.secondary:hover {
    background: #3f51b5;
    box-shadow: 0 4px 16px rgba(92, 107, 192, 0.3);
}

.md-btn.gray {
    background: #888;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.md-btn.gray:hover {
    background: #666;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.md-btn.add-btn {
    background: #43a047;
    box-shadow: 0 2px 8px rgba(67, 160, 71, 0.2);
}

.md-btn.add-btn:hover {
    background: #2e7031;
    box-shadow: 0 4px 16px rgba(67, 160, 71, 0.3);
}

/* === 表单控件 === */
.input-group {
    margin-bottom: 24px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    color: #1976d2;
    font-weight: 500;
    font-size: 14px;
}

.input-group label .material-icons {
    font-size: 18px;
    vertical-align: middle;
    margin-right: 4px;
}

input[type="text"],
input[type="password"],
input[type="datetime-local"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid #d0d9e8;
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    background: #fff;
    color: #1a1a2e;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

input:focus,
select:focus,
textarea:focus {
    border-color: #1976d2;
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.12);
}

input[readonly] {
    background: #f5f7fa;
    color: #888;
    cursor: not-allowed;
}

select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='%23555'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

/* === Checkbox 美化 === */
.checkbox-group {
    display: -webkit-flex;
    display: flex;
    -webkit-align-items: center;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: #f7faff;
    border: 1px solid #d0d9e8;
    border-radius: 12px;
    transition: border-color 0.2s ease;
}

.checkbox-group:hover {
    border-color: #1976d2;
}

.checkbox-group label {
    margin: 0;
    cursor: pointer;
    display: -webkit-flex;
    display: flex;
    -webkit-align-items: center;
    align-items: center;
    gap: 8px;
    color: #1976d2;
    font-weight: 500;
    font-size: 15px;
}

.checkbox-group input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    border: 2px solid #1976d2;
    border-radius: 4px;
    margin: 0;
    position: relative;
    transition: all 0.15s ease;
}

.checkbox-group input[type="checkbox"]:checked {
    background: #1976d2;
    border-color: #1976d2;
}

.checkbox-group input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 1px;
    width: 6px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    -webkit-transform: rotate(45deg);
    transform: rotate(45deg);
}

.checkbox-group .hint-text {
    font-size: 13px;
    color: #666;
    margin-left: 4px;
}

/* === 表格 === */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-bottom: 16px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

th,
td {
    border: none;
    padding: 10px 12px;
    text-align: center;
    border-bottom: 1px solid #e8ecf4;
}

th {
    background: #e3f0fc;
    color: #1976d2;
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 0.3px;
}

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

tbody tr {
    transition: background 0.15s ease;
}

tbody tr:hover {
    background: #f0f6ff;
}

/* === 消息提示 === */
.msg {
    color: #e53935;
    margin-bottom: 16px;
    padding: 12px 16px;
    background: #fff0f0;
    border-radius: 10px;
    border-left: 4px solid #e53935;
    font-size: 14px;
}

/* === 用户信息 === */
.user-info {
    margin-left: auto;
    font-size: 14px;
    opacity: 0.95;
}

.logout {
    float: right;
    color: #fff;
    cursor: pointer;
    margin-left: 32px;
    text-decoration: none !important;
    display: -webkit-inline-flex;
    display: inline-flex;
    -webkit-align-items: center;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    opacity: 0.9;
    transition: opacity 0.2s ease;
}

.logout:hover {
    opacity: 1;
}

/* === 导入区域 === */
.import-section {
    background: #f7faff;
    border: 1.5px dashed #b3c6e0;
    border-radius: 12px;
    padding: 20px;
    transition: border-color 0.2s ease;
}

.import-section:hover {
    border-color: #1976d2;
}

.import-hint {
    margin: 0 0 12px 0;
    font-size: 14px;
    color: #56657f;
}

.import-actions {
    display: -webkit-flex;
    display: flex;
    -webkit-flex-wrap: wrap;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 12px;
}

.import-textarea {
    width: 100%;
    min-height: 180px;
    padding: 14px;
    border: 1.5px solid #d0d9e8;
    border-radius: 10px;
    font-size: 14px;
    font-family: 'Consolas', 'Courier New', monospace;
    resize: vertical;
    display: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.import-footer {
    display: -webkit-flex;
    display: flex;
    -webkit-align-items: center;
    align-items: center;
    gap: 16px;
    margin-top: 12px;
    -webkit-flex-wrap: wrap;
    flex-wrap: wrap;
}

.file-hint {
    margin-top: 12px;
    font-size: 14px;
    color: #56657f;
    line-height: 1.5;
}

.hint {
    font-size: 13px;
    min-height: 18px;
    display: -webkit-inline-flex;
    display: inline-flex;
    -webkit-align-items: center;
    align-items: center;
}

.hint.success {
    color: #2e7d32;
}

.hint.error {
    color: #d32f2f;
}

.btn-label {
    margin-left: 6px;
}

/* === 卡片列表 (用于配置管理) === */
.card-list {
    display: -webkit-flex;
    display: flex;
    -webkit-flex-wrap: wrap;
    flex-wrap: wrap;
    gap: 32px;
    margin-top: 32px;
}

.add-card {
    border: 2px dashed #1976d2;
    background: #f0f6ff;
    color: #1976d2;
    -webkit-justify-content: center;
    justify-content: center;
    -webkit-align-items: center;
    align-items: center;
    cursor: pointer;
    min-height: 200px;
    min-width: 320px;
    display: -webkit-flex;
    display: flex;
    -webkit-flex-direction: column;
    flex-direction: column;
    border-radius: 16px;
    transition: background 0.2s ease, border-color 0.2s ease, -webkit-transform 0.2s ease;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease, -webkit-transform 0.2s ease;
    text-decoration: none !important;
}

.add-card:hover {
    background: #e3f0fc;
    border-color: #1565c0;
    -webkit-transform: translateY(-2px);
    transform: translateY(-2px);
}

/* === 操作栏 === */
.actions {
    display: -webkit-flex;
    display: flex;
    gap: 8px;
    -webkit-justify-content: center;
    justify-content: center;
}

/* === 居中辅助 === */
.align-center {
    display: -webkit-flex;
    display: flex;
    -webkit-flex-direction: column;
    flex-direction: column;
    -webkit-align-items: center;
    align-items: center;
}

/* === 搜索区 (用于 index.php) === */
.search-section {
    max-width: 440px;
    margin: 0 auto 48px auto;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    padding: 32px;
}

/* === 公开考试列表 (用于 index.php) === */
.public-section {
    margin-top: 8px;
}

.public-section h2 {
    font-size: 20px;
    color: #1976d2;
    display: -webkit-flex;
    display: flex;
    -webkit-align-items: center;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
}

.public-section h2 .material-icons {
    font-size: 24px;
}

.exam-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.exam-card {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    padding: 24px;
    display: -webkit-flex;
    display: flex;
    -webkit-flex-direction: column;
    flex-direction: column;
    transition: box-shadow 0.25s ease, -webkit-transform 0.25s ease;
    transition: box-shadow 0.25s ease, transform 0.25s ease;
    transition: box-shadow 0.25s ease, transform 0.25s ease, -webkit-transform 0.25s ease;
    border-left: 4px solid #1976d2;
}

.exam-card:hover {
    box-shadow: 0 8px 32px rgba(25, 118, 210, 0.12);
    -webkit-transform: translateY(-3px);
    transform: translateY(-3px);
}

.exam-card .exam-name {
    font-size: 18px;
    font-weight: 500;
    color: #1976d2;
    margin-bottom: 8px;
    display: -webkit-flex;
    display: flex;
    -webkit-align-items: center;
    align-items: center;
    gap: 8px;
}

.exam-card .exam-meta {
    color: #555;
    font-size: 14px;
    margin-bottom: 4px;
    display: -webkit-flex;
    display: flex;
    -webkit-align-items: center;
    align-items: center;
    gap: 6px;
}

.exam-card .exam-meta .material-icons {
    font-size: 16px;
    color: #888;
}

.exam-card .exam-subjects {
    margin-top: 12px;
    font-size: 13px;
    color: #666;
}

.exam-card .exam-subjects span {
    display: inline-block;
    background: #e3f0fc;
    color: #1976d2;
    padding: 2px 10px;
    border-radius: 10px;
    margin: 2px 4px 2px 0;
}

.exam-card .exam-footer {
    margin-top: auto;
    padding-top: 16px;
    display: -webkit-flex;
    display: flex;
    gap: 8px;
}

.exam-card .enter-btn {
    background: #1976d2;
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 8px 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: -webkit-inline-flex;
    display: inline-flex;
    -webkit-align-items: center;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    transition: background 0.2s ease, box-shadow 0.2s ease;
}

.exam-card .enter-btn:hover {
    background: #1565c0;
    box-shadow: 0 2px 8px rgba(25, 118, 210, 0.2);
}

.empty-public {
    text-align: center;
    color: #999;
    padding: 40px 0;
    font-size: 15px;
}

.empty-public .material-icons {
    font-size: 48px;
    color: #ccc;
    margin-bottom: 12px;
}

/* === JSON 预览 === */
.json-preview-wrap {
    margin-bottom: 24px;
    display: none;
}

.json-preview-title {
    font-size: 17px;
    color: #1976d2;
    margin-bottom: 8px;
}

pre code.hljs {
    font-size: 14px;
    border-radius: 10px;
}

.show-btn {
    margin-top: 12px;
    width: 100%;
}

/* === 页脚 === */
.footer {
    text-align: center;
    color: #888;
    margin-top: 40px;
    padding: 10px 0;
    font-size: 14px;
}

/* === 全局选中颜色 === */
::-moz-selection {
    background: rgba(25, 118, 210, 0.2);
}

::selection {
    background: rgba(25, 118, 210, 0.2);
}

/* === 响应式 === */
@media (max-width: 1200px) {
    .container {
        max-width: 99vw;
        padding: 0 12px;
    }
    .container-md {
        max-width: 99vw;
        padding: 0 12px;
    }
}

@media (max-width: 900px) {
    .container {
        margin: 20px auto;
    }
    .container-sm {
        margin: 20px auto;
    }
    .container-md {
        margin: 20px auto;
    }
    .navbar {
        padding: 12px 16px;
        -webkit-flex-wrap: wrap;
        flex-wrap: wrap;
        gap: 8px;
    }
    .user-info {
        margin-left: 0;
        width: 100%;
        -webkit-order: 3;
        order: 3;
    }
    .logout {
        margin-left: auto;
    }
    .card-list {
        gap: 20px;
    }
    .md2-card,
    .add-card {
        min-width: auto;
        width: 100%;
    }
    .exam-grid {
        grid-template-columns: 1fr;
    }
    table {
        font-size: 13px;
    }
    th, td {
        padding: 8px;
    }
}

@media (max-width: 640px) {
    .search-section {
        margin: 0 0 32px 0;
    }
    .md2-card {
        padding: 24px 20px;
    }
    .container {
        margin: 12px auto;
    }
    .home-btn {
        margin-left: 12px;
        padding: 6px 14px;
        font-size: 14px;
    }
}
