/* FxCart flat product interface v1 — square geometry, responsive full-width layout. */
:root {
    --fx-brand: #0052d9;
    --fx-brand-hover: #266fe8;
    --fx-text: #181818;
    --fx-text-secondary: #5e6673;
    --fx-border: #d9e0ea;
    --fx-border-light: #e8edf3;
    --fx-page: #f5f7fa;
    --fx-panel: #fff;
    --fx-danger: #d54941;
    --fx-success: #2ba471;
}

body.fxcart-dialog-open {
    overflow: hidden;
}

.fxcart-notice-overlay {
    position: fixed;
    z-index: 10050;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(16, 27, 47, .62);
}

.fxcart-notice-overlay.is-hidden {
    display: none;
}

.fxcart-notice-panel {
    width: min(720px, 100%);
    max-height: min(760px, calc(100vh - 48px));
    overflow: hidden;
    border: 1px solid #cfd8e6;
    border-radius: 0 !important;
    outline: 0;
    background: #fff;
    box-shadow: 0 18px 50px rgba(9, 30, 66, .24);
}

.fxcart-notice-header,
.fxcart-notice-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.fxcart-notice-header {
    min-height: 58px;
    padding: 0 22px;
    border-bottom: 1px solid #dce3ec;
    background: var(--fx-brand);
    color: #fff;
}

.fxcart-notice-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.fxcart-notice-close {
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 0 !important;
    background: transparent;
    color: #fff;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}

.fxcart-notice-close:hover,
.fxcart-notice-close:focus-visible {
    background: rgba(255, 255, 255, .14);
    outline: 2px solid #fff;
    outline-offset: -2px;
}

.fxcart-notice-content {
    max-height: calc(100vh - 210px);
    overflow-y: auto;
    padding: 22px;
    color: #4b5565;
    font-size: 14px;
    line-height: 1.75;
}

.fxcart-notice-content p {
    margin: 0 0 14px;
}

.fxcart-notice-content a {
    color: var(--fx-brand);
    text-decoration: underline;
}

.fxcart-notice-content .notice-orange { color: #d46b08; }
.fxcart-notice-content .notice-blue { color: #0052d9; }
.fxcart-notice-content .notice-green { color: #168f5b; }
.fxcart-notice-content .notice-red { color: #c9353f; }

.fxcart-notice-command {
    margin-bottom: 14px;
    padding: 14px;
    border-left: 3px solid var(--fx-brand);
    background: #f3f6fa;
}

.fxcart-notice-command code {
    display: block;
    overflow-x: auto;
    color: #263445;
    white-space: nowrap;
}

.fxcart-notice-footer {
    min-height: 64px;
    padding: 12px 22px;
    border-top: 1px solid #dce3ec;
    background: #f7f9fc;
    color: #5e6673;
    font-size: 14px;
}

.fxcart-notice-confirm,
.stock-refresh-button,
.product-overview .retry-button,
.product-overview .view-detail-btn {
    min-height: 38px;
    border-radius: 0 !important;
    cursor: pointer;
}

.fxcart-notice-confirm,
.stock-refresh-button {
    padding: 0 20px;
    border: 1px solid var(--fx-brand);
    background: var(--fx-brand);
    color: #fff;
}

.fxcart-notice-confirm:hover,
.stock-refresh-button:hover {
    border-color: var(--fx-brand-hover);
    background: var(--fx-brand-hover);
}

.product-overview {
    min-height: calc(100vh - 64px);
    padding: 32px 0 64px !important;
    background: var(--fx-page);
}

.product-overview > .container {
    width: calc(100% - 64px) !important;
    max-width: none !important;
    margin: 0 32px !important;
    padding: 0 !important;
}

.product-page-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 32px;
    margin-bottom: 24px;
    padding: 24px 28px;
    border: 1px solid var(--fx-border);
    border-left: 4px solid var(--fx-brand);
    background: #fff;
}

.product-page-eyebrow {
    margin: 0 0 4px;
    color: var(--fx-brand);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1.6px;
}

.product-overview .page-title {
    margin: 0 !important;
    color: var(--fx-text);
    font-size: 30px !important;
    font-weight: 600;
    line-height: 1.35;
    text-align: left !important;
}

.page-subtitle {
    margin: 8px 0 0;
    color: var(--fx-text-secondary);
    font-size: 14px;
}

.stock-sync-panel {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 14px;
    flex: 0 0 auto;
}

.stock-sync-status {
    color: var(--fx-text-secondary);
    font-size: 13px;
    white-space: nowrap;
}

.stock-sync-status::before {
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-right: 7px;
    content: "";
    background: var(--fx-success);
    vertical-align: 1px;
}

.stock-sync-status.is-syncing::before {
    background: #e37318;
    animation: stockStatusPulse .8s ease-in-out infinite alternate;
}

.stock-sync-status.is-error::before {
    background: var(--fx-danger);
}

.stock-refresh-button:disabled {
    border-color: #b8c6dc;
    background: #b8c6dc;
    cursor: wait;
}

.product-overview .region-filter,
.product-overview .loading-state,
.product-overview .error-state,
.product-overview .empty-state,
.product-overview .product-card,
.product-overview .custom-select-display,
.product-overview .custom-select-options,
.product-overview .cycle-button,
.product-overview .retry-button,
.product-overview .view-detail-btn,
.product-overview select,
.product-overview button,
.product-overview input,
.product-overview .discount-badge,
.product-overview .cycle-tag,
.product-overview .trial-badge,
.product-overview .product-skeleton-card,
.product-overview .product-skeleton-title,
.product-overview .product-skeleton-line,
.product-overview .product-skeleton-button {
    border-radius: 0 !important;
}

.product-overview .region-filter {
    margin-bottom: 24px;
    border: 1px solid var(--fx-border);
    background: #fff;
    box-shadow: none !important;
}

.product-overview .filter-header {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) minmax(260px, 1fr) minmax(420px, 1.6fr);
    gap: 0;
    padding: 0 !important;
    border-bottom: 1px solid var(--fx-border-light);
}

.product-overview .filter-row {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 70px;
    margin: 0 !important;
    padding: 14px 20px;
    border-right: 1px solid var(--fx-border-light);
}

.product-overview .filter-row:last-child {
    border-right: 0;
}

.product-overview .region-label,
.product-overview .zone-label,
.product-overview .cycle-label {
    flex: 0 0 auto;
    margin: 0 !important;
    color: #303846;
    font-size: 14px;
    font-weight: 600;
}

.product-overview .custom-select-container {
    flex: 1 1 auto;
    min-width: 0 !important;
    margin: 0 !important;
}

.product-overview .custom-select-display {
    min-width: 0 !important;
    width: 100%;
    min-height: 40px;
    padding: 9px 36px 9px 12px;
    border: 1px solid #c9d3e0;
    background: #fff;
    box-shadow: none !important;
    transform: none !important;
}

.product-overview .custom-select-display::after {
    position: absolute;
    top: 50%;
    right: 14px;
    width: 7px;
    height: 7px;
    border-right: 1px solid #5e6673;
    border-bottom: 1px solid #5e6673;
    content: "";
    transform: translateY(-70%) rotate(45deg);
}

.product-overview .custom-select-options {
    top: calc(100% - 1px);
    border: 1px solid #c9d3e0;
    box-shadow: 0 8px 20px rgba(20, 42, 74, .12);
    transform: none !important;
}

.product-overview .custom-select-option {
    padding: 10px 12px;
}

.product-overview .billing-cycle-buttons {
    gap: 8px;
}

.product-overview .cycle-button {
    min-height: 38px;
    padding: 0 15px;
    border: 1px solid #c9d3e0;
    background: #fff;
    box-shadow: none !important;
    transform: none !important;
}

.product-overview .cycle-button.active {
    border-color: var(--fx-brand);
    background: var(--fx-brand);
    color: #fff;
}

.product-overview .filter-tip {
    padding: 12px 20px;
    border: 0;
    background: #f4f7fb;
}

.product-overview .tip-icon {
    background: var(--fx-brand);
    color: #fff;
}

.product-overview .product-list,
.product-overview .product-skeleton-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
    gap: 16px;
    margin-top: 0;
}

.product-overview .product-card {
    display: flex;
    flex-direction: column;
    min-height: 280px;
    padding: 22px;
    border: 1px solid var(--fx-border);
    border-top: 3px solid #97b5e6;
    background: #fff;
    box-shadow: none !important;
    transform: none !important;
}

.product-overview .product-card:hover {
    border-color: var(--fx-brand);
    border-top-color: var(--fx-brand);
    box-shadow: 0 8px 22px rgba(30, 70, 126, .10) !important;
}

.product-overview .product-header {
    min-height: 48px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--fx-border-light);
}

.product-overview .product-name {
    color: var(--fx-text);
    font-size: 17px;
    font-weight: 600;
}

.product-overview .product-type {
    padding: 3px 8px;
    background: #e8f1ff;
    color: var(--fx-brand);
}

.product-overview .product-description {
    flex: 1 1 auto;
    margin: 16px 0;
    max-height: none !important;
    overflow: visible !important;
}

.product-overview .product-description pre {
    max-height: 116px;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    color: var(--fx-text-secondary);
}

/* 下拉菜单越过筛选框和商品区显示，避免被后续内容裁切。 */
.product-overview .region-filter,
.product-overview .filter-header,
.product-overview .filter-row {
    overflow: visible !important;
}

.product-overview .region-filter {
    position: relative;
    z-index: 30;
}

.product-overview .filter-row {
    position: relative;
}

.product-overview .custom-select-container {
    z-index: 1;
}

.product-overview .custom-select-container.open {
    z-index: 1200 !important;
}

.product-overview .custom-select-options,
.product-overview .custom-select-options.open {
    z-index: 1201 !important;
}

.product-overview #product-container,
.product-overview .loading-state,
.product-overview .error-state,
.product-overview .empty-state {
    position: relative;
    z-index: 1;
}

.product-overview .product-info {
    gap: 10px 16px;
    margin-bottom: 18px;
}

.product-overview .stock-info {
    padding: 3px 8px;
    border-left: 2px solid var(--fx-success);
    background: #eef8f3;
}

.product-overview .stock-info.is-low-stock {
    border-left-color: #e37318;
    background: #fff5e8;
}

.product-overview .stock-info.is-out-of-stock {
    border-left-color: var(--fx-danger);
    background: #fff0ed;
}

.product-overview .product-actions {
    margin-top: auto;
}

.product-overview .view-detail-btn {
    justify-content: center;
    min-width: 116px;
    padding: 8px 16px;
    border: 1px solid var(--fx-brand);
    background: var(--fx-brand);
    color: #fff;
}

.product-overview .view-detail-btn:hover {
    border-color: var(--fx-brand-hover);
    background: var(--fx-brand-hover);
}

.product-overview .view-detail-btn.is-disabled {
    border-color: #c7cdd6;
    background: #e7e9ed;
    color: #8b929d;
    cursor: not-allowed;
    pointer-events: none;
}

.product-overview .loading-state,
.product-overview .error-state,
.product-overview .empty-state {
    border: 1px solid var(--fx-border);
    background: #fff;
    box-shadow: none !important;
}

.product-overview .retry-button {
    border: 1px solid var(--fx-brand);
    background: var(--fx-brand);
}

.product-overview .product-skeleton-card {
    min-height: 280px;
}

@keyframes stockStatusPulse {
    from { opacity: .35; }
    to { opacity: 1; }
}

@media (max-width: 1180px) {
    .product-overview .filter-header {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .product-overview .billing-cycle-row {
        grid-column: 1 / -1;
        border-top: 1px solid var(--fx-border-light);
    }
}

@media (max-width: 767px) {
    .fxcart-notice-overlay {
        padding: 12px;
    }

    .fxcart-notice-header,
    .fxcart-notice-content,
    .fxcart-notice-footer {
        padding-right: 16px;
        padding-left: 16px;
    }

    .fxcart-notice-footer,
    .product-page-heading,
    .stock-sync-panel {
        align-items: stretch;
        flex-direction: column;
    }

    .product-overview {
        padding: 16px 0 40px !important;
    }

    .product-overview > .container {
        width: calc(100% - 24px) !important;
        margin: 0 12px !important;
    }

    .product-page-heading {
        align-items: stretch;
        gap: 18px;
        padding: 20px 16px;
    }

    .product-overview .page-title {
        font-size: 25px !important;
    }

    .stock-refresh-button {
        width: 100%;
    }

    .product-overview .filter-header {
        display: block;
    }

    .product-overview .filter-row {
        display: block;
        min-height: 0;
        padding: 15px 14px;
        border-right: 0;
        border-bottom: 1px solid var(--fx-border-light);
    }

    .product-overview .filter-row:last-child {
        border-bottom: 0;
    }

    .product-overview .region-label,
    .product-overview .zone-label,
    .product-overview .cycle-label {
        display: block;
        margin-bottom: 9px !important;
    }

    .product-overview .custom-select-container {
        display: block;
        width: 100%;
    }

    .product-overview .custom-select-options {
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
    }

    .product-overview .billing-cycle-buttons {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .product-overview .cycle-button {
        width: 100%;
        padding: 0 8px;
        white-space: normal;
    }

    .product-overview .product-list,
    .product-overview .product-skeleton-list {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    .stock-sync-status.is-syncing::before,
    .product-overview .fade-in,
    .product-overview .product-skeleton-title,
    .product-overview .product-skeleton-line,
    .product-overview .product-skeleton-button {
        animation: none !important;
    }
}
