/* ============================================================
   基础样式 & 布局
   ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 24px 20px;
    -moz-osx-font-smoothing: grayscale;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    font-family: Helvetica Neue,Helvetica,PingFang SC,Hiragino Sans GB,Microsoft YaHei,Arial,sans-serif

}
.container {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    width: 100%;
    max-width: 640px;
    overflow: hidden;
    margin: 20px 0;
}

/* 头部 */
.header {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: #fff;
    padding: 24px 24px 20px;
    text-align: center;
    position: relative;
}
.header h1 { font-size: 20px; font-weight: 600; }
.header p { font-size: 13px; opacity: 0.8; margin-top: 4px; }
.btn-logout {
    position: absolute; top: 16px; right: 16px;
    background: rgba(255,255,255,0.2); color: #fff;
    border: 1px solid rgba(255,255,255,0.4);
    padding: 6px 14px; border-radius: 8px;
    font-size: 12px; cursor: pointer; transition: all 0.2s;
}
.btn-logout:hover { background: rgba(255,255,255,0.35); }
.body { padding: 20px 24px 24px; }

/* ============================================================
   表单元素
   ============================================================ */
.step-label { font-size: 13px; color: #6b7280; margin-bottom: 6px; font-weight: 500; }
.input-group { display: flex; gap: 10px; margin-bottom: 14px; }
.input-group input { flex: 1; }
input {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s;
}
input:focus { border-color: #4f46e5; }
button {
    padding: 10px 16px;
    border: none;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
button:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-primary  { background: #4f46e5; color: #fff; }
.btn-primary:hover:not(:disabled)  { background: #4338ca; }
.btn-outline  { background: #fff; color: #4f46e5; border: 1.5px solid #4f46e5; }
.btn-outline:hover:not(:disabled)  { background: #f5f3ff; }
.btn-success  { background: #16a34a; color: #fff; }
.btn-success:hover:not(:disabled)  { background: #15803d; }
.btn-small { padding: 5px 10px; font-size: 12px; border-radius: 6px; }
.btn-full { width: 100%; margin-top: 8px; }

/* 图片验证码 */
.captcha-row {
    display: flex; gap: 10px; align-items: center; margin-bottom: 14px;
}
.captcha-img {
    height: 42px; border: 1.5px solid #e5e7eb; border-radius: 8px;
    cursor: pointer; flex-shrink: 0;
}
.captcha-img:hover { border-color: #4f46e5; opacity: 0.85; }

/* ============================================================
   Toast 消息提示（固定悬浮右上角）
   ============================================================ */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    max-width: 380px;
    padding: 12px 18px;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.5;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    pointer-events: none;
    opacity: 0;
    transform: translateX(40px);
    transition: opacity 0.3s, transform 0.3s;
}
.toast.error  { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; opacity: 1; transform: translateX(0); }
.toast.success { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; opacity: 1; transform: translateX(0); }
.toast.info   { background: #eff6ff; color: #2563eb; border: 1px solid #bfdbfe; opacity: 1; transform: translateX(0); }

/* ============================================================
   主导航 Tab（登录后显示）
   ============================================================ */
.main-tabs {
    display: flex; gap: 0; margin-bottom: 16px;
    border-bottom: 2px solid #e5e7eb;
}
.main-tab {
    flex: 1;
    padding: 10px 0;
    font-size: 14px;
    text-align: center;
    cursor: pointer;
    color: #6b7280;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
    user-select: none;
}
.main-tab:hover { color: #4f46e5; }
.main-tab.active {
    color: #4f46e5;
    border-bottom-color: #4f46e5;
    font-weight: 600;
}

/* Tab 面板 */
.tab-panel { display: none; }
.tab-panel.show { display: block; }

/* ============================================================
   信息卡片
   ============================================================ */
.info-card {
    background: #f9fafb;
    border-radius: 12px;
    padding: 18px;
    margin-top: 12px;
}
.info-card h3 {
    font-size: 14px; color: #6b7280; margin-bottom: 12px; font-weight: 500;
}
.info-row {
    display: flex;
    justify-content: space-between;
    padding: 7px 0;
    border-bottom: 1px solid #f3f4f6;
    font-size: 14px;
}
.info-row:last-child { border-bottom: none; }
.info-label { color: #6b7280; flex-shrink: 0; }
.info-value { color: #111827; font-weight: 500; text-align: right; word-break: break-all; }

/* 基本信息页提示语 */
.info-tip { margin-top: 12px; padding-top: 10px; border-top: 1px solid #f3f4f6; font-size: 12px; color: #9ca3af; line-height: 1.6; }
.info-tip a { color: #4f46e5; text-decoration: none; word-break: break-all; }
.info-tip a:hover { text-decoration: underline; }

/* ============================================================
   周期切换 Tab（学时 & 项目共用）
   ============================================================ */
.cycle-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.cycle-tab {
    flex: 1;
    padding: 7px 0;
    font-size: 12px;
    text-align: center;
    border-radius: 8px;
    background: #f3f4f6;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
    border: 1.5px solid transparent;
    user-select: none;
}
.cycle-tab.active {
    background: #ede9fe;
    color: #4f46e5;
    border-color: #4f46e5;
    font-weight: 600;
}

/* ============================================================
   学时统计
   ============================================================ */
.hours-total { text-align: center; padding: 4px 0 2px; }
.hours-total .num { font-size: 28px; font-weight: 700; color: #4f46e5; }
.hours-total .unit { font-size: 13px; color: #6b7280; margin-left: 2px; }
.hours-year-table { width: 100%; border-collapse: collapse; margin-top: 4px; }
.hours-year-table th, .hours-year-table td {
    padding: 4px 3px; text-align: center; font-size: 12px;
    border-bottom: 1px solid #f3f4f6;
}
.hours-year-table th { color: #6b7280; font-weight: 500; font-size: 11px; white-space: nowrap; }
.hours-year-table td { color: #374151; }
.hours-year-table .highlight td { background: #f5f3ff; }

/* ============================================================
   证书卡片
   ============================================================ */
.cert-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.cert-card-body { margin-bottom: 10px; }
.cert-card-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 5px 0;
    border-bottom: 1px solid #f9fafb;
    font-size: 13px;
}
.cert-card-row:last-child { border-bottom: none; }
.cert-card-label { color: #6b7280; flex-shrink: 0; font-size: 12px; }
.cert-card-value { color: #111827; font-weight: 500; text-align: right; }
.cert-card-hours { color: #4f46e5; font-weight: 700; font-size: 16px; }
.cert-card-action { text-align: center; }
.cert-pending { color: #f59e0b; font-size: 12px; background: #fffbeb; padding: 5px 12px; border-radius: 6px; }

/* ============================================================
   项目卡片
   ============================================================ */
.project-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.project-card-title {
    font-size: 13px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 8px;
    line-height: 1.4;
}
.project-card-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 12px;
}
.project-card-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    padding: 3px 0;
}
.project-card-label { color: #6b7280; flex-shrink: 0; font-size: 11px; }
.project-card-value { color: #111827; font-weight: 500; text-align: right; }
.project-card-hours { color: #4f46e5; font-weight: 700; font-size: 15px; }
.project-card-action { text-align: center; margin-top: 6px; }

/* 保留旧表格样式以防其他页面使用 */
.project-table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.project-table th, .project-table td {
    padding: 8px 6px; text-align: left; font-size: 13px;
    border-bottom: 1px solid #f3f4f6;
}
.project-table th { color: #6b7280; font-weight: 500; font-size: 12px; white-space: nowrap; }
.project-table td { color: #374151; }

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.6;
}
.badge-has-cert { background: #dcfce7; color: #16a34a; }
.badge-no-cert { background: #f3f4f6; color: #9ca3af; }
.badge-reject { background: #fef2f2; color: #dc2626; }

.pagination {
    display: flex; justify-content: center; align-items: center;
    gap: 8px; margin-top: 12px; font-size: 13px; color: #6b7280;
}
.pagination button { padding: 6px 12px; }
.project-count { font-size: 13px; color: #6b7280; margin-bottom: 8px; }

/* ============================================================
   加载动画
   ============================================================ */
.spinner {
    display: inline-block;
    width: 16px; height: 16px;
    border: 2px solid #e5e7eb;
    border-top-color: #4f46e5;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    vertical-align: middle;
    margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { color: #6b7280; font-size: 13px; text-align: center; padding: 16px 0; }

/* 下载中状态 */
.btn-downloading { background: #f59e0b !important; color: #fff !important; }

/* 登录页二维码 */
.qrcode-box { text-align: center; margin-top: 20px; padding-top: 16px; border-top: 1px solid #e5e7eb; }
.qrcode-img { width: 120px; height: 120px; border-radius: 8px; border: 1px solid #e5e7eb; }
.qrcode-text { color: #9ca3af; font-size: 12px; margin-top: 6px; }

/* 学时不足时显示的二维码 */
.hours-qrcode-box { text-align: center; margin-top: 12px; padding: 16px; background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; }
.hours-qrcode-box .qrcode-img { width: 140px; height: 140px; }
.hours-qrcode-box .qrcode-text { color: #4f46e5; font-size: 13px; font-weight: 500; margin-top: 8px; }

/* 登录按钮优化：验证码只有 6 位，输入框不需要太大，登录按钮要宽一些 */
.input-group-login { gap: 8px; }
.input-group-login input { flex: 0 0 45%; min-width: 100px; }
.btn-login { flex: 1; min-width: 80px; font-size: 15px; font-weight: 600; padding: 11px 20px; }

/* 驳回状态按钮 */
.btn-danger { background: #dc2626; color: #fff; font-weight: 700; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; }

/* ============================================================
   证书打印页样式
   ============================================================ */
.cert-print-body {
    background: #fff;
    padding: 40px;
    font-family: "SimSun", "宋体", serif;
}
.cert-print-body .cert-content {
    max-width: 800px;
    margin: 0 auto;
    border: 2px solid #c00;
    padding: 40px;
    position: relative;
}
.cert-print-body .cert-title {
    text-align: center;
    font-size: 24px;
    font-weight: bold;
    color: #c00;
    margin-bottom: 30px;
    letter-spacing: 4px;
}
.cert-print-body .cert-body {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    margin-bottom: 24px;
}
.cert-print-body .cert-text {
    flex: 1;
    font-size: 16px;
    line-height: 2;
    text-indent: 2em;
}
.cert-print-body .cert-photo {
    width: 120px;
    height: 160px;
    object-fit: cover;
    border: 1px solid #ccc;
}
.cert-print-body .cert-footer {
    text-align: center;
    margin-top: 30px;
    position: relative;
}
.cert-print-body .cert-stamp {
    width: 120px;
    opacity: 0.8;
}
.cert-print-body .cert-number {
    font-size: 14px;
    margin: 8px 0;
    color: #333;
}
.cert-print-body .cert-org {
    font-size: 15px;
    margin-top: 10px;
    font-weight: bold;
}
.cert-print-body .cert-date {
    font-size: 14px;
    margin-top: 6px;
    color: #555;
}
.cert-print-body .btn-print-area {
    text-align: center;
    margin-top: 24px;
}
/* ============================================================
   移动端适配
   ============================================================ */
@media screen and (max-width: 480px) {
    body {
        padding: 0;
        align-items: flex-start;
    }
    .container {
        border-radius: 0;
        margin: 0;
        max-width: 100%;
    }
    .header {
        padding: 16px 12px 14px;
    }
    .header h1 { font-size: 17px; }
    .header p { font-size: 12px; }
    .btn-logout { top: 10px; right: 8px; padding: 4px 10px; font-size: 11px; }
    .body { padding: 12px 10px 16px; }

    /* 主 Tab 缩小字号 */
    .main-tab { font-size: 12px; padding: 8px 0; }

    /* 信息卡片 */
    .info-card { padding: 12px 10px; }
    .info-card h3 { font-size: 13px; margin-bottom: 8px; }
    .info-row { font-size: 13px; padding: 6px 0; }
    .info-label { flex-shrink: 0; font-size: 12px; }
    .info-value { font-size: 13px; }

    /* 周期切换 */
    .cycle-tab { font-size: 11px; padding: 6px 0; }

    /* 学时统计 */
    .hours-total .num { font-size: 24px; }
    .hours-year-table th, .hours-year-table td { font-size: 10px; padding: 3px 1px; }

    /* 表格容器 - 横向滚动 */
    #hoursContent {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .hours-year-table { min-width: 300px; }

    /* 分页 */
    .pagination { gap: 4px; font-size: 12px; }
    .pagination button { padding: 5px 8px; font-size: 11px; }

    /* 输入框 */
    input { font-size: 14px; padding: 10px 12px; }
    button { font-size: 12px; padding: 8px 12px; }
    .input-group { gap: 6px; }

    /* 按钮 */
    .btn-full { margin-top: 10px; }

    /* 图片验证码移动端 */
    .captcha-row { gap: 6px; }
    .captcha-img { height: 38px; }

    /* Toast */
    .toast { top: 10px; right: 10px; max-width: 280px; font-size: 11px; padding: 8px 12px; }

    /* 登录页移动端适配 */
    .input-group-login { gap: 6px; }
    .input-group-login input { flex: 0 0 40%; min-width: 90px; font-size: 14px; }
    .btn-login { flex: 1; min-width: 70px; font-size: 14px; padding: 11px 8px; }

    /* 二维码 */
    .qrcode-img { width: 100px; height: 100px; }
    .hours-qrcode-box .qrcode-img { width: 120px; height: 120px; }
    .hours-qrcode-box { padding: 12px; }
    .hours-qrcode-box .qrcode-text { font-size: 12px; }
}

@media print {
    .cert-print-body { padding: 0; }
    .btn-print-area { display: none; }
}

/* 免责声明 */
.disclaimer {
    padding: 12px 16px;
    margin: 0 16px 16px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 3px solid #adb5bd;
}
.disclaimer p {
    font-size: 12px;
    color: #6c757d;
    line-height: 1.6;
    margin: 0;
}
.disclaimer a {
    color: #667eea;
    text-decoration: none;
}
.disclaimer a:hover {
    text-decoration: underline;
}
