/**
 * Purchase History Indicator Styles
 * Displays purchase history on single product pages
 *
 * @package YSC
 * @since 2.7.0
 */

.ysc-purchase-history-indicator {
    background: linear-gradient(135deg, #f0f9f0 0%, #e8f5e9 100%);
    border: 1px solid #c8e6c9;
    border-left: 4px solid #4caf50;
    border-radius: 4px;
    padding: 12px 16px;
    margin: 15px 0;
    font-size: 14px;
}

.ysc-purchase-history-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    color: #2e7d32;
}

.ysc-purchase-history-header .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
    color: #4caf50;
}

.ysc-purchase-history-header strong {
    font-weight: 600;
    font-size: 14px;
}

.ysc-purchase-history-details {
    list-style: none;
    margin: 0;
    padding: 0;
}

.ysc-purchase-history-details li {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    border-bottom: 1px dashed #c8e6c9;
    font-size: 13px;
    color: #555;
}

.ysc-purchase-history-details li:last-child {
    border-bottom: none;
}

.ysc-purchase-history-details .label {
    color: #666;
}

.ysc-purchase-history-details .value {
    font-weight: 500;
    color: #333;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .ysc-purchase-history-indicator {
        background: linear-gradient(135deg, #1b3d1b 0%, #1e4620 100%);
        border-color: #2e7d32;
    }

    .ysc-purchase-history-header {
        color: #81c784;
    }

    .ysc-purchase-history-details li {
        border-color: #2e7d32;
        color: #ccc;
    }

    .ysc-purchase-history-details .label {
        color: #aaa;
    }

    .ysc-purchase-history-details .value {
        color: #fff;
    }
}

/* ---------------------------------------------------------------------------
 * Purchase History Warning Modal (B2C only — injected by purchase-history-warning.js)
 * v2.39.0
 * ------------------------------------------------------------------------- */
.ysc-ph-modal[hidden] { display: none !important; }

.ysc-ph-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.ysc-ph-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    animation: ysc-ph-fade 160ms ease-out;
}

.ysc-ph-modal__dialog {
    position: relative;
    background: #fff;
    color: #1a1a1a;
    width: calc(100% - 32px);
    max-width: 440px;
    padding: 32px 28px 24px;
    border-radius: 10px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
    text-align: center;
    animation: ysc-ph-pop 180ms cubic-bezier(0.2, 0.9, 0.3, 1.1);
}

.ysc-ph-modal__icon {
    font-size: 44px;
    line-height: 1;
    color: #f57c00;
    margin-bottom: 12px;
}

.ysc-ph-modal__title {
    margin: 0 0 12px;
    font-size: 20px;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.3;
}

.ysc-ph-modal__body {
    margin: 0 0 24px;
    font-size: 15px;
    line-height: 1.55;
    color: #444;
}

.ysc-ph-modal__body strong {
    color: #1a1a1a;
}

.ysc-ph-modal__actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.ysc-ph-modal__cancel,
.ysc-ph-modal__confirm {
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    padding: 10px 20px;
    border-radius: 6px;
    border: 1px solid transparent;
    cursor: pointer;
    min-width: 120px;
    transition: background 120ms ease, border-color 120ms ease, color 120ms ease, transform 100ms ease;
}

.ysc-ph-modal__cancel {
    background: transparent;
    border-color: #bbb;
    color: #444;
}
.ysc-ph-modal__cancel:hover,
.ysc-ph-modal__cancel:focus {
    background: #f4f4f4;
    border-color: #888;
    outline: none;
}

.ysc-ph-modal__confirm {
    background: #f57c00;
    color: #fff;
    border-color: #f57c00;
}
.ysc-ph-modal__confirm:hover,
.ysc-ph-modal__confirm:focus {
    background: #ef6c00;
    border-color: #ef6c00;
    outline: none;
}
.ysc-ph-modal__confirm:active {
    transform: translateY(1px);
}

body.ysc-ph-modal-open {
    overflow: hidden;
}

@keyframes ysc-ph-fade {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes ysc-ph-pop {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0)  scale(1);    }
}

/* Mobile: edge-to-edge for small viewports */
@media (max-width: 480px) {
    .ysc-ph-modal__dialog {
        width: 100%;
        max-width: none;
        margin: 0;
        border-radius: 0;
        min-height: 100vh;
        display: flex;
        flex-direction: column;
        justify-content: center;
        padding: 32px 24px;
    }
    .ysc-ph-modal__actions {
        flex-direction: column-reverse;
    }
    .ysc-ph-modal__cancel,
    .ysc-ph-modal__confirm {
        width: 100%;
    }
}

/* Dark mode modal */
@media (prefers-color-scheme: dark) {
    .ysc-ph-modal__dialog {
        background: #222;
        color: #f0f0f0;
        box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
    }
    .ysc-ph-modal__title {
        color: #fff;
    }
    .ysc-ph-modal__body,
    .ysc-ph-modal__cancel {
        color: #cfcfcf;
    }
    .ysc-ph-modal__body strong {
        color: #fff;
    }
    .ysc-ph-modal__cancel {
        border-color: #555;
    }
    .ysc-ph-modal__cancel:hover,
    .ysc-ph-modal__cancel:focus {
        background: #2e2e2e;
        border-color: #888;
    }
}

/* ---------------------------------------------------------------------------
 * Order History Panel — persistent per-customer display (v2.40.0)
 * B2C: slim one-liner + optional <details> expand
 * B2B: Word & Sound-style grid (IBM Plex Mono numerics, uppercase labels)
 * Spec: docs/superpowers/specs/2026-04-21-order-history-panel-design.md
 * ------------------------------------------------------------------------- */

.ysc-oh-panel {
    margin: 10px 0;
}

/* B2C slim panel */
.ysc-oh-panel--b2c {
    font-size: 13px;
    color: #888;
    line-height: 1.4;
}

.ysc-oh-panel--b2c .ysc-oh-panel__summary {
    display: block;
}

.ysc-oh-details {
    margin-top: 4px;
}

.ysc-oh-details > summary {
    cursor: pointer;
    color: #aaa;
    font-size: 12px;
    user-select: none;
    list-style: none;
}

.ysc-oh-details > summary::-webkit-details-marker {
    display: none;
}

.ysc-oh-details > summary::before {
    content: '+ ';
}

.ysc-oh-details[open] > summary::before {
    content: '\2212 ';
}

.ysc-oh-details ul {
    list-style: none;
    margin: 5px 0 0 12px;
    padding: 0;
}

.ysc-oh-details ul li {
    font-size: 12px;
    color: #999;
    padding: 1px 0;
}

/* B2B: 4-cell Word & Sound grid */
.ysc-oh-panel--b2b {
    display: flex;
    flex-wrap: nowrap;
    margin: 12px 0;
    border: 1px solid #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
}

.ysc-oh-cell {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 8px 10px;
    background: #f9f9f9;
    border-right: 1px solid #e0e0e0;
    min-width: 0;
}

.ysc-oh-cell:last-child {
    border-right: none;
}

.ysc-oh-cell__label {
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #999;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ysc-oh-cell__value {
    font-family: 'IBM Plex Mono', 'Courier New', monospace;
    font-size: 18px;
    font-weight: 500;
    color: #1a1a1a;
    line-height: 1;
}

.ysc-oh-cell__value--date {
    font-size: 12px;
    letter-spacing: 0.02em;
    line-height: 1.4;
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
    .ysc-oh-panel--b2c {
        color: #666;
    }

    .ysc-oh-details > summary,
    .ysc-oh-details ul li {
        color: #555;
    }

    .ysc-oh-panel--b2b {
        border-color: #333;
    }

    .ysc-oh-cell {
        background: #1c1c1c;
        border-color: #333;
    }

    .ysc-oh-cell__label {
        color: #555;
    }

    .ysc-oh-cell__value {
        color: #d0d0d0;
    }
}

/* Mobile: B2B grid collapses to 2-col */
@media (max-width: 480px) {
    .ysc-oh-panel--b2b {
        flex-wrap: wrap;
    }

    .ysc-oh-cell {
        flex-basis: calc(50% - 1px);
        border-bottom: 1px solid #e0e0e0;
    }

    .ysc-oh-cell:nth-child(even) {
        border-right: none;
    }

    .ysc-oh-cell:last-child,
    .ysc-oh-cell:nth-last-child(2):nth-child(odd) {
        border-bottom: none;
    }
}

@media (max-width: 480px) and (prefers-color-scheme: dark) {
    .ysc-oh-cell {
        border-bottom-color: #333;
    }
}

