/*
 * Heartland FurMeet – NEWS
 * Datei: news.css
 * Typ: Web/PC – Stylesheet
 *
 * Zuständig für:
 * - News-Karten und News-Übersicht
 * - Kategorien
 * - Likes
 * - Angepinnte News
 * - Newsticker
 * - Newsverwaltung für Moderatoren
 *
 * Keine globalen Layout- oder Dashboard-Regeln.
 */

/* =========================================================
   Einheitliche Buttons
   ========================================================= */

.news-confirm-actions button,
.news-create-form button[type="submit"],
.news-edit-form button[type="submit"],
.news-management-table a,
.news-delete-trigger,
.news-edit-cancel {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 180px;
    min-width: 180px;
    height: 44px;
    min-height: 44px;
    margin: 0;
    padding: 10px 18px;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease, filter 0.18s ease;
}

    .news-confirm-actions button:hover,
    .news-management-table a:hover,
    .news-edit-cancel:hover {
        border-color: var(--accent);
        background: var(--surface-hover);
    }

.news-create-form button[type="submit"],
.news-edit-form button[type="submit"] {
    border-color: var(--accent);
    background: var(--accent);
    color: var(--background);
    font-weight: 700;
}

    .news-create-form button[type="submit"]:hover,
    .news-edit-form button[type="submit"]:hover {
        filter: brightness(1.08);
    }

.news-delete-trigger {
    border-color: color-mix(in srgb, var(--error) 50%, transparent);
    background: color-mix(in srgb, var(--error) 12%, var(--surface));
    color: var(--error);
}

    .news-delete-trigger:hover {
        border-color: var(--error);
        background: color-mix(in srgb, var(--error) 22%, var(--surface));
    }

#news-delete-confirm-button {
    border-color: var(--error);
    background: var(--error);
    color: var(--background);
}

    #news-delete-confirm-button:hover {
        filter: brightness(1.1);
    }

#news-delete-cancel {
    background: var(--surface);
    color: var(--text);
}

/* =========================================================
   News-Übersicht
   ========================================================= */

.news-section {
    width: 100%;
    min-width: 0;
}

.news-section__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.news-section__title {
    margin: 0;
    font-size: 1.5rem;
    line-height: 1.3;
}

.news-section__list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
    gap: 20px;
}

/* News-Karten */

.news-card {
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    color: var(--text);
}

.news-card__content {
    padding: 18px;
}

.news-card__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.news-card__category {
    display: inline-flex;
    align-items: center;
    padding: 4px 9px;
    border: 1px solid currentColor;
    border-radius: 999px;
    font-size: 0.8rem;
}

.news-card__title {
    margin: 0 0 10px;
    font-size: 1.15rem;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.news-card__excerpt {
    margin: 0;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

.news-card__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
}

.news-card__like {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

    .news-card__like[aria-pressed="true"] {
        font-weight: 700;
    }

/* Angepinnte News */

.news-card--pinned {
    border: 2px solid var(--accent);
    background: var(--surface);
}

    .news-card--pinned .news-card__pinned-label {
        color: var(--accent);
        font-weight: 700;
    }

/* Leere News-Listen */

.news-empty {
    padding: 24px;
    border: 1px dashed var(--border-strong);
    border-radius: 12px;
    color: var(--text-secondary);
    text-align: center;
}

/* Newsticker */

.news-ticker {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    padding: 12px 16px;
    border-radius: 8px;
    background: var(--surface);
    overflow-wrap: anywhere;
}

.news-ticker__label {
    flex: 0 0 auto;
    font-weight: 700;
}

/* =========================================================
   Statusmeldungen
   ========================================================= */

.news-message {
    margin: 16px 0;
    padding: 12px 16px;
    border-radius: 8px;
}

.news-message-success {
    border: 1px solid color-mix(in srgb, var(--success) 40%, transparent);
    background: color-mix(in srgb, var(--success) 12%, var(--surface));
    color: var(--success);
}

/* =========================================================
   News auf der Startseite
   ========================================================= */

.home-news-list .news-card {
    border-radius: 10px;
    background: var(--background);
}

.home-news-list .news-card__content {
    padding: 14px;
}

.home-news-list .news-card__meta {
    gap: 6px;
    margin-bottom: 8px;
}

.home-news-list .news-card__title {
    margin-bottom: 8px;
    font-size: 1rem;
}

.home-news-list .news-card__excerpt {
    line-height: 1.5;
}

.home-news-list time {
    display: block;
    margin-top: 10px;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

/* =========================================================
   Löschbestätigung
   ========================================================= */

.news-confirm-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: var(--overlay);
}

    .news-confirm-overlay[hidden] {
        display: none;
    }

.news-confirm-dialog {
    width: 100%;
    max-width: 440px;
    padding: 1.5rem;
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

    .news-confirm-dialog h2 {
        margin-top: 0;
    }

.news-confirm-actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

/* =========================================================
   Newsverwaltung – Web/PC
   ========================================================= */

.news-management {
    width: min(100% - 32px, 1200px);
    margin: 36px auto;
    color: var(--text);
}

.news-management-header {
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

    .news-management-header h1 {
        margin: 0 0 8px;
        font-size: clamp(1.8rem, 4vw, 2.4rem);
        line-height: 1.2;
    }

    .news-management-header p {
        margin: 0;
        color: var(--text-secondary);
        line-height: 1.6;
    }

/* Erstellen und Listen */

.news-management-create,
.news-management-list {
    min-width: 0;
    margin-bottom: 28px;
    padding: clamp(18px, 3vw, 28px);
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

    .news-management-create h2,
    .news-management-list h2 {
        margin: 0 0 22px;
        font-size: 1.35rem;
        line-height: 1.35;
    }

/* Formulare */

.news-create-form,
.news-edit-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

    .news-create-form .form-group,
    .news-edit-form .form-group {
        min-width: 0;
        margin: 0;
    }

        .news-create-form .form-group:has(textarea),
        .news-edit-form .form-group:has(textarea),
        .news-create-form .form-group:has(input[type="checkbox"]),
        .news-edit-form .form-group:has(input[type="checkbox"]) {
            grid-column: 1 / -1;
        }

    .news-create-form label,
    .news-edit-form label {
        display: block;
        margin-bottom: 8px;
        font-weight: 600;
        line-height: 1.4;
    }

    .news-create-form input:not([type="checkbox"]),
    .news-create-form select,
    .news-create-form textarea,
    .news-edit-form input:not([type="checkbox"]),
    .news-edit-form select,
    .news-edit-form textarea {
        display: block;
        box-sizing: border-box;
        width: 100%;
        min-width: 0;
        padding: 12px 14px;
        border: 1px solid var(--border-strong);
        border-radius: 8px;
        background: var(--background);
        color: var(--text);
        font: inherit;
        transition: border-color 0.18s ease, box-shadow 0.18s ease;
    }

    .news-create-form textarea,
    .news-edit-form textarea {
        min-height: 180px;
        resize: vertical;
        line-height: 1.6;
    }

        .news-create-form input:focus,
        .news-create-form select:focus,
        .news-create-form textarea:focus,
        .news-edit-form input:focus,
        .news-edit-form select:focus,
        .news-edit-form textarea:focus {
            outline: none;
            border-color: var(--accent);
            box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
        }

    .news-create-form input[type="checkbox"],
    .news-edit-form input[type="checkbox"] {
        width: 17px;
        height: 17px;
        margin: 0 8px 0 0;
        accent-color: var(--accent);
        vertical-align: middle;
    }

    .news-create-form .form-group:has(input[type="checkbox"]) label,
    .news-edit-form .form-group:has(input[type="checkbox"]) label {
        display: flex;
        align-items: center;
        gap: 4px;
        margin: 0;
        font-weight: 500;
    }

    /* Formularaktionen */

    .news-create-form button[type="submit"],
    .news-edit-form button[type="submit"],
    .news-edit-form .news-edit-cancel {
        justify-self: start;
        grid-column: 1 / -1;
    }

/* Tabellenaktionen */

.news-management-table-wrapper {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 10px;
}

.news-management-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

    .news-management-table th,
    .news-management-table td {
        padding: 14px 16px;
        border-bottom: 1px solid var(--border);
        vertical-align: middle;
    }

    .news-management-table th {
        background: var(--background);
        color: var(--text-secondary);
        font-size: 0.82rem;
        font-weight: 700;
        letter-spacing: 0.035em;
        text-transform: uppercase;
        white-space: nowrap;
    }

    .news-management-table tbody tr:last-child td {
        border-bottom: 0;
    }

    .news-management-table tbody tr:hover {
        background: var(--surface-hover);
    }

    .news-management-table td:first-child {
        min-width: 180px;
        font-weight: 600;
        overflow-wrap: anywhere;
    }

    .news-management-table td:last-child {
        white-space: nowrap;
    }

/* Löschformular */

.news-delete-form {
    display: inline-flex;
    margin: 0;
}

/* Leere Verwaltungsliste */

.news-management-list > p {
    margin: 0;
    padding: 18px;
    border: 1px dashed var(--border-strong);
    border-radius: 8px;
    color: var(--text-secondary);
    text-align: center;
}

/* Erfolgsmeldung in der Verwaltung */

.news-management .news-message {
    padding: 14px 18px;
    border-radius: 9px;
    line-height: 1.5;
}

.news-management .news-message-success {
    border-color: color-mix(in srgb, var(--success) 40%, transparent);
    background: color-mix(in srgb, var(--success) 12%, var(--surface));
    color: var(--success);
}

/* Einheitliche Dialogfarben innerhalb der Newsverwaltung */

.news-management .news-confirm-dialog {
    background: var(--surface);
    color: var(--text);
}

/* =========================================================
   Quellenlinks in News-Karten
   ========================================================= */

.news-card__source {
    margin: 8px 0;
    color: inherit;
    font-size: inherit;
}

    .news-card__source a {
        color: inherit;
        text-decoration: none;
    }

        .news-card__source a:hover {
            color: var(--accent);
            text-decoration: none;
        }

/* =========================================================
   Responsive Anpassungen
   ========================================================= */

@media (max-width: 760px) {
    .news-management {
        width: min(100% - 24px, 1200px);
        margin: 24px auto;
    }

    .news-create-form,
    .news-edit-form {
        grid-template-columns: minmax(0, 1fr);
        gap: 18px;
    }

        .news-create-form .form-group,
        .news-edit-form .form-group {
            grid-column: 1 / -1;
        }

    .news-management-table th,
    .news-management-table td {
        padding: 11px 12px;
    }
}

@media (max-width: 600px) {
    .news-section__header {
        align-items: flex-start;
        flex-direction: column;
    }

    .news-section__list {
        grid-template-columns: minmax(0, 1fr);
    }

    .news-card__content {
        padding: 15px;
    }

    .home-news-list .news-card__content {
        padding: 12px;
    }
}

@media (max-width: 480px) {
    .news-management {
        width: calc(100% - 20px);
        margin: 16px auto;
    }

    .news-management-create,
    .news-management-list {
        padding: 16px;
        border-radius: 10px;
    }

    .news-management-table th,
    .news-management-table td {
        padding: 10px;
        font-size: 0.85rem;
    }

        .news-management-table td:last-child {
            white-space: normal;
        }

            .news-management-table td:last-child a,
            .news-management-table td:last-child .news-delete-trigger {
                margin: 2px;
            }
}

/* Startseiten-News: abgestimmtes Kartenlayout */
.home-news-list .news-card {
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    background: var(--surface);
    color: var(--text);
}

.home-news-list .news-card--pinned {
    border: 2px solid var(--accent);
}

.home-news-list .news-card__content {
    padding: 18px;
}

.home-news-list .news-card__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.home-news-list .news-card__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.home-news-list .news-card__like-form {
    margin: 0;
}

.home-news-list .news-card__like {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 52px;
    padding: 7px 11px;
    border: 1px solid var(--accent);
    border-radius: 999px;
    background: transparent;
    color: var(--text);
    font: inherit;
    line-height: 1.2;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

    .home-news-list .news-card__like span:first-child {
        font-size: 1.15rem;
        line-height: 1;
    }

    .home-news-list .news-card__like[aria-pressed="true"] {
        background: rgba(214, 182, 92, .14);
        border-color: var(--accent);
        color: var(--accent);
    }

    .home-news-list .news-card__like:disabled {
        opacity: .65;
        cursor: not-allowed;
    }

.home-news-list .news-card__title {
    margin: 0;
    font-size: 1.15rem;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.home-news-list .news-card__separator {
    width: 100%;
    height: 3px;
    margin: 12px 0 16px;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(90deg, transparent 0%, var(--accent) 18%, rgba(214, 182, 92, .18) 82%, transparent 100%);
    opacity: .9;
}

.home-news-list .news-card__separator--bottom {
    height: 2px;
    margin: 16px 0 12px;
    opacity: .55;
}

.home-news-list .news-card__excerpt {
    margin: 0;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

.home-news-list .news-card__footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 14px;
    margin: 0;
    color: var(--text-secondary);
    font-size: .82rem;
}

    .home-news-list .news-card__footer time {
        display: inline;
        margin: 0;
        color: inherit;
        font-size: inherit;
    }

    .home-news-list .news-card__footer .news-card__source {
        margin: 0;
        font-size: inherit;
    }

        .home-news-list .news-card__footer .news-card__source a {
            color: inherit;
            text-decoration: none;
        }

            .home-news-list .news-card__footer .news-card__source a:hover {
                color: var(--accent);
                text-decoration: underline;
            }

@media (max-width: 480px) {
    .home-news-list .news-card__content {
        padding: 14px;
    }

    .home-news-list .news-card__footer {
        gap: 6px 10px;
    }
}


.news-pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin: 24px 0;
}

    .news-pagination a,
    .news-pagination__current {
        display: inline-flex;
        justify-content: center;
        align-items: center;
        min-width: 40px;
        padding: 8px 12px;
        border: 1px solid var(--border);
        border-radius: 8px;
        color: var(--text);
        text-decoration: none;
    }

        .news-pagination a:hover,
        .news-pagination__current {
            border-color: var(--accent);
            background: var(--accent);
            color: #222;
        }