/* SHL Promo Engine - Base Styles v5.2.1 */

.shl-promo-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
    text-align: center;
    line-height: 1.5;

    /* Global Icon Geometry Defaults */
    --shl-icon-size: 80px;
    --shl-icon-top: 0;
    --shl-icon-left: 0;
    --shl-icon-radius: 50%;
    --shl-icon-border: 4px;
    --shl-icon-border-color: #dadada;
    --shl-icon-clip: none;
}

.shl-gsr-header {
    display: flex;
    align-items: center;
    gap: 18px;
    text-align: left;
    position: relative;
}

/* v5.2.9 SHADOW SHELL
   DARKER SHADOW: Increased opacity from 0.55 to 0.75 for more depth.
*/
.shl-gsr-icon {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    background: transparent !important;
    clip-path: none !important;
    
    /* Darker, aggressive shadow for high-end contrast */
    filter: drop-shadow(0 8px 16px rgba(0,0,0,0.65));
    
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible !important; 
    flex-shrink: 0;
    z-index: 10;
    width: var(--shl-icon-size, 80px);
    height: var(--shl-icon-size, 80px);
}

/* v5.2.9 CONTENT LAYER
   THICKER BORDER: Increased moat from 4px to 10px.
*/
.shl-gsr-icon-inner {
    width: 100% !important;
    height: 100% !important;
    background: #FFFFFF !important;
    clip-path: var(--shl-icon-clip) !important;
    padding: var(--shl-icon-moat, 3px) !important; /* Crisp 3px premium white border for 64px layouts, adjustable via moat variable */
    box-sizing: border-box !important;
    
    /* AA-Hardening remains active */
    outline: 1px solid #FFFFFF;
    outline-offset: -1px;
    
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden !important;
}

/* v5.2.3 IMAGE LAYER
   Slight scale increase to bridge the gap and remove the black ring.
*/
.shl-gsr-icon img, 
.shl-gsr-icon svg {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    background: transparent !important; /* Removed white background here */
    clip-path: var(--shl-icon-clip) !important;
    
    /* Scale fix: Expands image 1% to seal the edge gap */
    transform: scale(1.02);
    display: block;
}


.shl-gsr-info {
    flex-grow: 1;
}

.shl-gsr-title {
    margin: 0 0 4px 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--shl-text) !important;
    line-height: 1.2;
}

.shl-gsr-dev {
    display: block;
    font-size: 14px;
    color: var(--shl-text-dim) !important;
}

.shl-btn-primary {
    background-color: var(--shl-primary);
    color: #ffffff;
    border: none;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    width: 100%;
}

.shl-btn-primary:hover { opacity: 0.9; }

.shl-btn-primary:disabled,
.shl-btn-disabled {
    background-color: #666666;
    cursor: not-allowed;
    opacity: 0.6;
}

.shl-success-box {
    background-color: rgba(var(--shl-primary-rgb), 0.05);
    border: 1px solid var(--shl-border);
    border-radius: 8px;
    padding: 24px 20px;
    text-align: center;
    color: var(--shl-text);
    margin-bottom: 20px;
}

/* PRESERVED: Expiration & Pulse Logic */
.shl-exp-text {
    font-size: 13px;
    color: var(--shl-text-dim);
    margin-top: 10px;
    font-weight: 500;
}
.shl-exp-warning { color: #FF9F0A !important; }
.shl-exp-urgent {
    color: #FF453A !important;
    font-weight: 700;
}
.shl-pulse { animation: shl-pulse-anim 2s infinite; }

.shl-redemption-status {
    margin-top: 8px;
    animation: shl-fade-in 0.5s ease-out;
}

.shl-promo-footer {
    text-align: right;
    margin-top: 6px;
}

.shl-promo-count {
    font-size: 14px;
    color: var(--shl-text-dim) !important;
}

.shl-info-tip {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.shl-info-tip svg {
    transition: transform 0.2s ease, color 0.2s ease;
}

.shl-info-tip:hover svg {
    transform: scale(1.2);
    color: var(--shl-primary);
}

@keyframes shl-pulse-anim {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.shl-code-display {
    font-family: 'Courier New', Courier, monospace;
    font-size: 20px;
    font-weight: 700;
    background: #000000;
    color: #FFFFFF;
    padding: 8px 16px;
    border-radius: 6px;
    letter-spacing: 2px;
    display: inline-block;
    word-break: break-all;
    margin-top: 5px;
    border: 1px solid #444;
    min-width: 180px;
}

.shl-action-buttons {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    justify-content: center;
    align-items: stretch;
    width: 100%;
}

/* PRESERVED: Copy Button Styles */
.shl-btn-copy {
    background-color: #3A3A3C;
    color: #ffffff;
    border: none;
    padding: 12px 24px;
    font-size: 16px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    flex: 1 1 0;
    transition: all 0.2s ease;
    white-space: nowrap;
    text-align: center;
}

.shl-btn-copy:hover {
    background-color: #4A4A4C;
    transform: translateY(-1px);
}

.shl-btn-redeem {
    background-color: #00875F;
    color: #ffffff !important;
    text-decoration: none !important;
    padding: 12px 24px;
    font-size: 16px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    flex: 1 1 0;
    text-align: center;
    transition: all 0.2s ease;
    box-sizing: border-box;
    white-space: nowrap;
}

.shl-btn-redeem:hover {
    background-color: #006b4b;
    color: #ffffff !important;
    transform: translateY(-1px);
}

/* PRESERVED: Link & Branding Hover Effects */
.shl-gsr-title a {
    color: inherit !important;
    text-decoration: none !important;
    transition: color 0.2s ease, opacity 0.2s ease;
}
.shl-gsr-title a:hover {
    opacity: 0.85;
    text-decoration: underline !important;
    text-underline-offset: 4px;
}
.shl-branding-link {
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-origin: left center;
}
.shl-branding-link:hover { transform: scale(1.05); }

.shl-zoomable {
    cursor: zoom-in;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.shl-zoomable:hover { transform: scale(1.05); }

/* Modal System (Consolidated Logic) */
.shl-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000001; 
    display: none; 
    align-items: center;
    justify-content: center;
    cursor: pointer; 
    pointer-events: auto !important; 
    animation: shl-fade-in 0.3s ease-out;
}

.shl-modal-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    flex-direction: column;
    background: var(--shl-surface, #1C1C1E);
    padding: 30px;
    border-radius: 24px;
    border: 1px solid var(--shl-border, #3A3A3C);
    box-shadow: 0 20px 50px rgba(0,0,0,0.6);
    color: var(--shl-text, #FFFFFF);
    cursor: default; 
    z-index: 1000001; 
}

.shl-help-modal h3, 
.shl-help-modal strong {
    color: #F5F5F7 !important;
    font-weight: 700;
}

.shl-help-modal h3 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 22px;
}

/* PRESERVED: Focus & Close Button Hardening */
.shl-modal-content:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(var(--shl-primary-rgb), 0.5), 0 20px 50px rgba(0,0,0,0.6);
}

.shl-modal-close:focus,
.shl-icon-modal-close:focus {
    outline: 2px solid var(--shl-primary);
    outline-offset: 4px;
}

/* Help Modal Action Link & Status */
.shl-modal-claim-container {
    margin-top: 15px;
    text-align: center;
}

.shl-modal-claim {
    color: var(--shl-primary);
    text-decoration: underline;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
    font-size: 14px;
}

.shl-modal-claim:hover {
    opacity: 0.8;
}

.shl-modal-status {
    margin-top: 15px;
    padding: 12px;
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.4;
    display: none;
    text-align: center;
    border: 1px solid rgba(255,255,255,0.1);
}

/* Icon-Specific Content Sizing + Forced Dark (always appears on dark backdrop) */
.shl-icon-modal-content {
    padding: 25px;
    min-width: 300px;
    min-height: 300px;
    align-items: center;
    justify-content: center;
    /* The icon lightbox is always dark — it sits on a dark blurred overlay,
       so we hard-code these regardless of the campaign's theme setting. */
    background: #1C1C1E !important;
    border-color: #3A3A3C !important;
    color: #FFFFFF !important;
}

.shl-icon-modal-content img,
.shl-icon-modal-content svg {
    width: 450px !important;
    height: 450px !important;
    max-width: 80vw !important;
    max-height: 80vh !important;
    object-fit: cover !important;
    border-radius: 12px;
}

.shl-icon-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    color: #FFFFFF !important;
    font-size: 32px;
    /* !important guards against WP theme button resets adding a white background box */
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    cursor: pointer;
    line-height: 1;
    transition: transform 0.2s ease;
    z-index: 20;
    padding: 10px;
}

.shl-icon-modal-close:hover { transform: scale(1.1); }

@keyframes shl-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Mobile Responsive Stacking */
@media (max-width: 600px) {
    .shl-promo-container {
        margin-top: 100px;
        padding: 0 15px;
        --shl-icon-size: 180px;
        --shl-icon-top: 0;
        --shl-icon-left: 0;
    }
    .shl-gsr-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
        min-height: 0;
        gap: 10px;
        margin-bottom: 25px;
    }
    .shl-gsr-icon {
        position: relative;
        top: var(--shl-icon-top);
        left: var(--shl-icon-left);
        margin: -110px auto 15px auto;
        width: var(--shl-icon-size);
        height: var(--shl-icon-size);
    }
    .shl-gsr-info { margin-left: 0; }
    .shl-gsr-title { font-size: 20px; }
}

/* Stacking Layer Enforcement: Ensure all card contents stack above tactile textures */
.shl-promo-container > * {
    position: relative;
    z-index: 2;
}

/* --- Icon Shape System (High Fidelity Geometry) --- */
.shl-shape-circle   { --shl-icon-clip: circle(50% at 50% 50%) !important; }
.shl-shape-square   { --shl-icon-clip: none !important; }
.shl-shape-rounded  { --shl-icon-clip: inset(0% round 12%) !important; }

/* True Superellipse Squircle (60-point High Density Polygon) */
.shl-shape-squircle { 
    --shl-icon-clip: polygon(
        100.00% 50.00%, 100.00% 55.26%, 99.97% 60.62%, 99.86% 66.20%, 99.52% 72.05%, 98.70% 78.12%, 97.02% 84.16%, 94.07% 89.68%, 89.68% 94.07%, 84.16% 97.02%, 78.12% 98.70%, 72.05% 99.52%, 66.20% 99.86%, 60.62% 99.97%, 55.26% 100.00%, 50.00% 100.00%, 44.74% 100.00%, 39.38% 99.97%, 33.80% 99.86%, 27.95% 99.52%, 21.88% 98.70%, 15.84% 97.02%, 10.32% 94.07%, 5.93% 89.68%, 2.98% 84.16%, 1.30% 78.12%, 0.48% 72.05%, 0.14% 66.20%, 0.03% 60.62%, 0.00% 55.26%, 0.00% 50.00%, 0.00% 44.74%, 0.03% 39.38%, 0.14% 33.80%, 0.48% 27.95%, 1.30% 21.88%, 2.98% 15.84%, 5.93% 10.32%, 10.32% 5.93%, 15.84% 2.98%, 21.88% 1.30%, 27.95% 0.48%, 33.80% 0.14%, 39.38% 0.03%, 44.74% 0.00%, 50.00% 0.00%, 55.26% 0.00%, 60.62% 0.03%, 66.20% 0.14%, 72.05% 0.48%, 78.12% 1.30%, 84.16% 2.98%, 89.68% 5.93%, 94.07% 10.32%, 97.02% 15.84%, 98.70% 21.88%, 99.52% 27.95%, 99.86% 33.80%, 99.97% 39.38%, 100.00% 44.74%
    ) !important;
}

/* Subtle 12-Point Scalloped Wavy (64-point High Density Polygon) */
.shl-shape-wavy { 
    --shl-icon-clip: polygon(
        97.60% 50.00%, 98.11% 54.74%, 98.69% 59.69%, 97.76% 64.49%, 95.09% 68.67%, 92.06% 72.48%, 89.87% 76.64%, 88.08% 81.25%, 85.36% 85.36%, 81.25% 88.08%, 76.64% 89.87%, 72.48% 92.06%, 68.67% 95.09%, 64.49% 97.76%, 59.69% 98.69%, 54.74% 98.11%, 50.00% 97.60%, 45.26% 98.11%, 40.31% 98.69%, 35.51% 97.76%, 31.33% 95.09%, 27.52% 92.06%, 23.36% 89.87%, 18.75% 88.08%, 14.64% 85.36%, 11.92% 81.25%, 10.13% 76.64%, 7.94% 72.48%, 4.91% 68.67%, 2.24% 64.49%, 1.31% 59.69%, 1.89% 54.74%, 2.40% 50.00%, 1.89% 45.26%, 1.31% 40.31%, 2.24% 35.51%, 4.91% 31.33%, 7.94% 27.52%, 10.13% 23.36%, 11.92% 18.75%, 14.64% 14.64%, 18.75% 11.92%, 23.36% 10.13%, 27.52% 7.94%, 31.33% 4.91%, 35.51% 2.24%, 40.31% 1.31%, 45.26% 1.89%, 50.00% 2.40%, 54.74% 1.89%, 59.69% 1.31%, 64.49% 2.24%, 68.67% 4.91%, 72.48% 7.94%, 76.64% 10.13%, 81.25% 11.92%, 85.36% 14.64%, 88.08% 18.75%, 89.87% 23.36%, 92.06% 27.52%, 95.09% 31.33%, 97.76% 35.51%, 98.69% 40.31%, 98.11% 45.26%
    ) !important;
}

/* Conditional Campaign Text Styling */
.shl-promo-text-wrap {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
    margin: 18px auto;
    font-size: 15px;
    line-height: 1.6;
    color: var(--shl-text-dim, #555555);
    max-width: 480px;
    width: 100%;
}
.shl-promo-text-wrap.shl-align-center {
    text-align: center;
}
.shl-promo-text-wrap.shl-align-left {
    text-align: left;
}
.shl-promo-text-wrap.shl-align-right {
    text-align: right;
}

/* Block Editor Hardening: Selectable & Deletable Error Blocks */
.shl-promo-wrapper-block {
    display: block;
    width: 100%;
    clear: both;
}

/* Ensure empty/hidden wrappers still have some layout height in the editor block editor preview */
.wp-admin .shl-promo-wrapper-block:empty,
.editor-styles-wrapper .shl-promo-wrapper-block:empty {
    min-height: 50px;
    border: 1px dashed #ccc;
    background: #f9f9f9;
}

/* Stylings for error states and placeholders in both frontend and editor */
.shl-promo-wrapper-block[data-block-type="shl-promo-error"] {
    display: block;
    min-height: 50px;
    box-sizing: border-box;
}

/* Real-time drag overrides for block editor preview */
.shl-block-preview-wrap[style*="--shl-primary"] .shl-promo-wrapper {
    --shl-primary: inherit !important;
}
.shl-block-preview-wrap[style*="--shl-surface"] .shl-promo-wrapper,
.shl-block-preview-wrap[style*="--shl-surface"] .shl-promo-container {
    --shl-surface: inherit !important;
    --shl-gradient-to: inherit !important;
    --shl-text: inherit !important;
    --shl-text-dim: inherit !important;
    --shl-border: inherit !important;
    --shl-shadow: inherit !important;
}

