/* ========== 全局 ========== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', 'Microsoft YaHei', sans-serif; background: #f0f2f5; color: #333; min-height: 100vh; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
a { color: #1a73e8; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ========== 容器 ========== */
.container { max-width: 1280px; margin: 0 auto; padding: 0 16px; }
.page-wrap { padding: 24px 0; }

/* ========== 头部导航 ========== */
.header { background: #1a73e8; color: #fff; padding: 0; box-shadow: 0 2px 8px rgba(0,0,0,0.15); position: sticky; top: 0; z-index: 100; }
.header .container { display: flex; align-items: center; height: 56px; gap: 12px; }
.header .container .nav { margin-left: auto; }
.header .logo { font-size: 17px; font-weight: 700; color: #fff; display: flex; align-items: center; gap: 6px; white-space: nowrap; flex-shrink: 0; }
.header .logo .logo-text { font-weight: 700; }
.header .logo .logo-subtitle { font-weight: 400; font-size: 13px; opacity: 0.75; }
@media (max-width: 480px) {
    .header .logo .logo-subtitle { font-size: 11px; }
}
.header .logo:hover { text-decoration: none; }
.header .nav { display: flex; align-items: center; gap: 2px; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.header .nav::-webkit-scrollbar { display: none; }
.header .nav a { color: rgba(255,255,255,0.85); padding: 5px 9px; border-radius: 6px; font-size: 12.5px; transition: all .2s; white-space: nowrap; flex-shrink: 0; }
.header .nav a:hover { background: rgba(255,255,255,0.15); text-decoration: none; color: #fff; }
.header .nav a.active { background: rgba(255,255,255,0.2); color: #fff; }
.header .user-info { display: flex; align-items: center; gap: 8px; font-size: 12px; color: rgba(255,255,255,0.85); white-space: nowrap; flex-shrink: 0; }
.header .user-info .badge { background: rgba(255,255,255,0.2); padding: 2px 8px; border-radius: 10px; font-size: 12px; }

/* ========== 卡片 ========== */
.card { background: #fff; border-radius: 10px; box-shadow: 0 1px 4px rgba(0,0,0,0.08); padding: 20px; margin-bottom: 16px; }
.card-header { font-size: 16px; font-weight: 600; color: #333; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid #f0f0f0; display: flex; justify-content: space-between; align-items: center; }
.card-header .sub { font-size: 13px; font-weight: 400; color: #999; }

/* ========== 会员信息卡片 ========== */
.member-card { background: linear-gradient(135deg, #1a73e8, #0d47a1); color: #fff; border-radius: 10px; padding: 24px; margin-bottom: 16px; }
.member-card h2 { font-size: 20px; margin-bottom: 8px; }
.member-card .status { font-size: 14px; opacity: 0.9; margin-bottom: 4px; }
.member-card .expire { font-size: 13px; opacity: 0.8; }

/* ========== 表格 ========== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { background: #f8f9fa; padding: 10px 12px; text-align: left; font-weight: 600; color: #555; border-bottom: 2px solid #e0e0e0; white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid #f0f0f0; vertical-align: middle; }
tr:hover td { background: #f8fbff; }
tr:last-child td { border-bottom: none; }

/* ========== 按钮 ========== */
.btn { display: inline-flex; align-items: center; gap: 4px; padding: 8px 16px; border: none; border-radius: 6px; font-size: 13px; cursor: pointer; transition: all .2s; text-decoration: none; white-space: nowrap; }
.btn:hover { text-decoration: none; opacity: 0.9; }
.btn-primary { background: #1a73e8; color: #fff; }
.btn-primary:hover { background: #1557b0; }
.btn-success { background: #34a853; color: #fff; }
.btn-success:hover { background: #2d9249; }
.btn-danger { background: #ea4335; color: #fff; }
.btn-danger:hover { background: #d33426; }
.btn-warning { background: #fbbc04; color: #333; }
.btn-warning:hover { background: #e5ab00; }
.btn-outline { background: transparent; border: 1px solid #ddd; color: #555; }
.btn-outline:hover { border-color: #1a73e8; color: #1a73e8; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { display: block; width: 100%; text-align: center; }
.btn-group { display: flex; gap: 6px; flex-wrap: wrap; }

/* ========== 表单 ========== */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; color: #555; font-size: 14px; font-weight: 500; }
.form-group input[type="text"], .form-group input[type="password"], .form-group input[type="number"], .form-group select, .form-group textarea {
    width: 100%; padding: 9px 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; transition: border-color .2s; font-family: inherit;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: #1a73e8; outline: none; box-shadow: 0 0 0 2px rgba(26,115,232,0.15); }
.form-group textarea { min-height: 80px; resize: vertical; }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 160px; }
.form-hint { font-size: 12px; color: #999; margin-top: 4px; }

/* ========== 分页 ========== */
.pagination { display: flex; align-items: center; gap: 4px; margin-top: 16px; flex-wrap: wrap; }
.pagination a, .pagination span { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; height: 32px; padding: 0 8px; border: 1px solid #e0e0e0; border-radius: 4px; font-size: 13px; color: #555; text-decoration: none; transition: all .2s; }
.pagination a:hover { border-color: #1a73e8; color: #1a73e8; text-decoration: none; }
.pagination .current { background: #1a73e8; border-color: #1a73e8; color: #fff; font-weight: 600; }
.pagination .page-info { border: none; color: #999; font-size: 12px; margin-left: 8px; }

/* ========== 消息提示 ========== */
.msg-bar { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.msg-success { background: #e8f5e9; color: #2e7d32; border: 1px solid #c8e6c9; }
.msg-error { background: #fde8e8; color: #c62828; border: 1px solid #f5c6c6; }

/* ========== 模态框 ========== */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 1000; justify-content: center; align-items: center; }
.modal-overlay.active { display: flex; }
.modal { background: #fff; border-radius: 12px; padding: 24px; width: 480px; max-width: 90vw; max-height: 80vh; overflow-y: auto; box-shadow: 0 4px 24px rgba(0,0,0,0.2); }
.modal h3 { margin-bottom: 16px; font-size: 18px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }

/* ========== 登录/注册框 ========== */
.auth-page { display: flex; justify-content: center; align-items: center; min-height: 100vh; background: #f0f2f5; padding: 20px; }
.auth-box { background: #fff; border-radius: 12px; box-shadow: 0 2px 20px rgba(0,0,0,0.1); width: 380px; max-width: 100%; padding: 36px; }
.auth-box h1 { text-align: center; color: #1a73e8; margin-bottom: 8px; font-size: 22px; }
.auth-box .subtitle { text-align: center; color: #999; font-size: 13px; margin-bottom: 24px; }
.auth-box .btn-block { margin-bottom: 12px; }
.auth-box .auth-link { text-align: center; font-size: 13px; color: #999; }
@media (max-width: 480px) {
    .auth-box { padding: 24px 16px; border-radius: 8px; }
}
.announcement { background: #fffbe6; border: 1px solid #ffe58f; border-radius: 8px; padding: 14px 16px; margin-bottom: 16px; }
.announcement .title { font-weight: 600; font-size: 15px; margin-bottom: 6px; }
.announcement .content { font-size: 14px; color: #555; line-height: 1.6; }
.announcement .time { font-size: 12px; color: #999; margin-top: 6px; }

/* ========== 账号类型卡片列表 ========== */
.type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.type-card { background: #fff; border: 1px solid #e8e8e8; border-radius: 10px; padding: 16px; transition: all .2s; cursor: pointer; word-break: break-all; overflow-wrap: break-word; }
.type-card:hover { border-color: #1a73e8; box-shadow: 0 2px 12px rgba(26,115,232,0.1); transform: translateY(-1px); }
.type-card h3 { font-size: 16px; color: #333; margin-bottom: 6px; }
.type-card .desc { font-size: 13px; color: #666; line-height: 1.6; margin-bottom: 12px; overflow-wrap: break-word; word-break: break-all; width: 100%; max-width: 100%; }
.type-card .btn { width: 100%; }

/* 静态卡片（仅展示，无交互效果） */
.type-card-static { cursor: default !important; }
.type-card-static:hover { border-color: #e8e8e8 !important; box-shadow: 0 1px 4px rgba(0,0,0,0.08) !important; transform: none !important; }

/* ========== 折叠介绍 ========== */
.desc-collapse { margin-bottom: 12px; }
.desc-collapse .desc { margin-bottom: 4px; max-height: 0; overflow: hidden; transition: max-height 0.3s ease; font-size: 13px; color: #666; line-height: 1.6; word-break: break-all; overflow-wrap: break-word; }
.desc-collapse .desc.open { max-height: 1000px; }
.desc-toggle { background: none; border: none; color: #1a73e8; font-size: 12px; cursor: pointer; padding: 2px 0; display: block; }
.desc-toggle:hover { text-decoration: underline; }

/* ========== 账户详情/说明 ========== */
.instructions-box { background: #f8f9fa; border: 1px solid #e8e8e8; border-radius: 8px; padding: 16px; margin-top: 12px; font-size: 14px; line-height: 1.7; white-space: pre-wrap; }

/* ========== 领取限制醒目标识 ========== */
.limit-notice { display: flex; align-items: center; gap: 10px; background: linear-gradient(135deg, #fff8e1, #fff3cd); border: 2px solid #ffc107; border-radius: 10px; padding: 14px 18px; margin-bottom: 16px; box-shadow: 0 2px 8px rgba(255,193,7,0.2); }
.limit-notice-icon { font-size: 22px; flex-shrink: 0; }
.limit-notice-text { font-size: 15px; color: #856404; font-weight: 600; line-height: 1.4; }
@media (max-width: 480px) {
    .limit-notice { padding: 10px 14px; gap: 8px; }
    .limit-notice-text { font-size: 14px; }
}

/* ========== 领取状态指示器 ========== */
.claim-status-bar { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-radius: 10px; margin-bottom: 16px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.claim-status-bar.claimed { background: linear-gradient(135deg, #e8f5e9, #c8e6c9); border: 2px solid #66bb6a; }
.claim-status-bar.available { background: linear-gradient(135deg, #e3f2fd, #bbdefb); border: 2px solid #42a5f5; }
.claim-status-icon { font-size: 22px; flex-shrink: 0; }
.claim-status-text { font-size: 14px; font-weight: 600; line-height: 1.4; }
.claim-status-bar.claimed .claim-status-text { color: #2e7d32; }
.claim-status-bar.available .claim-status-text { color: #1565c0; }
@media (max-width: 480px) {
    .claim-status-bar { padding: 10px 14px; gap: 8px; }
    .claim-status-text { font-size: 13px; }
}

/* ========== 复制按钮 ========== */
.copy-btn { cursor: pointer; }
.copy-btn:hover { color: #1a73e8; }

/* ========== 搜索过滤栏 ========== */
.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; padding: 16px; background: #f8f9fa; border-radius: 8px; margin-bottom: 16px; }
.filter-bar .form-group { margin-bottom: 0; min-width: 140px; }
.filter-bar .form-group input, .filter-bar .form-group select { padding: 7px 10px; font-size: 13px; }

/* ========== 响应式 - 手机优化 ========== */

/* 小屏通用调整 */
@media (max-width: 480px) {
    .page-wrap { padding: 12px 0; }
    .card { padding: 14px; border-radius: 8px; }
    .card-header { font-size: 15px; flex-direction: column; align-items: flex-start; gap: 6px; }
    .member-card { padding: 18px; border-radius: 8px; }
    .member-card h2 { font-size: 17px; }
    .container { padding: 0 10px; }
    .logo-admin { display: none; }
}

/* 平板和手机通用 */
@media (max-width: 768px) {
    /* 头部导航 - 重构手机版 */
    .header .container { flex-wrap: wrap; height: auto; padding: 6px 10px; gap: 2px; }
    .header .container > :first-child { order: 1; } /* logo */
    .header .container > .user-info { order: 2; }
    .header .container > .nav { order: 3; }
    .header .logo { font-size: 16px; line-height: 1.2; }
    .header .user-info { font-size: 12px; gap: 6px; }
    .header .user-info span { max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .header .nav { width: 100%; overflow-x: auto; padding: 6px 0 4px; gap: 4px; -webkit-overflow-scrolling: touch; scrollbar-width: none; border-top: 1px solid rgba(255,255,255,0.1); margin-top: 2px; }
    .header .nav::-webkit-scrollbar { display: none; }
    .header .nav a { font-size: 13px; padding: 6px 10px; white-space: nowrap; flex-shrink: 0; border-radius: 4px; }
    .header .user-info a { font-size: 12px; padding: 2px 8px; background: rgba(255,255,255,0.15); border-radius: 4px; }
    .logo-admin { display: inline; }

    /* 账号类型卡片 - 单列 */
    .type-grid { grid-template-columns: 1fr; gap: 10px; }

    /* 表单 - 堆叠 */
    .form-row { flex-direction: column; gap: 0; }
    .form-row .form-group { min-width: 100%; }

    /* 过滤栏 - 堆叠 */
    .filter-bar { flex-direction: column; padding: 12px; }
    .filter-bar .form-group { min-width: 100%; }

    /* 表格 - 在小屏上显示为卡片 */
    .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    
    /* 统计卡片 - 2列 */
    .stats-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 8px !important; }
    .stat-card { padding: 12px !important; }
    .stat-card .num { font-size: 22px !important; }

    /* 按钮 - 增大触控区域 */
    .btn { padding: 10px 18px; font-size: 14px; min-height: 40px; }
    .btn-sm { padding: 7px 12px; font-size: 13px; min-height: 36px; }
}

/* 超小屏额外优化 */
@media (max-width: 360px) {
    .header .nav a { font-size: 11px; padding: 5px 6px; }
    .card { padding: 10px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 8px !important; }
    .stat-card { padding: 12px !important; }
    .stat-card .num { font-size: 22px !important; }

    /* 模态框 */
    .modal { width: 92vw; padding: 18px; max-height: 90vh; }
    .modal h3 { font-size: 16px; }
    .modal-actions { flex-direction: column; }
    .modal-actions .btn { width: 100%; justify-content: center; }

    /* 分页 */
    .pagination a, .pagination span { min-width: 28px; height: 28px; font-size: 12px; }

    /* 公告 */
    .announcement { padding: 10px 12px; }
    .announcement .title { font-size: 14px; }
    .announcement .content { font-size: 13px; }

    /* Toast */
    .toast-msg { bottom: 20px !important; max-width: 90vw !important; }
    
    /* 说明框 */
    .instructions-box { font-size: 13px; padding: 12px; }

    /* 空状态 */
    .empty-state { padding: 24px 16px; }
    .empty-state .icon { font-size: 36px; }
}

/* 超小屏额外优化 */
@media (max-width: 360px) {
    .header .logo { font-size: 14px; }
    .header .nav a { font-size: 12px; padding: 5px 8px; }
    .header .user-info { font-size: 11px; }
    .logo-admin { display: none; }
    .card { padding: 10px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 6px !important; }
    .stat-card { padding: 8px !important; }
    .stat-card .num { font-size: 18px !important; }
    .stat-card .label { font-size: 11px !important; }
}

/* ========== 状态标签 ========== */
.tag { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 500; }
.tag-success { background: #e8f5e9; color: #2e7d32; }
.tag-danger { background: #fde8e8; color: #c62828; }
.tag-warning { background: #fff3e0; color: #e65100; }
.tag-info { background: #e3f2fd; color: #1565c0; }
.tag-default { background: #f5f5f5; color: #666; }

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

/* ========== 手机端卡片式表格 ========== */
@media (max-width: 640px) {
    .table-wrap table,
    .table-wrap thead,
    .table-wrap tbody,
    .table-wrap tr,
    .table-wrap th,
    .table-wrap td {
        display: block;
    }
    .table-wrap thead tr {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 8px 12px;
        background: #f8f9fa;
        border-bottom: 2px solid #e0e0e0;
        margin-bottom: 8px;
        border-radius: 6px;
    }
    .table-wrap thead tr th {
        border: none;
        padding: 4px 0;
    }
    .table-wrap tbody tr {
        background: #fff;
        border: 1px solid #e8e8e8;
        border-radius: 10px;
        padding: 12px;
        margin-bottom: 12px;
        box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    }
    .table-wrap tbody tr:hover td {
        background: transparent;
    }
    .table-wrap tr td {
        border: none;
        padding: 4px 0;
        display: flex;
        align-items: center;
        gap: 6px;
    }
    .table-wrap tr td:before {
        content: attr(data-label);
        font-weight: 600;
        color: #888;
        font-size: 12px;
        min-width: 60px;
        flex-shrink: 0;
    }
    .table-wrap td .btn-group,
    .table-wrap td .btn {
        width: auto;
    }
    .table-wrap tr td:last-child:before {
        display: none;
    }
    .table-wrap tr td:last-child {
        flex-wrap: wrap;
        gap: 4px;
        margin-top: 6px;
        padding-top: 8px;
        border-top: 1px dashed #eee;
    }
}

/* ========== 使用说明内联显示 ========== */
.instructions-text { font-size: 13px; color: #555; line-height: 1.5; display: block; max-width: 250px; white-space: pre-wrap; word-break: break-all; }
@media (max-width: 640px) {
    .instructions-text { max-width: none; font-size: 12px; }
}
