/* ============================================================
   班主任管理平台 - 全局样式表 v3
   所有样式本地化，禁止调用外部CSS/JS/字体
   ============================================================ */

/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
    color: #333; background: #f5f7fa; line-height: 1.6; min-height: 100vh;
    display: flex; flex-direction: column;
}
a { color: #4a6cf7; text-decoration: none; }
a:hover { color: #3a5ce5; }
img { max-width: 100%; height: auto; }
ul, ol { list-style: none; }
input, button, textarea, select { font-family: inherit; font-size: inherit; }

/* Layout */
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; width: 100%; }
.container-fluid { width: 100%; padding: 0; }
.container-sm { max-width: 480px; margin: 0 auto; padding: 0 20px; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-10 { gap: 10px; }
.gap-15 { gap: 15px; }
.gap-20 { gap: 20px; }

/* ==================== Header ==================== */
.header {
    background: #fff; border-bottom: 1px solid #e8ecf1;
    padding: 0 24px; height: 56px; display: flex; align-items: center;
    justify-content: space-between; position: sticky; top: 0; z-index: 100;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.header-logo { display: flex; align-items: center; }
.header-logo img { height: 36px; width: auto; }
.header-logo h1 { font-size: 18px; font-weight: 700; color: #333; white-space: nowrap; }
.header-nav { display: flex; align-items: center; gap: 4px; }
.header-nav a {
    padding: 8px 14px; border-radius: 6px; font-size: 14px; color: #555;
    transition: all 0.2s; white-space: nowrap;
}
.header-nav a:hover { background: #f0f3ff; color: #4a6cf7; }
.header-nav a.active { background: #4a6cf7; color: #fff; }

/* 个人中心下拉菜单 */
.nav-dropdown { position: relative; }
.nav-dropdown-toggle {
    padding: 8px 14px; border-radius: 6px; font-size: 14px; color: #555;
    cursor: pointer; transition: all 0.2s; display: flex; align-items: center; gap: 4px;
    background: none; border: none; white-space: nowrap;
}
.nav-dropdown-toggle:hover { background: #f0f3ff; color: #4a6cf7; }
.nav-dropdown-toggle .arrow { font-size: 10px; transition: transform 0.2s; }
.nav-dropdown:hover .nav-dropdown-toggle .arrow { transform: rotate(180deg); }
.nav-dropdown-menu {
    position: absolute; top: 100%; right: 0; margin-top: 4px;
    background: #fff; border-radius: 10px; box-shadow: 0 6px 24px rgba(0,0,0,0.12);
    min-width: 160px; padding: 6px 0; opacity: 0; visibility: hidden;
    transform: translateY(-8px); transition: all 0.2s; z-index: 200;
}
.nav-dropdown:hover .nav-dropdown-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.nav-dropdown-menu a {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 16px; font-size: 14px; color: #555; border-radius: 0;
    transition: all 0.15s;
}
.nav-dropdown-menu a:hover { background: #f5f7fa; color: #4a6cf7; }
.nav-dropdown-menu a.danger { color: #f56c6c; }
.nav-dropdown-menu a.danger:hover { background: #fef0f0; }
.nav-dropdown-menu .divider { height: 1px; background: #f0f0f0; margin: 4px 0; }

/* 移动端菜单按钮 */
.mobile-menu-btn { display: none; background: none; border: none; font-size: 22px; cursor: pointer; padding: 4px 8px; color: #555; }

/* ==================== Banner ==================== */
.banner-section {
    width: 100%; position: relative; overflow: hidden;
    background: linear-gradient(135deg, #4a6cf7 0%, #6c5ce7 50%, #a855f7 100%);
}
.banner-bg {
    width: 100%; height: 100%; object-fit: cover; position: absolute; top: 0; left: 0;
}
.banner-overlay {
    position: relative; z-index: 1; padding: 50px 24px; text-align: center; color: #fff;
}
.banner-overlay h2 { font-size: 28px; font-weight: 700; margin-bottom: 8px; text-shadow: 0 2px 8px rgba(0,0,0,0.2); }
.banner-overlay p { font-size: 15px; opacity: 0.9; text-shadow: 0 1px 4px rgba(0,0,0,0.15); }

/* ==================== Category Nav ==================== */
.category-nav {
    background: #fff; border-bottom: 1px solid #f0f0f0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.category-nav .container {
    display: flex; align-items: stretch; overflow-x: auto;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.category-nav .container::-webkit-scrollbar { display: none; }
.nav-item {
    padding: 14px 24px; font-size: 15px; color: #666; white-space: nowrap;
    border-bottom: 2px solid transparent; transition: all 0.2s; cursor: pointer;
    text-align: center; flex: 1; min-width: 80px;
}
.nav-item:hover { color: #4a6cf7; background: #fafbff; }
.nav-item.active { color: #4a6cf7; border-bottom-color: #4a6cf7; font-weight: 600; }

/* ==================== Tool Grid ==================== */
.tool-section { padding: 24px 0; flex: 1; }
.tool-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}
.tool-card {
    background: #fff; border-radius: 12px; overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04); transition: all 0.25s;
    border: 1px solid #f0f0f0;
}
.tool-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,0.1); }
.tool-thumb { height: 140px; background: linear-gradient(135deg, #667eea, #764ba2); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.tool-thumb img { width: 100%; height: 100%; object-fit: cover; }
.tool-thumb-placeholder { font-size: 36px; color: #fff; font-weight: 700; }
.tool-info { padding: 14px 16px; }
.tool-name { font-size: 15px; font-weight: 600; margin-bottom: 4px; color: #333; }
.tool-desc { font-size: 13px; color: #999; margin-bottom: 10px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tool-meta { display: flex; align-items: center; justify-content: space-between; }
.tool-price { font-size: 16px; font-weight: 700; color: #f56c6c; }
.tool-price.free { color: #67c23a; }
.tool-actions { display: flex; gap: 6px; }

/* ==================== User Center Layout ==================== */
.uc-layout {
    display: flex; min-height: calc(100vh - 56px - 80px); flex: 1;
}
.uc-sidebar {
    width: 220px; background: #fff; border-right: 1px solid #f0f0f0;
    padding: 24px 0; flex-shrink: 0;
}
.uc-avatar-area { text-align: center; padding: 0 20px 20px; border-bottom: 1px solid #f0f0f0; margin-bottom: 8px; }
.uc-avatar {
    width: 56px; height: 56px; border-radius: 50%; background: linear-gradient(135deg, #4a6cf7, #6c5ce7);
    color: #fff; display: inline-flex; align-items: center; justify-content: center;
    font-size: 22px; font-weight: 600;
}
.uc-avatar-area .name { margin-top: 8px; font-weight: 600; font-size: 15px; }
.uc-avatar-area .vip-badge { display: inline-block; margin-top: 4px; padding: 2px 10px; border-radius: 10px; font-size: 12px; background: linear-gradient(135deg, #f7b733, #fc4a1a); color: #fff; }
.uc-menu-item {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 24px; font-size: 14px; color: #666;
    transition: all 0.15s; border-left: 3px solid transparent;
}
.uc-menu-item:hover { background: #fafbff; color: #4a6cf7; }
.uc-menu-item.active { background: #f0f3ff; color: #4a6cf7; border-left-color: #4a6cf7; font-weight: 600; }
.uc-menu-item .icon { font-size: 16px; width: 20px; text-align: center; }

.uc-main { flex: 1; padding: 24px 32px; min-width: 0; background: #f5f7fa; }
.uc-card {
    background: #fff; border-radius: 12px; padding: 24px 28px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04); margin-bottom: 20px;
    border: 1px solid #f0f0f0;
}
.uc-card-title { font-size: 17px; font-weight: 600; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid #f5f5f5; }

/* ==================== VIP Card ==================== */
.vip-card {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    border-radius: 14px; padding: 28px; color: #fff; position: relative; overflow: hidden;
}
.vip-card::before {
    content: ''; position: absolute; top: -30px; right: -30px;
    width: 120px; height: 120px; border-radius: 50%;
    background: rgba(247,183,51,0.15);
}
.vip-card::after {
    content: ''; position: absolute; bottom: -40px; left: -20px;
    width: 100px; height: 100px; border-radius: 50%;
    background: rgba(247,183,51,0.1);
}
.vip-card .vip-label { font-size: 13px; opacity: 0.8; margin-bottom: 4px; }
.vip-card .vip-status { font-size: 20px; font-weight: 700; margin-bottom: 12px; }
.vip-card .vip-price { font-size: 36px; font-weight: 800; }
.vip-card .vip-price small { font-size: 16px; font-weight: 400; opacity: 0.8; }
.vip-card .vip-desc { font-size: 13px; opacity: 0.7; margin-top: 8px; }
.vip-card .vip-btn {
    display: inline-block; margin-top: 16px; padding: 10px 28px;
    background: linear-gradient(135deg, #f7b733, #fc4a1a); color: #fff;
    border: none; border-radius: 8px; font-size: 15px; font-weight: 600;
    cursor: pointer; transition: opacity 0.2s;
}
.vip-card .vip-btn:hover { opacity: 0.9; }

/* ==================== My Tools Grid ==================== */
.my-tool-list { display: flex; flex-direction: column; gap: 12px; }
.my-tool-item {
    display: flex; align-items: center; gap: 16px; padding: 16px 20px;
    background: #fafbfc; border-radius: 10px; border: 1px solid #f0f0f0;
    transition: all 0.2s;
}
.my-tool-item:hover { background: #f0f3ff; border-color: #dce2f7; }
.my-tool-icon {
    width: 48px; height: 48px; border-radius: 10px;
    background: linear-gradient(135deg, #4a6cf7, #6c5ce7);
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-size: 18px; font-weight: 700; flex-shrink: 0;
}
.my-tool-info { flex: 1; min-width: 0; }
.my-tool-info h4 { font-size: 15px; font-weight: 600; margin-bottom: 2px; }
.my-tool-info p { font-size: 13px; color: #999; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.my-tool-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ==================== Footer ==================== */
.site-footer {
    background: #2c3e50; color: rgba(255,255,255,0.7); padding: 20px 0;
    text-align: center; font-size: 13px; margin-top: auto;
}
.footer-inner { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.footer-copyright { margin-bottom: 4px; }
.footer-icp a { color: rgba(255,255,255,0.5); transition: color 0.2s; }
.footer-icp a:hover { color: rgba(255,255,255,0.8); }

/* ==================== Buttons ==================== */
.btn { display: inline-block; padding: 8px 18px; border: none; border-radius: 8px; font-size: 14px; cursor: pointer; transition: all 0.2s; text-align: center; line-height: 1.5; }
.btn:hover { opacity: 0.85; }
.btn-primary { background: #4a6cf7; color: #fff; }
.btn-success { background: #67c23a; color: #fff; }
.btn-danger { background: #f56c6c; color: #fff; }
.btn-warning { background: #e6a23c; color: #fff; }
.btn-outline { background: #fff; color: #4a6cf7; border: 1px solid #4a6cf7; }
.btn-sm { padding: 5px 12px; font-size: 13px; border-radius: 6px; }
.btn-lg { padding: 12px 28px; font-size: 16px; }
.btn-block { display: block; width: 100%; }

/* ==================== Forms ==================== */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 500; color: #555; }
.form-group label.required::after { content: ' *'; color: #f56c6c; }
.form-control {
    width: 100%; padding: 10px 14px; border: 1px solid #dcdfe6; border-radius: 8px;
    font-size: 14px; transition: border-color 0.2s; background: #fff;
    line-height: 1.5;
}
.form-control:focus { outline: none; border-color: #4a6cf7; box-shadow: 0 0 0 3px rgba(74,108,247,0.1); }
select.form-control { appearance: auto; }
textarea.form-control { resize: vertical; min-height: 80px; }

/* ==================== Cards ==================== */
.card { background: #fff; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.04); border: 1px solid #f0f0f0; }
.card-header { padding: 16px 20px; border-bottom: 1px solid #f5f5f5; }
.card-header h3 { font-size: 16px; font-weight: 600; }
.card-body { padding: 20px; }

/* ==================== Alerts ==================== */
.alert { padding: 12px 16px; border-radius: 8px; 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: #f0f5ff; color: #4a6cf7; border: 1px solid #d9e2f7; }

/* ==================== Badges ==================== */
.badge { display: inline-block; padding: 3px 10px; border-radius: 10px; font-size: 12px; font-weight: 500; }
.badge-success { background: #f0f9eb; color: #67c23a; }
.badge-danger { background: #fef0f0; color: #f56c6c; }
.badge-warning { background: #fdf6ec; color: #e6a23c; }
.badge-info { background: #f0f5ff; color: #4a6cf7; }

/* ==================== Auth Pages ==================== */
.auth-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; background: linear-gradient(135deg, #f5f7fa 0%, #e8ecf1 100%); }
.auth-box { background: #fff; padding: 40px 36px; border-radius: 16px; box-shadow: 0 8px 32px rgba(0,0,0,0.08); max-width: 420px; width: 100%; }
.auth-box h2 { text-align: center; margin-bottom: 6px; font-size: 22px; }
.auth-box .subtitle { text-align: center; color: #999; margin-bottom: 24px; font-size: 14px; }
.switch-link { text-align: center; margin-top: 20px; font-size: 14px; color: #999; }
.switch-link a { color: #4a6cf7; font-weight: 500; }

/* ==================== Tables ==================== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 14px; border-bottom: 1px solid #f0f0f0; text-align: left; font-size: 14px; }
th { background: #fafbfc; font-weight: 600; color: #666; font-size: 13px; }
tr:hover td { background: #fafbff; }

/* ==================== Pagination ==================== */
.pagination { display: flex; gap: 6px; margin-top: 16px; justify-content: center; flex-wrap: wrap; }
.pagination a { padding: 6px 14px; border: 1px solid #e8ecf1; border-radius: 6px; font-size: 13px; color: #666; transition: all 0.2s; }
.pagination a:hover, .pagination a.active { background: #4a6cf7; color: #fff; border-color: #4a6cf7; }

/* ==================== Modal ==================== */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 1000; align-items: center; justify-content: center; }
.modal-overlay.show { display: flex; }
/* 弹窗内容盒子 */
.modal-box { background: #fff; border-radius: 14px; padding: 28px; max-width: 480px; width: 90%; max-height: 85vh; overflow-y: auto; box-shadow: 0 12px 40px rgba(0,0,0,0.15); }
.modal-box h3 { margin-bottom: 16px; font-size: 18px; }
.modal-footer { margin-top: 16px; display: flex; gap: 10px; justify-content: flex-end; }
/* 兼容旧写法：.modal 同时作为遮罩层，.modal-content作为内容盒子 */
.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 1000; align-items: center; justify-content: center; }
.modal.show { display: flex; }
.modal .modal-content { background: #fff; border-radius: 14px; padding: 28px; max-width: 600px; width: 90%; max-height: 85vh; overflow-y: auto; box-shadow: 0 12px 40px rgba(0,0,0,0.15); }
.modal .modal-content h3 { margin-bottom: 16px; font-size: 18px; }
.modal .modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal .modal-header h3 { margin: 0; }
.modal .modal-close { background: none; border: none; font-size: 24px; cursor: pointer; color: #999; padding: 0 4px; }
.modal .modal-close:hover { color: #333; }
.modal .modal-footer { margin-top: 16px; display: flex; gap: 10px; justify-content: flex-end; }

/* ==================== Pay Page ==================== */
.pay-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; background: #f5f7fa; }
.pay-box { background: #fff; padding: 36px; border-radius: 16px; box-shadow: 0 4px 20px rgba(0,0,0,0.08); text-align: center; max-width: 400px; width: 100%; }
.pay-amount { font-size: 32px; font-weight: 800; color: #333; margin: 12px 0; }
.pay-qr { margin: 16px auto; }
.pay-qr img { max-width: 220px; border: 1px solid #eee; border-radius: 8px; padding: 8px; }
.pay-tip { font-size: 13px; color: #999; margin-top: 8px; }

/* ==================== Empty State ==================== */
.empty-state { text-align: center; padding: 50px 20px; color: #999; }
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* ==================== Toast ==================== */
.toast { position: fixed; top: 20px; right: 20px; padding: 12px 20px; border-radius: 8px; font-size: 14px; z-index: 2000; transform: translateX(120%); transition: transform 0.3s; box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.toast.show { transform: translateX(0); }
.toast-success { background: #67c23a; color: #fff; }
.toast-error { background: #f56c6c; color: #fff; }
.toast-warning { background: #e6a23c; color: #fff; }

/* ==================== Loading ==================== */
.loading { display: flex; align-items: center; justify-content: center; padding: 40px; }
.spinner { width: 32px; height: 32px; border: 3px solid #e8ecf1; border-top-color: #4a6cf7; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ==================== Responsive ==================== */
@media (max-width: 768px) {
    .header { padding: 0 16px; }
    .header-nav { display: none; }
    .mobile-menu-btn { display: block; }
    .header-nav.open {
        display: flex; flex-direction: column; position: absolute;
        top: 56px; left: 0; right: 0; background: #fff;
        padding: 8px 0; box-shadow: 0 4px 12px rgba(0,0,0,0.1);
        border-bottom: 1px solid #e8ecf1; z-index: 200;
    }
    .header-nav.open a { padding: 12px 20px; border-radius: 0; }
    .nav-dropdown-menu {
        position: static; box-shadow: none; opacity: 1; visibility: visible;
        transform: none; display: none; padding: 0 0 0 20px;
    }
    .nav-dropdown:hover .nav-dropdown-menu { display: block; }
    .banner-overlay { padding: 30px 16px; }
    .banner-overlay h2 { font-size: 20px; }
    .nav-item { padding: 12px 14px; font-size: 14px; }
    .tool-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
    .tool-thumb { height: 100px; }
    .tool-info { padding: 10px 12px; }
    .tool-name { font-size: 14px; }
    .uc-layout { flex-direction: column; }
    .uc-sidebar { width: 100%; border-right: none; border-bottom: 1px solid #f0f0f0; padding: 16px 0; }
    .uc-avatar-area { padding: 0 16px 12px; }
    .uc-menu-item { padding: 10px 20px; }
    .uc-main { padding: 16px; }
    .uc-card { padding: 16px 18px; }
    .my-tool-item { flex-direction: column; align-items: flex-start; gap: 10px; }
    .my-tool-actions { width: 100%; }
    .my-tool-actions .btn { flex: 1; text-align: center; }
    .auth-box { padding: 28px 20px; }
    .modal { padding: 20px; width: 95%; }
    .vip-card { padding: 20px; }
    .vip-card .vip-price { font-size: 28px; }
}
