/* ===== Agent Modal ===== */
.agent-modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.agent-modal.active { display: flex; }
.agent-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    cursor: pointer;
}
.agent-modal-content {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    background: rgba(18, 18, 18, 0.95);
    border: 1px solid rgba(61, 61, 61, 0.3);
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}
.agent-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 1.2rem;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}
.agent-modal-close:hover { background: rgba(148, 163, 184, 0.1); color: #f1f5f9; }
.agent-modal-title {
    color: #f1f5f9;
    font-size: 1.25rem;
    font-weight: 800;
    margin-bottom: 16px;
    text-align: center;
}
.agent-modal-list { display: flex; flex-direction: column; gap: 10px; }
.agent-modal-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: rgba(28, 28, 28, 0.6);
    border: 1px solid rgba(61, 61, 61, 0.2);
    border-radius: 14px;
    text-decoration: none;
    color: #f1f5f9;
    cursor: pointer;
    transition: all 0.2s ease;
}
.agent-modal-item:hover {
    border-color: var(--d-primary, #FFD400);
    background: rgba(255, 212, 0, 0.08);
}
.agent-modal-item-info { display: flex; flex-direction: column; gap: 4px; }
.agent-modal-item-name { font-weight: 700; font-size: 1rem; }
.agent-modal-item-coupon {
    font-size: 0.8rem;
    color: #FFD400;
    font-weight: 600;
}
.agent-modal-item > i { color: #94a3b8; font-size: 0.9rem; }

:root {
    --theme-base: #080808;
    --theme-card: rgba(18, 18, 18, 0.7);
    --theme-element: rgba(28, 28, 28, 0.6);
    --theme-border: rgba(43, 43, 43, 0.5);
    --theme-border-light: rgba(61, 61, 61, 0.3);
    --theme-border-hover: rgba(255, 212, 0, 0.4);
    --theme-primary: #FFD400;
    --theme-primary-light: #FFF36A;
    --theme-primary-alpha: rgba(255, 212, 0, 0.14);
    --theme-button: #FFD400;
    --theme-button-hover: #F2C500;
    --theme-button-text: #080808;
}

#productDetailPage {
    --d-primary: #FFD400;
    --d-primary-light: #FFF36A;
    --d-card: rgba(18, 18, 18, 0.7);
    --d-element: rgba(28, 28, 28, 0.6);
    --d-border: rgba(43, 43, 43, 0.5);
    --d-border-light: rgba(61, 61, 61, 0.3);
    --d-border-hover: rgba(255, 212, 0, 0.4);
    --d-base: #080808;
    --d-text: #F7F4EA;
    --d-muted: #98958D;
    --d-button: #FFD400;
    --d-button-hover: #F2C500;
    --d-button-text: #080808;
}

/* ===== Show/Hide ===== */
#productDetailPage.detail-hidden { display: none !important; }
body.detail-page-open { overflow: hidden; }
body.detail-page-open #productListPage { display: none !important; }
body.detail-page-open #header { display: none !important; }
body.detail-page-open .topbar { display: none !important; }

/* ===== Shell ===== */
#productDetailPage {
    width: 100%;
    max-width: 100vw;
    min-height: 100vh;
    overflow-x: hidden;
    background: linear-gradient(to bottom, #080808 0%, #0C0C0C 100%);
    color: var(--d-text);
    font-family: 'Inter', sans-serif;
}
#productDetailPage * { box-sizing: border-box; }

.detail-shell {
    width: min(100%, 1280px);
    margin: 0 auto;
}

/* ===== Header ===== */
.detail-header {
    position: sticky;
    top: 0;
    z-index: 70;
    background: rgba(8, 8, 8, 0.85);
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    border-bottom: 1px solid var(--d-border);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
}

.detail-header-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
}

.detail-back-btn {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    color: var(--d-text);
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}
.detail-back-btn:hover { background: var(--d-primary-alpha); color: var(--d-primary-light); }

.detail-brand-link {
    display: none;
    flex-shrink: 0;
    text-decoration: none;
}
@media (min-width: 640px) { .detail-brand-link { display: flex; align-items: center; gap: 8px; } }

#detailBrandName {
    color: var(--d-primary-light);
    font-weight: 800;
    font-size: 1.25rem;
    letter-spacing: 0.02em;
}

.detail-search-form {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    height: 48px;
    background: var(--d-element);
    border: 1px solid var(--d-border-light);
    border-radius: 999px;
    overflow: hidden;
}

#detailSearchInput {
    width: 100%;
    height: 100%;
    padding: 0 16px;
    min-width: 0;
    background: transparent;
    border: none;
    outline: none;
    color: var(--d-text);
    font-size: 0.95rem;
    font-family: inherit;
}
#detailSearchInput::placeholder { color: #6b7280; }

.detail-search-form button {
    flex-shrink: 0;
    height: 40px;
    width: 48px;
    margin-right: 6px;
    background: var(--d-button);
    border: none;
    border-radius: 50%;
    color: var(--d-button-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    transition: transform 0.15s ease;
}
.detail-search-form button:active { transform: scale(0.95); }

.detail-share-btn {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    background: var(--d-element);
    border: 1px solid var(--d-primary);
    border-radius: 50%;
    color: var(--d-primary-light);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all 0.15s ease;
}
.detail-share-btn:active { transform: scale(0.95); }

/* ===== Main ===== */
.detail-main-wrap {
    padding: 24px;
}
@media (min-width: 768px) { .detail-main-wrap { padding: 32px 24px; } }

/* ===== Panels ===== */
.detail-panel {
    background: var(--d-card);
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    border: 1px solid var(--d-border);
    border-radius: 18px;
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.18);
}

.detail-subpanel {
    background: var(--d-element);
    border: 1px solid var(--d-border-light);
    border-radius: 14px;
}

.detail-title, .detail-strong, .detail-white { color: var(--d-text) !important; }
.detail-muted { color: var(--d-muted) !important; }

.detail-price {
    color: #FF4B3E;
    font-size: 1.875rem;
    font-weight: 800;
    text-shadow: 0 0 14px rgba(255, 75, 62, 0.25);
}

.detail-accent-bg {
    background: var(--d-button);
    color: var(--d-button-text);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}
.detail-accent-bg:hover { background: var(--d-button-hover); }

.detail-accent-border {
    border-color: var(--d-primary);
    color: var(--d-primary-light);
}

.detail-subpanel:hover, .detail-panel:hover {
    border-color: var(--d-border-hover);
}

/* ===== Not Found ===== */
.detail-not-found {
    padding: 48px;
    text-align: center;
}
.detail-not-found h1 { color: var(--d-text); font-size: 1.5rem; font-weight: 800; margin-top: 16px; }
.detail-not-found-btn {
    margin-top: 24px;
    padding: 12px 24px;
    border-radius: 999px;
    font-weight: 700;
}

/* ===== Content Grid ===== */
.detail-content-grid {
    display: grid;
    gap: 20px;
    align-items: start;
}
@media (min-width: 1024px) {
    .detail-content-grid {
        grid-template-columns: minmax(0, 1.12fr) minmax(350px, 0.88fr);
        gap: 28px;
    }
}

.detail-left-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

/* ===== Gallery ===== */
.detail-gallery-panel { overflow: hidden; }

#detailMainImageWrap {
    position: relative;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    margin: 14px;
    border-radius: 16px;
    background: transparent;
    user-select: none;
    cursor: grab;
}

#detailMainGalleryViewport {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #ffffff;
    border-radius: 16px;
}

#detailMainGalleryTrack {
    display: flex;
    height: 100%;
    transform: translate3d(0, 0, 0);
    transition: transform 320ms cubic-bezier(0.22, 0.61, 0.36, 1);
    will-change: transform;
}

.detail-main-slide {
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    overflow: hidden;
}

.detail-main-slide-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #ffffff;
    border-radius: 16px;
    pointer-events: none;
    -webkit-user-drag: none;
}

.detail-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.55);
    color: #ffffff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    z-index: 5;
    transition: all 0.2s ease;
}
.detail-nav-btn:hover { background: rgba(0, 0, 0, 0.75); }
.detail-prev-btn { left: 12px; }
.detail-next-btn { right: 12px; }

.detail-image-counter {
    position: absolute;
    right: 12px;
    top: 12px;
    background: rgba(0, 0, 0, 0.7);
    color: #ffffff;
    padding: 6px 12px;
    font-size: 0.8rem;
    font-weight: 700;
    border-radius: 999px;
}

.detail-gallery-dots {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
}
.detail-gallery-dots > * {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--d-border-hover);
    cursor: pointer;
    transition: all 0.2s ease;
}
.detail-dot-active {
    width: 22px !important;
    border-radius: 999px !important;
    background: var(--d-primary) !important;
}

#detailThumbs {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 10px;
    margin: 12px 14px 14px;
    background: var(--d-primary-alpha);
    border: 1px solid var(--d-border-light);
    border-radius: 20px;
    scroll-snap-type: x proximity;
}
#detailThumbs::-webkit-scrollbar { display: none; }
#detailThumbs { scrollbar-width: none; }

#detailThumbs > button {
    flex: 0 0 96px;
    width: 96px;
    height: 96px;
    border-radius: 14px;
    border: 2px solid transparent;
    overflow: hidden;
    cursor: pointer;
    scroll-snap-align: start;
    background: transparent;
    padding: 0;
    transition: all 0.2s ease;
}
#detailThumbs > button:hover { border-color: var(--d-border-hover); }

.detail-thumb-active {
    border-color: var(--d-primary) !important;
    box-shadow: 0 0 0 3px var(--d-primary-alpha) !important;
}

.detail-thumb-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 11px;
}

/* ===== Aside ===== */
.detail-aside {
    padding: 24px;
}
@media (min-width: 1024px) {
    .detail-aside {
        position: sticky;
        top: 92px;
    }
}

.detail-breadcrumb {
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 16px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#detailTitle {
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1.3;
    word-break: break-word;
    color: var(--d-text);
}
@media (min-width: 640px) { #detailTitle { font-size: 1.875rem; } }

#detailPrice { margin-top: 20px; }

.detail-desktop-actions { margin-top: 24px; }

.detail-buy-btn {
    width: 100%;
    min-height: 56px;
    font-size: 1.1rem;
    font-weight: 800;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform 0.15s ease;
}
.detail-buy-btn:active { transform: scale(0.98); }

.detail-weidian-btn {
    width: 100%;
    margin-top: 12px;
    min-height: 48px;
    border-radius: 999px;
    font-weight: 800;
    color: var(--d-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}
.detail-weidian-btn:hover { border-color: var(--d-primary); }

.detail-weidian-icon {
    width: 24px;
    height: 24px;
    background: #dc2626;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 0.8rem;
}

.detail-tips-wrap {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--d-border);
}

.detail-tips-content {
    padding: 16px;
    color: var(--d-muted);
    font-size: 0.875rem;
    line-height: 1.6;
    border-radius: 14px;
}

.detail-desc-title {
    color: var(--d-text);
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 8px;
}

/* ===== Guides ===== */
.detail-guide-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.detail-guide-card {
    overflow: hidden;
    border: 1px solid var(--d-border-light);
    border-radius: 8px;
    background: var(--d-card);
}

.detail-guide-toggle {
    width: 100%;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border: none;
    background: transparent;
    color: var(--d-text);
    text-align: left;
    font-size: 0.875rem;
    font-weight: 800;
    cursor: pointer;
}
.detail-guide-toggle:hover { background: var(--d-primary-alpha); color: var(--d-primary-light); }

.detail-guide-toggle-title {
    display: flex;
    align-items: center;
    gap: 9px;
}
.detail-guide-toggle-title > i { font-size: 1.2rem; }

.detail-guide-caret { transition: transform 180ms ease; }
.detail-guide-toggle[aria-expanded="true"] .detail-guide-caret { transform: rotate(180deg); }

.detail-guide-article {
    max-height: 0;
    overflow: hidden;
    transition: max-height 300ms ease;
    padding: 0 16px;
    color: #cbd5e1;
    font-size: 0.875rem;
    line-height: 1.7;
}
.detail-guide-toggle[aria-expanded="true"] + .detail-guide-article {
    max-height: 600px;
    overflow-y: auto;
    padding: 4px 16px 18px;
    border-top: 1px solid var(--d-border);
}

/* ===== QC Section ===== */
.detail-qc-section { margin-top: 28px; }

.detail-qc-heading { padding: 0 18px; margin-bottom: 16px; }
.detail-qc-heading h2 { font-size: 1.5rem; font-weight: 800; }
@media (min-width: 640px) { .detail-qc-heading h2 { font-size: 1.875rem; } }

#detailQcGrid {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 0 18px;
}

.detail-qc-card {
    width: 100%;
    overflow: hidden;
    border: 1px solid var(--d-border-light);
    border-radius: 22px;
    background: var(--d-primary-alpha);
    padding: 7px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.14);
}

.detail-grid-image {
    display: block;
    width: 100%;
    height: auto;
    object-fit: contain;
    background: #ffffff;
    border-radius: 16px;
}

/* ===== Bottom Bar (Mobile) ===== */
.detail-bottom-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 85;
    background: rgba(12, 12, 12, 0.92);
    backdrop-filter: blur(16px);
    border-top: 1px solid var(--d-border);
    padding: 12px 16px;
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 -12px 30px rgba(0, 0, 0, 0.3);
}

.detail-bottom-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.detail-bottom-share-btn {
    width: 48px;
    min-width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
}

.detail-bottom-buy-btn {
    min-width: 132px;
    max-width: calc(100vw - 184px);
    height: 48px;
    padding: 0 22px;
    border-radius: 999px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: transform 0.15s ease;
}
.detail-bottom-buy-btn:active { transform: scale(0.95); }

#detailBottomBuyText {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: clamp(11px, 3.6vw, 16px);
}

@media (min-width: 768px) {
    .detail-bottom-bar { display: none !important; }
}

/* ===== Mobile ===== */
@media (max-width: 767px) {
    .detail-header-inner { padding: 12px 14px; }
    .detail-share-btn { display: none; }
    .detail-main-wrap { padding: 0; }
    .detail-desktop-actions { display: none !important; }
    .detail-prev-btn, .detail-next-btn { display: none !important; }
    #detailMainImageWrap { margin: 12px; border-radius: 14px; }
    #detailMainGalleryViewport, .detail-main-slide-image { border-radius: 14px; }
    #detailThumbs { margin: 10px 12px 12px; padding: 8px; border-radius: 18px; }
    #detailThumbs > button {
        flex: 0 0 28%;
        width: 28%;
        height: auto;
        aspect-ratio: 1 / 1;
        min-width: 78px;
        max-width: 104px;
        border-radius: 13px;
    }
    #productDetailPage { padding-bottom: 88px; }
    .detail-shell { width: 100%; }
    .detail-panel { border-radius: 0 !important; border-left: 0 !important; border-right: 0 !important; }
    .detail-aside { margin-top: 0; padding-bottom: 24px; }
    .detail-qc-section { margin-top: 24px; }
    .detail-qc-heading, #detailQcGrid { padding-left: 14px; padding-right: 14px; }
    #detailQcGrid { gap: 14px; }
    .detail-qc-card { padding: 6px; border-radius: 19px; }
    .detail-grid-image { border-radius: 14px; }
}
