/* ==========================================================================
   Soziales Netzwerk – Redesign
   Farben & Radius NUR über diese Variablen, wie vorgegeben.
   ========================================================================== */

:root {
    --main-color: #F7EFE6;
    --main-accent: #DAD4C9;
    --main-font-color: #191919;
    --font-color-one: #ededed;
    --accent-one: #870505;
    --accent-two: #c9c4b9;
    --accent-three: #F1EAE4;
    --shadow: 0 1px 2px rgba(27, 27, 47, .06), 0 12px 28px -12px rgba(27, 27, 47, .18);
    --sn-radius: 5px;
}

/* --------------------------------------------------------------------
   Grundgerüst / Reset innerhalb des Plugins
   -------------------------------------------------------------------- */
.sn-page,
.sn-page .container {
    color: var(--main-font-color);
}

.sn-page .tborder {
    border: 0;
    background: transparent;
    box-shadow: none;
}

.sn-page .trow1 {
    background: transparent;
}

.sn-page a {
    color: var(--main-font-color);
}

.sn-page textarea,
.sn-page input[type="text"],
.sn-page input[type="date"],
.sn-page input[type="time"] {
    font-family: inherit;
    color: var(--main-font-color);
}

/* --------------------------------------------------------------------
   Profil-Karte (oben): Avatar / Username / Felder / Plus-Button
   -------------------------------------------------------------------- */
.sn-card {
    background: var(--accent-three);
    border-radius: var(--sn-radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin: 20px 0;
}

.sn-card__top {
    display: flex;
    align-items: center;
    gap: 16px;
}

.sn-avatar {
    width: 84px;
    height: 84px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--main-accent);
    box-shadow: var(--shadow);
    border: 3px solid var(--main-color);
}

.sn-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.sn-info {
    flex: 1;
    min-width: 0;
}

.sn-username {
    font-weight: 700;
    color: var(--accent-one);
    font-size: 22px;
    line-height: 1.2;
}

.sn-username a {
    color: var(--accent-one);
    text-decoration: none;
}

.sn-fields {
    font-size: 13px;
    color: var(--main-font-color);
    margin-top: 6px;
}

.sn-fields img {
    max-height: 24px;
}

.sn-field {
    margin-bottom: 2px;
}

.sn-field__label {
    font-weight: 700;
}

.sn-add-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--accent-one);
    color: var(--font-color-one);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 27px;
    line-height: 1;
    text-decoration: none;
    flex-shrink: 0;
    box-shadow: var(--shadow);
    transition: transform .15s ease, opacity .15s ease;
}

.sn-add-btn:hover {
    transform: scale(1.08);
    color: var(--font-color-one);
    opacity: .9;
}

/* Freunde-Box + Titelbild-Box (zweite Reihe der Karte) */
.sn-card__bottom {
    display: flex;
    gap: 16px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.sn-friends-box {
    background: var(--main-accent);
    border-radius: var(--sn-radius);
    padding: 10px;
    width: 190px;
    flex-shrink: 0;
    height: 150px;
    overflow-y: auto;
}

.sn-friends-box__title {
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 6px;
    color: var(--main-font-color);
}

.sn-friend {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 0;
    font-size: 13px;
}

.sn-friend--pending,
.sn-friend--asked {
    opacity: .9;
}

.sn-avatar-xs {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.sn-avatar-sm {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.sn-icon-btn {
    color: var(--main-font-color);
    text-decoration: none;
    opacity: .7;
    margin-left: 2px;
}

.sn-icon-btn:hover {
    opacity: 1;
    color: var(--accent-one);
}

.sn-cover-box {
    flex: 1;
    min-width: 220px;
    min-height: 150px;
    border-radius: var(--sn-radius);
    background-color: var(--main-accent);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.sn-friendaction {
    margin-top: 10px;
    text-align: center;
    font-size: 14px;
}

.sn-fields .sn-field:first-child .sn-field__value {
    font-weight: bold;
}

/* --------------------------------------------------------------------
   Post-Grid (3er Reihen, Instagram-artig)
   -------------------------------------------------------------------- */
.sn-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, 350px);
    justify-content: center;
    gap: 6px;
    margin-top: 20px;
}

.sn-grid #posts {
    display: contents;
}

.sn-tile-wrap {
    position: relative;
    aspect-ratio: 1 / 1;
}

.sn-tile {
    position: absolute;
    inset: 0;
    display: block;
    background: var(--main-accent);
    border-radius: var(--sn-radius);
    overflow: hidden;
    text-decoration: none;
    color: var(--main-font-color);
    box-shadow: var(--shadow);
    transition: transform .15s ease;
}

.sn-tile:hover {
    transform: translateY(-2px);
}

.sn-tile__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.sn-tile__content {
    padding: 10px;
    height: 100%;
    box-sizing: border-box;
}

.sn-tile__date {
    display: block;
    font-size: 11px;
    opacity: .65;
    margin-bottom: 4px;
}

.sn-tile__text {
    display: -webkit-box;
    -webkit-line-clamp: 6;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 13px;
    line-height: 1.35;
}

/* --------------------------------------------------------------------
   Overlay / Pop-up (Post-Detail mit Kommentaren, & neuer Beitrag)
   Nutzt das CSS :target Muster, funktioniert auch für per AJAX
   nachgeladene Posts (kein zusätzliches JS nötig).
   -------------------------------------------------------------------- */
.sn-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    box-sizing: border-box;
    overflow-y: auto;
}

.sn-overlay:target {
    opacity: 1;
    pointer-events: auto;
}

.sn-overlay__backdrop {
    position: fixed;
    inset: 0;
    background: hsla(0, 0%, 0%, .6);
}

.sn-overlay__box {
    position: relative;
    z-index: 1;
    margin: auto;
    width: min(900px, 92vw);
    max-height: min(92vh, calc(100vh - 48px));
    background: var(--main-color);
    border-radius: var(--sn-radius);
    box-shadow: var(--shadow);
    display: flex;
    overflow: hidden;
    flex-shrink: 0;
}

.sn-overlay__box--single {
    display: block;
    width: min(480px, 92vw);
    padding: 24px;
    overflow-y: auto;
}

.sn-overlay__close {
    position: absolute;
    top: 6px;
    right: 14px;
    z-index: 2;
    font-size: 29px;
    line-height: 1;
    color: var(--main-font-color);
    text-decoration: none;
}

.sn-overlay__close:hover {
    color: var(--accent-one);
}

.sn-overlay__media {
    flex: 1.2;
    min-width: 0;
    overflow-y: auto;
    padding: 20px;
    border-right: 1px solid var(--accent-two);
}

.sn-overlay__comments {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 280px;
    max-width: 380px;
}

.sn-postHead {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.sn-postName {
    font-weight: 700;
    display: block;
}

.sn-postName a {
    color: var(--main-font-color);
    text-decoration: none;
}

.sn-postDate {
    font-size: 12px;
    opacity: .7;
    display: block;
}

.sn-gotolink {
    margin-left: auto;
    color: var(--main-font-color);
    opacity: .6;
    text-decoration: none;
}

.sn-gotolink:hover {
    opacity: 1;
    color: var(--accent-one);
}

.sn-socialPost {
    margin: 8px 0;
    line-height: 1.5;
}

.sn-postimg {
    margin-top: 10px;
    text-align: center;
}

.sn-postimg img {
    display: inline-block;
    width: auto;
    height: auto;
    max-width: 400px;
    max-height: 400px;
    border-radius: var(--sn-radius);
}

.sn-likes {
    font-size: 13px;
    text-align: right;
    border-top: 1px solid var(--accent-two);
    padding-top: 8px;
    margin-top: 12px;
}

.sn-like-link {
    color: var(--accent-one);
    text-decoration: none;
    font-weight: 700;
}

.sn-like-link .fa-heart {
    font-size: 10px;
    vertical-align: middle;
}

.sn-like-link:hover {
    opacity: .8;
}

/* Anzahl der Likes: zeigt nur die Zahl, Liste der Namen erscheint bei Hover/Klick (Tap = Fokus) */
.sn-likecount {
    position: relative;
    cursor: pointer;
    outline: none;
}

.sn-likelist {
    position: absolute;
    right: 0;
    bottom: 100%;
    margin-bottom: 6px;
    background: var(--main-color);
    border-radius: var(--sn-radius);
    box-shadow: var(--shadow);
    padding: 8px 12px;
    min-width: 150px;
    max-height: 180px;
    overflow-y: auto;
    text-align: left;
    display: none;
    z-index: 5;
}

.sn-likecount:hover .sn-likelist,
.sn-likecount:focus .sn-likelist,
.sn-likecount:focus-within .sn-likelist {
    display: block;
}

.sn-liker {
    display: block;
    font-size: 13px;
    padding: 2px 0;
    white-space: nowrap;
}

.sn-liker a {
    color: var(--main-font-color);
    text-decoration: none;
}

.sn-liker a:hover {
    color: var(--accent-one);
}

.sn-edit {
    margin-left: 6px;
}

.sn-edit-btn {
    background: none;
    border: 0;
    color: var(--main-font-color);
    opacity: .55;
    font-size: 13px;
    padding: 0 4px;
    cursor: pointer;
    text-decoration: none;
}

.sn-edit-btn:hover {
    opacity: 1;
    color: var(--accent-one);
}

/* Kommentare */
.sn-comments-list {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.sn-comment {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.sn-comment__body {
    flex: 1;
    font-size: 13px;
}

.sn-comment__name {
    font-weight: 700;
    margin-right: 6px;
}

.sn-comment__date {
    font-size: 12px;
    opacity: .65;
}

.sn-comment__text {
    margin-top: 3px;
    line-height: 1.4;
}

.sn-comment__likes {
    font-size: 12px;
    margin-top: 4px;
}

.sn-comment__likes .sn-like-link {
    font-weight: 400;
}

/* Kommentar-Formular unten in der Scrollbox – kein Bild-Upload */
.sn-comment-form {
    border-top: 1px solid var(--accent-two);
    padding: 12px 20px;
    background: var(--accent-three);
}

.sn-comment-form textarea {
    width: 100%;
    resize: vertical;
    border-radius: var(--sn-radius);
    border: 1px solid var(--accent-two);
    padding: 8px;
    background: var(--main-color);
    color: var(--main-font-color);
    margin-top: 6px;
}

.sn-comment-form input[type="date"],
.sn-comment-form input[type="time"] {
    border-radius: var(--sn-radius);
    border: 1px solid var(--accent-two);
    padding: 3px 6px;
    font-size: 12px;
    background: var(--main-color);
}

.sn-comment-form img {
    vertical-align: middle;
}

.sn-send {
    background: var(--accent-one);
    color: var(--font-color-one);
    border: 0;
    border-radius: var(--sn-radius);
    padding: 7px 16px;
    margin-top: 8px;
    cursor: pointer;
    font-weight: 700;
}

.sn-send:hover {
    opacity: .9;
}

/* Formular für neuen Beitrag (Plus-Button Pop-up) */
.sn-newpost legend {
    font-weight: 700;
    color: var(--accent-one);
    font-size: 19px;
    margin-bottom: 12px;
}

.sn-newpost textarea {
    width: 100%;
    border-radius: var(--sn-radius);
    border: 1px solid var(--accent-two);
    padding: 10px;
    margin: 10px 0;
    background: var(--main-color);
    color: var(--main-font-color);
}

.sn-fileLabel {
    display: block;
    font-size: 13px;
    margin: 10px 0;
}

/* Bild-Popup (Klick auf Postbild) */
.sn-imgpop {
    position: fixed;
    inset: 0;
    z-index: 1100;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    box-sizing: border-box;
}

.sn-imgpop:target {
    opacity: 1;
    pointer-events: auto;
}

.sn-imgpop__backdrop {
    position: fixed;
    inset: 0;
    background: hsla(0, 0%, 0%, .75);
}

.sn-imgpop__box {
    position: relative;
    z-index: 1;
    margin: auto;
    max-width: 90vw;
    max-height: 90vh;
    width: fit-content;
    flex-shrink: 0;
}

.sn-imgpop__box img {
    max-width: 100%;
    max-height: 90vh;
    border-radius: var(--sn-radius);
    display: block;
}

/* --------------------------------------------------------------------
   Newsfeed (misc_main)
   -------------------------------------------------------------------- */
.sn-newsfeed-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 20px 0 4px;
}

.sn-newsfeed-title {
    font-size: 20px;
    color: var(--accent-one);
    margin: 0;
}

.sn-newsfeed-pages {
    font-size: 13px;
}

/* Lade-Spinner für Infinite Scroll */
#loader {
    display: block;
    margin: 24px auto;
}

/* --------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------- */
@media (max-width: 700px) {
    .sn-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 3px;
    }

    .sn-card__top {
        flex-wrap: wrap;
    }

    .sn-overlay__box {
        flex-direction: column;
        width: 96vw;
        max-height: 94vh;
    }

    .sn-overlay__media {
        border-right: 0;
        border-bottom: 1px solid var(--accent-two);
    }

    .sn-overlay__comments {
        max-width: none;
    }
}