/* 西游大战僵尸2 — 详情页布局（对齐爆枪英雄 bq-editor-shell / bq-editor-layout） */

.save-editor-body .detail-page.xy-detail-page {
    width: 100%;
    max-width: 1200px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 3rem);
    min-height: calc(100vh - 3rem);
    max-height: calc(100vh - 3rem);
}

.xy-detail-page .detail-header {
    flex-shrink: 0;
}

.xy-detail-layout {
    display: flex;
    flex: 1;
    min-height: 0;
    align-items: stretch;
    overflow: hidden;
}

.xy-sidebar {
    width: 200px;
    flex-shrink: 0;
    border-right: 1px solid var(--border);
    background: var(--bg-input);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.65rem 0.35rem;
    align-self: stretch;
}

.xy-nav-btn {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.5rem 0.85rem;
    margin-bottom: 2px;
    border: none;
    border-radius: var(--radius-sm, 8px);
    background: transparent;
    color: var(--text-muted);
    font-size: 0.8125rem;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.xy-nav-btn:hover {
    background: rgba(99, 102, 241, 0.08);
    color: var(--text);
}

.xy-nav-btn.active {
    background: var(--primary-bg, rgba(99, 102, 241, 0.12));
    color: var(--primary);
    font-weight: 600;
}

.xy-content {
    flex: 1;
    min-width: 0;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.85rem 1rem 1.25rem;
    background: var(--bg-card, var(--bg-page));
}

.xy-content .panel {
    display: none;
}

.xy-content .panel.active {
    display: block;
    min-height: 100%;
    box-sizing: border-box;
}

.xy-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.xy-field--wide {
    grid-column: span 2;
}

.xy-field--actions {
    display: flex;
    align-items: flex-end;
}

.xy-select-list {
    width: 100%;
    min-height: 140px;
    font-size: 0.8125rem;
}

.xy-field--pick {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    min-width: 0;
}

.xy-item-pick-count {
    font-weight: 400;
    color: var(--text-muted, #888);
    font-size: 0.75rem;
}

.xy-item-pick-wrap {
    width: 100%;
}

.xy-add-cat-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: stretch;
    justify-content: flex-start;
}

.xy-add-cat-tab {
    flex: 1 1 calc(25% - 6px);
    min-width: 4.5em;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-input, rgba(0, 0, 0, 0.03));
    color: var(--text-muted, #666);
    font: inherit;
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    text-align: center;
    white-space: nowrap;
}

.xy-add-cat-tab:hover {
    border-color: var(--primary);
    color: var(--text);
}

.xy-add-cat-tab.is-active {
    border-color: var(--primary);
    background: rgba(59, 130, 246, 0.12);
    color: var(--primary);
}

.xy-item-pick-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 10px;
    margin: 8px 0 6px;
}

.xy-item-pick-selected {
    font-size: 0.75rem;
    color: var(--primary);
    font-weight: 600;
}

.xy-item-pick-list {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    width: 100%;
    max-height: 240px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card, #fff);
    text-align: left;
}

.xy-item-pick-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    width: 100%;
    padding: 7px 10px;
    border: none;
    border-bottom: 1px solid var(--border);
    background: transparent;
    color: var(--text);
    font: inherit;
    text-align: left;
    cursor: pointer;
    box-sizing: border-box;
}

.xy-item-pick-row:last-child {
    border-bottom: none;
}

.xy-item-pick-row:hover {
    background: var(--bg-input, rgba(0, 0, 0, 0.04));
}

.xy-item-pick-row.is-active,
.xy-item-pick-row.is-selected {
    background: rgba(59, 130, 246, 0.12);
}

.xy-item-pick-check {
    flex: 0 0 16px;
    width: 16px;
    height: 16px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-card, #fff);
    position: relative;
    box-sizing: border-box;
}

.xy-item-pick-row.is-selected .xy-item-pick-check {
    border-color: var(--primary);
    background: var(--primary);
}

.xy-item-pick-row.is-selected .xy-item-pick-check::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 1px;
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.xy-item-pick-name {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 0.8125rem;
    line-height: 1.35;
    word-break: break-word;
}

.xy-item-pick-id {
    flex: 0 0 auto;
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    font-size: 0.7rem;
    color: var(--text-muted, #888);
    white-space: nowrap;
}

.xy-item-pick-empty {
    padding: 16px 12px;
    text-align: left;
    color: var(--text-muted, #888);
    font-size: 0.8125rem;
}

[data-theme="dark"] .xy-item-pick-list {
    background: var(--bg-input);
}

[data-theme="dark"] .xy-item-pick-row.is-active,
[data-theme="dark"] .xy-item-pick-row.is-selected {
    background: rgba(96, 165, 250, 0.15);
}

[data-theme="dark"] .xy-add-cat-tab.is-active {
    background: rgba(96, 165, 250, 0.15);
}

.xy-inline-input {
    width: 100%;
    min-width: 48px;
    padding: 4px 6px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-card, #fff);
    color: var(--text);
    font-size: 0.75rem;
    box-sizing: border-box;
}

.xy-autopet-row {
    cursor: pointer;
}

.xy-table .xy-inline-input:focus {
    outline: none;
    border-color: var(--primary);
}

@media (max-width: 768px) {
    .xy-field--wide {
        grid-column: span 1;
    }
}

.xy-panel {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm, 10px);
    padding: 0.85rem 1rem;
    margin-bottom: 10px;
}

.xy-panel h3 {
    margin: 0 0 0.65rem;
    font-size: 0.9rem;
    color: var(--text);
    font-weight: 600;
}

.xy-sub {
    font-weight: 400;
    color: var(--text-dim);
    font-size: 0.75rem;
}

.xy-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    align-items: start;
}

.xy-field {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.xy-field label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 4px;
    font-weight: 500;
    line-height: 1.3;
    min-height: 1.3em;
}

.xy-field input,
.xy-field select {
    width: 100%;
    min-height: 36px;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm, 8px);
    background: var(--bg-card, #fff);
    color: var(--text);
    font-size: 0.8125rem;
    font-family: inherit;
    box-sizing: border-box;
    flex-shrink: 0;
}

.xy-field input:focus,
.xy-field select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow, rgba(99, 102, 241, 0.15));
}

.xy-field-hint {
    display: block;
    font-size: 0.68rem;
    color: var(--text-dim);
    font-weight: 400;
    margin-top: 4px;
    line-height: 1.35;
    min-height: 1.35em;
}

.xy-field-hint--empty {
    visibility: hidden;
    user-select: none;
}

.xy-inline-tip {
    margin: 0 0 0.5rem;
    font-size: 0.75rem;
    color: var(--text-dim);
    line-height: 1.5;
}

.xy-stat {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.xy-tag-list {
    margin: 0;
    padding-left: 1.1rem;
    font-size: 0.8125rem;
    line-height: 1.75;
    color: var(--text-muted);
}

.xy-empty {
    color: var(--text-dim);
    font-size: 0.8125rem;
    margin: 0;
}

.xy-quick-row,
.xy-quick-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.xy-tip {
    margin: 0.65rem 0 0;
    font-size: 0.72rem;
    color: var(--text-dim);
    line-height: 1.5;
}

.xy-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm, 8px);
}

.xy-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
}

.xy-table th,
.xy-table td {
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}

.xy-table th {
    font-weight: 600;
    color: var(--text-muted);
    background: rgba(99, 102, 241, 0.04);
    white-space: nowrap;
}

.xy-table tbody tr:last-child td {
    border-bottom: none;
}

.xy-table--clickable .xy-item-row {
    cursor: pointer;
    transition: background 0.12s;
}

.xy-table--clickable .xy-item-row:hover td {
    background: rgba(99, 102, 241, 0.08);
}

.xy-item-actions {
    white-space: nowrap;
}

.xy-item-actions .btn {
    padding: 2px 8px;
    font-size: 0.72rem;
}

.xy-item-actions .btn + .btn {
    margin-left: 4px;
}

#xyItemMask .modal-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.xy-grid--modal {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

/* 自定义确认弹窗 */
.xy-confirm-modal .modal-hdr {
    padding-bottom: 0.35rem;
}

.xy-confirm-msg {
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.55;
    color: var(--text);
    white-space: pre-wrap;
}

.btn-danger {
    background: #dc2626;
    color: #fff;
    border: none;
}

.btn-danger:hover {
    background: #b91c1c;
}

/* 仓库折叠面板 */
.xy-wh-collapse {
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 10px;
    background: var(--bg-card, #fff);
    overflow: hidden;
}

.xy-wh-collapse-hdr {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    cursor: pointer;
    list-style: none;
    font-size: 0.9rem;
    font-weight: 600;
    user-select: none;
}

.xy-wh-collapse-hdr::-webkit-details-marker {
    display: none;
}

.xy-wh-collapse-hdr::before {
    content: '';
    width: 0;
    height: 0;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-left: 6px solid var(--text-muted, #888);
    transition: transform 0.15s;
    flex-shrink: 0;
}

.xy-wh-collapse[open] > .xy-wh-collapse-hdr::before {
    transform: rotate(90deg);
}

.xy-wh-collapse-title {
    flex: 1;
    min-width: 0;
}

.xy-wh-collapse-body {
    padding: 0 12px 12px;
    border-top: 1px solid var(--border);
}

.xy-wh-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 8px;
    margin: 10px 0 8px;
}

.xy-wh-toolbar .btn {
    font-size: 0.72rem;
    padding: 4px 10px;
}

.xy-item-select-cell {
    width: 32px;
    text-align: center;
}

.xy-item-select,
.xy-wh-check-all {
    width: 15px;
    height: 15px;
    cursor: pointer;
    vertical-align: middle;
}

[data-theme="dark"] .xy-wh-collapse {
    background: var(--bg-input);
}

.xy-subpanel {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px dashed rgba(148, 163, 184, 0.25);
}

.xy-subpanel h4 {
    margin: 0 0 8px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
}

.xy-child-block {
    margin-bottom: 8px;
    padding: 8px;
    border-radius: 8px;
    background: rgba(99, 102, 241, 0.04);
}

.xy-subheading {
    margin: 12px 0 6px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
}

.xy-mobile-nav-toggle {
    display: none;
    margin: 0 1rem 0.5rem;
}

@media (max-width: 768px) {
    .save-editor-body .detail-page.xy-detail-page {
        height: auto;
        min-height: calc(100vh - 2rem);
        max-height: none;
    }

    .xy-mobile-nav-toggle {
        display: inline-flex;
    }

    .xy-detail-layout {
        flex-direction: column;
    }

    .xy-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
        display: none;
        flex-direction: row;
        flex-wrap: nowrap;
        overflow-x: auto;
        padding: 0.5rem;
        gap: 4px;
    }

    .xy-sidebar.open {
        display: flex;
    }

    .xy-nav-btn {
        width: auto;
        flex: 0 0 auto;
        white-space: nowrap;
        margin-bottom: 0;
    }

    .xy-grid {
        grid-template-columns: 1fr;
    }
}
