/* ============================================================
   课程打卡系统 - 全局样式
   配色：蓝白为主，橙色点缀
   字体：微软雅黑
   ============================================================ */

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

body {
    font-family: "Microsoft YaHei", "微软雅黑", sans-serif;
    background: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

/* ========== 导航栏（默认折叠，鼠标悬停展开） ========== */
.navbar {
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    position: sticky;
    top: 0;
    z-index: 100;
    height: 6px;              /* 默认只留 6px 感应条 */
    overflow: hidden;
    transition: height 0.25s ease, box-shadow 0.25s ease;
    border-bottom: 1px solid transparent;
}
/* 默认顶部留一条很淡的提示，用户鼠标一扫就能发现 */
.navbar::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 6px;
    background: repeating-linear-gradient(
        45deg,
        rgba(26, 115, 232, 0.12),
        rgba(26, 115, 232, 0.12) 6px,
        rgba(255, 255, 255, 0) 6px,
        rgba(255, 255, 255, 0) 12px
    );
    transition: background 0.2s ease;
}
.navbar:hover {
    height: 60px;             /* 展开到正常高度 */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
    border-bottom: 1px solid #e8f0fe;
    overflow: visible;
}
.navbar:hover::before {
    background: #1a73e8;      /* 鼠标展开后顶部变蓝色实线 */
}
/* 为折叠/展开补偿：避免导航占位跳动造成内容抖一下 */
body {
    padding-top: 6px;
}
.navbar:hover + * + main.container,  /* header之后紧跟 main（中间没其它元素时） */
body > main.container {
    transition: transform 0.25s ease;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}

.nav-brand {
    font-size: 20px;
    font-weight: bold;
    color: #1a73e8;
}

.nav-menu {
    display: flex;
    gap: 8px;
}

.nav-link {
    padding: 8px 16px;
    color: #555;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.2s;
}

.nav-link:hover {
    background: #e8f0fe;
    color: #1a73e8;
}

.nav-link.active {
    background: #1a73e8;
    color: #fff;
}

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

/* ========== 页面标题 ========== */
.page-title {
    font-size: 24px;
    color: #1a73e8;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e8f0fe;
}

.section-title {
    font-size: 18px;
    color: #333;
    margin: 20px 0 12px;
}

/* ========== 表格 ========== */
.table-wrapper {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 12px 16px;
    text-align: center;
    border-bottom: 1px solid #eee;
}

th {
    background: #f8f9fa;
    color: #555;
    font-weight: 600;
    white-space: nowrap;
}

tr:hover {
    background: #f8fbff;
}

/* 已打卡整列高亮（行列倒置版：<th class="col-checked"> 带上此 class，整列 via col-date 选择器无法直接实现，改用 JS 或 CSS 规则） */
#recordTable tbody td {
    position: relative;
}

/* ===== 行列倒置表格专用样式 ===== */
#recordTable th.row-header,
#recordTable td.row-header {
    position: sticky;
    left: 0;
    background: #f8f9fa;
    z-index: 2;
    border-right: 2px solid #e5e7eb;
    white-space: nowrap;
    text-align: left;
    padding: 12px 14px;
    font-weight: 600;
    color: #555;
}
#recordTable thead th.row-header {
    z-index: 4;
    background: #f0f3f7;
}
#recordTable thead th.col-date {
    min-width: 140px;
    position: sticky;
    top: 0;
    z-index: 3;
    padding: 10px 8px;
}
#recordTable thead th.col-date .th-date {
    font-weight: 700;
    color: #1a73e8;
    font-size: 14px;
    letter-spacing: 0.5px;
}
#recordTable thead th.col-date.col-today {
    background: #fff3e0;
}
#recordTable thead th.col-date.col-today .th-date {
    color: #e65100;
}
#recordTable thead th.col-date.col-checked {
    background: #e8f5e9;
}
#recordTable thead th.col-date.col-checked .th-date::after {
    content: " ✓";
    color: #2e7d32;
    font-weight: bold;
}

/* 列与列分割线 */
#recordTable th,
#recordTable td {
    border-right: 1px solid #e5e7eb;
}
#recordTable th:last-child,
#recordTable td:last-child {
    border-right: none;
}

/* 今日单元格底色（行列倒置版：每列通过 [data-date="今日日期"] 统一选中） */
#recordTable tbody td.cell-today {
    background: #fff8e6;
}

/* 已打卡列：整列浅绿（通过 col-checked 的列索引无法纯CSS，这里用 data-status=1 的 td） */
#recordTable tbody td[data-status="1"] {
    background: #f0f9eb;
}

/* 手机端：列最小宽度进一步压缩，避免横向滚动太宽 */
@media (max-width: 576px) {
    #recordTable thead th.col-date {
        min-width: 96px;
        padding: 8px 4px;
    }
    #recordTable thead th.col-date .th-date {
        font-size: 12px;
    }
    #recordTable th.row-header {
        padding: 8px 10px;
        font-size: 13px;
    }
    #recordTable tbody td {
        padding: 6px 4px;
    }
    #recordTable tbody td select.course-select {
        max-width: 100%;
        width: 100%;
    }
    #recordTable .course-text.course-chip {
        padding: 3px 8px;
        font-size: 12px;
        min-width: 36px;
    }
}

/* ========== 按钮 ========== */
.btn {
    display: inline-block;
    padding: 8px 18px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    min-height: 36px;
    line-height: 1.4;
    transition: all 0.2s;
    text-decoration: none;
    white-space: nowrap;
    vertical-align: middle;
}

.btn-primary {
    background: #1a73e8;
    color: #fff;
}

.btn-primary:hover {
    background: #1557b0;
}

.btn-warning {
    background: #ff9800;
    color: #fff;
}

.btn-warning:hover {
    background: #e68a00;
}

.btn-danger {
    background: #e74c3c;
    color: #fff;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-success {
    background: #4caf50;
    color: #fff;
}

.btn-success:hover {
    background: #3d8b40;
}

.btn-default {
    background: #f5f5f5;
    color: #333;
    border: 1px solid #ddd;
}

.btn-default:hover {
    background: #e8e8e8;
}

.btn-sm {
    padding: 5px 12px;
    font-size: 13px;
    min-height: 30px;
}

/* ========== 表单 ========== */
.form-inline {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding: 16px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.form-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

label {
    color: #555;
    font-size: 14px;
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="password"],
select {
    padding: 7px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    min-height: 34px;
    font-family: inherit;
    background: #fff;
    color: #333;
    transition: border-color 0.2s, box-shadow 0.2s;
    vertical-align: middle;
}

input:focus,
select:focus {
    border-color: #1a73e8;
    outline: none;
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.12);
}

input[type="text"].edit-input,
input[type="number"].edit-input {
    width: 100%;
    max-width: 140px;
}

select.course-select {
    min-width: 80px;
}

/* ========== 课程颜色相关 ========== */
/* 下拉框 option 颜色（大部分浏览器支持 option[style]） */
select option {
    padding: 4px 8px;
    background: #fff;
}

/* 已打卡的胶囊色块 */
.course-text.course-chip {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: 13px;
    color: #333;
    min-width: 48px;
    text-align: center;
}

/* 空值"-"不显示色块感 */
.course-text.course-chip:empty,
.course-text.course-chip:only-child(:contains("-")) {
    background: transparent !important;
    border-color: transparent !important;
    color: #999;
}

/* 表格内的输入框 */
td input[type="text"],
td input[type="number"],
td select {
    width: 100%;
    max-width: 150px;
}

/* ========== 状态标签 ========== */
.tag {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
}

.tag-success {
    background: #e8f5e9;
    color: #2e7d32;
}

.tag-warning {
    background: #fff3e0;
    color: #e65100;
}

.tag-default {
    background: #f0f0f0;
    color: #666;
}

/* ========== 提示信息 ========== */
.alert {
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 16px;
}

.alert-info {
    background: #e8f0fe;
    color: #1a73e8;
}

.alert-success {
    background: #e8f5e9;
    color: #2e7d32;
}

.alert-warning {
    background: #fff3e0;
    color: #e65100;
}

/* ========== 统计卡片 ========== */
.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    text-align: center;
}

.stat-card .stat-value {
    font-size: 32px;
    font-weight: bold;
    color: #1a73e8;
    margin: 8px 0;
}

.stat-card .stat-label {
    color: #888;
    font-size: 14px;
}

/* ========== 工具栏 ========== */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 10px;
}

/* ========== 页脚 ========== */
.footer {
    text-align: center;
    padding: 20px;
    color: #999;
    font-size: 13px;
}

.footer .beian {
    margin-top: 6px;
}

.footer .beian a {
    color: #999;
    text-decoration: none;
}

.footer .beian a:hover {
    color: #1976D2;
    text-decoration: underline;
}

.footer .beian .beian-sep {
    margin: 0 6px;
    color: #ccc;
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
    .navbar {
        height: 5px;
    }
    .navbar::before {
        height: 5px;
    }
    .navbar:hover {
        height: auto;
    }
    body {
        padding-top: 5px;
    }
    .nav-container {
        flex-direction: column;
        height: auto;
        padding: 10px;
    }
    .nav-brand {
        margin-bottom: 8px;
    }
    .nav-menu {
        flex-wrap: wrap;
        justify-content: center;
    }
    .container {
        padding: 0 10px;
        margin: 16px auto;
    }
    .page-title {
        font-size: 20px;
        margin-bottom: 14px;
    }
    th, td {
        padding: 8px 6px;
        font-size: 13px;
    }

    /* 手机端查询栏：form-group 占满整行；后面紧跟的按钮自动排成两列等宽共一行 */
    .form-inline {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        align-items: center;
        padding: 12px;
    }
    .form-inline .form-group {
        grid-column: 1 / -1; /* 跨两列，独占一行 */
        width: 100%;
    }
    .form-inline .btn {
        width: 100%;
        grid-column: span 1;
    }

    .form-group {
        width: 100%;
        justify-content: space-between;
    }
    .form-group label {
        min-width: 64px;
    }
    .form-group input,
    .form-group select {
        flex: 1;
        min-width: 0;
    }
    .btn {
        min-height: 40px;
        padding: 8px 14px;
    }
    input[type="text"],
    input[type="number"],
    input[type="date"],
    input[type="password"],
    select {
        min-height: 38px;
    }
}

@media (max-width: 576px) {
    /* 手机端：表格内容紧凑 + 操作列不换行 */
    th, td {
        padding: 6px 4px;
        font-size: 12px;
    }
    td select.course-select,
    td input.edit-input {
        max-width: 100%;
        width: 100%;
    }
    .course-text.course-chip {
        padding: 3px 8px;
        font-size: 12px;
        min-width: 36px;
    }
    .nav-link {
        padding: 6px 10px;
        font-size: 13px;
    }
    .btn,
    .btn-sm {
        font-size: 13px;
        padding: 6px 10px;
        min-height: 36px;
    }
    .table-wrapper {
        border-radius: 6px;
    }
}
