/* shop.css — v6 完整版 */
#shop { display: none; }
#shop.active { display: block; }
.shop-inner { max-width: 1000px; margin: 0 auto; padding: 24px 16px; }

/* ---- 二级 Tab ---- */
.shop-sub-tabs {
    display: flex; align-items: center;
    height: 48px; padding: 0 20px;
    background: #fff;
    border-bottom: 1px solid var(--border);
    gap: 32px;
}
.shop-sub-tab {
    height: 100%;
    display: flex; align-items: center;
    color: #6B7280;
    font-size: 14px;
    font-weight: 600;
    background: none; border: none; cursor: pointer;
    font-family: inherit;
    position: relative;
    padding: 0 4px;
}
.shop-sub-tab:hover { color: #111827; }
.shop-sub-tab.active {
    color: var(--brand-500);
}
.shop-sub-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 3px;
    background: var(--brand-500);
    border-radius: 3px 3px 0 0;
}

/* ---- 页面头部 ---- */
.shop-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    padding: 20px 20px 4px;
    background: #fff;
}
.shop-header h1 {
    font-size: 22px; font-weight: 700; color: #111827; margin: 0;
}
.shop-header h1 .spark { font-size: 16px; color: var(--brand-500); }
.shop-header .subtitle {
    margin-top: 8px;
    font-size: 14px; color: #6B7280;
}
.shop-toolbar { display: flex; align-items: center; gap: 8px; }
.toolbar-btn {
    height: 32px; padding: 0 14px; border-radius: 8px;
    font-size: 13px; font-weight: 600; border: none; cursor: pointer;
    font-family: inherit; transition: all .15s;
    display: inline-flex; align-items: center; gap: 4px;
}
.toolbar-btn--red { background: #FEF2F2; color: #DC2626; }
.toolbar-btn--red:hover { background: #FEE2E2; }
.toolbar-btn--brand { background: var(--brand-50); color: var(--brand-600); }
.toolbar-btn--brand:hover { background: var(--brand-100); }
.toolbar-btn--gray { background: #F3F4F6; color: #4B5563; }
.toolbar-btn--gray:hover { background: #E5E7EB; }

/* ---- 统计概览卡 ---- */
.shop-stats {
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: 16px; padding: 16px 20px; background: #fff;
}
.shop-stat-card {
    display: flex; align-items: center; gap: 16px;
    background: #F9FAFB; border-radius: 16px; padding: 16px;
}
.shop-stat-card .stat-emoji { font-size: 24px; width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; }
.shop-stat-card .stat-info { display: flex; flex-direction: column; gap: 2px; }
.shop-stat-card .stat-label { font-size: 12px; color: #9CA3AF; font-weight: 600; }
.shop-stat-card .stat-value { font-size: 22px; font-weight: 900; color: #111827; display: flex; align-items: baseline; gap: 4px; }
.shop-stat-card .stat-unit { font-size: 12px; color: #9CA3AF; font-weight: 500; }

/* ---- 商品分区通用 ---- */
.shop-section { background: #fff; margin-top: 0; padding: 24px 20px; }
.shop-section-header {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 12px;
}
.shop-section-header h2 { font-size: 18px; font-weight: 600; color: #111827; margin: 0; }
.shop-section-header .section-desc { font-size: 13px; color: #6B7280; margin-top: 2px; }
.shop-section-header .section-link {
    margin-left: auto;
    font-size: 13px; font-weight: 600; color: var(--brand-500);
    background: none; border: none; cursor: pointer;
}
.shop-section-header .section-link:hover { color: var(--brand-600); }

/* ---- 普通商品卡 ---- */
.normal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 14px; row-gap: 18px; }
.item-card {
    height: 180px;
    padding: 14px 10px 12px;
    background: #FFFEFE;
    border: 1px solid #F3F4F6;
    border-radius: 14px;
    display: flex; flex-direction: column; align-items: center;
    gap: 5px;
    text-align: center;
    cursor: pointer;
    font-family: inherit;
    transition: all .2s;
    box-shadow: 0 1px 3px rgba(15,23,42,0.04);
}
.item-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px -8px rgba(15,23,42,0.1); border-color: var(--brand-500); }
.item-emoji { font-size: 40px; line-height: 1; margin-top: 2px; }
.item-name { font-size: 12px; font-weight: 500; color: #111827; line-height: 1.25; }
.item-price { display: flex; align-items: baseline; gap: 2px; margin-top: 1px; }
.item-price .num { font-size: 20px; font-weight: 800; color: var(--brand-500); line-height: 1; }
.item-price .unit { color: #6B7280; font-size: 11px; }
.item-stock { font-size: 11px; color: #6B7280; background: #F9FAFB; padding: 2px 8px; border-radius: 99px; margin-top: auto; }

/* ---- 次级 Tab 页面 ---- */
.shop-sub-page { display: none; }
.shop-sub-page.active { display: block; }

.shop-records-header { padding: 20px 20px 0; background: #fff; }
.shop-records-header h1 { font-size: 22px; font-weight: 700; color: #111827; }
.shop-records-header .subtitle { margin-top: 8px; font-size: 14px; color: #6B7280; }

.shop-toolbar-row { display: flex; align-items: center; justify-content: flex-end; padding: 16px 20px 0; background: #fff; gap: 12px; }

.filter-combobox { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border: 1px solid #e5e7eb; border-radius: 12px; background: #fff; cursor: pointer; font-family: inherit; font-size: 14px; color: #374151; }

/* ---- 弹窗系统 ---- */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(15,23,42,0.6);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: none;
    align-items: flex-start; justify-content: center;
    padding: 24px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    animation: modalFadeIn 0.25s ease;
}
@keyframes modalFadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-overlay.is-open { display: flex !important; }
.modal-overlay > .modal {
    background: linear-gradient(180deg, #ffffff 0%, #fafbfc 100%);
    box-shadow: 0 32px 64px -16px rgba(0,0,0,0.25), 0 0 0 1px rgba(0,0,0,0.04), 0 0 80px -20px rgba(98,180,165,0.12);
    border-radius: 24px;
    position: relative;
    width: 100%;
    max-height: calc(100vh - 48px);
    display: flex; flex-direction: column;
    margin: auto;
}
.modal-overlay > .modal.modal--2xl { max-width: 720px; }
.modal-overlay > .modal.modal--lg { max-width: 640px; }
.modal-overlay > .modal.modal--md { max-width: 480px; }
.modal-overlay > .modal.modal--sm { max-width: 360px; }
.modal-overlay > .modal.modal--xs { max-width: 300px; }
.modal-overlay > .modal.modal--full { max-width: 90vw; max-height: calc(100vh - 48px); }

.modal-banner {
    height: 52px;
    display: flex; align-items: center;
    flex-shrink: 0; border-radius: 24px 24px 0 0;
}
.modal-banner--slate { background: #f9fafb; border-bottom: 1px solid #f3f4f6; }
.modal-banner--purple { background: #faf5ff; border-bottom: 1px solid #f3e8ff; }
.modal-banner--amber { background: #fffbeb; border-bottom: 1px solid #fef3c7; }
.modal-banner-title { font-size: 16px; font-weight: 700; color: #111827; }

.modal-close {
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 12px;
    border: none; background: transparent;
    color: #9ca3af; cursor: pointer;
    transition: all .15s; flex-shrink: 0;
}
.modal-close:hover { background: #f3f4f6; color: #4B5563; }

.modal-body { flex: 1; overflow-y: auto; padding: 20px 24px; }
.modal-footer { display: flex; gap: 12px; padding: 16px 24px 24px; flex-shrink: 0; }
.modal-footer .btn { flex: 1; }

.btn { font-family: inherit; }
.btn--sm { height: 32px; padding: 0 14px; font-size: 13px; border-radius: 10px; }
.btn--md { height: 40px; padding: 0 18px; font-size: 14px; border-radius: 12px; }
.btn--full { width: 100%; }
.btn-primary { background: var(--brand-500); color: #FFFFFF; border: none; cursor: pointer; font-weight: 600; transition: all .15s; }
.btn-primary:hover { background: var(--brand-600); }
.btn-secondary { background: #f3f4f6; color: #4B5563; border: none; cursor: pointer; font-weight: 600; transition: all .15s; }
.btn-secondary:hover { background: #e5e7eb; }
.btn-ghost { background: transparent; color: #6b7280; border: none; cursor: pointer; font-weight: 600; transition: all .15s; }
.btn-ghost:hover { background: #f3f4f6; color: #4B5563; }
.btn-danger { background: #fef2f2; color: #dc2626; border: none; cursor: pointer; font-weight: 600; transition: all .15s; }
.btn-danger:hover { background: #fee2e2; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.form-group { margin-bottom: 16px; }
.form-label { font-size: 13px; font-weight: 600; color: #374151; margin-bottom: 6px; display: block; }
.form-input {
    width: 100%; height: 40px; padding: 0 14px;
    border: 1.5px solid #e5e7eb; border-radius: 10px;
    font-size: 14px; color: #111827; outline: none; transition: all .15s;
    box-sizing: border-box;
}
.form-input:focus { border-color: var(--brand-400); box-shadow: 0 0 0 3px rgba(98,180,165,0.15); }
.form-select { width: 100%; height: 40px; padding: 0 14px; border: 1.5px solid #e5e7eb; border-radius: 10px; font-size: 14px; color: #111827; outline: none; background: #fff; cursor: pointer; appearance: auto; }
.form-textarea { width: 100%; padding: 10px 14px; border: 1.5px solid #e5e7eb; border-radius: 10px; font-size: 14px; color: #111827; outline: none; resize: vertical; min-height: 80px; box-sizing: border-box; }
.form-textarea:focus { border-color: var(--brand-400); box-shadow: 0 0 0 3px rgba(98,180,165,0.15); }

.card { background: #fff; border-radius: 16px; padding: 16px; border: 1px solid #f3f4f6; }

/* ---- 管理商品 ---- */
#modal-product-manage .modal-body { padding-top: 16px; }
#modal-product-manage .product-list { display: flex; flex-direction: column; gap: 10px; }
.product-row {
    display: flex; align-items: center; gap: 14px;
    padding: 12px 14px;
    background: linear-gradient(180deg, #ffffff 0%, #fafbfc 100%);
    border: 1px solid rgba(226,232,240,0.9); border-radius: 14px;
    box-shadow: 0 1px 3px rgba(15,23,42,0.04);
    transition: all .18s cubic-bezier(0.4,0,0.2,1);
}
.product-row:hover {
    border-color: rgba(203,213,225,1);
    box-shadow: 0 4px 12px rgba(15,23,42,0.08);
    transform: translateY(-1px);
}
.product-icon {
    width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center; font-size: 24px;
    background: linear-gradient(180deg, #eef2ff 0%, #e0e7ff 100%);
    border: 1px solid #e0e7ff;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.6);
}
.product-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.product-name-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.product-name { font-size: 15px; font-weight: 700; color: #111827; }
.product-tag {
    font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 999px;
    line-height: 18px; white-space: nowrap;
}
.product-tag--hot { color: #c2410c; background: #ffedd5; border: 1px solid #fed7aa; }
.product-tag--new { color: #047857; background: #d1fae5; border: 1px solid #a7f3d0; }
.product-tag--limited { color: #6d28d9; background: #ede9fe; border: 1px solid #ddd6fe; }
.product-price { font-size: 13px; color: #6b7280; font-weight: 600; font-variant-numeric: tabular-nums; }
.product-price .coin-dot { color: #f59e0b; }
.product-actions { display: flex; gap: 8px; flex-shrink: 0; }
.product-action {
    padding: 7px 14px; border-radius: 10px; font-size: 13px; font-weight: 700;
    cursor: pointer; border: 1.5px solid transparent; transition: all .15s;
    font-family: inherit;
}
.product-action--edit {
    color: var(--brand-600); background: var(--brand-50); border-color: var(--brand-200);
}
.product-action--edit:hover { background: var(--brand-100); border-color: var(--brand-300); }
.product-action--delete {
    color: #dc2626; background: #fef2f2; border-color: #fecaca;
}
.product-action--delete:hover { background: #fee2e2; border-color: #fca5a5; }
.product-empty { text-align: center; padding: 40px 20px; color: #9ca3af; }

#modal-product-manage .modal-footer { border-top: 1px solid #f3f4f6; }

/* ---- 新增商品 ---- */
#modal-product-add > div {
    display: flex; flex-direction: column;
    flex: 1; overflow: hidden;
}
#modal-product-add .modal-body { flex: 1; overflow-y: auto; }
#modal-product-add .form-pane { display: block; }
#modal-product-add .form-pane[hidden] { display: none; }
#modal-product-add .form-section { margin-bottom: 20px; }
#modal-product-add .product-type-tabs { display: flex; gap: 8px; margin-bottom: 20px; }
#modal-product-add .product-type-tab { padding: 8px 16px; border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 600; transition: all .15s; font-family: inherit; }
#modal-product-add .modal-footer { border-top: 1px solid #f3f4f6; }

/* ---- Emoji 选择器 ---- */
.emoji-picker-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; }
.emoji-option {
    width: 100%; aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
    font-size: 22px; border-radius: 6px; cursor: pointer; transition: all .1s;
    border: 2px solid transparent;
}
.emoji-option:hover { background: #f3f4f6; }
.emoji-option.selected { background: var(--brand-100); border-color: var(--brand-400); }

/* ---- 班币管理 ---- */
#modal-coin-manage .modal-body { padding-top: 16px; }
.coin-mgr-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.coin-mgr-total { font-size: 14px; color: #6b7280; }
.coin-mgr-total span { font-size: 28px; font-weight: 900; color: var(--brand-500); }
.coin-mgr-search { position: relative; flex: 1; }
.coin-mgr-search input { width: 100%; height: 40px; padding: 0 14px 0 36px; border: 1.5px solid #e5e7eb; border-radius: 10px; font-size: 13px; outline: none; box-sizing: border-box; }
.coin-mgr-search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #9ca3af; }

.coin-student-list { display: flex; flex-direction: column; gap: 8px; min-height: 200px; max-height: 400px; overflow-y: auto; }
.coin-student-row {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px; border-radius: 12px;
    border: 1px solid #f3f4f6; background: #fff;
}
.coin-student-name { flex: 1; font-size: 14px; font-weight: 600; color: #111827; }
.coin-student-balance { font-size: 14px; font-weight: 700; color: #111827; min-width: 40px; text-align: right; }
.coin-student-adjust { display: flex; align-items: center; gap: 4px; }
.coin-student-adjust input { width: 72px; height: 32px; padding: 0 8px; border: 1.5px solid #e5e7eb; border-radius: 8px; font-size: 13px; text-align: center; outline: none; }
.coin-student-adjust input:focus { border-color: var(--brand-400); }
.coin-adjust-btn { height: 32px; padding: 0 12px; font-size: 12px; font-weight: 600; border: none; border-radius: 8px; cursor: pointer; font-family: inherit; transition: all .15s; }
.coin-adjust-btn.positive { background: #d1fae5; color: #065f46; }
.coin-adjust-btn.positive:hover { background: #a7f3d0; }
.coin-adjust-btn.negative { background: #fee2e2; color: #991b1b; }
.coin-adjust-btn.negative:hover { background: #fecaca; }

/* ---- 购买抽屉 ---- */
.modal-drawer-overlay { position: fixed; inset: 0; z-index: 1000; background: rgba(15,23,42,0.3); display: none; }
.modal-drawer-overlay.is-open { display: block; }
.modal-drawer { position: fixed; top: 0; right: 0; bottom: 0; width: 420px; max-width: 92vw; background: #fff; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25); z-index: 1001; display: flex; flex-direction: column; transform: translateX(100%); transition: transform 0.25s ease; }
.modal-drawer-overlay.is-open .modal-drawer { transform: translateX(0); }
.modal-drawer__header, .drawer-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid #f3f4f6; flex-shrink: 0; }
.modal-drawer__title, .drawer-title { font-size: 18px; font-weight: 800; color: #111827; margin: 0; letter-spacing: -0.2px; }
.modal-drawer__close, .drawer-close { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: 12px; border: none; background: transparent; color: #9ca3af; cursor: pointer; transition: all .15s; font-size: 20px; }
.modal-drawer__close:hover, .drawer-close:hover { background: #f3f4f6; color: #4B5563; }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px 24px; }
.drawer-footer { padding: 16px 24px 24px; border-top: 1px solid #f3f4f6; flex-shrink: 0; }
.drawer-mask { position: fixed; inset: 0; z-index: 1000; }

/* ---- 兑换记录表格 ---- */
.records-table-wrap { padding: 0 20px 20px; background: #fff; }
.records-table { width: 100%; border-collapse: collapse; }
.records-table th { font-size: 12px; font-weight: 600; color: #9ca3af; padding: 12px 8px; text-align: left; border-bottom: 1px solid #f3f4f6; }
.records-table td { font-size: 14px; color: #374151; padding: 12px 8px; border-bottom: 1px solid #f3f4f6; }
