/**
 * SNAPSMACK - Community Component + Dock Styles
 *
 * Two distinct blocks:
 *
 *   1. .ss-community-dock  — floating FAB cluster (likes + reactions).
 *      Fixed-position, lives outside the document flow. Mirrors the social
 *      dock's position class system (ss-cdock-bottom-right etc.).
 *
 *   2. .ss-community       — in-flow comment thread block, embedded in
 *      a skin's layout (drawer, panel, etc.).
 *
 * Philosophy: neutral defaults that won't clash with any skin. Skins can
 * override via their own style.css using these selectors.
 * No skin-specific rules live here.
 *
 * Loaded via require_scripts[] in skin manifests alongside
 * ss-engine-community.js.
 */


/* ==========================================================================
   CONTAINER
   ========================================================================== */

.ss-community {
    margin-top: 32px;
    font-family: inherit;
    font-size: 14px;
    color: inherit;
}


/* ==========================================================================
   INTERACTION BAR (likes + reactions row)
   ========================================================================== */

.ss-community-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(128, 128, 128, 0.2);
}


/* --- LIKE BUTTON --- */

.ss-like-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: 1px solid rgba(128, 128, 128, 0.3);
    color: inherit;
    padding: 6px 14px;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    letter-spacing: 0.02em;
    transition: border-color 0.15s, color 0.15s;
    user-select: none;
}

.ss-like-btn:hover {
    border-color: rgba(128, 128, 128, 0.7);
}

.ss-like-btn.is-liked {
    border-color: #e05252;
    color: #e05252;
}

.ss-like-icon {
    display: inline-flex;
    align-items: center;
    line-height: 1;
    transition: transform 0.1s;
}

.ss-like-icon svg {
    fill: none;
    stroke: #e05252;
    stroke-width: 1.5;
    transition: fill 0.15s ease;
}

.ss-like-btn.is-liked .ss-like-icon svg {
    fill: #e05252;
}

.ss-like-btn.is-liked .ss-like-icon {
    transform: scale(1.15);
}

.ss-like-count {
    font-size: 12px;
    opacity: 0.7;
    min-width: 1ch;
}


/* --- REACTIONS WRAP --- */

.ss-reactions-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.ss-reaction-trigger {
    background: none;
    border: 1px solid rgba(128, 128, 128, 0.3);
    color: inherit;
    width: 36px;
    height: 32px;
    cursor: pointer;
    font-size: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.15s;
}

.ss-reaction-trigger:hover,
.ss-reaction-trigger.has-reaction {
    border-color: rgba(128, 128, 128, 0.7);
}

.ss-reaction-add {
    font-size: 14px;
    opacity: 0.5;
}

.ss-reaction-picker {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    background: var(--wall-bg, #1a1a1a);
    border: 1px solid rgba(128, 128, 128, 0.3);
    padding: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    width: 240px;
    z-index: 100;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.ss-reaction-picker[hidden] {
    display: none;
}

.ss-reaction-opt {
    background: none;
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 18px;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: border-color 0.1s, transform 0.1s;
    border-radius: 2px;
}

.ss-reaction-opt:hover {
    border-color: rgba(128, 128, 128, 0.4);
    transform: scale(1.2);
}

.ss-reaction-opt.is-active {
    border-color: rgba(128, 128, 128, 0.6);
    background: rgba(128, 128, 128, 0.1);
}

.ss-rx-count {
    position: absolute;
    bottom: 1px;
    right: 2px;
    font-size: 8px;
    opacity: 0.6;
    font-family: inherit;
    line-height: 1;
}


/* --- REACTION SUMMARY --- */

.ss-reaction-summary {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.ss-rx-pill {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 12px;
    opacity: 0.7;
}


/* --- AUTH NUDGE --- */

.ss-auth-nudge {
    font-size: 12px;
    opacity: 0.5;
    letter-spacing: 0.02em;
    margin-left: auto;
}

.ss-auth-nudge a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.ss-auth-nudge a:hover {
    opacity: 1;
    text-decoration: none;
}


/* ==========================================================================
   COMMENT THREAD
   ========================================================================== */

.ss-comments {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.ss-comment-thread {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-bottom: 24px;
}

.ss-comment {
    padding: 14px 0;
    border-bottom: 1px solid rgba(128, 128, 128, 0.1);
}

.ss-comment:first-child {
    border-top: 1px solid rgba(128, 128, 128, 0.1);
}


/* --- COMMENT META ROW --- */

.ss-comment-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.ss-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.ss-avatar-placeholder {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(128, 128, 128, 0.2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0;
    flex-shrink: 0;
}

.ss-commenter {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.ss-comment-date {
    font-size: 11px;
    opacity: 0.4;
}

.ss-comment-delete {
    background: none;
    border: none;
    cursor: pointer;
    color: inherit;
    opacity: 0;
    font-size: 10px;
    padding: 2px 4px;
    margin-left: auto;
    transition: opacity 0.15s;
}

.ss-comment:hover .ss-comment-delete {
    opacity: 0.4;
}

.ss-comment-delete:hover {
    opacity: 1 !important;
}

.ss-comment-body {
    font-size: 14px;
    line-height: 1.55;
    opacity: 0.85;
    padding-left: 36px; /* aligns with text after avatar */
}


/* ==========================================================================
   COMMENT FORM
   ========================================================================== */

.ss-comment-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ss-comment-input-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.ss-comment-textarea {
    flex: 1;
    background: none;
    border: none;
    border-bottom: 1px solid rgba(128, 128, 128, 0.3);
    color: inherit;
    font-family: inherit;
    font-size: 14px;
    padding: 6px 0;
    resize: none;
    outline: none;
    line-height: 1.5;
    transition: border-color 0.15s;
    min-height: 32px;
    overflow: hidden;
}

.ss-comment-textarea:focus {
    border-bottom-color: rgba(128, 128, 128, 0.7);
}

.ss-comment-textarea::placeholder {
    opacity: 0.4;
}

.ss-comment-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-left: 38px; /* aligns with textarea */
}

.ss-comment-actions[hidden] {
    display: none;
}

.ss-comment-author {
    font-size: 11px;
    opacity: 0.4;
    letter-spacing: 0.04em;
}

.ss-comment-btns {
    display: flex;
    gap: 8px;
}

.ss-comment-cancel,
.ss-comment-submit {
    background: none;
    border: 1px solid rgba(128, 128, 128, 0.3);
    color: inherit;
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 6px 14px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.ss-comment-cancel:hover {
    border-color: rgba(128, 128, 128, 0.6);
}

.ss-comment-submit {
    background: rgba(128, 128, 128, 0.15);
}

.ss-comment-submit:hover {
    background: rgba(128, 128, 128, 0.3);
    border-color: rgba(128, 128, 128, 0.6);
}

.ss-comment-submit:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.ss-comment-status {
    font-size: 12px;
    padding-left: 38px;
    opacity: 0.6;
    min-height: 1em;
}


/* --- NOT LOGGED IN PROMPT --- */

.ss-comment-login-prompt {
    font-size: 13px;
    opacity: 0.5;
    padding: 12px 0;
    border-top: 1px solid rgba(128, 128, 128, 0.15);
}

.ss-comment-login-prompt a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.ss-comment-login-prompt a:hover {
    opacity: 1;
    text-decoration: none;
}


/* ==========================================================================
   COMMUNITY DOCK — floating FAB cluster
   ========================================================================== */

/* --- BASE --- */

.ss-community-dock {
    position: fixed;
    z-index: 9997;           /* below social dock (9998) and lightbox */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    pointer-events: none;    /* children re-enable as needed */
}

.ss-community-dock * {
    pointer-events: auto;
}


/* --- CORNER POSITIONS --- */
/* Mirrors ss-engine-social-dock.css naming: ss-cdock-{position} */

.ss-cdock-bottom-right {
    bottom: 84px;   /* stacks above the download button (bottom:80px) */
    right: 30px;
}

.ss-cdock-bottom-left {
    bottom: 84px;
    left: 30px;
}

.ss-cdock-top-right {
    top: 84px;
    right: 30px;
}

.ss-cdock-top-left {
    top: 84px;
    left: 30px;
}

.ss-cdock-right-top {
    right: 16px;
    top: 84px;
}

.ss-cdock-right-bottom {
    right: 16px;
    bottom: 84px;
}

.ss-cdock-left-top {
    left: 16px;
    top: 84px;
}

.ss-cdock-left-bottom {
    left: 16px;
    bottom: 84px;
}


/* --- CONFLICT OFFSET ---
   Applied when community dock and social dock share a corner.
   Shifts the community dock inward so they don't overlap. */

.ss-cdock-bottom-right.ss-cdock-conflict { right: 76px;  }
.ss-cdock-bottom-left.ss-cdock-conflict  { left:  76px;  }
.ss-cdock-top-right.ss-cdock-conflict    { right: 76px;  }
.ss-cdock-top-left.ss-cdock-conflict     { left:  76px;  }
.ss-cdock-right-top.ss-cdock-conflict    { bottom: 76px; }
.ss-cdock-right-bottom.ss-cdock-conflict { bottom: 76px; }
.ss-cdock-left-top.ss-cdock-conflict     { bottom: 76px; }
.ss-cdock-left-bottom.ss-cdock-conflict  { bottom: 76px; }


/* --- BUTTON CLUSTER --- */

.ss-cdock-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}


/* --- INDIVIDUAL BUTTONS --- */

.ss-cdock-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.25);
    background: rgba(0, 0, 0, 0.65);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    color: rgba(255, 255, 255, 0.75);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-size: 18px;
    line-height: 1;
    transition: background 0.15s, border-color 0.15s, transform 0.15s, color 0.15s;
    padding: 0;
    opacity: 0.7;
    text-decoration: none;
    -webkit-user-select: none;
    user-select: none;
}

.ss-cdock-btn:hover {
    background: rgba(0, 0, 0, 0.88);
    border-color: rgba(255, 255, 255, 0.6);
    color: #fff;
    transform: scale(1.1);
    opacity: 1;
}


/* --- TRIGGER STATES --- */

.ss-cdock-react-btn.has-reaction {
    border-color: rgba(255, 255, 255, 0.5);
    opacity: 1;
}

.ss-cdock-react-btn.is-liked {
    border-color: rgba(224, 82, 82, 0.8);
    color: #e05252;
    opacity: 1;
}

.ss-cdock-heart-active {
    color: #e05252;
}

/* --- SVG HEART IN PICKER --- */

.ss-cdock-heart-svg svg {
    fill: none;
    stroke: #e05252;
    stroke-width: 1.5;
    transition: fill 0.15s ease, stroke 0.15s ease;
}

.ss-cdock-heart.is-active .ss-cdock-heart-svg svg {
    fill: #e05252;
    stroke: #e05252;
}

.ss-cdock-heart.is-active {
    border-color: rgba(224, 82, 82, 0.5);
    background: rgba(224, 82, 82, 0.12);
}

.ss-cdock-heart.is-active:hover {
    background: rgba(224, 82, 82, 0.2);
}

/* Heart SVG in FAB button */
.ss-cdock-heart-active svg {
    fill: #e05252;
    stroke: #e05252;
    stroke-width: 1.5;
    width: 20px;
    height: 20px;
}

.ss-cdock-current-rx {
    font-size: 20px;
}

.ss-cdock-react-btn svg {
    opacity: 0.8;
}


/* --- REACTION PICKER --- */

.ss-cdock-picker {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: rgba(0, 0, 0, 0.75);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 28px;
    padding: 8px 6px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);

    /* Slide-in animation */
    transform-origin: bottom center;
    animation: ss-cdock-expand 0.2s cubic-bezier(0.2, 0.9, 0.2, 1) both;
}

.ss-cdock-picker[hidden] {
    display: none;
}

@keyframes ss-cdock-expand {
    from { opacity: 0; transform: scale(0.8) translateY(8px); }
    to   { opacity: 1; transform: scale(1)   translateY(0);   }
}

/* Flip direction for top-positioned docks */
.ss-cdock-top-right .ss-cdock-picker,
.ss-cdock-top-left  .ss-cdock-picker {
    transform-origin: top center;
    animation-name: ss-cdock-expand-down;
}

@keyframes ss-cdock-expand-down {
    from { opacity: 0; transform: scale(0.8) translateY(-8px); }
    to   { opacity: 1; transform: scale(1)   translateY(0);    }
}


/* --- REACTION OPTION BUTTONS --- */

.ss-cdock-reaction {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid transparent;
    background: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    transition: background 0.12s, border-color 0.12s, transform 0.12s;
    padding: 0;
    position: relative;
}

.ss-cdock-reaction:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: scale(1.2);
}

.ss-cdock-reaction.is-active {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.4);
}

.ss-cdock-emoji {
    font-size: 20px;
    line-height: 1;
}

.ss-cdock-rx-count {
    font-size: 8px;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1;
    font-family: inherit;
}


/* --- RESPONSIVE --- */

@media (max-width: 480px) {
    .ss-community-dock {
        display: none;
    }
}
