/**
 * Saints Core - Announcements Shortcode Styles
 *
 * Two themes: ward (accent color) and stake (navy).
 * Three urgency levels: normal, important, urgent.
 * Three layers: trigger bar → preview rows → expanded section.
 *
 * @package SaintsCore
 * @since 1.10.0
 */

/* =================================================================
   THEME VARIABLES
   ================================================================= */

/* Ward style (default) */
.announcements-container[data-style="ward"] {
    --accent: var(--ward-accent-color, #0C6CB6);
    --accent-dark: color-mix(in srgb, var(--ward-accent-color, #0C6CB6) 85%, black);
    --accent-light: color-mix(in srgb, var(--ward-accent-color, #0C6CB6) 10%, white);
    --border-color: #E8E4DD;
    --trigger-bg: #fff;
    --radius: 16px;
    --row-radius: 10px;
}

/* Stake style */
.announcements-container[data-style="stake"] {
    --accent: #0B3C5D;
    --accent-dark: #072a42;
    --accent-light: #E8EEF3;
    --border-color: #E2E8F0;
    --trigger-bg: #fff;
    --radius: 8px;
    --row-radius: 8px;
}

/* =================================================================
   CONTAINER
   ================================================================= */

.announcements-container {
    font-family: 'Montserrat', sans-serif;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
    margin: 0;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

/* Hide Elementor container when no active announcements.
   Add CSS class "announcements-wrapper" to the Elementor container holding the shortcode. */
.announcements-wrapper:has(.announcements-empty) {
    display: none;
}

/* =================================================================
   TRIGGER BAR (Layer 1)
   ================================================================= */

.announcements-trigger {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--trigger-bg);
    cursor: pointer;
    user-select: none;
    transition: background 0.2s ease;
    border-bottom: 1px solid var(--border-color);
}

.announcements-trigger:hover {
    background: var(--accent-light);
}

.announcements-trigger:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

.trigger-icon {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: #fff;
    border-radius: 10px;
}

.trigger-text {
    flex: 1;
    min-width: 0;
}

.trigger-title {
    font-family: 'Quattrocento', serif;
    font-size: 1.2rem;
    font-weight: 700;
    color: #333333;
    line-height: 1.3;
}

.trigger-subtitle {
    font-size: 1.05rem;
    color: #333333;
    margin-top: 2px;
    line-height: 1.3;
}

/* Count badge */
.trigger-count {
    flex-shrink: 0;
    min-width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    font-size: 0.9rem;
    font-weight: 700;
    padding: 0 8px;
}

.trigger-count.has-normal {
    background: var(--accent-light);
    color: var(--accent-dark);
}

.trigger-count.has-important {
    background: rgba(240, 168, 48, 0.18);
    color: #9A6B00;
}

.trigger-count.has-urgent {
    background: rgba(231, 76, 60, 0.15);
    color: #C0392B;
}

/* Trigger chevron */
.trigger-chevron {
    flex-shrink: 0;
    transition: transform 0.3s ease;
    color: #9ca3af;
}

.announcements-container.open .trigger-chevron {
    transform: rotate(180deg);
}

/* =================================================================
   PREVIEW ROWS (Layer 2)
   ================================================================= */

.announcements-preview {
    padding: 12px;
}

.announcements-preview .a-row + .a-row {
    margin-top: 6px;
}

/* =================================================================
   ANNOUNCEMENT ROW
   ================================================================= */

.a-row {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 10px 12px;
    border-radius: var(--row-radius);
    cursor: pointer;
    user-select: none;
    transition: background 0.15s ease;
    position: relative;
}

.a-row:hover {
    background: #f9fafb;
}

.a-row:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

/* Urgency stripe */
.a-stripe {
    flex-shrink: 0;
    width: 3px;
    min-height: 20px;
    align-self: stretch;
    border-radius: 2px;
    margin-right: 12px;
    background: var(--accent);
}

.a-row.important .a-stripe {
    background: #F0A830;
}

.a-row.urgent .a-stripe {
    background: #E74C3C;
}

/* Urgency backgrounds */
.a-row.important {
    background: #FFF8EC;
}

.a-row.important:hover {
    background: #FFF3DC;
}

.a-row.urgent {
    background: #FDEDEB;
}

.a-row.urgent:hover {
    background: #FCDDD9;
}

/* Row content area */
.a-content {
    flex: 1;
    min-width: 0;
    padding-right: 2vw;
}

.a-top {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.a-title {
    font-family: 'Quattrocento', serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: #333333;
    line-height: 1.4;
}

/* Urgency badge */
.a-badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 8px;
    border-radius: 10px;
    line-height: 1.4;
}

.a-badge-important {
    background: rgba(240, 168, 48, 0.18);
    color: #9A6B00;
}

.a-badge-urgent {
    background: rgba(231, 76, 60, 0.15);
    color: #C0392B;
}

/* Row body (expandable) */
.a-body {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.3s ease, opacity 0.2s ease, margin 0.3s ease;
    margin-top: 0;
}

.a-row.expanded .a-body {
    max-height: 300px;
    opacity: 1;
    margin-top: 8px;
}

.a-message {
    font-size: 1.05rem;
    color: #333333;
    line-height: 1.6;
}

.a-message p {
    margin: 0 0 0.5em;
}

.a-message p:last-child {
    margin-bottom: 0;
}

/* Row link */
.a-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
    transition: color 0.15s ease;
}

.a-link:hover {
    color: var(--accent-dark);
    text-decoration: underline;
}

.a-link svg {
    flex-shrink: 0;
    transition: transform 0.15s ease;
}

.a-link:hover svg {
    transform: translateX(2px);
}

/* Row meta (expiry + chevron) */
.a-meta {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 12px;
    padding-top: 2px;
}

.a-expiry {
    font-size: 0.9rem;
    color: #333333;
    white-space: nowrap;
}

.a-chevron {
    transition: transform 0.3s ease;
    color: #333333;
    flex-shrink: 0;
}

.a-row.expanded .a-chevron {
    transform: rotate(180deg);
}

/* =================================================================
   SHOW MORE ROW
   ================================================================= */

.show-more-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    cursor: pointer;
    user-select: none;
    border-top: 1px solid var(--border-color);
    transition: background 0.15s ease;
}

.show-more-row:hover {
    background: var(--trigger-bg);
}

.show-more-row:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

.show-more-text {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--accent);
}

.show-more-chevron {
    transition: transform 0.3s ease;
    color: var(--accent);
}

.announcements-container.open .show-more-chevron {
    transform: rotate(180deg);
}

/* =================================================================
   EXPANDED SECTION (Layer 3)
   ================================================================= */

.announcements-expand {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.4s ease, opacity 0.3s ease;
    padding: 0 8px;
}

.announcements-container.open .announcements-expand {
    max-height: 1000px;
    opacity: 1;
    padding: 0 8px 8px;
}

.expand-divider {
    height: 1px;
    background: var(--border-color);
    margin: 4px 0 8px;
}

/* Tier dividers */
.tier-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 12px 0 8px;
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #333333;
}

.tier-divider::before,
.tier-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

/* =================================================================
   RESPONSIVE
   ================================================================= */

/* Mobile (<768px) */
@media (max-width: 767px) {
    .a-expiry {
        display: none;
    }

    .announcements-trigger {
        padding: 12px 14px;
        gap: 10px;
    }

    .a-row {
        padding: 8px 10px;
    }

    .trigger-title {
        font-size: 1.1rem;
    }

    .trigger-subtitle {
        font-size: 0.9rem;
    }
}

/* Small mobile (<480px) */
@media (max-width: 479px) {
    .trigger-icon {
        width: 30px;
        height: 30px;
        border-radius: 8px;
    }

    .trigger-icon svg {
        width: 16px;
        height: 16px;
    }

    .trigger-count {
        min-width: 24px;
        height: 24px;
        font-size: 0.85rem;
        padding: 0 6px;
    }

    .a-badge {
        font-size: 0.8rem;
        padding: 1px 6px;
    }

    .a-title {
        font-size: 1rem;
    }
}
