/* ═══════════════════════════════════════════
   bst_cms v2 — 全局品牌样式
   品牌色系：蓝色主线 + 青绿点缀
   ═══════════════════════════════════════════ */

/* ── CSS 变量覆盖 AdminLTE ── */
:root,
[data-bs-theme="light"] {
    --bs-primary: #4361ee;
    --bs-primary-rgb: 67, 97, 238;
    --bs-primary-bg-subtle: #ebf0ff;
    --bs-primary-border-subtle: #c7d4fe;
    --bs-link-color: #4361ee;
    --bs-link-hover-color: #3a56d4;
    --bs-success: #06d6a0;
    --bs-success-rgb: 6, 214, 160;
    --bs-info: #4cc9f0;
    --bs-info-rgb: 76, 201, 240;
    --bs-warning: #ffd166;
    --bs-warning-rgb: 255, 209, 102;
    --bs-danger: #ef476f;
    --bs-danger-rgb: 239, 71, 111;
    --bs-body-bg: #f5f7fb;
    --bs-body-color: #2d3748;
}

/* ── 全局字体 ── */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    letter-spacing: 0.01em;
}

/* ── 页面背景 ── */
.app-wrapper {
    background: var(--bs-body-bg);
}

/* ═══════════════════════════════════════════
   顶栏
   ═══════════════════════════════════════════ */
.app-header {
    background: linear-gradient(135deg, #4361ee 0%, #3a56d4 100%) !important;
    border-bottom: none !important;
    box-shadow: 0 2px 12px rgba(67, 97, 238, 0.25);
    min-height: 56px;
}
.app-header .nav-link {
    color: rgba(255, 255, 255, 0.85) !important;
    transition: color 0.2s;
    padding: 0.75rem 1rem;
}
.app-header .nav-link:hover {
    color: #fff !important;
}
.app-header .dropdown-toggle::after {
    border-top-color: rgba(255, 255, 255, 0.7);
}

/* ═══════════════════════════════════════════
   侧边栏
   ═══════════════════════════════════════════ */
.app-sidebar {
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%) !important;
    border-right: none !important;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.08);
}

.sidebar-brand {
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 1rem 1.25rem;
}
.sidebar-brand .brand-link {
    color: #fff !important;
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.sidebar-brand .brand-image {
    width: 32px;
    height: 32px;
    border-radius: 6px;
}

/* 导航项 */
.sidebar-menu .nav-item {
    margin: 2px 8px;
}
.sidebar-menu .nav-link {
    color: rgba(255, 255, 255, 0.65) !important;
    border-radius: 8px;
    padding: 0.6rem 1rem;
    transition: all 0.2s;
    font-size: 0.9rem;
}
.sidebar-menu .nav-link:hover {
    color: #fff !important;
    background: rgba(255, 255, 255, 0.1);
}
.sidebar-menu .nav-link.active {
    color: #fff !important;
    background: linear-gradient(135deg, rgba(67, 97, 238, 0.6), rgba(67, 97, 238, 0.3));
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(67, 97, 238, 0.3);
}
.sidebar-menu .nav-link.active .nav-icon {
    color: #fff;
}
.sidebar-menu .nav-icon {
    color: rgba(255, 255, 255, 0.4);
    width: 1.5rem;
    font-size: 0.95rem;
    transition: color 0.2s;
}
.sidebar-menu .nav-link:hover .nav-icon {
    color: rgba(255, 255, 255, 0.8);
}

/* 分组标题 */
.sidebar-menu .nav-header {
    color: rgba(255, 255, 255, 0.3) !important;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 1rem 1.25rem 0.4rem;
    margin: 0 8px;
}

/* ═══════════════════════════════════════════
   内容区
   ═══════════════════════════════════════════ */
.app-content {
    padding: 1.5rem;
    position: relative;
}

/* Admin iframe — 覆盖整个内容区 */
#admin-frame {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    z-index: 1;
    background: #fff;
}

.app-content-header {
    margin-bottom: 1rem;
}

/* ── 卡片 ── */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.2s;
}
.card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}
.card-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    background: transparent;
    padding: 1rem 1.25rem;
}
.card-title {
    font-weight: 600;
    font-size: 1rem;
}

/* ── 按钮 ── */
.btn {
    border-radius: 8px;
    font-weight: 500;
    padding: 0.45rem 1.1rem;
    transition: all 0.2s;
}
.btn-primary {
    background: linear-gradient(135deg, #4361ee 0%, #3a56d4 100%);
    border: none;
    box-shadow: 0 2px 8px rgba(67, 97, 238, 0.3);
}
.btn-primary:hover {
    background: linear-gradient(135deg, #3a56d4 0%, #2d46c0 100%);
    box-shadow: 0 4px 14px rgba(67, 97, 238, 0.4);
    transform: translateY(-1px);
}
.btn-success {
    background: linear-gradient(135deg, #06d6a0 0%, #05b88c 100%);
    border: none;
    box-shadow: 0 2px 8px rgba(6, 214, 160, 0.3);
}
.btn-success:hover {
    background: linear-gradient(135deg, #05b88c 0%, #049a73 100%);
    box-shadow: 0 4px 14px rgba(6, 214, 160, 0.4);
    transform: translateY(-1px);
}
.btn-outline-primary {
    border-color: #4361ee;
    color: #4361ee;
}
.btn-outline-primary:hover {
    background: #4361ee;
    border-color: #4361ee;
}

/* ── 表格 ── */
.table thead th {
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    border-bottom-width: 1px;
}
.table tbody td {
    vertical-align: middle;
    font-size: 0.9rem;
}

/* ── Badge 标签 ── */
.badge {
    font-weight: 500;
    padding: 0.35em 0.7em;
    border-radius: 6px;
}

/* ── Alert 提示 ── */
.alert {
    border: none;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* ── 表单控件 ── */
.form-control {
    border-radius: 8px;
    border-color: #e2e8f0;
    padding: 0.5rem 0.85rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.form-control:focus {
    border-color: #4361ee;
    box-shadow: 0 0 0 0.2rem rgba(67, 97, 238, 0.15);
}
.input-group-text {
    border-radius: 8px;
    background: #f1f5f9;
    border-color: #e2e8f0;
}

/* ═══════════════════════════════════════════
   页脚
   ═══════════════════════════════════════════ */
.app-footer {
    background: #fff !important;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    color: #9ca3af;
    font-size: 0.8rem;
    padding: 0.8rem 1.5rem;
}

/* ═══════════════════════════════════════════
   仪表盘组件增强
   ═══════════════════════════════════════════ */
.small-box {
    border-radius: 14px;
    overflow: hidden;
}
.small-box .inner {
    padding: 1.25rem;
}
.small-box .inner h3 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}
.small-box .inner p {
    font-size: 0.9rem;
    opacity: 0.85;
    margin: 0;
}
.small-box .icon {
    font-size: 4.5rem;
    opacity: 0.12;
    top: 8px;
    right: 15px;
}
.small-box-footer {
    background: rgba(0, 0, 0, 0.1) !important;
    padding: 0.5rem 0;
    font-size: 0.85rem;
    transition: background 0.2s;
}
.small-box:hover .small-box-footer {
    background: rgba(0, 0, 0, 0.18) !important;
}

/* 自定义渐变背景 */
.small-box.bg-primary { background: linear-gradient(135deg, #4361ee 0%, #3a56d4 100%) !important; }
.small-box.bg-success { background: linear-gradient(135deg, #06d6a0 0%, #05b88c 100%) !important; }
.small-box.bg-warning { background: linear-gradient(135deg, #ffd166 0%, #f5c542 100%) !important; }
.small-box.bg-danger  { background: linear-gradient(135deg, #ef476f 0%, #d63d5e 100%) !important; }
.small-box.bg-info    { background: linear-gradient(135deg, #4cc9f0 0%, #3ab8df 100%) !important; }

/* ═══════════════════════════════════════════
   登录 & 注册页
   ═══════════════════════════════════════════ */
.auth-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

/* 背景装饰圈 */
.auth-page::before {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(67, 97, 238, 0.15), transparent 70%);
    top: -100px;
    right: -100px;
    pointer-events: none;
}
.auth-page::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(6, 214, 160, 0.1), transparent 70%);
    bottom: -80px;
    left: -80px;
    pointer-events: none;
}

.auth-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.auth-card-header {
    background: linear-gradient(135deg, #4361ee 0%, #3a56d4 100%);
    padding: 2rem 2rem 1.5rem;
    text-align: center;
    color: #fff;
}

.auth-card-header .auth-logo {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.auth-card-header .auth-subtitle {
    font-size: 0.85rem;
    opacity: 0.8;
    margin-top: 0.3rem;
}

.auth-card-body {
    padding: 2rem;
}

.auth-card-body .input-group {
    margin-bottom: 1rem;
}
.auth-card-body .input-group-text {
    background: #f8fafc;
    border-right: none;
    border-radius: 10px 0 0 10px;
    padding: 0.6rem 0.9rem;
}
.auth-card-body .form-control {
    border-left: none;
    border-radius: 0 10px 10px 0;
    padding: 0.6rem 0.9rem;
}
.auth-card-body .input-group:focus-within .input-group-text {
    border-color: #4361ee;
    color: #4361ee;
}
.auth-card-body .input-group:focus-within {
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.12);
    border-radius: 10px;
}

.auth-card-body .btn {
    width: 100%;
    padding: 0.7rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 10px;
    margin-top: 0.5rem;
}

.auth-card-footer {
    text-align: center;
    padding: 0 2rem 1.5rem;
    font-size: 0.85rem;
}
.auth-card-footer a {
    color: #4361ee;
    font-weight: 500;
}

.auth-remember {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    color: #6b7280;
}
.auth-remember input[type="checkbox"] {
    accent-color: #4361ee;
}

/* ── 响应式 ── */
@media (max-width: 480px) {
    .auth-card {
        margin: 1rem;
        border-radius: 12px;
    }
    .auth-card-header {
        padding: 1.5rem 1.5rem 1rem;
    }
    .auth-card-body {
        padding: 1.5rem;
    }
}

/* ═══════════════════════════════════════════
   移动端响应式
   ═══════════════════════════════════════════ */

/* ── 小屏幕 sidebar 优化 ── */
@media (max-width: 991.98px) {
    .app-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 1040;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        width: 260px;
    }

    /* AdminLTE sidebar-open 状态由 JS toggle 触发 */
    body.sidebar-open .app-sidebar {
        transform: translateX(0);
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
    }

    /* 遮罩层 */
    .sidebar-overlay {
        position: fixed;
        inset: 0;
        z-index: 1035;
        background: rgba(0, 0, 0, 0.4);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }
    body.sidebar-open .sidebar-overlay {
        opacity: 1;
        visibility: visible;
    }

    /* 内容区占满宽 */
    .app-content {
        margin-left: 0 !important;
        padding: 1rem;
    }

    /* 顶栏 padding 调整 */
    .app-header .container-fluid {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    /* 表格横向滚动 */
    .table-responsive {
        -webkit-overflow-scrolling: touch;
    }
}

/* ── 平板端 sidebar 折叠优化 ── */
@media (min-width: 992px) and (max-width: 1199.98px) {
    .sidebar-menu .nav-link p {
        font-size: 0.82rem;
    }
}

/* ── 手机端小屏表格优化 ── */
@media (max-width: 575.98px) {
    .app-content {
        padding: 0.75rem;
    }
    .card-body {
        padding: 0.75rem;
    }
    .small-box .inner h3 {
        font-size: 1.5rem;
    }
    .small-box .inner p {
        font-size: 0.78rem;
    }
    .small-box .icon {
        font-size: 3rem;
        top: 12px;
        right: 10px;
    }
    .small-box .inner {
        padding: 0.75rem 1rem;
    }
}

/* ═══════════════════════════════════════════
   图表相关
   ═══════════════════════════════════════════ */
.chart-container {
    position: relative;
    width: 100%;
    min-height: 320px;
}
.chart-container-sm {
    position: relative;
    width: 100%;
    min-height: 260px;
}

/* ═══════════════════════════════════════════
   商户登录页 — 琥珀/橙色系
   ═══════════════════════════════════════════ */
.auth-page-merchant {
    background: linear-gradient(135deg, #292524 0%, #1c1917 50%, #431407 100%);
}

.auth-page-merchant::before {
    background: radial-gradient(circle, rgba(245, 158, 11, 0.15), transparent 70%);
}
.auth-page-merchant::after {
    background: radial-gradient(circle, rgba(251, 191, 36, 0.1), transparent 70%);
}

.auth-card-merchant .auth-card-header-merchant {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
}

/* 商户版 focus 覆盖 */
.auth-page-merchant .input-group:focus-within .input-group-text {
    border-color: #d97706;
    color: #d97706;
}
.auth-page-merchant .input-group:focus-within {
    box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.15);
}
.auth-page-merchant .form-control:focus {
    border-color: #d97706;
    box-shadow: 0 0 0 0.2rem rgba(217, 119, 6, 0.15);
}

.btn-merchant {
    width: 100%;
    padding: 0.7rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 10px;
    margin-top: 0.5rem;
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    border: none;
    color: #fff;
    box-shadow: 0 2px 8px rgba(217, 119, 6, 0.3);
    transition: all 0.2s;
}
.btn-merchant:hover {
    background: linear-gradient(135deg, #b45309 0%, #92400e 100%);
    box-shadow: 0 4px 14px rgba(217, 119, 6, 0.45);
    color: #fff;
    transform: translateY(-1px);
}

.auth-card-merchant .auth-card-footer a {
    color: #d97706;
    font-weight: 500;
}
.auth-card-merchant .auth-card-footer a:hover {
    color: #b45309;
}
