/* Announcements page */

.ann-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    gap: 12px;
}

.ann-header h1 {
    margin: 0;
}

/* Modal & form: reuses .modal/.modal-overlay/.modal-content from events.css.
   Pull those styles in if not already loaded for this page. */
.modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 16px;
    overflow-y: auto;
}
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(30, 27, 22, 0.55);
}
.modal-content {
    position: relative;
    width: 100%;
    max-width: 640px;
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(30, 27, 22, 0.25);
    z-index: 1;
    padding: 0;
    display: flex;
    flex-direction: column;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #DDD8CE;
}
.modal-header h2 {
    font-family: 'Oswald', sans-serif;
    font-size: 1.3rem;
    color: #3E2E18;
    margin: 0;
}
.modal-close {
    background: none;
    border: 0;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    color: #8C8578;
    padding: 0 4px;
}
.modal-close:hover { color: #BA272C; }

#announcementForm {
    padding: 20px 24px 8px;
}

.form-group {
    margin-bottom: 14px;
}
.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #4A453D;
    margin-bottom: 6px;
}
.form-group input[type="text"],
.form-group input[type="date"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid #DDD8CE;
    border-radius: 6px;
    font-family: 'Open Sans', sans-serif;
    font-size: 0.95rem;
    color: #1E1B16;
    background: #FAFAF7;
}
.form-group input[type="text"]:focus,
.form-group input[type="date"]:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #004B87;
    background: var(--white);
}
.form-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.label-hint {
    font-weight: 400;
    font-size: 0.8rem;
    color: #8C8578;
}
.label-hint code {
    background: #F0EDE6;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 0.78rem;
}

.ann-slug-row {
    display: flex;
    align-items: stretch;
    border: 1px solid #DDD8CE;
    border-radius: 6px;
    background: #FAFAF7;
    overflow: hidden;
}
.ann-slug-row:focus-within {
    border-color: #004B87;
    background: var(--white);
}
.ann-slug-prefix {
    background: #F0EDE6;
    color: #8C8578;
    font-size: 0.9rem;
    padding: 9px 10px;
    border-right: 1px solid #DDD8CE;
    font-family: monospace;
}
.ann-slug-row input {
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    flex: 1;
}
.ann-slug-row input:focus {
    outline: none;
}

.checkbox-label {
    display: flex !important;
    align-items: center;
    gap: 8px;
    font-weight: 500 !important;
    cursor: pointer;
}
.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
}

#annBodyEditor {
    background: #FAFAF7;
    min-height: 180px;
}
.ql-editor {
    min-height: 160px;
    font-family: 'Open Sans', sans-serif;
}
.event-html-source {
    width: 100%;
    font-family: monospace;
    font-size: 0.8rem;
    padding: 8px;
    border: 1px solid #DDD8CE;
    border-radius: 6px;
    background: #FAFAF7;
}

.event-image-field {
    border: 1px dashed #DDD8CE;
    border-radius: 6px;
    padding: 12px;
    background: #FAFAF7;
}
.event-image-preview {
    display: block;
    max-width: 100%;
    max-height: 220px;
    border-radius: 6px;
    margin-bottom: 10px;
    object-fit: cover;
}
.event-image-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.event-image-status {
    font-size: 0.85rem;
    color: #8C8578;
}
.event-image-status.error { color: #BA272C; }
.event-image-status.saved { color: #2D5E2A; }

.form-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    padding: 16px 0 8px;
    border-top: 1px solid #DDD8CE;
    margin-top: 16px;
}
.ann-delete-btn {
    margin-right: auto;
    color: #BA272C !important;
    border-color: #BA272C !important;
}
.ann-delete-btn:hover {
    background: #BA272C !important;
    color: #fff !important;
}

.btn {
    display: inline-block;
    padding: 9px 18px;
    border-radius: 6px;
    font-family: 'Oswald', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    cursor: pointer;
    border: 1px solid transparent;
    text-decoration: none;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.btn-primary {
    background: #BA272C;
    color: #fff;
    border-color: #BA272C;
}
.btn-primary:hover { background: #8E1E22; border-color: #8E1E22; }
.btn-secondary {
    background: var(--white);
    color: #4A453D;
    border-color: #DDD8CE;
}
.btn-secondary:hover { background: #F0EDE6; }
.btn-add {
    flex-shrink: 0;
}

.event-message {
    padding: 0 24px 16px;
    font-size: 0.9rem;
}
.event-message.error { color: #BA272C; }
.event-message.success { color: #2D5E2A; }

/* List view */
.ann-list {
    margin-top: 24px;
    display: grid;
    gap: 16px;
}
.ann-empty {
    color: #8C8578;
    text-align: center;
    padding: 48px 0;
    font-size: 0.95rem;
}
.events-loading {
    color: #8C8578;
    font-size: 0.9rem;
    text-align: center;
    padding: 24px 0;
}

.ann-card {
    background: var(--white);
    border: 1px solid #DDD8CE;
    border-radius: 10px;
    overflow: hidden;
    display: grid;
    grid-template-columns: 220px 1fr;
    transition: box-shadow 0.15s;
    position: relative;
}
.ann-card:hover {
    box-shadow: 0 4px 16px rgba(30, 27, 22, 0.08);
}
.ann-card.no-image {
    grid-template-columns: 1fr;
}
.ann-card-image {
    width: 100%;
    height: 100%;
    min-height: 140px;
    object-fit: cover;
    display: block;
}
.ann-card-body {
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.ann-card-meta {
    display: flex;
    gap: 8px;
    align-items: center;
    font-size: 0.78rem;
    color: #8C8578;
    flex-wrap: wrap;
}
.ann-card-date {
    font-weight: 600;
    color: #4A453D;
}
.ann-card-title {
    font-family: 'Oswald', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: #3E2E18;
    line-height: 1.2;
    margin: 0;
}
.ann-card-excerpt {
    color: #4A453D;
    font-size: 0.9rem;
    line-height: 1.5;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
}
.ann-card-actions {
    display: flex;
    gap: 10px;
    margin-top: 6px;
    flex-wrap: wrap;
}
.ann-card-link {
    color: #004B87;
    text-decoration: underline;
    font-size: 0.85rem;
}
.ann-card-link:hover { color: #BA272C; }

/* Status badges */
.ann-status-badge {
    font-family: 'Oswald', sans-serif;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 2px 8px;
    border-radius: 12px;
}
.ann-status-unpublished { background: #F0EDE6; color: #8C8578; }
.ann-status-private    { background: #FFF1D6; color: #876237; }
.ann-status-public     { background: #DBEDD9; color: #2D5E2A; }
.ann-popup-badge {
    background: #004B87;
    color: #fff;
    font-family: 'Oswald', sans-serif;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 2px 8px;
    border-radius: 12px;
}

@media (max-width: 600px) {
    .ann-card {
        grid-template-columns: 1fr;
    }
    .ann-card-image {
        height: 180px;
        min-height: 0;
    }
    .form-row-2 {
        grid-template-columns: 1fr;
    }
}

.rich-text p { margin: 0 0 12px; }
.rich-text p:last-child { margin-bottom: 0; }
.rich-text h2, .rich-text h3, .rich-text h4 {
    font-family: 'Oswald', sans-serif;
    color: #3E2E18;
    margin: 18px 0 10px;
}
.rich-text h2 { font-size: 1.2rem; }
.rich-text h3 { font-size: 1.05rem; }
.rich-text h4 { font-size: 0.95rem; }
.rich-text ul, .rich-text ol { margin: 0 0 12px 24px; padding-left: 4px; }
.rich-text li { margin-bottom: 4px; }
.rich-text a { color: #004B87; text-decoration: underline; }
.rich-text a:hover { color: #BA272C; }
.rich-text img { max-width: 100%; height: auto; border-radius: 6px; margin: 8px 0; }
.rich-text blockquote {
    border-left: 3px solid #DDD8CE;
    padding-left: 12px;
    color: #8C8578;
    margin: 8px 0;
}

/* Short-link row in admin modal */
.short-link-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    margin-bottom: 14px;
    background: #F0EDE6;
    border-radius: 6px;
    font-size: 0.85rem;
    flex-wrap: wrap;
}
.short-link-label {
    font-weight: 600;
    color: #4A453D;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.72rem;
    font-family: 'Oswald', sans-serif;
}
.short-link-row a {
    color: #004B87;
    text-decoration: none;
    font-family: monospace;
    word-break: break-all;
}
.short-link-row a:hover { text-decoration: underline; }
.short-link-copy {
    background: var(--white);
    border: 1px solid #DDD8CE;
    color: #4A453D;
    font-family: 'Oswald', sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    margin-left: auto;
}
.short-link-copy:hover { background: #F0EDE6; }

/* Quill editor view — give paragraphs and lists the same spacing they'll have when rendered.
   !important is required because Quill's stylesheet sets margin: 0 on .ql-editor p. */
.ql-editor p { margin: 0 0 12px !important; }
.ql-editor p:last-child { margin-bottom: 0 !important; }
.ql-editor ol, .ql-editor ul { margin: 0 0 12px 0 !important; }
.ql-editor li { margin-bottom: 4px; }

/* Detail popup (when clicking an announcement card from this page) */
.ann-detail-body {
    padding: 24px;
}
.ann-detail-image {
    display: block;
    width: calc(100% + 48px);
    margin: -24px -24px 16px;
    max-height: 320px;
    object-fit: cover;
}
.ann-detail-date {
    font-size: 0.85rem;
    color: #8C8578;
    margin-bottom: 6px;
}
.ann-detail-title {
    font-family: 'Oswald', sans-serif;
    font-size: 1.7rem;
    color: #3E2E18;
    margin-bottom: 16px;
    line-height: 1.2;
}
.ann-detail-content {
    color: #4A453D;
    line-height: 1.65;
    font-size: 0.95rem;
}
.ann-detail-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #DDD8CE;
}


/* === Dark mode (audit #35-42, added 2026-08-05) =========================== */
[data-theme="dark"] .ann-card-title, [data-theme="dark"] .ann-modal h2,
[data-theme="dark"] .ann-detail-title { color: var(--brown-dark); }
[data-theme="dark"] .ann-card-date, [data-theme="dark"] .ann-card-excerpt,
[data-theme="dark"] .ann-form label, [data-theme="dark"] .ann-detail-content,
[data-theme="dark"] .ann-detail-date { color: var(--gray-700); }
[data-theme="dark"] .rich-text, [data-theme="dark"] .rich-text h1,
[data-theme="dark"] .rich-text h2, [data-theme="dark"] .rich-text h3,
[data-theme="dark"] .rich-text p { color: var(--gray-700); }
[data-theme="dark"] .rich-text a, [data-theme="dark"] .ac-link { color: var(--tl-blue); }
[data-theme="dark"] .ann-form input[type="text"],
[data-theme="dark"] .ann-form input[type="date"],
[data-theme="dark"] .ann-form input[type="datetime-local"],
[data-theme="dark"] .ann-form select,
[data-theme="dark"] .ann-form textarea {
    background: var(--white); color: var(--gray-900); border-color: var(--gray-200);
}
[data-theme="dark"] #annBodyEditor { background: #1A1816; }
[data-theme="dark"] .ql-snow .ql-stroke { stroke: #C4BFB6; }
[data-theme="dark"] .ql-snow .ql-fill { fill: #C4BFB6; }
[data-theme="dark"] .ql-snow .ql-picker { color: #C4BFB6; }
[data-theme="dark"] .ql-toolbar.ql-snow, [data-theme="dark"] .ql-container.ql-snow { border-color: #3A3734; }
[data-theme="dark"] .btn-secondary { color: var(--gray-700); border-color: var(--gray-200); }
[data-theme="dark"] .btn-secondary:hover { background: #35322F; }
[data-theme="dark"] .ann-slug-row, [data-theme="dark"] .ann-hint code,
[data-theme="dark"] .ann-image-field, [data-theme="dark"] .short-link-row {
    background: var(--gray-100); border-color: var(--gray-200);
}
[data-theme="dark"] .short-link-copy { color: var(--tl-blue); }
[data-theme="dark"] .ann-status-public { background: #1A2A1A; color: #81C784; }
[data-theme="dark"] .ann-status-private { background: #1A2A3A; color: #64B5F6; }
[data-theme="dark"] .ann-status-unpublished { background: #3A3020; color: #D4A55A; }

/* The modal fields use .form-group (not .ann-form) with hard-coded light
 * hexes — theme them directly (audit #38 addendum). */
[data-theme="dark"] .form-group input[type="text"],
[data-theme="dark"] .form-group input[type="date"],
[data-theme="dark"] .form-group select,
[data-theme="dark"] .form-group textarea {
    background: var(--white);
    color: var(--gray-900);
    border-color: var(--gray-200);
}
[data-theme="dark"] .ann-slug-prefix { background: var(--gray-100); color: var(--gray-700); }
[data-theme="dark"] .ann-hint code, [data-theme="dark"] .friendly-url-hint code {
    background: var(--gray-100); color: var(--gray-700);
}


/* Dues-gated empty state. A family whose dues aren't recorded yet can't read
   troop announcements — this explains that instead of surfacing the rules
   error, and points at the one thing that changes it. */
.ann-locked {
    max-width: 520px;
    margin: 28px auto;
    padding: 30px 26px;
    text-align: center;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg, 12px);
}
.ann-locked h2 {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    color: var(--brown-dark);
    margin: 0 0 10px;
}
.ann-locked p {
    color: var(--gray-700);
    font-size: 0.95rem;
    line-height: 1.6;
    margin: 0 0 18px;
}
.ann-locked-cta {
    display: inline-block;
    background: var(--tl-blue);
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.92rem;
    padding: 11px 22px;
    border-radius: 8px;
}
.ann-locked-cta:hover { filter: brightness(1.08); }
.ann-locked-note {
    font-size: 0.86rem;
    color: var(--gray-500);
    margin: 16px 0 0;
}
