/* ============================================================
   店主端 Web 站 — 现代化样式
   ============================================================ */

:root {
    --shop-primary: #2563eb;
    --shop-primary-hover: #1d4ed8;
    --shop-primary-light: #eff6ff;
    --shop-primary-subtle: #dbeafe;
    --shop-sidebar-bg: #0f172a;
    --shop-sidebar-hover: rgba(255, 255, 255, 0.06);
    --shop-sidebar-active: var(--shop-primary);
    --shop-bg: #f1f5f9;
    --shop-card-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shop-card-shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shop-border: #e2e8f0;
    --shop-text-muted: #64748b;
    --shop-nav-height: 56px;
    --shop-content-max-width: 1480px;
    --shop-dynamic-bottom-space: 0px;
    --shop-radius-lg: 16px;
}

/* ========== 全局 ========== */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: var(--shop-bg);
    color: #1e293b;
    overflow-x: hidden;
}

body.sidebar-open {
    overflow: hidden;
}

a {
    text-underline-offset: 3px;
}

button,
a,
.btn,
.form-control,
.form-select {
    -webkit-tap-highlight-color: transparent;
}

.btn:disabled,
.btn.disabled,
[aria-disabled="true"],
.is-disabled {
    cursor: not-allowed !important;
    pointer-events: none;
    opacity: 0.62;
}

/* ========== 顶部导航 / 主内容 ========== */
.shop-navbar {
    height: var(--shop-nav-height);
    background: #fff;
    border-bottom: 1px solid var(--shop-border);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
    z-index: 1030;
}

.shop-navbar .navbar-brand {
    min-width: 0;
}

.shop-navbar .navbar-brand span {
    max-width: 48vw;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.shop-main {
    min-height: 0;
    min-width: 0;
    padding-bottom: var(--shop-dynamic-bottom-space);
}

.shop-main > .container-fluid {
    max-width: var(--shop-content-max-width);
    margin-left: auto;
    margin-right: auto;
}

.shop-page-header {
    gap: 12px;
}

.shop-page-header-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* ========== Toast 提示 ========== */
.toast-msg {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    color: #fff;
    padding: 11px 18px;
    border-radius: 12px;
    font-size: 0.875rem;
    z-index: 9999;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: min(680px, calc(100vw - 32px));
    line-height: 1.55;
    word-break: break-word;
}
.toast-msg.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.toast-msg.error {
    background: #dc2626;
}
.toast-msg.success {
    background: #16a34a;
}
.toast-msg.warning {
    background: #f59e0b;
    color: #111827;
}

/* ========== 页面标题 ========== */
.page-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 16px;
}

/* ========== 卡片通用 ========== */
.card {
    border: none;
    border-radius: var(--shop-radius-lg);
    box-shadow: var(--shop-card-shadow);
    transition: box-shadow 0.2s ease;
    overflow: hidden;
}
.card:hover {
    box-shadow: var(--shop-card-shadow-hover);
}
.card-header {
    border-bottom: 1px solid var(--shop-border);
    font-weight: 600;
    color: #0f172a;
}

/* ========== 统计卡片 ========== */
.stat-card {
    border: none;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}
.stat-card .stat-icon {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 2.5rem;
    opacity: 0.12;
    color: var(--shop-primary);
}
.stat-card .stat-label {
    font-size: 0.8rem;
    color: var(--shop-text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.stat-card .stat-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.2;
}
.stat-card-accent {
    border-left: 4px solid var(--shop-primary);
}
.stat-card-success {
    border-left: 4px solid #16a34a;
}
.stat-card-warning {
    border-left: 4px solid #f59e0b;
}
.stat-card-danger {
    border-left: 4px solid #dc2626;
}

/* ========== 侧边栏导航 ========== */
.sidebar {
    width: 220px;
    height: calc(100vh - var(--shop-nav-height));
    height: calc(100dvh - var(--shop-nav-height));
    min-height: calc(100vh - var(--shop-nav-height));
    max-height: calc(100vh - var(--shop-nav-height));
    max-height: calc(100dvh - var(--shop-nav-height));
    flex: 0 0 220px;
    align-self: flex-start;
    background: var(--shop-sidebar-bg);
    position: sticky;
    top: var(--shop-nav-height);
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
}
.sidebar .nav-link {
    color: rgba(255, 255, 255, 0.55);
    padding: 10px 16px;
    border-radius: 8px;
    transition: all 0.15s ease;
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 2px 8px;
    border: none;
    text-decoration: none;
}
.sidebar .nav-link:hover {
    background: var(--shop-sidebar-hover);
    color: rgba(255, 255, 255, 0.9);
}
.sidebar .nav-link.active {
    background: var(--shop-sidebar-active);
    color: #fff;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}
.sidebar .nav-link i {
    width: 18px;
    text-align: center;
    font-size: 0.9rem;
}
.sidebar .sidebar-section {
    padding: 12px 16px 6px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.3);
    font-weight: 600;
}

/* ========== 筛选栏 ========== */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
}
.filter-bar .form-select,
.filter-bar .form-control {
    flex: 1 1 140px;
    border-radius: 8px;
    border-color: var(--shop-border);
    font-size: 0.875rem;
    height: 38px;
}
.filter-bar .form-select:focus,
.filter-bar .form-control:focus {
    border-color: var(--shop-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* ========== 表格优化 ========== */
.table {
    margin-bottom: 0;
    font-size: 0.875rem;
}
.table-responsive {
    -webkit-overflow-scrolling: touch;
}
.table th {
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--shop-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-bottom-width: 1px;
    padding: 12px 16px;
}
/* 桌面端允许 th 不换行；移动端允许换行防止撑开页面 */
@media (min-width: 768px) {
    .table th {
        white-space: nowrap;
    }
}
.table td {
    vertical-align: middle;
    padding: 12px 16px;
    border-color: var(--shop-border);
}
.table td code,
.table th code {
    white-space: normal;
    word-break: break-all;
}
.table-hover tbody tr:hover {
    background-color: var(--shop-primary-light);
}

/* ========== 分页 ========== */
.pagination .page-item.active .page-link {
    background-color: var(--shop-primary);
    border-color: var(--shop-primary);
    border-radius: 8px;
    font-weight: 600;
}
.pagination .page-link {
    color: var(--shop-primary);
    border-radius: 8px;
    margin: 0 2px;
    font-size: 0.85rem;
}
.pagination .page-link:hover {
    background-color: var(--shop-primary-light);
    border-color: var(--shop-primary);
}

/* ========== Modal ========== */
.modal-content {
    border: none;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}
.modal-header {
    border-bottom: 1px solid var(--shop-border);
    padding: 16px 24px;
}
.modal-body {
    padding: 24px;
}
.modal-footer {
    border-top: 1px solid var(--shop-border);
    padding: 16px 24px;
}

/* ========== 图片上传预览 ========== */
.upload-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.upload-preview .preview-item {
    position: relative;
    width: 100px;
    height: 100px;
    border-radius: 10px;
    overflow: hidden;
    border: 2px dashed var(--shop-border);
    transition: border-color 0.2s;
}
.upload-preview .preview-item:hover {
    border-color: var(--shop-primary);
}
.upload-preview .preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.upload-preview .preview-item .remove-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(220, 38, 38, 0.9);
    color: #fff;
    border: none;
    font-size: 12px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.15s;
}
.upload-preview .preview-item .remove-btn:hover {
    transform: scale(1.1);
}

/* ========== 操作按钮组 ========== */
.action-btn-group {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}
.action-btn-group .btn {
    border-radius: 9px;
    white-space: nowrap;
}

/* ========== 进度条美化 ========== */
.progress {
    border-radius: 6px;
    background-color: #e2e8f0;
}
.progress-bar {
    border-radius: 6px;
}

/* ========== 表单控件 ========== */
.form-control, .form-select {
    border-radius: 8px;
    border-color: var(--shop-border);
    font-size: 0.875rem;
}
.form-control:focus, .form-select:focus {
    border-color: var(--shop-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.form-label {
    font-weight: 500;
    font-size: 0.875rem;
    color: #334155;
    margin-bottom: 6px;
}

/* ========== 徽章美化 ========== */
.badge {
    font-weight: 500;
    letter-spacing: 0.3px;
}

/* ========== 空状态 ========== */
.empty-state {
    padding: 60px 20px;
    text-align: center;
    color: #94a3b8;
}
.empty-state i {
    font-size: 3rem;
    margin-bottom: 12px;
    display: block;
}

/* ========== 通知铃铛动画 ========== */
.notification-bell {
    position: relative;
    cursor: pointer;
    color: #64748b;
    font-size: 1.1rem;
    transition: color 0.15s;
}
.notification-bell:hover {
    color: var(--shop-primary);
}
.notification-bell .badge-dot {
    position: absolute;
    top: -2px;
    right: -4px;
    width: 8px;
    height: 8px;
    background: #ef4444;
    border-radius: 50%;
    border: 2px solid #fff;
}

.sidebar .nav-pending-badge {
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 20px;
}

.shop-state-row {
    padding: 32px 12px !important;
    color: #94a3b8 !important;
}

.shop-state-row i {
    display: block;
    margin-bottom: 8px;
    font-size: 24px;
    color: #cbd5e1;
}

.shop-sticky-actions {
    position: sticky;
    bottom: 0;
    z-index: 1020;
    background: rgba(241, 245, 249, 0.92);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(226, 232, 240, 0.9);
    box-shadow: 0 -10px 30px rgba(15, 23, 42, 0.08);
    border-radius: 16px;
    padding: 12px;
}

.shop-sticky-actions .btn {
    min-height: 40px;
}

.shop-soft-panel {
    background: #fff;
    border: 1px solid var(--shop-border);
    border-radius: var(--shop-radius-lg);
    box-shadow: var(--shop-card-shadow);
}

/* ========== 响应式通用 ========== */
.container-fluid {
    padding: 16px;
}
@media (min-width: 768px) {
    .container-fluid {
        padding: 24px;
    }
}

.card-body {
    padding: 20px;
}

/* ========== 小屏手机 (< 576px) ========== */
@media (max-width: 575.98px) {
    .table th, .table td {
        padding: 8px 10px;
        font-size: 0.8rem;
    }
    .table .btn-sm {
        padding: 3px 8px;
        font-size: 0.75rem;
    }
    .action-btn-group .btn {
        width: 100%;
        margin-bottom: 4px;
    }
    .shop-page-header-actions {
        width: 100%;
        justify-content: stretch;
    }
    .shop-page-header-actions .btn,
    .shop-page-header > .btn,
    .shop-page-header > a.btn {
        flex: 1 1 auto;
        min-height: 40px;
    }
    /* flex 标题行允许换行 */
    .d-flex.justify-content-between.align-items-center.mb-4,
    .d-flex.justify-content-between.align-items-center.mb-3 {
        flex-wrap: wrap;
        gap: 8px;
    }
    .form-control, .form-select {
        height: 40px;
        font-size: 14px;
    }
    .input-group-text {
        height: 40px;
    }
    .filter-bar .form-select,
    .filter-bar .form-control {
        flex: 1 1 100%;
    }
    .page-title {
        font-size: 1.1rem;
    }
    /* 卡片间距 */
    .card-body {
        padding: 14px;
    }
    /* 统计卡片 */
    .stat-card {
        padding: 12px 14px !important;
    }
    .stat-card .stat-value {
        font-size: 1.3rem;
    }
    .stat-card .stat-label {
        font-size: 0.72rem;
    }
    .stat-card .stat-icon {
        font-size: 1.8rem;
        right: 8px;
        opacity: 0.08;
    }
    /* 金刚区快捷入口 — 改为3列 */
    .quick-entry-item {
        padding: 12px 4px;
        border-radius: 10px;
    }
    .quick-entry-item .quick-icon {
        width: 40px;
        height: 40px;
        border-radius: 12px;
        font-size: 1rem;
    }
    .quick-entry-item .quick-text {
        font-size: 0.7rem;
    }
    /* 筛选栏行 */
    .row.g-2 > [class*="col-"] {
        margin-bottom: 6px;
    }
    /* 分页 */
    .pagination .page-link {
        padding: 6px 10px;
        font-size: 0.8rem;
        border-radius: 6px;
        min-width: 36px;
        text-align: center;
    }
    /* 模态框全屏 */
    .modal-dialog {
        margin: 0;
        max-width: 100%;
    }
    .modal-content {
        border-radius: 0;
        min-height: 100vh;
    }
    .modal-header {
        padding: 14px 16px;
    }
    .modal-body {
        padding: 16px;
    }
    .modal-footer {
        padding: 12px 16px;
    }
    .modal-footer .btn {
        flex: 1;
        min-height: 48px;
    }
    /* Toast */
    .toast-msg {
        top: max(12px, env(safe-area-inset-top));
        left: 12px;
        right: 12px;
        transform: none;
        font-size: 0.85rem;
        padding: 12px 16px;
        text-align: center;
        justify-content: center;
        max-width: none;
    }
    .toast-msg.show {
        transform: translateY(0);
    }

    .shop-sticky-actions {
        position: fixed;
        left: 10px;
        right: 10px;
        bottom: max(10px, env(safe-area-inset-bottom));
        border-radius: 18px;
    }
}

/* ========== 移动端侧边栏抽屉 ========== */
@media (max-width: 767.98px) {
    .sidebar {
        position: fixed;
        top: var(--shop-nav-height);
        left: -240px;
        width: 240px;
        flex-basis: 240px;
        z-index: 1050;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
        border-radius: 0 16px 16px 0;
    }
    .sidebar.show {
        left: 0;
    }
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: var(--shop-nav-height);
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 1040;
        backdrop-filter: blur(2px);
    }
    .sidebar-overlay.show {
        display: block;
    }
    .shop-navbar .navbar-brand span {
        max-width: 42vw;
        font-size: 0.9rem !important;
    }
    .shop-main > .container-fluid {
        padding-bottom: calc(16px + var(--shop-dynamic-bottom-space));
    }
}

/* ========== 登录/注册页 ========== */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f0f4ff 0%, #e8f0fe 50%, #f1f5f9 100%);
    padding: 20px;
}
.auth-card {
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(37, 99, 235, 0.1);
    overflow: hidden;
    max-width: 900px;
    width: 100%;
}
.auth-card .auth-left {
    background: linear-gradient(135deg, var(--shop-primary) 0%, #1e40af 100%);
    padding: 48px 40px;
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}
.auth-card .auth-left h2 {
    font-weight: 800;
    font-size: 1.8rem;
    margin-bottom: 12px;
}
.auth-card .auth-left p {
    opacity: 0.85;
    font-size: 0.95rem;
    line-height: 1.6;
}
.auth-card .auth-left .brand-icon {
    width: 72px;
    height: 72px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
}
.auth-card .auth-right {
    padding: 48px 40px;
}
.auth-card .auth-right .form-control {
    height: 48px;
    border-radius: 10px;
    padding-left: 44px;
    font-size: 0.95rem;
}
.auth-card .auth-right .input-group-text {
    width: 48px;
    height: 48px;
    border-radius: 10px 0 0 10px;
    border: 1px solid var(--shop-border);
    background: #f8fafc;
    color: var(--shop-text-muted);
}
.auth-card .auth-right .form-control:focus {
    padding-left: 44px;
}
.auth-card .btn-auth {
    height: 48px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 1rem;
    background: var(--shop-primary);
    border: none;
    transition: all 0.2s;
}
.auth-card .btn-auth:hover {
    background: var(--shop-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}
.auth-card .auth-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 0.9rem;
    color: var(--shop-text-muted);
}
.auth-card .auth-footer a {
    color: var(--shop-primary);
    font-weight: 600;
    text-decoration: none;
}
.auth-card .auth-footer a:hover {
    text-decoration: underline;
}

@media (max-width: 767.98px) {
    .auth-card {
        border-radius: 16px;
    }
    .auth-card .auth-left {
        padding: 32px 24px;
    }
    .auth-card .auth-right {
        padding: 32px 24px;
    }
}

/* ========== 工作台金刚区 ========== */
.quick-entry-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 8px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    color: #334155;
}
.quick-entry-item:hover {
    background: var(--shop-primary-light);
    color: var(--shop-primary);
    transform: translateY(-2px);
}
.quick-entry-item .quick-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    background: var(--shop-primary-light);
    color: var(--shop-primary);
    transition: all 0.2s;
}
.quick-entry-item:hover .quick-icon {
    background: var(--shop-primary);
    color: #fff;
}
.quick-entry-item .quick-text {
    font-size: 0.8rem;
    font-weight: 500;
}

/* ========== 订单状态标签 ========== */
.status-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}
.status-tag.pending { background: #fef3c7; color: #92400e; }
.status-tag.accepted { background: #e0f2fe; color: #0369a1; }
.status-tag.issued { background: #dcfce7; color: #166534; }
.status-tag.completed { background: #f1f5f9; color: #475569; }
.status-tag.cancelled { background: #fee2e2; color: #991b1b; }
.status-tag.granted { background: #dcfce7; color: #166534; }
.status-tag.fundraising { background: #e0f2fe; color: #0369a1; }
.status-tag.wait_draw { background: #dbeafe; color: #1e40af; }
.status-tag.rewarded { background: #dcfce7; color: #166534; }
.status-tag.cancelled { background: #fee2e2; color: #991b1b; }

/* ========== 数字动画 ========== */
@keyframes countUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.stat-value {
    animation: countUp 0.4s ease-out;
}

/* ========== 加载骨架屏 ========== */
.skeleton {
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 6px;
}
@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
