/* GNL Notice Bar - Public Styles */

/* Sentinel element - visible but inert for Avada */
#gnl-notice-offset {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 0; /* Set by JavaScript when bar is visible */
    opacity: 0; /* Visually hidden but still :visible */
    visibility: visible;
    pointer-events: none;
    z-index: 0;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    overflow: hidden;
}

/* Base notice bar styles */
.gnl-notice {
    position: relative; /* Always be a containing block for absolute close button */
    --gnl-notice-top: 0px; /* Explicit zero default to prevent gap */
    width: 100%;
    box-sizing: border-box;
    z-index: var(--gnl-notice-z, 99999);
    display: none;
}

/* Sticky positioning */
.gnl-notice.is-sticky {
    position: sticky;
    top: var(--gnl-notice-top, 0); /* Use scoped variable */
    z-index: var(--gnl-notice-z, 99999);
    width: 100%;
}

/* Only bump offset when admin bar is actually present */
body.admin-bar .gnl-notice.is-sticky {
    --gnl-notice-top: 32px;
}

@media (max-width: 782px) {
    body.admin-bar .gnl-notice.is-sticky {
        --gnl-notice-top: 46px;
    }
}

/* Inner container - symmetric padding approach */
.gnl-notice-inner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    max-width: var(--gnl-max, 1200px);
    margin: 0 auto;
    padding: 12px 30px; /* Symmetric 30px padding */
    box-sizing: border-box;
}

/* Content area - truly centered */
.gnl-notice-content {
    flex: 1 1 auto;
    min-width: 0;
    word-wrap: break-word;
    text-align: center; /* Center text+link inside the column */
    line-height: 1;
}

/* Space between text and link */
.gnl-notice-text {
    font: inherit;
    margin: 0;
    margin-inline-end: 10px;
    line-height: 1.6;
    display: inline;
}

/* Base link styles */
.gnl-notice-link {
    display: inline;
    color: inherit;
    text-decoration: none;
    font-weight: var(--gnl-btn-fw, inherit);
}

/* Underline style (always inline) */
.gnl-notice-link.is-underline {
    display: inline;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--gnl-text-color);
    border-bottom: 1px solid currentColor;
    font-weight: var(--gnl-btn-fw, inherit);
}

/* Ghost style (uses CSS vars for sizing) */
.gnl-notice-link.is-ghost {
    display: inline-block;
    white-space: nowrap;
    max-width: 100%;
    margin: 0;
    padding: var(--gnl-btn-pv, 6px) var(--gnl-btn-ph, 12px);
    border-radius: var(--gnl-btn-radius, 6px);
    background: transparent;
    border: var(--gnl-btn-bw, 1px) solid var(--gnl-text-color);
    color: var(--gnl-text-color);
    line-height: 1.25;
    font-weight: var(--gnl-btn-fw, inherit);
}

/* Filled style (background & border use text color, text uses bg color) */
.gnl-notice-link.is-filled {
    display: inline-block;
    white-space: nowrap;
    max-width: 100%;
    margin: 0;
    padding: var(--gnl-btn-pv, 6px) var(--gnl-btn-ph, 12px);
    border-radius: var(--gnl-btn-radius, 6px);
    background: var(--gnl-text-color);
    border: var(--gnl-btn-bw, 1px) solid transparent;
    color: var(--gnl-bg-color);
    line-height: 1.25;
    font-weight: var(--gnl-btn-fw, inherit);
}

/* Focus states for accessibility (no hover effects) */
.gnl-notice-link:focus-visible {
    outline: 2px solid var(--gnl-text-color);
    outline-offset: 2px;
}

/* Emergency wrap for very long button text on narrow screens */
@media (max-width: 360px) {
    .gnl-notice-link.is-ghost,
    .gnl-notice-link.is-filled {
        white-space: normal; /* Allow wrap as last resort */
    }
}

/* Responsiveness: Ghost/Filled degrade to inline underline on ≤1024px */
@media (max-width: 1024px) {
    .gnl-notice-link.is-ghost,
    .gnl-notice-link.is-filled {
        display: inline;
        padding: 0;
        border-radius: 0;
        border: 0;
        border-bottom: 1px solid currentColor;
        background: transparent;
        color: inherit;
        font-weight: var(--gnl-btn-fw, inherit);
        white-space: nowrap;
    }
}

/* Close button - positioned inside right padding, consistent 36x36px size */
.gnl-notice-close {
    position: absolute;
    top: 50%;
    inset-inline-end: 15px; /* Half the padding (30px/2) - RTL-safe */
    transform: translateY(-50%);
    z-index: 1; /* Ensure it stays on top */
    background: transparent;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: inherit;
    padding: 8px;
    line-height: 1;
    width: 36px; /* Consistent size everywhere */
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

/* Close button focus states (no hover effects) */
.gnl-notice-close:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
    background: rgba(255,255,255,0.1);
}

/* Close button SVG sizing */
.gnl-notice-close .gnl-close-ic {
    width: 22px; /* Increased from 20px */
    height: 22px;
    display: block;
    pointer-events: none;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .gnl-notice-inner {
        gap: 0.75rem;
    }
    
    .gnl-notice-close {
        inset-inline-end: 18px; /* Adjust for smaller padding */
    }
}

@media (max-width: 782px) {
    .gnl-notice-inner {
        padding: 10px 26px 12px;
        gap: 0.5rem;
    }
    
    .gnl-notice-close {
        inset-inline-end: 13px; /* Half the padding (26px/2) */
    }
}

@media (max-width: 480px) {
    .gnl-notice-close {
        inset-inline-end: 0px;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .gnl-notice-link.is-ghost,
    .gnl-notice-link.is-filled {
        border-width: 2px;
    }
    
    .gnl-notice-close:focus-visible {
        outline-width: 3px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .gnl-notice-link,
    .gnl-notice-close {
        transition: none;
    }
}