/* ============================================================
   manage-page.css — Stage 3-G F4.12-G 廣告管理頁
   port from docs/mockup/manage.html inline <style>
   依賴：tokens.css + base.css（由 _Layout_Userside 載入）
   ============================================================ */

main { padding: var(--sp-6) 0 var(--sp-9); }
/* 內容寬度用預設 --max-w-content（1200、= topbar）；應用頁不另設窄欄 */

/* ─── 頁面 header ─── */
.page-h { margin-bottom: var(--sp-5); }
.page-h__crumb {
    font-size: var(--fs-xs);
    color: var(--text-tertiary);
    margin-bottom: var(--sp-3);
    font-weight: var(--fw-semibold);
    line-height: 1.4;
}
.page-h__crumb a { color: inherit; font-weight: inherit; text-decoration: none; }
.page-h__crumb a:hover { color: var(--c-pink); }
.page-h__crumb .crumb-sep { margin: 0 var(--sp-2); opacity: 0.45; font-weight: var(--fw-regular); }
.page-h__crumb .crumb-current { color: var(--text-primary); }

.page-h__title {
    font-size: clamp(2rem, 4vw, 3rem);
    line-height: 1.05;
    font-weight: var(--fw-extra);
    letter-spacing: -0.03em;
    margin-bottom: var(--sp-2);
    display: flex;
    align-items: baseline;
    gap: var(--sp-2);
    flex-wrap: wrap;
}
.page-h__title .accent {
    background: var(--c-yellow);
    border: 1.5px solid var(--c-ink);
    padding: 0 12px;
    border-radius: var(--radius-md);
    box-shadow: 3px 3px 0 var(--c-ink);
    transform: rotate(-1deg);
    display: inline-block;
}
[data-theme="dark"] .page-h__title .accent {
    background: var(--c-yellow);
    border-color: var(--c-yellow);
    color: var(--text-on-yellow);
    box-shadow: 3px 3px 0 rgba(var(--c-yellow-rgb), 0.30);
}
.page-h__lead {
    font-size: var(--fs-base);
    color: var(--text-secondary);
    max-width: 640px;
    line-height: 1.6;
    text-wrap: pretty;
}

/* ─── server alert（TempData["AlertMessage"]）─── */
.server-alert {
    padding: 12px 16px;
    background: var(--bg-surface);
    border: 1.5px solid var(--c-pink);
    border-left-width: 5px;
    border-radius: var(--radius-md);
    color: var(--c-ink);
    font-size: var(--fs-sm);
    box-shadow: 4px 4px 0 var(--c-pink);
    margin-bottom: var(--sp-4);
}
[data-theme="dark"] .server-alert {
    background: var(--bg-surface);
    color: var(--text-primary);
    box-shadow: 4px 4px 0 rgba(255, 87, 120, 0.45);
}

/* ─── 數據總覽 ─── */
.metrics-section { margin-bottom: var(--sp-6); }
.metrics-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: var(--sp-3);
    margin-bottom: var(--sp-3);
    flex-wrap: wrap;
}
.metrics-header__title {
    font-size: var(--fs-md);
    font-weight: var(--fw-extra);
    display: inline-flex;
    align-items: baseline;
    gap: var(--sp-2);
}
.metrics-header__title .num {
    font-family: var(--f-mono);
    font-size: var(--fs-xs);
    color: var(--text-tertiary);
    font-weight: var(--fw-bold);
}
.date-pill {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    padding: 6px 14px;
    background: var(--bg-surface);
    border: 1.5px solid var(--c-ink);
    border-radius: var(--radius-pill);
    font-family: var(--f-mono);
    font-size: var(--fs-xs);
    font-weight: var(--fw-bold);
    color: var(--c-ink);
    box-shadow: 2px 2px 0 var(--c-ink);
}
.date-pill svg { width: 12px; height: 12px; opacity: 0.6; }
[data-theme="dark"] .date-pill {
    background: var(--bg-elevated);
    border-color: var(--border-strong);
    color: var(--text-primary);
    box-shadow: 2px 2px 0 rgba(240, 242, 248, 0.15);
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: var(--sp-3);
}
@media (max-width: 1180px) {
    .metrics-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 720px) {
    .metrics-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 480px) {
    .metrics-grid { grid-template-columns: 1fr 1fr; }
}

.metric-card {
    padding: var(--sp-4);
    background: var(--bg-surface);
    border: 1.5px solid var(--c-ink);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-pop-sm);
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: all var(--t-fast);
}
.metric-card:hover {
    transform: translate(-1px, -1px);
    box-shadow: var(--shadow-pop);
}
.metric-card__label {
    font-size: var(--fs-xs);
    font-weight: var(--fw-semibold);
    color: var(--text-tertiary);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-family: var(--f-mono);
}
.metric-card__value {
    font-family: var(--f-mono);
    font-size: 1.5rem;
    font-weight: var(--fw-extra);
    color: var(--c-ink);
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}
.metric-card__value small {
    font-size: var(--fs-xs);
    font-weight: var(--fw-medium);
    opacity: 0.55;
    margin-left: 2px;
}
[data-theme="dark"] .metric-card {
    background: var(--bg-surface);
    border-color: var(--border-strong);
}
[data-theme="dark"] .metric-card__value { color: var(--text-primary); }

/* ─── Section divider header（影片 / 廣告兩大區塊）─── */
.section-h {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--sp-3);
    margin: var(--sp-6) 0 var(--sp-3);
    flex-wrap: wrap;
}
.section-h__title {
    font-size: var(--fs-lg);
    font-weight: var(--fw-extra);
    display: inline-flex;
    align-items: baseline;
    gap: var(--sp-2);
}
.section-h__title .num {
    font-family: var(--f-mono);
    font-size: var(--fs-xs);
    color: var(--text-tertiary);
    font-weight: var(--fw-bold);
}

/* ─── Filter tabs ─── */
.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-2);
    margin-bottom: var(--sp-5);
}
.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 44px; /* 觸控基準 44px｜原 padding 僅 ~38px */
    padding: var(--sp-2) var(--sp-4);
    background: var(--bg-surface);
    border: 1.5px solid var(--c-ink);
    border-radius: var(--radius-pill);
    cursor: pointer;
    font-family: inherit;
    font-size: var(--fs-sm);
    font-weight: var(--fw-semibold);
    color: var(--c-ink);
    transition: all var(--t-fast);
    box-shadow: 2px 2px 0 var(--c-ink);
}
.filter-chip:hover {
    transform: translate(-1px, -1px);
    box-shadow: 3px 3px 0 var(--c-ink);
}
.filter-chip.is-active {
    background: var(--c-ink);
    color: #FFFFFF;
}
.filter-chip__count {
    font-family: var(--f-mono);
    font-size: var(--fs-xs);
    padding: 2px 6px;
    background: rgba(15, 22, 50, 0.10);
    border-radius: var(--radius-pill);
    font-weight: var(--fw-bold);
}
.filter-chip.is-active .filter-chip__count {
    background: rgba(255, 255, 255, 0.20);
}
[data-theme="dark"] .filter-chip {
    background: var(--bg-elevated);
    border-color: var(--border-strong);
    color: var(--text-primary);
}
[data-theme="dark"] .filter-chip.is-active {
    background: var(--c-yellow);
    border-color: var(--c-yellow);
    color: var(--text-on-yellow);
}
[data-theme="dark"] .filter-chip__count { background: rgba(240, 242, 248, 0.12); }
[data-theme="dark"] .filter-chip.is-active .filter-chip__count { background: rgba(15, 22, 50, 0.15); }

/* ─── 廣告卡片列表 ─── */
.ad-list {
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
}
.ad-card {
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: var(--sp-4);
    padding: var(--sp-4);
    background: var(--bg-surface);
    border: 1.5px solid var(--c-ink);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-pop-sm);
    transition: all var(--t-fast);
    cursor: pointer;
    align-items: center;
}
@media (max-width: 540px) {
    .ad-card { grid-template-columns: 90px 1fr; }
}
.ad-card:hover {
    transform: translate(-2px, -2px);
    box-shadow: var(--shadow-pop);
}
[data-theme="dark"] .ad-card {
    background: var(--bg-surface);
    border-color: var(--border-strong);
}

.ad-card__cover {
    aspect-ratio: 9 / 16;
    border-radius: var(--radius-md);
    border: 1.5px solid var(--c-ink);
    background-size: cover;
    background-position: center;
    background-color: var(--bg-elevated);
    position: relative;
    overflow: hidden;
}
.ad-card__cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.ad-card__cover-gradient {
    position: absolute; inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0) 60%, rgba(0,0,0,0.5) 100%);
    pointer-events: none;
}
[data-theme="dark"] .ad-card__cover { border-color: var(--border-strong); }

.ad-card__body { min-width: 0; }
.ad-card__head {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    margin-bottom: var(--sp-2);
    flex-wrap: wrap;
}
.ad-card__name {
    font-size: var(--fs-md);
    font-weight: var(--fw-extra);
    color: var(--c-ink);
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    flex: 1;
}
.ad-card__meta {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--sp-3);
    font-size: var(--fs-xs);
}
@media (max-width: 540px) {
    .ad-card__meta { grid-template-columns: repeat(2, 1fr); }
}
.ad-card__meta-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.ad-card__meta-label {
    color: var(--text-tertiary);
    font-weight: var(--fw-semibold);
    font-size: 10px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.ad-card__meta-value {
    color: var(--c-ink);
    font-weight: var(--fw-bold);
    font-family: var(--f-mono);
    font-size: var(--fs-sm);
    font-variant-numeric: tabular-nums;
}
[data-theme="dark"] .ad-card__name,
[data-theme="dark"] .ad-card__meta-value { color: var(--text-primary); }

/* F21：退點通知 chip（Rejected ad 顯示「已退回 N 點」）*/
.refund-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    background: var(--c-mint-soft);
    color: #0F1632;
    border: 1.5px solid var(--c-mint);
    border-radius: var(--radius-pill);
    font-size: var(--fs-xs);
    font-weight: var(--fw-bold);
    margin-top: var(--sp-2);
}
.refund-chip svg { width: 12px; height: 12px; }
[data-theme="dark"] .refund-chip {
    background: rgba(var(--c-mint-rgb), 0.15);
    color: var(--c-mint);
    border-color: var(--c-mint);
}

/* 狀態 badge */
.ad-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border: 1.5px solid var(--c-ink);
    border-radius: var(--radius-pill);
    font-size: var(--fs-xs);
    font-weight: var(--fw-bold);
    box-shadow: 2px 2px 0 var(--c-ink);
    white-space: nowrap;
    background: var(--bg-surface);
}
.ad-status--allow { background: var(--c-mint); color: #0F1632; }
.ad-status--pending { background: var(--warning); color: #0F1632; }
.ad-status--rejected { background: var(--c-pink); color: #0F1632; }
[data-theme="dark"] .ad-status { color: var(--text-primary); border-color: var(--border-strong); }
[data-theme="dark"] .ad-status--allow { background: var(--c-mint); color: #0F1632; border-color: var(--c-mint); }
[data-theme="dark"] .ad-status--pending { background: var(--warning); color: #0F1632; border-color: var(--warning); }
[data-theme="dark"] .ad-status--rejected { background: var(--c-pink); color: #0F1632; border-color: var(--c-pink); }

/* 非通過卡片：不可點、無 hover lift */
.ad-card[data-status="Pending"],
.ad-card[data-status="Rejected"] {
    cursor: default;
}
.ad-card[data-status="Pending"]:hover,
.ad-card[data-status="Rejected"]:hover {
    transform: none;
    box-shadow: var(--shadow-pop-sm);
}

/* ─── 影片狀態小卡片（dtoVideoReview / dtoVideoReject）─── */
.video-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: var(--sp-3);
    margin-bottom: var(--sp-4);
}
.video-mini {
    display: flex;
    gap: var(--sp-3);
    padding: var(--sp-3);
    background: var(--bg-surface);
    border: 1.5px solid var(--c-ink);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-pop-sm);
    align-items: center;
}
[data-theme="dark"] .video-mini {
    background: var(--bg-surface);
    border-color: var(--border-strong);
}
.video-mini__thumb {
    width: 56px;
    height: 80px;
    flex-shrink: 0;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--c-ink);
    background-color: var(--bg-elevated);
    background-size: cover;
    background-position: center;
    overflow: hidden;
}
.video-mini__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
[data-theme="dark"] .video-mini__thumb { border-color: var(--border-strong); }
.video-mini__body { min-width: 0; flex: 1; }
.video-mini__name {
    font-size: var(--fs-sm);
    font-weight: var(--fw-bold);
    color: var(--c-ink);
    line-height: 1.3;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
[data-theme="dark"] .video-mini__name { color: var(--text-primary); }
.video-mini__reason {
    font-size: var(--fs-xs);
    color: var(--c-pink);
    font-weight: var(--fw-semibold);
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ─── Metrics Modal ─── */
.mtx-modal {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    display: none;
    align-items: center;
    justify-content: center;
    padding: var(--sp-5);
}
.mtx-modal.is-open { display: flex; }
.mtx-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 15, 31, 0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: mtxBackdropIn 200ms ease-out;
}
@keyframes mtxBackdropIn { from { opacity: 0; } to { opacity: 1; } }
.mtx-modal__panel {
    position: relative;
    width: 100%;
    max-width: 600px;
    background: var(--bg-surface);
    border: 1.5px solid var(--c-ink);
    border-radius: var(--radius-xl);
    box-shadow: 8px 8px 0 var(--c-ink);
    animation: mtxPopIn 360ms cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}
@keyframes mtxPopIn {
    0%   { opacity: 0; transform: scale(0.92) translateY(8px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}
.mtx-modal__head {
    padding: var(--sp-5);
    background: var(--c-ink);
    color: #FFFFFF;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--sp-3);
    flex-shrink: 0;
}
.mtx-modal__title {
    font-size: var(--fs-xs);
    color: rgba(255,255,255,0.65);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: var(--fw-bold);
    font-family: var(--f-mono);
    margin-bottom: 6px;
}
.mtx-modal__name {
    font-size: var(--fs-lg);
    font-weight: var(--fw-extra);
    line-height: 1.2;
}
.mtx-modal__close {
    width: 36px; height: 36px; min-height: 36px;
    border-radius: 50%;
    background: var(--c-yellow);
    border: 1.5px solid var(--c-yellow);
    cursor: pointer;
    color: var(--c-ink);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--t-fast);
    box-shadow: 2px 2px 0 rgba(255, 255, 255, 0.20);
    flex-shrink: 0;
}
.mtx-modal__close:hover {
    transform: translate(-1px, -1px) rotate(90deg);
    box-shadow: 3px 3px 0 rgba(255, 255, 255, 0.25);
}
.mtx-modal__body {
    padding: var(--sp-5);
    overflow-y: auto;
}
.mtx-modal__loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    padding: var(--sp-5);
    font-family: var(--f-mono);
    font-size: var(--fs-sm);
    color: var(--text-tertiary);
}
.mtx-modal__loading-spinner {
    width: 18px; height: 18px;
    border: 2.5px solid var(--c-ink);
    border-right-color: transparent;
    border-radius: 50%;
    animation: mtxSpin 800ms linear infinite;
}
[data-theme="dark"] .mtx-modal__loading-spinner {
    border-color: var(--c-yellow);
    border-right-color: transparent;
}
@keyframes mtxSpin { to { transform: rotate(360deg); } }

.mtx-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: var(--sp-3);
}
.mtx-grid > :first-child { grid-column: 1 / -1; }
@media (max-width: 540px) {
    .mtx-grid { grid-template-columns: 1fr 1fr; }
    .mtx-grid > :first-child { grid-column: 1 / -1; }
}
.mtx-cell {
    padding: var(--sp-4);
    background: var(--c-cream-soft);
    border: 1.5px solid var(--c-ink);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.mtx-cell--highlight {
    background: var(--c-yellow);
    color: var(--text-on-yellow);
}
.mtx-cell__label {
    font-size: var(--fs-xs);
    color: var(--text-tertiary);
    font-weight: var(--fw-bold);
    font-family: var(--f-mono);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.mtx-cell--highlight .mtx-cell__label { color: rgba(15, 22, 50, 0.55); }
.mtx-cell__value {
    font-family: var(--f-mono);
    font-size: 1.5rem;
    font-weight: var(--fw-extra);
    color: var(--c-ink);
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}
.mtx-cell--highlight .mtx-cell__value {
    font-size: 2rem;
    color: var(--text-on-yellow);
}
.mtx-cell__value small {
    font-size: var(--fs-xs);
    font-weight: var(--fw-medium);
    opacity: 0.55;
    margin-left: 2px;
}

[data-theme="dark"] .mtx-modal__panel {
    background: var(--bg-surface);
    border-color: var(--border-strong);
    box-shadow: 8px 8px 0 rgba(var(--c-yellow-rgb), 0.25);
}
[data-theme="dark"] .mtx-modal__head {
    background: var(--bg-elevated);
}
[data-theme="dark"] .mtx-cell {
    background: var(--bg-elevated);
    border-color: var(--border-strong);
}
[data-theme="dark"] .mtx-cell__value { color: var(--text-primary); }
[data-theme="dark"] .mtx-cell--highlight {
    background: var(--c-yellow);
    color: var(--text-on-yellow);
}
[data-theme="dark"] .mtx-cell--highlight .mtx-cell__value { color: var(--text-on-yellow); }

/* 空狀態 */
.empty-state {
    padding: var(--sp-7) var(--sp-5);
    text-align: center;
    background: var(--c-cream-soft);
    border: 1.5px dashed var(--c-ink);
    border-radius: var(--radius-lg);
}
.empty-state__icon { font-size: 48px; margin-bottom: var(--sp-3); }
.empty-state__title { font-size: var(--fs-md); font-weight: var(--fw-extra); margin-bottom: var(--sp-2); }
.empty-state__lead { font-size: var(--fs-sm); color: var(--text-secondary); }
[data-theme="dark"] .empty-state { background: var(--bg-elevated); border-color: var(--border-strong); }

