/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    background-color: #f5f5f5;
}

a {
    color: #337ab7;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

.clearfix::after {
    content: "";
    display: table;
    clear: both;
}

/* 表单样式 */
.form-group {
    margin-bottom: 15px;
}

/* 管理后台：单行搜索（输入框与按钮同一行；表单内回车提交） */
.form-inline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.form-inline.mb-3 {
    margin-bottom: 15px;
}

.form-inline .form-group {
    flex: 1 1 260px;
    min-width: 0;
    margin-bottom: 0;
}

.form-inline .form-group .form-control {
    width: 100%;
}

.form-inline > .form-control {
    flex: 1 1 260px;
    min-width: 180px;
    width: auto;
    max-width: 100%;
}

.form-inline > .btn,
.form-inline > a.btn {
    flex-shrink: 0;
}

.form-inline select.form-control {
    flex: 0 1 220px;
    min-width: 140px;
    max-width: 280px;
    width: auto;
    height: 34px;
}

.form-control {
    display: block;
    width: 100%;
    height: 34px;
    padding: 6px 12px;
    font-size: 14px;
    line-height: 1.42857143;
    color: #555;
    background-color: #fff;
    background-image: none;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
    transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
}

.form-control:focus {
    border-color: #66afe9;
    outline: 0;
    box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102,175,233,.6);
}

.btn {
    display: inline-block;
    padding: 6px 12px;
    margin-bottom: 0;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.42857143;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    cursor: pointer;
    user-select: none;
    background-image: none;
    border: 1px solid transparent;
    border-radius: 4px;
}

.btn-primary {
    color: #fff;
    background-color: #337ab7;
    border-color: #2e6da4;
}

.btn-success {
    color: #fff;
    background-color: #5cb85c;
    border-color: #4cae4c;
}

.btn-danger {
    color: #fff;
    background-color: #d9534f;
    border-color: #d43f3a;
}

.btn-info {
    color: #fff;
    background-color: #5bc0de;
    border-color: #46b8da;
}

.btn:hover {
    opacity: 0.9;
}

.label {
    display: inline;
    padding: 0.2em 0.6em 0.3em;
    font-size: 75%;
    font-weight: 700;
    line-height: 1;
    color: #fff;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.25em;
}

.label-success {
    background-color: #5cb85c;
}

.label-default {
    background-color: #777;
}

.input-group {
    position: relative;
    display: flex;
    border-collapse: separate;
}

.input-group-addon {
    padding: 6px 12px;
    font-size: 14px;
    font-weight: 400;
    line-height: 1;
    color: #555;
    text-align: center;
    background-color: #eee;
    border: 1px solid #ccc;
    white-space: nowrap;
}

.input-group-addon:first-child {
    border-right: 0;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.input-group-addon:last-child {
    border-left: 0;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.input-group .form-control:not(:first-child):not(:last-child) {
    border-radius: 0;
}

/* 表格样式 */
.table {
    width: 100%;
    max-width: 100%;
    margin-bottom: 20px;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 8px;
    line-height: 1.42857143;
    vertical-align: top;
    border-top: 1px solid #ddd;
    text-align: left;
}

.table th {
    font-weight: bold;
    background-color: #f9f9f9;
}

.table-striped > tbody > tr:nth-of-type(odd) {
    background-color: #f9f9f9;
}

.table-hover > tbody > tr:hover {
    background-color: #f5f5f5;
}

/* 管理系统样式 */
.admin-wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 220px;
    background-color: #263544;
    color: #fff;
    position: fixed;
    height: 100%;
    overflow-y: auto;
}

.sidebar-header {
    padding: 12px 15px;
    background-color: #222;
    font-size: 16px;
    font-weight: bold;
    border-bottom: 1px solid #333;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    text-align: center;
}

.sidebar-logo {
    max-height: 36px;
    max-width: 100px;
    object-fit: contain;
    vertical-align: middle;
}

.sidebar-title {
    line-height: 1.3;
    word-break: break-all;
}

.sidebar-menu {
    padding: 15px 0;
}

.sidebar-menu ul {
    list-style: none;
}

.sidebar-menu li {
    margin: 0;
}

.sidebar-menu li a {
    display: block;
    padding: 10px 15px;
    color: #a7b1c2;
    text-decoration: none;
    transition: all 0.3s;
}

.sidebar-menu li a:hover,
.sidebar-menu li a.active {
    color: #fff;
    background-color: #1f2c39;
    border-left: 4px solid #1ab394;
}

.sidebar-menu li a i {
    margin-right: 10px;
}

.main-content {
    margin-left: 220px;
    padding: 15px;
    width: calc(100% - 220px);
}

.page-header {
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.page-header h1 {
    margin: 0;
    font-size: 24px;
}

.card {
    background-color: #fff;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.24);
    margin-bottom: 20px;
    overflow: hidden;
}

.card-header {
    padding: 15px;
    background-color: #f9f9f9;
    border-bottom: 1px solid #eee;
}

.card-header h3 {
    margin: 0;
    font-size: 18px;
}

.card-body {
    padding: 15px;
}

/* 仪表盘样式 */
.dashboard-stats {
    display: flex;
    flex-wrap: wrap;
    margin: -10px;
}

.stat-card {
    flex: 1 1 200px;
    background-color: #fff;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.24);
    margin: 10px;
    padding: 20px;
    text-align: center;
}

.stat-card h2 {
    font-size: 24px;
    margin-bottom: 10px;
}

.stat-card p {
    color: #777;
    margin: 0;
}

.stat-card.primary {
    border-top: 3px solid #337ab7;
}

.stat-card.success {
    border-top: 3px solid #5cb85c;
}

.stat-card.info {
    border-top: 3px solid #5bc0de;
}

.stat-card.warning {
    border-top: 3px solid #f0ad4e;
}

/* 分页样式 */
.pagination {
    display: inline-block;
    padding-left: 0;
    margin: 20px 0;
    border-radius: 4px;
}

.pagination li {
    display: inline;
}

.pagination li a,
.pagination li span {
    position: relative;
    float: left;
    padding: 6px 12px;
    margin-left: -1px;
    line-height: 1.42857143;
    color: #337ab7;
    text-decoration: none;
    background-color: #fff;
    border: 1px solid #ddd;
}

.pagination li.active a,
.pagination li.active span {
    z-index: 2;
    color: #fff;
    cursor: default;
    background-color: #337ab7;
    border-color: #337ab7;
}

.pagination li.disabled a,
.pagination li.disabled span {
    color: #777;
    cursor: not-allowed;
    background-color: #fff;
    border-color: #ddd;
}

/* 警告框样式 */
.alert {
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid transparent;
    border-radius: 4px;
}

.alert-success {
    color: #3c763d;
    background-color: #dff0d8;
    border-color: #d6e9c6;
}

.alert-info {
    color: #31708f;
    background-color: #d9edf7;
    border-color: #bce8f1;
}

.alert-warning {
    color: #8a6d3b;
    background-color: #fcf8e3;
    border-color: #faebcc;
}

.alert-danger {
    color: #a94442;
    background-color: #f2dede;
    border-color: #ebccd1;
}

/* 用户端：全宽自适应 + 底部占位 */
.user-mobile {
    width: 100%;
    max-width: 100%;
    margin: 0;
    background-color: #fff;
    min-height: 100vh;
    min-height: 100dvh;
    position: relative;
    box-sizing: border-box;
    padding-bottom: 12px;
}

.user-footer-spacer {
    width: 100%;
    height: calc(118px + env(safe-area-inset-bottom, 0px));
    flex-shrink: 0;
    pointer-events: none;
}

.user-header {
    background-color: #337ab7;
    color: #fff;
    padding: 15px clamp(12px, 4vw, 72px);
    text-align: center;
    box-sizing: border-box;
    width: 100%;
}

.user-content {
    padding: 15px clamp(12px, 4vw, 72px) 20px;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
}

.user-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    transform: none;
    width: 100%;
    max-width: none;
    box-sizing: border-box;
    background-color: #fff;
    border-top: 1px solid #ddd;
    display: flex;
    z-index: 100;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.08);
    padding: 8px 0;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
}

@media (min-width: 768px) {
    .user-content {
        font-size: 16px;
    }
    .user-header h2 {
        font-size: 1.35rem;
    }
    .user-points {
        font-size: 28px;
    }
    .user-avatar {
        width: 96px;
        height: 96px;
    }
}

.nav-item {
    flex: 1;
    text-align: center;
    padding: 10px 0;
}

.nav-item.active {
    color: #337ab7;
}

.nav-item i {
    display: block;
    font-size: 20px;
    margin-bottom: 5px;
}

/* 用户信息卡片 */
.user-card {
    background-color: #fff;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.24);
    padding: 15px;
    margin-bottom: 15px;
}

.user-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin: 0 auto 15px;
    display: block;
    object-fit: cover;
}

.user-info {
    text-align: center;
}

.user-info h2 {
    margin-bottom: 5px;
}

.user-points {
    font-size: 24px;
    color: #f0ad4e;
    margin: 10px 0;
}

.user-level {
    display: inline-block;
    padding: 3px 8px;
    background-color: #5bc0de;
    color: #fff;
    border-radius: 3px;
    font-size: 12px;
}

/* 首页：横向用户信息条（仅布局；配色与原先 user-card / 积分 / 等级 / 进度条一致） */
.user-home-hero {
    margin-bottom: 15px;
    border-radius: 4px;
    overflow: hidden;
    background-color: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
}

.user-profile-strip {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 15px;
    text-decoration: none;
    color: #333;
    background-color: #fff;
    -webkit-tap-highlight-color: transparent;
}

.user-profile-strip:hover,
.user-profile-strip:focus,
.user-profile-strip:active,
.user-profile-strip:visited {
    text-decoration: none !important;
    color: #333;
}

.user-profile-strip,
.user-profile-strip * {
    text-decoration: none !important;
}

.user-profile-strip:hover *,
.user-profile-strip:focus *,
.user-profile-strip:active * {
    text-decoration: none !important;
}

.user-profile-strip:active {
    background-color: #fafafa;
}

.user-profile-strip__avatar-wrap {
    flex-shrink: 0;
    width: 64px;
    height: 64px;
}

.user-profile-strip__avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.user-profile-strip__main {
    flex: 1;
    min-width: 0;
    text-align: left;
}

.user-profile-strip__nickname {
    font-size: 1.25rem;
    font-weight: bold;
    line-height: 1.3;
    margin: 0;
    color: #333;
}

.user-profile-strip__points-row {
    margin-top: 6px;
    line-height: 1.2;
}

.user-profile-strip__points-num {
    color: #f0ad4e;
    font-weight: bold;
    font-size: 24px;
}

.user-profile-strip__kila {
    margin-top: 8px;
    font-size: 13px;
    color: #666;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-profile-strip__level-row {
    margin-top: 10px;
}

.user-profile-strip__level-chip {
    display: inline-block;
    padding: 3px 8px;
    font-size: 12px;
    font-weight: normal;
    color: #fff;
    background-color: #5bc0de;
    border-radius: 3px;
}

.user-profile-strip__chevron {
    flex-shrink: 0;
    font-size: 1.5rem;
    line-height: 1;
    color: #999;
    font-weight: 300;
    padding-left: 4px;
}

.user-upgrade-panel {
    padding: 0 15px 15px;
    background-color: #fff;
}

.user-upgrade-panel__hint {
    margin: 0 0 5px;
    font-size: 14px;
    color: #333;
}

.user-upgrade-panel__track {
    height: 10px;
    border-radius: 10px;
    background-color: #eee;
    overflow: hidden;
}

.user-upgrade-panel__fill {
    height: 100%;
    border-radius: 10px;
    background-color: #337ab7;
}

@media (max-width: 380px) {
    .user-profile-strip {
        padding: 12px;
        gap: 10px;
    }

    .user-profile-strip__avatar-wrap,
    .user-profile-strip__avatar {
        width: 56px;
        height: 56px;
    }

    .user-profile-strip__points-num {
        font-size: 20px;
    }
}

/* 管理后台：编辑用户模态框 */
.admin-modal-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
}
.admin-modal-backdrop.is-open {
    display: flex;
}
.admin-modal-dialog {
    background: #fff;
    border-radius: 4px;
    max-width: 520px;
    width: 100%;
    max-height: calc(100vh - 40px);
    overflow: auto;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
    position: relative;
}
.admin-modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    font-size: 16px;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.admin-modal-close {
    background: none;
    border: none;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    color: #999;
    padding: 0 4px;
}
.admin-modal-close:hover {
    color: #333;
}
.admin-modal-body {
    padding: 20px;
}

/* 邀请码页：标签切换（与后台主色 #337ab7 一致） */
.invite-tabs {
    border: 1px solid #dce0e6;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(38, 53, 68, 0.08);
    background: #fff;
}

.invite-tab-nav {
    display: flex;
    margin: 0;
    padding: 0;
    background: linear-gradient(180deg, #eef2f6 0%, #e4e9ef 100%);
    border-bottom: 1px solid #cdd4dc;
}

.invite-tab-nav .invite-tab-btn {
    flex: 1;
    padding: 14px 16px;
    margin: 0;
    border: none;
    border-right: 1px solid rgba(0, 0, 0, 0.06);
    background: transparent;
    color: #5c6773;
    font-size: 14px;
    line-height: 1.4;
    cursor: pointer;
    transition: color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    text-align: center;
    box-sizing: border-box;
}

.invite-tab-nav a.invite-tab-btn {
    text-decoration: none;
    display: block;
}

.invite-tab-nav .invite-tab-btn:last-child {
    border-right: none;
}

.invite-tab-nav .invite-tab-btn:hover:not(.active) {
    color: #263544;
    background: rgba(255, 255, 255, 0.45);
}

.invite-tab-nav .invite-tab-btn:focus {
    outline: none;
    box-shadow: inset 0 0 0 2px rgba(51, 122, 183, 0.35);
    z-index: 1;
}

.invite-tab-nav .invite-tab-btn.active {
    background: #fff;
    color: #337ab7;
    font-weight: 600;
    box-shadow: 0 3px 0 #337ab7 inset;
}

.invite-tab-panels {
    background: #fff;
    padding: 16px 18px 18px;
}

.invite-tab-panel {
    display: none !important;
}

.invite-tab-panel.active {
    display: block !important;
    animation: invite-tab-fade 0.22s ease;
}

.invite-tab-panel[hidden] {
    display: none !important;
}

@keyframes invite-tab-fade {
    from {
        opacity: 0.65;
    }
    to {
        opacity: 1;
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }
    
    .main-content {
        margin-left: 0;
        width: 100%;
    }
    
    .dashboard-stats {
        flex-direction: column;
    }
}
