/* ===== detail.css — 资产详情页共享样式（index.html 浮窗 & detail.html URL 直进共用） ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
.hidden { display: none !important; }
body {
    font-family: "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
    background: var(--bg-page);
    color: var(--color-text-main);
    overflow-x: hidden;
}

/* ===== 视觉令牌（与 index.html / admin.html 统一 Design Language） ===== */
:root {
    /* 背景层 */
    --bg-card:               #ffffff;
    --bg-table-alt:          #f8fafc;
    --bg-footer:             #ffffff;
    --bg-actionsheet-mask:   rgba(0,0,0,0.45);
    --bg-page:               #f8f9fb;

    /* 分割线 */
    --border-light:          #ececf0;
    --border:                #ececf0;

    /* 品牌色 & 文字色 */
    --color-primary:         #2468f2;
    --primary:               #2468f2;
    --primary-hover:         #1b5ae0;
    --color-text-title:      #ffffff;
    --color-text-main:       #111827;
    --text-primary:          #111827;
    --color-text-sub:        #64748b;
    --text-secondary:        #64748b;
    --color-field-label:     #374151;
    --text-label:            #374151;
    --color-error:           #dc2626;
    --danger:                #dc2626;
    --color-badge-more:      #f97316;

    /* 圆角 */
    --radius-card:           12px;
    --radius-btn:            8px;
    --radius-input:          6px;

    /* 间距 */
    --gap-page-edge:         20px;
    --gap-section:           16px;
    --gap-card-pad-h:        20px;
    --gap-card-pad-v:        18px;

    /* 字号与字重 */
    --fs-hero:               22px;
    --fw-hero:               700;
    --fs-field-label:        13px;
    --fw-field-label:        500;
    --fs-field-value:        15px;
    --fw-field-value:        500;
    --fs-subtle:             14px;
    --fs-action-item:        13px;

    /* 阴影 */
    --shadow-card:           0 1px 2px rgba(17, 24, 39, 0.03), 0 1px 3px rgba(17, 24, 39, 0.03);
    --shadow-actionsheet:    0 -8px 28px rgba(0, 0, 0, 0.10);

    /* 补充色 */
    --bg-actionsheet-gap:    #f2f3f5;
    --toast-bg:              rgba(17,24,39,0.78);
    --color-on-primary:      #ffffff;
    --color-viewer-muted:    #cbd5e1;
    --color-svg-placeholder: #9ca3af;
    --color-error-stroke:    #dc2626;

    /* 状态语义色 */
    --status-inuse-bg:   #e7f6ec;
    --status-inuse-fg:   #15803d;
    --status-idle-bg:    #f2f4f7;
    --status-idle-fg:    #64748b;
    --status-unavail-bg: #fdf0e7;
    --status-unavail-fg: #c2410c;
    --status-scrap-bg:   #fdeaea;
    --status-scrap-fg:   #b91c1c;
    --status-other-bg:   #e9f1fd;
    --status-other-fg:   #1d4ed8;
    --status-available-bg: #e0f2f1;
    --status-available-fg: #00897b;
}

/* ===== 加载态 ===== */
.detail-loading { min-height: 60vh; display: flex; align-items: center; justify-content: center; }
.detail-loading-box { display: flex; flex-direction: column; align-items: center; gap: 12px; color: var(--color-text-sub); font-size: 15px; }
.detail-spinner { width: 28px; height: 28px; border: 3px solid var(--border-light); border-top-color: var(--color-primary); border-radius: 50%; animation: detail-spin 0.8s linear infinite; }
@keyframes detail-spin { to { transform: rotate(360deg); } }

/* ===== BLOCK 1：标题区 ===== */
.block-hero {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    margin: calc(12px + env(safe-area-inset-top)) var(--gap-page-edge) 0;
    padding: 24px var(--gap-card-pad-h) 20px;
    text-align: center;
}
.hero-title {
    font-size: var(--fs-hero);
    font-weight: var(--fw-hero);
    color: var(--color-text-main);
    line-height: 1.35;
    word-break: break-word;
}
.hero-sub {
    margin-top: 8px;
    font-size: var(--fs-subtle);
    font-weight: 500;
    color: var(--color-text-sub);
    word-break: break-all;
}

/* ===== BLOCK 2：字段卡片 ===== */
.card-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    margin: var(--gap-section) var(--gap-page-edge) 0;
    position: relative;
    overflow: visible;
    padding: 16px var(--gap-card-pad-h) 18px;
}
.field-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 0;
    padding: 0;
}
.field-label {
    font-size: var(--fs-field-label);
    font-weight: var(--fw-field-label);
    color: var(--text-secondary);
    line-height: 1.3;
    word-break: break-word;
}
.field-value {
    flex: 1;
    font-size: var(--fs-field-value);
    font-weight: var(--fw-field-value);
    color: var(--color-text-main);
    background: var(--bg-table-alt);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 10px 12px;
    min-height: 44px;
    display: flex;
    align-items: center;
    word-break: break-word;
    line-height: 1.4;
}
.field-value .dash { color: var(--color-text-sub); font-weight: 400; }

/* ===== 状态 badge ===== */
.status-badge { display: inline-block; padding: 3px 10px; border-radius: 4px; font-size: 12px; font-weight: 500; line-height: 1.5; white-space: nowrap; }
.status-inuse { background: var(--status-inuse-bg); color: var(--status-inuse-fg); }
.status-idle { background: var(--status-idle-bg); color: var(--status-idle-fg); }
.status-unavailable { background: var(--status-unavail-bg); color: var(--status-unavail-fg); }
.status-scrapped { background: var(--status-scrap-bg); color: var(--status-scrap-fg); }
.status-other { background: var(--status-other-bg); color: var(--status-other-fg); }
.status-available { background: var(--status-available-bg); color: var(--status-available-fg); }

/* ===== Actionsheet 危险项 ===== */
.more-danger { color: var(--danger); }

/* ===== BLOCK 3：资产图片卡片 ===== */
.section-title {
    margin: calc(var(--gap-section) + 4px) var(--gap-page-edge) 8px;
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text-main);
}
.card-photo {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    margin: 0 var(--gap-page-edge);
    overflow: hidden;
    padding: 0;
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
}
.photo-wrap { position: relative; cursor: zoom-in; background: var(--bg-table-alt); }
.photo-img { width: 100%; height: auto; max-height: 360px; object-fit: contain; display: block; }
.photo-more-badge {
    position: absolute; right: 10px; bottom: 10px;
    min-width: 26px; height: 26px; line-height: 26px;
    padding: 0 8px; text-align: center;
    background: var(--color-badge-more); color: #fff;
    border-radius: 13px; font-size: 13px; font-weight: 600;
}
.photo-placeholder {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 10px; padding: 24px 0;
    width: 100%;
    background: var(--bg-card); color: var(--color-text-sub);
    font-size: 14px;
}
.photo-broken .photo-placeholder { display: flex; }
.photo-wrap.photo-broken .photo-img { display: none !important; }

/* ===== 占位 ===== */
.page-spacer { height: calc(80px + env(safe-area-inset-bottom)); }

/* ===== BLOCK 4：底部固定操作栏 ===== */
.bottom-action-bar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    background: var(--bg-footer);
    border-top: 1px solid var(--border-light);
    padding-bottom: env(safe-area-inset-bottom);
    display: grid;
    grid-template-columns: 1fr 1fr;
}
.action-item {
    height: 60px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 4px;
    background: none; border: none; cursor: pointer;
    font-family: inherit;
    color: var(--color-text-main);
    -webkit-tap-highlight-color: transparent;
}
.action-item:active { background: var(--bg-table-alt); }
.action-icon { width: 22px; height: 22px; }
.action-label { font-size: var(--fs-action-item); font-weight: 500; color: var(--color-text-main); }

/* ===== 更多 Actionsheet ===== */
.more-actionsheet {
    position: fixed; inset: 0; z-index: 10001;   /* V6.5: 提高层级，高于 modal overlay (9999) */
    visibility: hidden;
}
.more-actionsheet.show { visibility: visible; }
.more-mask {
    position: fixed; inset: 0; z-index: 10001;
    background: var(--bg-actionsheet-mask);
    opacity: 0; transition: opacity 0.25s ease;
}
.more-actionsheet.show .more-mask { opacity: 1; }
.more-panel {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 10002;
    background: var(--bg-card);
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: var(--shadow-actionsheet);
    border-top-left-radius: 16px; border-top-right-radius: 16px;
    transform: translateY(100%); transition: transform 0.25s ease;
    overflow: hidden;
}
.more-actionsheet.show .more-panel { transform: translateY(0); }
.more-item {
    width: 100%; height: 56px;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    background: none; border: none;
    border-bottom: 1px solid var(--border-light);
    font-family: inherit;
    font-size: var(--fs-action-item);
    color: var(--color-text-main);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.more-item:active { background: var(--bg-table-alt); }
.more-item svg { width: 18px; height: 18px; }
.more-gap { height: 8px; background: var(--bg-actionsheet-gap); }
.more-cancel { color: var(--color-text-sub); border-bottom: none; }

/* ===== 错误卡片 / 申请权限卡片 ===== */
.error-card, .apply-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    margin: var(--gap-section) var(--gap-page-edge) 0;
    padding: 32px var(--gap-card-pad-h);
    text-align: center;
}
.error-icon { width: 40px; height: 40px; margin-bottom: 12px; }
.error-msg { font-size: 15px; color: var(--color-text-main); margin-bottom: 20px; }
.retry-btn {
    height: 40px; padding: 0 28px;
    background: var(--color-primary); color: var(--color-on-primary);
    border: none; border-radius: var(--radius-btn);
    font-size: 15px; font-weight: 500; cursor: pointer; font-family: inherit;
}
.apply-title { font-size: 17px; font-weight: 600; color: var(--color-text-main); margin-bottom: 10px; }
.apply-desc { font-size: 14px; color: var(--color-text-sub); line-height: 1.6; margin-bottom: 16px; }
.apply-textarea {
    width: 100%; min-height: 96px; padding: 10px 12px;
    border: 1px solid var(--border-light); border-radius: 8px;
    font-family: inherit; font-size: 14px; color: var(--color-text-main);
    resize: vertical;
}
.apply-textarea:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(36,104,242,0.14); }
.apply-btn {
    width: 100%; height: 44px; margin-top: 14px;
    background: var(--color-primary); color: var(--color-on-primary);
    border: none; border-radius: var(--radius-btn);
    font-size: 15px; font-weight: 500; cursor: pointer; font-family: inherit;
}
.apply-hint { margin-top: 12px; font-size: var(--fs-subtle); color: var(--color-text-sub); }

/* ===== 照片全屏查看 ===== */
.photo-viewer { position: fixed; inset: 0; z-index: 10002; background: rgba(0,0,0,0.92); display: flex; flex-direction: column; touch-action: none; }
.photo-viewer-top { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; color: var(--color-on-primary); }
.photo-viewer-count { font-size: 14px; color: var(--color-viewer-muted); }
.photo-viewer-close { width: 36px; height: 36px; background: none; border: none; color: var(--color-on-primary); font-size: 28px; cursor: pointer; line-height: 1; }
.photo-viewer-body { flex: 1; display: flex; align-items: center; justify-content: center; overflow: hidden; padding: 0 8px; }
.photo-viewer-img { max-width: 90%; max-height: 90%; object-fit: contain; transform-origin: center; transition: transform 0.2s; }
.photo-viewer-nav { background: none; border: none; color: var(--color-on-primary); font-size: 40px; cursor: pointer; padding: 8px 12px; opacity: 0.8; }
.photo-viewer-nav:hover { opacity: 1; }
.photo-viewer-prev { margin-right: auto; }
.photo-viewer-next { margin-left: auto; }
.photo-viewer-bottom { display: flex; justify-content: center; gap: 8px; padding: 16px; }

/* ===== 拍照本地预览 Modal ===== */
.photo-preview { position: fixed; inset: 0; z-index: 10003; background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center; padding: 24px; }
.photo-preview-box { background: var(--bg-card); border-radius: 14px; padding: 16px; max-width: 88vw; text-align: center; }
.photo-preview-box img { max-width: 70vw; max-height: 60vh; border-radius: 8px; display: block; margin: 0 auto; }
.photo-preview-note { margin-top: 12px; font-size: 13px; color: var(--color-text-sub); }
.photo-preview-close {
    margin-top: 14px; height: 38px; padding: 0 24px;
    background: var(--color-primary); color: var(--color-on-primary);
    border: none; border-radius: var(--radius-btn); font-size: 14px; cursor: pointer; font-family: inherit;
}

/* ===== Toast ===== */
.detail-toast {
    position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%);
    z-index: 10003;
    min-width: 96px; min-height: 40px;
    padding: 10px 18px;
    display: flex; align-items: center; justify-content: center;
    background: var(--toast-bg); color: var(--color-text-title);
    border-radius: 8px;
    font-size: 14px; line-height: 1.4;
    text-align: center;
    transition: opacity 0.3s ease;
}

/* ===== PC 浮窗化：满屏直进时居中限宽 ===== */
@media (min-width: 769px) {
    body { --fs-hero: 24px; }
    body.detail-standalone {
        display: flex;
        flex-direction: column;
        align-items: center;
        padding: 28px 20px 100px;
    }
    body.detail-standalone .block-hero,
    body.detail-standalone .card-fields,
    body.detail-standalone .photo-section,
    body.detail-standalone .section-title {
        width: 100%;
        max-width: 720px;
        margin-left: auto;
        margin-right: auto;
    }
    body.detail-standalone .block-hero { margin-top: 0; }
    body.detail-standalone .section-title { text-align: left; }
    body.detail-standalone .bottom-action-bar {
        left: 50%;
        transform: translateX(-50%);
        width: 100%;
        max-width: 720px;
        border-left: 1px solid var(--border-light);
        border-right: 1px solid var(--border-light);
        border-radius: 12px 12px 0 0;
        overflow: hidden;
    }
}

/* ===== 移动端单列适配 ===== */
@media (max-width: 768px) {
    body { --fs-hero: 20px; --fs-field-label: 14px; }
    .card-fields { grid-template-columns: 1fr; }
    .photo-img { max-height: 400px; }
    .card-photo { padding: 0 10px; }
    .photo-placeholder { margin: 0 10px; width: auto; }
    .block-hero { padding: 20px var(--gap-card-pad-h) 16px; }
    .section-title { margin-left: calc(var(--gap-page-edge) + 2px); margin-right: calc(var(--gap-page-edge) + 2px); }
}
