/* Parent wrapper to scope all alert styles and prevent conflicts */
.ct-alerts-wrapper {
    width: 100%;
    box-sizing: border-box;
}

/* Base alert wrapper */
.ct-alerts-wrapper .ct-alert {
    width: 100%;
    box-sizing: border-box;
    margin: 0;
    position: relative;
    border: none;
    
    /* CSS Variables with defaults */
    --ct-alert-bg-color: #ffab37;
    --ct-alert-text-color: #414141;
    --ct-alert-close-color: #ffffff;
    --ct-alert-button-bg: #ffffff;
    --ct-alert-button-text: #000000;
    --ct-alert-button-hover-bg: #f5f5f5;
    --ct-alert-button-hover-text: #000000;
    --ct-alert-padding-top: 16px;
    --ct-alert-padding-right: 24px;
    --ct-alert-padding-bottom: 16px;
    --ct-alert-padding-left: 24px;
    --ct-alert-max-width: 1200px;
    --ct-alert-border-radius: 0px;
    --ct-alert-heading-font-family: var(--theme-font-family, var(--theme-font-stack-default));
    --ct-alert-heading-font-size: 17px;
    --ct-alert-brief-font-size: 14px;
    --ct-alert-button-font-size: 12px;
    
    color: var(--ct-alert-text-color);
    padding: var(--ct-alert-padding-top) var(--ct-alert-padding-right) var(--ct-alert-padding-bottom) var(--ct-alert-padding-left);
    background: var(--ct-alert-bg-color);
    border-radius: var(--ct-alert-border-radius);
    display: flex;
    align-items: center;
    flex-direction: column;
    gap: 10px;
}

.ct-alerts-wrapper .ct-alert-content {
    width: 100%;
    max-width: var(--ct-alert-max-width);
    display: flex;
    flex-direction: column;
    gap: 0;
    position: relative;
}

/* Horizontal layout: main content in row, text left + button right */
.ct-alerts-wrapper .ct-alert-layout-horizontal .ct-alert-content {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.ct-alerts-wrapper .ct-alert-layout-horizontal .ct-alert-main-group,
.ct-alerts-wrapper .ct-alert-layout-horizontal .ct-alert-main.ct-alert-main-row {
    flex: 1;
    min-width: 0;
}

.ct-alerts-wrapper .ct-alert-main-group {
    display: flex;
    align-items: var(--ct-alert-icon-align, center);
    gap: var(--ct-alert-icon-gap, 16px);
    min-width: 0;
    width: 100%;
}

.ct-alerts-wrapper .ct-alert-main-group .ct-alert-main {
    flex: 1;
    min-width: 0;
}

.ct-alerts-wrapper .ct-alert-icon-wrap {
    flex-shrink: 0;
    line-height: 0;
    background-color: var(--ct-alert-icon-bg, #ffffff);
    padding: var(--ct-alert-icon-pad, 12px);
    border-radius: var(--ct-alert-icon-r, 50px);
    overflow: hidden;
}

.ct-alerts-wrapper .ct-alert-icon {
    display: block;
    width: var(--ct-alert-icon-size, auto);
    max-width: 100%;
    height: auto;
}

.ct-alerts-wrapper .ct-alert-icon--default {
    flex-shrink: 0;
    color: var(--ct-alert-icon-fill, #000000);
}

.ct-alerts-wrapper .ct-alert-layout-horizontal .ct-alert-read-more-inline {
    flex-shrink: 0;
}

/* Centered layout: dot + text + button in one centered row */
.ct-alerts-wrapper .ct-alert-layout-centered .ct-alert-content {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: var(--ct-alert-centered-content-button-gap, 24px);
    text-align: center;
}

.ct-alerts-wrapper .ct-alert-layout-centered .ct-alert-main-group,
.ct-alerts-wrapper .ct-alert-layout-centered .ct-alert-main,
.ct-alerts-wrapper .ct-alert-layout-centered .ct-alert-main.ct-alert-main-row {
    flex: 0 1 auto;
    width: auto;
    max-width: 100%;
}

.ct-alerts-wrapper .ct-alert-layout-centered .ct-alert-main-centered {
    align-items: center;
}

.ct-alerts-wrapper .ct-alert-layout-centered .ct-alert-title-line {
    justify-content: center;
}

.ct-alerts-wrapper .ct-alert-layout-centered .ct-alert-brief {
    text-align: center;
}

.ct-alerts-wrapper .ct-alert-layout-centered .ct-alert-read-more-inline {
    flex-shrink: 0;
}

.ct-alerts-wrapper .ct-alert-layout-centered .ct-alert-read-more-inline.ct-alert-buttons-group {
    display: inline-flex;
}

.ct-alerts-wrapper .ct-alert-layout-centered .ct-alert-side-links--right {
    margin-left: 0;
}

/* Text link button with trailing arrow */
.ct-alerts-wrapper .ct-alert-button.ct-alert-button-style-link-icon {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
    min-height: unset;
    height: auto;
    font-family: var(--ct-alert-button-link-font-family, var(--theme-font-family, var(--theme-font-stack-default)));
    text-decoration: underline;
    text-underline-offset: 0.12em;
    font-weight: 600;
    gap: 0.35em;
    white-space: nowrap;
}

.ct-alerts-wrapper .ct-alert-read-more .ct-alert-button.ct-alert-button-style-link-icon:hover,
.ct-alerts-wrapper .ct-alert-read-more .ct-alert-button.ct-alert-button-style-link-icon:focus-visible,
.ct-alerts-wrapper .ct-alert-read-more-inline .ct-alert-button.ct-alert-button-style-link-icon:hover,
.ct-alerts-wrapper .ct-alert-read-more-inline .ct-alert-button.ct-alert-button-style-link-icon:focus-visible {
    transform: none;
    box-shadow: none;
}

.ct-alerts-wrapper .ct-alert-button.ct-alert-button-style-link-icon:hover,
.ct-alerts-wrapper .ct-alert-button.ct-alert-button-style-link-icon:focus-visible {
    background: transparent !important;
    text-decoration: underline;
    opacity: 0.88;
}

.ct-alerts-wrapper .ct-alert-button-style-link-icon.ct-alert-button-has-border {
    border-width: 0 !important;
}

.ct-alerts-wrapper .ct-alert-button-icon {
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
    line-height: 1;
    color: inherit;
}

.ct-alerts-wrapper .ct-alert-button-icon-svg {
    display: block;
    width: 1.05em;
    height: 1.05em;
    flex-shrink: 0;
    color: inherit;
}

/* When custom button spacing is set, override padding; otherwise use theme (ct-button) */
.ct-alerts-wrapper .ct-alert-button-custom-spacing .ct-alert-layout-horizontal .ct-alert-read-more-inline .ct-alert-button,
.ct-alerts-wrapper .ct-alert-button-custom-spacing .ct-alert-read-more .ct-alert-button {
    padding: var(--ct-alert-button-padding-top) var(--ct-alert-button-padding-right) var(--ct-alert-button-padding-bottom) var(--ct-alert-button-padding-left);
}

/* Optional per-button borders (only when fields are set in alert settings) */
.ct-alerts-wrapper .ct-alert-button--1.ct-alert-button-has-border {
    border-style: solid;
    border-width: var(--ct-alert-button-1-bdr-w, 0);
    border-color: var(--ct-alert-button-1-bdr-c, transparent);
    border-radius: var(--ct-alert-button-1-bdr-r, 0) !important;
}

.ct-alerts-wrapper .ct-alert-button--2.ct-alert-button-has-border {
    border-style: solid;
    border-width: var(--ct-alert-button-2-bdr-w, 0);
    border-color: var(--ct-alert-button-2-bdr-c, transparent);
    border-radius: var(--ct-alert-button-2-bdr-r, 0) !important;
}

.ct-alerts-wrapper .ct-alert-button--1.ct-alert-button-has-border:hover,
.ct-alerts-wrapper .ct-alert-button--1.ct-alert-button-has-border:focus-visible {
    border-color: var(--ct-alert-button-1-bdr-hc, var(--ct-alert-button-1-bdr-c, transparent));
}

.ct-alerts-wrapper .ct-alert-button--2.ct-alert-button-has-border:hover,
.ct-alerts-wrapper .ct-alert-button--2.ct-alert-button-has-border:focus-visible {
    border-color: var(--ct-alert-button-2-bdr-hc, var(--ct-alert-button-2-bdr-c, transparent));
}

.ct-alerts-wrapper .ct-alert-layout-horizontal .ct-alert-read-more-inline .ct-alert-button:not(.ct-alert-button-has-border) {
    border: 0;
}

.ct-alerts-wrapper .ct-alert-layout-horizontal .ct-alert-read-more-inline .ct-alert-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: var(--ct-alert-button-font-size);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}

.ct-alerts-wrapper .ct-alert-button--1 {
    background: var(--ct-alert-button-1-bg, var(--ct-alert-button-bg));
    color: var(--ct-alert-button-1-text, var(--ct-alert-button-text));
}

.ct-alerts-wrapper .ct-alert-button--2 {
    background: var(--ct-alert-button-2-bg, var(--ct-alert-button-1-bg, var(--ct-alert-button-bg)));
    color: var(--ct-alert-button-2-text, var(--ct-alert-button-1-text, var(--ct-alert-button-text)));
}

.ct-alerts-wrapper .ct-alert-button--1:hover,
.ct-alerts-wrapper .ct-alert-button--1:focus-visible {
    background: var(--ct-alert-button-1-hover-bg, var(--ct-alert-button-hover-bg));
    color: var(--ct-alert-button-1-hover-text, var(--ct-alert-button-hover-text));
}

.ct-alerts-wrapper .ct-alert-button--2:hover,
.ct-alerts-wrapper .ct-alert-button--2:focus-visible {
    background: var(--ct-alert-button-2-hover-bg, var(--ct-alert-button-1-hover-bg, var(--ct-alert-button-hover-bg)));
    color: var(--ct-alert-button-2-hover-text, var(--ct-alert-button-1-hover-text, var(--ct-alert-button-hover-text)));
}

/* Address section - separator + location + address (matches content max-width) */
.ct-alerts-wrapper .ct-alert-address-wrap {
    width: 100%;
    max-width: var(--ct-alert-max-width);
    margin-top: var(--ct-alert-address-wrap-margin-top, 12px);
}

.ct-alerts-wrapper .ct-alert-address-separator {
    width: 100%;
    height: 0;
    border-top: 1px solid rgba(0, 0, 0, 0.12);
    margin-bottom: 12px;
}

.ct-alerts-wrapper .ct-alert-address {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    color: var(--ct-alert-text-color);
}

.ct-alerts-wrapper .ct-alert-address-icon {
    flex-shrink: 0;
}

.ct-alerts-wrapper .ct-alert-location-icon {
    width: 24px;
    height: 24px;
}

.ct-alerts-wrapper .ct-alert-address .ct-alert-address-link,
.ct-alerts-wrapper .ct-alert-address .ct-alert-address-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ct-alerts-wrapper .ct-alert-address .ct-alert-address-link {
    text-decoration: underline;
    color: inherit;
}

.ct-alerts-wrapper .ct-alert-address .ct-alert-address-link:hover {
    opacity: 0.9;
}

.ct-alerts-wrapper .ct-alert-extra-links {
    width: 100%;
    margin-top: 12px;
    font-size: var(--ct-alert-brief-font-size);
    line-height: 1.45;
    color: var(--ct-alert-text-color);
}

.ct-alerts-wrapper .ct-alert-extra-links p {
    margin: 0 0 0.5em;
    font-weight: 400;
}

.ct-alerts-wrapper .ct-alert-extra-links p:last-child {
    margin-bottom: 0;
}

.ct-alerts-wrapper .ct-alert-extra-links a {
    color: inherit;
    text-decoration: underline;
}

/* Singular alert: address + extra below post content */
.ct-alert-single-supplement {
    margin-top: 1.75rem;
    clear: both;
}

.ct-alert-single-separator {
    width: 100%;
    height: 0;
    border-top: 1px solid rgba(0, 0, 0, 0.12);
    margin-bottom: 1rem;
}

.ct-alert-extra-links--single {
    font-size: 1rem;
    line-height: 1.5;
    color: inherit;
}

.ct-alert-extra-links--single p {
    margin: 0 0 0.75em;
}

.ct-alert-extra-links--single p:last-child {
    margin-bottom: 0;
}

.ct-alert-single-supplement .ct-alert-address {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 0.75rem;
}

.ct-alert-single-supplement .ct-alert-address-icon {
    flex-shrink: 0;
    color: var(--theme-palette-color-1, #2271b1);
}

.ct-alert-single-supplement .ct-alert-address .ct-alert-address-link,
.ct-alert-single-supplement .ct-alert-address .ct-alert-address-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ct-alerts-wrapper .ct-alert-heading {
    font-family: var(--ct-alert-heading-font-family, var(--theme-font-family, var(--theme-font-stack-default)));
    font-size: var(--ct-alert-heading-font-size);
    font-weight: 700;
    margin: 0;
    color: var(--ct-alert-text-color);
    line-height: 1.2;
}

.ct-alerts-wrapper .ct-alert-title-line {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5em;
    min-width: 0;
}

.ct-alerts-wrapper .ct-alert-title-dot {
    flex: 0 0 auto;
    width: var(--ct-alert-title-dot-size, 8px);
    height: var(--ct-alert-title-dot-size, 8px);
    border-radius: 50%;
    background: var(--ct-alert-title-dot-color, currentColor);
}

.ct-alerts-wrapper .ct-alert-main-inline .ct-alert-heading,
.ct-alerts-wrapper .ct-alert-main-inline .ct-alert-brief--inline {
    flex: 0 1 auto;
    min-width: 0;
}

.ct-alerts-wrapper .ct-alert-brief--inline {
    display: inline;
    font-size: var(--ct-alert-brief-font-size);
    line-height: 1.4;
    margin: 0;
    color: var(--ct-alert-text-color);
    font-weight: 400;
}

.ct-alerts-wrapper .ct-alert-side-links {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--ct-alert-side-links-gap, 0.65em);
    color: var(--ct-alert-side-links-color, var(--ct-alert-text-color));
    font-size: var(--ct-alert-side-links-size, inherit);
    line-height: 1.3;
}

.ct-alerts-wrapper .ct-alert-side-links--right {
    flex: 0 0 auto;
    margin-left: auto;
}

.ct-alerts-wrapper .ct-alert-side-links--below {
    width: 100%;
    max-width: var(--ct-alert-max-width);
    margin-top: 0.5rem;
}

.ct-alerts-wrapper .ct-alert-side-link {
    color: inherit;
    text-decoration: none;
}

.ct-alerts-wrapper a.ct-alert-side-link:hover {
    text-decoration: underline;
    opacity: 0.92;
}

.ct-alerts-wrapper .ct-alert-side-links-sep {
    flex: 0 0 auto;
    width: var(--ct-alert-side-links-sep-size, 4px);
    height: var(--ct-alert-side-links-sep-size, 4px);
    border-radius: 50%;
    background: var(--ct-alert-side-links-sep-color, currentColor);
}

.ct-alerts-wrapper .ct-alert-brief {
    font-size: var(--ct-alert-brief-font-size);
    line-height: 1.4;
    margin: 0;
    color: var(--ct-alert-text-color);
}

.ct-alerts-wrapper .ct-alert-brief p {
    margin: 0;
    font-weight: 400;
}

.ct-alerts-wrapper .ct-alert-main {
    display: flex;
    flex-direction: column;
    gap: var(--ct-alert-main-gap, 8px);
    flex: 1;
}

.ct-alerts-wrapper .ct-alert-read-more {
    max-width: var(--ct-alert-max-width);
    width: 100%;
}

/* Multiple CTAs: primary + optional second button */
.ct-alerts-wrapper .ct-alert-buttons-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--ct-alert-buttons-gap, 0.5rem);
}

.ct-alerts-wrapper .ct-alert-layout-horizontal .ct-alert-read-more-inline.ct-alert-buttons-group {
    display: inline-flex;
}

/* ct-button = Blocksy theme styles; ct-alert-button = our overrides (colors from settings). Padding only when ct-alert-button-custom-spacing is set. */
.ct-alerts-wrapper .ct-alert-read-more .ct-alert-button:not(.ct-alert-button-has-border),
.ct-alerts-wrapper .ct-alert-read-more-inline .ct-alert-button:not(.ct-alert-button-has-border) {
    border: 0;
}

.ct-alerts-wrapper .ct-alert-read-more .ct-alert-button,
.ct-alerts-wrapper .ct-alert-read-more-inline .ct-alert-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: var(--ct-alert-button-font-size);
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease, color 120ms ease;
    white-space: nowrap;
    margin: 0;
}

.ct-alerts-wrapper .ct-alert-read-more .ct-alert-button:hover,
.ct-alerts-wrapper .ct-alert-read-more .ct-alert-button:focus-visible,
.ct-alerts-wrapper .ct-alert-read-more-inline .ct-alert-button:hover,
.ct-alerts-wrapper .ct-alert-read-more-inline .ct-alert-button:focus-visible {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
}

.ct-alerts-wrapper .ct-alert-close {
    background: none;
    border: none;
    color: var(--ct-alert-close-color);
    font-size: var(--ct-alert-close-size, 30px);
    line-height: 1;
    min-height: 10px;
    cursor: pointer;
    padding: 0px;
    transition: opacity 120ms ease;
    margin: 0;
    position: absolute;
    z-index: 10;
}

/* Position relative to outer container (.ct-alert) */
.ct-alerts-wrapper .ct-alert-close-outer {
    top: var(--ct-alert-close-top, 10px);
    right: var(--ct-alert-close-right, 15px);
}

/* Position relative to content container (.ct-alert-content) */
.ct-alerts-wrapper .ct-alert-close-content {
    position: absolute;
    top: var(--ct-alert-close-top, 10px);
    right: var(--ct-alert-close-right, 15px);
}

/* Inline in right-side links row (.ct-alert-side-links--right) */
.ct-alerts-wrapper .ct-alert-close-inline {
    position: relative;
    top: auto;
    right: auto;
    flex: 0 0 auto;
    align-self: center;
    margin: 0;
}

.ct-alerts-wrapper .ct-alert-close:hover,
.ct-alerts-wrapper .ct-alert-close:focus-visible {
    opacity: 0.75;
}

/* Reopen icon - shown when alert is closed and allow_reopen is on */
.ct-alerts-wrapper .ct-alert-reopen-icon {
    display: none;
    position: fixed;
    top: 0px;
    right: 24px;
    z-index: 999999;
    width: 56px;
    height: 56px;
    padding: 8px;
    border: none;
    border-radius: 0px 0px 5px 5px;
    background: var(--ct-alert-bg-color, #ffab37);
    color: var(--ct-alert-text-color, #414141);
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.admin-bar .ct-alerts-wrapper .ct-alert-reopen-icon {
    top: 32px;
}
@media(max-width: 1024px){
    .ct-alerts-wrapper .ct-alert-reopen-icon {
        top: 80px;
        position: absolute;
    }
    .admin-bar .ct-alerts-wrapper .ct-alert-reopen-icon {
        position: absolute;
        top: 112px;
    }
}
.ct-alerts-wrapper .ct-alert-reopen-icon.ct-alert-reopen-icon-visible {
    display: flex;
    align-items: center;
    justify-content: center;
}

.ct-alerts-wrapper .ct-alert-reopen-icon:hover,
.ct-alerts-wrapper .ct-alert-reopen-icon:focus-visible {
    transform: scale(1.08);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.ct-alerts-wrapper .ct-alert-reopen-icon-svg {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .ct-alerts-wrapper .ct-alert-button:not(.ct-alert-button-style-link-icon) {
        width: 100%;
        justify-content: center;
    }

    .ct-alerts-wrapper .ct-alert-layout-horizontal .ct-alert-content,
    .ct-alerts-wrapper .ct-alert-layout-centered .ct-alert-content {
        flex-direction: column;
    }

    .ct-alerts-wrapper .ct-alert-main-inline .ct-alert-title-line {
        flex-wrap: wrap;
    }

    .ct-alerts-wrapper .ct-alert-side-links--right {
        margin-left: 0;
        width: 100%;
    }

    .ct-alerts-wrapper .ct-alert-main-group {
        gap: var(--ct-alert-icon-gap-m, 12px);
    }

    .ct-alerts-wrapper .ct-alert-icon-wrap {
        padding: var(--ct-alert-icon-pad-m, 8px);
        border-radius: var(--ct-alert-icon-r-m, 50px);
    }

    .ct-alerts-wrapper .ct-alert-icon {
        width: var(--ct-alert-icon-size-m, 32px);
    }

    /* Allow reopen: on mobile, reopen icon uses position relative and shows with its own height */
    .ct-alerts-wrapper .ct-alert-reopen-icon.ct-alert-reopen-icon-visible {
        position: relative;
        top: auto;
        right: auto;
        width: 100%;
        border-radius: 0;
        box-shadow: none;
    }
}
