/* BuddyBoss Announcements v4 – Frontend */

/* ── Bar ── */
.bba-bar {
    position: fixed; left: 0; right: 0; z-index: 99999;
    padding: 12px 20px;
    box-shadow: 0 2px 12px rgba(0,0,0,.25);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px; line-height: 1.4;
    transition: transform .35s ease, opacity .35s ease;
}
.bba-bar-top    { top: 0; }
.bba-bar-bottom { bottom: 0; }
.bba-bar.bba-bar--hidden               { opacity: 0; pointer-events: none; transform: translateY(-110%); }
.bba-bar-bottom.bba-bar--hidden        { transform: translateY(110%); }
body.bba-bar-offset-top    { padding-top:    52px !important; }
body.bba-bar-offset-bottom { padding-bottom: 52px !important; }

.bba-bar-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
}
.bba-bar-icon  { font-size: 18px; flex-shrink: 0; }
.bba-network-label {
    background: rgba(255,255,255,.2); border: 1px solid rgba(255,255,255,.4);
    border-radius: 4px; font-size: 10px; font-weight: 700;
    padding: 2px 7px; text-transform: uppercase; letter-spacing: .5px; flex-shrink: 0;
}
.bba-bar-content {
    flex: none;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 12px;
}
.bba-bar-title    { font-weight: 700; font-size: 15px; }
.bba-bar-message  { opacity: .92; }
.bba-expires      { font-size: 11px; opacity: .65; white-space: nowrap; display: none; }
.bba-dismiss-btn  {
    background: transparent; border: 1px solid rgba(255,255,255,.4); border-radius: 50%;
    width: 28px; height: 28px; font-size: 14px; cursor: pointer; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    transition: background .2s; padding: 0; line-height: 1;
}
.bba-dismiss-btn:hover { background: rgba(255,255,255,.15); border-color: rgba(255,255,255,.7); }

/* ── Form wrap ── */
.bba-form-wrap {
    background: #fff; border: 1px solid #e2e8f0; border-radius: 12px;
    padding: 32px; max-width: 680px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    box-shadow: 0 4px 24px rgba(0,0,0,.06);
}
.bba-form-header { text-align: center; margin-bottom: 24px; }
.bba-form-icon   { font-size: 36px; display: block; margin-bottom: 8px; }
.bba-form-header h3 { margin: 0 0 6px; font-size: 22px; color: #1a202c; font-weight: 700; }
.bba-form-header p  { margin: 0; color: #64748b; font-size: 14px; }

/* Alerts */
.bba-alert { display: flex; gap: 10px; padding: 12px 16px; border-radius: 8px; margin-bottom: 18px; font-size: 14px; font-weight: 500; }
.bba-alert-success { background: #f0fdf4; border: 1px solid #86efac; color: #166534; }
.bba-alert-error   { background: #fef2f2; border: 1px solid #fca5a5; color: #991b1b; }

/* Live panel */
.bba-live-panel {
    background: #f0fdf4; border: 1px solid #86efac; border-radius: 10px;
    padding: 14px 18px; margin-bottom: 20px;
}
.bba-live-panel-header { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #166534; margin-bottom: 10px; }
.bba-live-dot {
    width: 8px; height: 8px; border-radius: 50%; background: #22c55e; flex-shrink: 0;
    animation: bba-pulse 1.5s ease-in-out infinite;
}
@keyframes bba-pulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:.5;transform:scale(1.4)} }
.bba-live-title { font-style: italic; color: #15803d; }
.bba-position-row { display: flex; align-items: center; gap: 10px; font-size: 13px; color: #374151; flex-wrap: wrap; }
.bba-position-toggle { display: flex; gap: 6px; }
.bba-pos-btn {
    padding: 5px 14px; border: 1px solid #d1d5db; border-radius: 6px;
    background: #fff; font-size: 13px; cursor: pointer; font-family: inherit;
    transition: all .2s;
}
.bba-pos-btn:hover    { border-color: #3b82f6; background: #eff6ff; }
.bba-pos-btn.bba-pos-active { background: #1e3a5f; color: #fff; border-color: #1e3a5f; }
.bba-pos-status { font-size: 12px; color: #16a34a; min-width: 70px; }

/* Scope */
.bba-scope-toggle { display: flex; gap: 10px; flex-wrap: wrap; }
.bba-scope-opt {
    display: flex; align-items: center; gap: 8px; padding: 8px 16px;
    border: 2px solid #e2e8f0; border-radius: 8px; cursor: pointer;
    font-weight: 500; font-size: 14px; transition: border-color .2s, background .2s;
}
.bba-scope-opt:has(input:checked)       { border-color: #3b82f6; background: #eff6ff; }
.bba-scope-network:has(input:checked)   { border-color: #8b1a1a; background: #fff5f5; }
.bba-scope-opt input[type="radio"]      { display: none; }

/* Fields */
.bba-field { margin-bottom: 18px; position: relative; }
.bba-field label { display: block; font-size: 13px; font-weight: 600; color: #374151; margin-bottom: 5px; }
.bba-required { color: #ef4444; }
.bba-field input[type="text"],
.bba-field textarea,
.bba-field input[type="number"] {
    width: 100%; padding: 10px 14px; border: 1px solid #d1d5db; border-radius: 8px;
    font-size: 14px; color: #1a202c; background: #fafafa;
    transition: border-color .2s, box-shadow .2s;
    box-sizing: border-box; font-family: inherit;
}
.bba-field input:focus, .bba-field textarea:focus {
    outline: none; border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,.15); background: #fff;
}
.bba-field textarea { resize: vertical; min-height: 90px; }
.bba-input-sm  { width: 80px !important; }
.bba-hint      { margin: 4px 0 0; font-size: 12px; color: #9ca3af; }
.bba-char-count{ position: absolute; right: 12px; bottom: -17px; font-size: 11px; color: #9ca3af; }

/* 3-col row */
.bba-field-row-3 { display: grid; grid-template-columns: 100px 1fr 1fr; gap: 16px; align-items: start; }

/* Position radio */
.bba-pos-select { display: flex; gap: 8px; }
.bba-pos-radio {
    display: flex; align-items: center; gap: 6px; padding: 8px 14px;
    border: 2px solid #e2e8f0; border-radius: 8px; cursor: pointer;
    font-size: 13px; font-weight: 500; transition: border-color .2s, background .2s;
}
.bba-pos-radio:has(input:checked), .bba-pos-radio-active { border-color: #1e3a5f; background: #eff6ff; color: #1e3a5f; }
.bba-pos-radio input[type="radio"] { display: none; }

/* Preview */
.bba-preview-bar {
    background: #1e3a5f; color: #fff; border-radius: 8px; padding: 10px 14px;
    font-size: 13px; display: flex; align-items: center; justify-content: space-between;
    gap: 8px; min-height: 40px; transition: background .3s;
}
.bba-preview-bar.bba-preview-network { background: #8b1a1a; }
.bba-preview-close {
    background: transparent; border: 1px solid rgba(255,255,255,.4); border-radius: 50%;
    width: 22px; height: 22px; font-size: 11px; cursor: default; color: #fff; flex-shrink: 0; padding: 0; line-height: 1;
}

/* Submit */
.bba-form-footer { margin-top: 24px; padding-top: 18px; border-top: 1px solid #f1f5f9; }
.bba-submit-btn {
    display: inline-flex; align-items: center; gap: 8px;
    background: #1e3a5f; color: #fff; border: none; border-radius: 8px;
    padding: 12px 24px; font-size: 15px; font-weight: 600; cursor: pointer;
    transition: background .2s, transform .1s; font-family: inherit;
}
.bba-submit-btn:hover  { background: #2d5a8e; }
.bba-submit-btn:active { transform: scale(.98); }
.bba-note { margin: 10px 0 0; font-size: 12px; color: #9ca3af; }

@media (max-width: 768px) {
    /* ── Bar: stack layout on mobile ── */
    .bba-bar { padding: 10px 14px; }

    .bba-bar-inner {
        flex-wrap: wrap;
        justify-content: flex-start;
        align-items: flex-start;
        gap: 6px;
        position: relative;
        padding-right: 36px; /* room for dismiss btn */
    }

    .bba-bar-content {
        flex: 1;
        min-width: 0;
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }

    .bba-bar-title   { font-size: 14px; white-space: normal; word-break: break-word; }
    .bba-bar-message { font-size: 13px; white-space: normal; word-break: break-word; }

    .bba-dismiss-btn {
        position: absolute;
        top: 50%;
        right: 0;
        transform: translateY(-50%);
        flex-shrink: 0;
    }

    .bba-bar-icon { display: none; } /* hide bullhorn icon on small screens to save space */

    /* Increase body offset since bar is taller when text wraps */
    body.bba-bar-offset-top    { padding-top:    80px !important; }
    body.bba-bar-offset-bottom { padding-bottom: 80px !important; }
}

@media (max-width: 600px) {
    .bba-form-wrap   { padding: 20px; }
    .bba-field-row-3 { grid-template-columns: 1fr; }
    .bba-scope-toggle, .bba-pos-select { flex-direction: column; }
}

/* ── Manage controls (v5) ── */
.bba-live-controls { display: flex; flex-direction: column; gap: 10px; }

.bba-control-row {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.bba-control-label { font-size: 13px; color: #374151; font-weight: 500; min-width: 60px; }

.bba-control-danger-row {
    padding-top: 10px;
    border-top: 1px solid #bbf7d0;
}

.bba-action-btn {
    padding: 6px 14px; border-radius: 7px; font-size: 13px;
    font-family: inherit; cursor: pointer; font-weight: 500;
    border: 1px solid; transition: all .2s;
}
.bba-btn-disable {
    background: #fff; border-color: #d1d5db; color: #374151;
}
.bba-btn-disable:hover { background: #fef9c3; border-color: #fbbf24; color: #92400e; }

.bba-btn-delete {
    background: #fff; border-color: #fca5a5; color: #dc2626;
}
.bba-btn-delete:hover { background: #fef2f2; border-color: #ef4444; }

.bba-btn-enable {
    background: #fff; border-color: #86efac; color: #166534;
    padding: 4px 10px; font-size: 12px;
}
.bba-btn-enable:hover { background: #f0fdf4; }

.bba-btn-delete-sm {
    background: transparent; border: none; color: #9ca3af;
    font-size: 15px; cursor: pointer; padding: 2px 6px;
    transition: color .2s;
}
.bba-btn-delete-sm:hover { color: #ef4444; }

.bba-action-status { font-size: 12px; min-width: 80px; }

/* ── Past announcements panel ── */
.bba-past-panel {
    background: #fafafa; border: 1px solid #e2e8f0; border-radius: 10px;
    padding: 14px 18px; margin-bottom: 20px;
}
.bba-past-header {
    font-size: 13px; font-weight: 600; color: #374151; margin-bottom: 10px;
}
.bba-past-list { list-style: none; margin: 0; padding: 0; }
.bba-past-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 0; border-bottom: 1px solid #f1f5f9; gap: 10px;
}
.bba-past-item:last-child { border-bottom: none; }
.bba-past-info { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.bba-past-title { font-size: 13px; color: #374151; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bba-past-badge {
    font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 20px; flex-shrink: 0;
}
.bba-badge-inactive { background: #f1f5f9; color: #64748b; }
.bba-badge-expired  { background: #fef3c7; color: #92400e; }
.bba-past-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

/* ── New announcement section ── */
.bba-new-section { margin-top: 4px; }
.bba-new-header {
    font-size: 14px; font-weight: 700; color: #374151;
    margin-bottom: 16px; padding-bottom: 10px;
    border-bottom: 2px solid #f1f5f9;
}

/* ── Font Awesome sizing tweaks ── */
.bba-bar-icon i         { font-size: 16px; }
.bba-bar-icon           { display: flex; align-items: center; }
.bba-dismiss-btn i      { font-size: 13px; }
.bba-network-label i    { font-size: 10px; }
.bba-expires i          { font-size: 11px; }
.bba-form-icon i        { font-size: 34px; display: block; }
.bba-form-icon          { font-size: 34px; }
.bba-alert i            { font-size: 15px; flex-shrink: 0; margin-top: 1px; }
.bba-live-panel-header i{ font-size: 13px; }
.bba-control-label i    { font-size: 12px; }
.bba-pos-btn i          { font-size: 11px; }
.bba-action-btn i       { font-size: 12px; }
.bba-past-header i      { font-size: 13px; }
.bba-past-badge i       { font-size: 10px; }
.bba-new-header i       { font-size: 14px; }
.bba-scope-opt i        { font-size: 13px; }
.bba-pos-radio i        { font-size: 11px; }
.bba-field label i      { font-size: 12px; color: #6b7280; }
.bba-preview-close i    { font-size: 12px; }
.bba-submit-btn i       { font-size: 15px; }
.bba-note i             { font-size: 12px; }
.bba-action-status i    { font-size: 12px; }

/* ── Preview mode bar ── */
.bba-bar-preview {
    border-bottom: 3px dashed rgba(255,255,255,.5) !important;
}

.bba-preview-label {
    background: rgba(255,255,255,.2);
    border: 1px solid rgba(255,255,255,.4);
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    white-space: nowrap;
    flex-shrink: 0;
    letter-spacing: .3px;
}

.bba-publish-btn {
    background: rgba(255,255,255,.9);
    color: #1e3a5f !important;
    border: none;
    border-radius: 6px;
    padding: 5px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: background .2s, transform .1s;
}
.bba-publish-btn:hover  { background: #ffffff; transform: scale(1.03); }
.bba-publish-btn:active { transform: scale(.98); }
.bba-publish-btn.bba-publishing { opacity: .7; pointer-events: none; }

/* ── Preview / Publish form buttons ── */
.bba-form-footer { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.bba-btn-preview {
    background: #f8faff !important;
    color: #1e3a5f !important;
    border: 2px solid #1e3a5f !important;
}
.bba-btn-preview:hover { background: #eff6ff !important; }
.bba-btn-publish { background: #1e3a5f; }
.bba-note { width: 100%; margin: 4px 0 0 !important; }

/* ── Preview panel in form ── */
.bba-preview-panel {
    background: #fffbeb;
    border: 1px solid #fbbf24;
    border-left: 4px solid #f59e0b;
}
.bba-preview-panel .bba-live-panel-header { color: #92400e; }
.bba-preview-note {
    font-size: 13px; color: #78350f;
    margin: 0 0 12px; line-height: 1.5;
}
.bba-btn-publish-preview {
    background: #1e3a5f;
    color: #fff;
    border-color: #1e3a5f;
}
.bba-btn-publish-preview:hover { background: #2d5a8e; border-color: #2d5a8e; }

/* ── HTML content inside bar message ── */
.bba-bar-message a {
    color: inherit;
    text-decoration: underline;
    opacity: .9;
}
.bba-bar-message a:hover { opacity: 1; }
.bba-bar-message strong,
.bba-bar-message b  { font-weight: 700; }
.bba-bar-message em,
.bba-bar-message i  { font-style: italic; }
.bba-bar-message u  { text-decoration: underline; }
.bba-bar-message p  { margin: 0; }
.bba-bar-message p + p { margin-top: 4px; }

/* ── TinyMCE editor on frontend ── */
.bba-form-wrap .wp-editor-wrap { border-radius: 8px; overflow: hidden; border: 1px solid #d1d5db; }
.bba-form-wrap .wp-editor-wrap:focus-within { border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,.15); }
.bba-form-wrap .mce-toolbar .mce-btn { border-radius: 4px; }
.bba-form-wrap #wp-bba_message-editor-container { background: #fafafa; }
