/* comment.css  --  per-game comment section (firebase-comment.js)
   Dark glass card that matches the site's dark gradient theme and the
   pink (#ec6090) accent used elsewhere. 
   css comments:
   */

.comment-section {
    max-width: 100%;
    margin: 26px 0 10px;
    padding: 22px 22px 18px;
    border-radius: 16px;
    background: rgba(20, 22, 40, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 10px 34px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: #e8e9f3;
    font-family: "Poppins", sans-serif;
    text-align: left;
}

/* the site centers text inside the game column -- force everything here left */
.comment-section,
.comment-section * {
    text-align: left;
}

.comment-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 16px;
    color: #fff;
}

.comment-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    height: 24px;
    padding: 0 8px;
    border-radius: 999px;
    background: #ec6090;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
}


/* ---- form ---- */

.comment-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.comment-form input,
.comment-form textarea {
    width: 100%;
    padding: 11px 14px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    font-size: 15px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s, background 0.15s;
}

.comment-form textarea {
    min-height: 84px;
    resize: vertical;
    line-height: 1.5;
}

.comment-form input:focus,
.comment-form textarea:focus {
    border-color: #ec6090;
    background: rgba(255, 255, 255, 0.08);
}

.comment-form input::placeholder,
.comment-form textarea::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.comment-form input:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    color: rgba(255, 255, 255, 0.75);
}

.btn-submit-comment {
    align-self: flex-end;
    padding: 10px 24px;
    border: none;
    border-radius: 999px;
    background: linear-gradient(135deg, #ec6090, #b5417d);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.12s, box-shadow 0.15s, opacity 0.15s;
}

.btn-submit-comment:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(236, 96, 144, 0.4);
}

.btn-submit-comment:active {
    transform: translateY(0);
    opacity: 0.9;
}


/* ---- list ---- */

.comment-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    /* height / overflow: see ".comment-section .comment-list(.is-scroll)" below */
}

.comment-empty {
    color: rgba(255, 255, 255, 0.5);
    font-size: 15px;
    text-align: center;
    padding: 24px 0;
    margin: 0;
}

.comment-item {
    display: flex;
    gap: 12px;
    padding: 14px 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    animation: comment-fade-in 0.25s ease;
}

.comment-item:last-child {
    border-bottom: none;
}

/* arrived here from a notification toast */
.comment-item.comment-hilite {
    animation: comment-hilite 2.6s ease;
    border-radius: 10px;
}
@keyframes comment-hilite {
    0%, 60% { background: rgba(0, 242, 254, 0.14); box-shadow: 0 0 0 1px rgba(0, 242, 254, 0.4); }
    100% { background: transparent; box-shadow: none; }
}

.comment-avatar {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 17px;
    font-weight: 700;
    text-transform: uppercase;
}

/* custom identity: image avatar (ubg88 admin, or a badges/<name> entry) */
.comment-avatar.comment-avatar-custom {
    background: #fff;
    padding: 0;
    box-shadow: 0 0 0 2px currentColor, 0 0 9px rgba(255, 255, 255, 0.18);
    color: rgba(255, 255, 255, 0.35);
}

.comment-avatar.comment-avatar-custom img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

/* badge chip next to the name -- inline background colour comes from JS */
.comment-badge {
    display: inline-block;
    margin-left: 2px;
    padding: 1px 7px;
    border-radius: 999px;
    background: #7c8190;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    vertical-align: 1px;
    white-space: nowrap;
}

.comment-body {
    flex: 1;
    min-width: 0;
}

.comment-meta {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 3px;
}

.comment-name {
    font-weight: 600;
    font-size: 14.5px;
    color: #fff;
}

.comment-time {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
}

.comment-text {
    font-size: 15px;
    line-height: 1.55;
    color: #dcdce8;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

.comment-reactions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.cmt-react-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    background: transparent;
    color: rgba(255, 255, 255, 0.6);
    font-size: 13px;
    cursor: pointer;
    transition: color 0.12s, border-color 0.12s, background 0.12s;
}

.cmt-react-btn:hover {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.3);
}

.cmt-react-btn.is-disabled {
    opacity: 0.45;
    cursor: default;
    pointer-events: none;
}

.cmt-react-btn.react-liked {
    color: #4ade80;
    border-color: #4ade80;
    background: rgba(74, 222, 128, 0.12);
}

.cmt-react-btn.react-disliked {
    color: #f87171;
    border-color: #f87171;
    background: rgba(248, 113, 113, 0.12);
}

.comment-delete,
.comment-edit {
    padding: 4px 10px;
    border: none;
    border-radius: 999px;
    background: transparent;
    font-size: 13px;
    cursor: pointer;
    transition: color 0.12s;
}

.comment-delete { color: rgba(248, 113, 113, 0.7); }
.comment-delete:hover { color: #f87171; }
.comment-edit { color: rgba(255, 255, 255, 0.55); }
.comment-edit:hover { color: #fff; }

.comment-edited {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.35);
    font-style: italic;
}

/* inline edit box */
.comment-item [hidden] {
    display: none !important;
}

.comment-edit-box {
    margin: 6px 0 2px;
}

.comment-edit-input {
    width: 100%;
    min-height: 64px;
    padding: 9px 12px;
    border-radius: 10px;
    border: 1px solid #ec6090;
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    font-size: 15px;
    font-family: inherit;
    line-height: 1.5;
    resize: vertical;
    outline: none;
}

.comment-edit-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.btn-cmt-save,
.btn-cmt-cancel {
    padding: 6px 16px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
}

.btn-cmt-save {
    background: #ec6090;
    color: #fff;
}

.btn-cmt-save:hover { background: #d94e80; }

.btn-cmt-cancel {
    background: transparent;
    border-color: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.7);
}

.btn-cmt-cancel:hover { color: #fff; }

/* "Change name" control next to the name field */
.cmt-change-name {
    align-self: flex-start;
    margin-top: -2px;
    padding: 2px 4px;
    border: none;
    background: transparent;
    color: #ec6090;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
}

.cmt-change-name:hover { text-decoration: underline; }
.cmt-change-name:disabled { opacity: 0.5; cursor: default; }
.cmt-cancel-name { color: rgba(255, 255, 255, 0.5); }

.cmt-name-msg {
    font-size: 12.5px;
    color: rgba(255, 255, 255, 0.55);
    margin-top: -2px;
}

.cmt-name-msg.is-error {
    color: #f87171;
}

@keyframes comment-fade-in {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 575px) {
    .comment-section {
        padding: 16px 14px;
        border-radius: 12px;
    }
    .comment-section-title {
        font-size: 18px;
    }
    .btn-submit-comment {
        align-self: stretch;
    }
}

/* ===== Threaded replies + one bounded scroll box ===== */

.comment-section .comment-list {
    overflow: visible;
}

/* The whole list is a scroll box (JS always adds .is-scroll when there are
   comments); it only shows a scrollbar once its content passes max-height,
   whether that's from many comments or one long reply thread. */
.comment-section .comment-list.is-scroll {
    max-height: 1000px;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 8px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.22) transparent;
}
.comment-section .comment-list.is-scroll::-webkit-scrollbar {
    width: 10px;
}
.comment-section .comment-list.is-scroll::-webkit-scrollbar-track {
    background: transparent;
    margin: 6px 0;
}
.comment-section .comment-list.is-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    border: 3px solid transparent;
    background-clip: padding-box;
}
.comment-section .comment-list.is-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.35);
    background-clip: padding-box;
}

.comment-item { scroll-margin: 14px; }

.comment-thread {
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    animation: comment-fade-in 0.25s ease;
}
.comment-thread:last-child { border-bottom: none; }

/* the root/reply items no longer carry their own divider */
.comment-thread .comment-item {
    border-bottom: none;
}

/* ---- Reply button on every comment ---- */
.comment-reply-btn {
    padding: 4px 10px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: rgba(255, 255, 255, 0.6);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.12s;
}
.comment-reply-btn:hover { color: #00f2fe; }

/* ---- Replies block, indented under the root ---- */
.comment-replies {
    margin-left: 52px;
    padding-left: 14px;
    border-left: 2px solid rgba(255, 255, 255, 0.08);
}
.comment-replies:not(.has-replies) {
    border-left: none;
    padding-left: 0;
    margin-left: 52px;
}

.comment-replies-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 2px 0 4px;
    padding: 4px 4px;
    border: none;
    background: transparent;
    color: #00f2fe;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}
.comment-replies-toggle::before {
    content: "";
    width: 18px;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
    opacity: 0.5;
}
.comment-replies-toggle:hover { text-decoration: underline; }

/* Reply list: collapses to 0 for "View N replies", otherwise grows to its
   natural height inside the one outer .comment-list scroll box -- no nested
   scrollbar. The big max-height is just the animation ceiling. */
.comment-reply-list {
    overflow: hidden;
    max-height: 20000px;
    opacity: 1;
    transition: max-height 0.3s ease, opacity 0.22s ease;
}
.comment-reply-list.is-collapsed {
    max-height: 0;
    opacity: 0;
}

/* smaller reply items */
.comment-item-reply {
    padding: 10px 4px;
    gap: 10px;
}
.comment-item-reply .comment-avatar {
    width: 32px;
    height: 32px;
    font-size: 14px;
}
.comment-item-reply .comment-text { font-size: 14px; }
.comment-item-reply .comment-name { font-size: 13.5px; }

/* ---- inline reply form ---- */
.comment-reply-form-slot { margin-top: 2px; }

.comment-reply-box {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    margin-top: 0;
    transition: max-height 0.2s ease, opacity 0.18s ease, margin-top 0.2s ease;
}
.comment-reply-box.is-open {
    max-height: 240px;
    opacity: 1;
    margin-top: 8px;
    margin-bottom: 10px;
}

.comment-reply-input {
    width: 100%;
    min-height: 56px;
    padding: 9px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    font-size: 14px;
    font-family: inherit;
    line-height: 1.5;
    resize: vertical;
    outline: none;
}
.comment-reply-input:focus { border-color: #00f2fe; }

.comment-reply-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}
.btn-reply-post {
    background: #00c2d1;
    color: #04252a;
}
.btn-reply-post:hover { background: #00d8e8; }

/* ===========================================================================
   Pinned comment
   One root comment per game can be pinned to the top by a moderator. The
   list order is done in JS (firebase-comment.js hoists it); everything here
   is the marker that explains WHY it is first, so it does not just look like
   the newest comment.
   ======================================================================== */

.comment-thread.is-pinned-thread {
    position: relative;
    border: 1px solid var(--ubg-accent-soft, rgba(236, 96, 144, .35));
    border-radius: 14px;
    background: var(--ubg-fill, rgba(255, 255, 255, .04));
    padding: 4px 8px 2px;
    margin-bottom: 14px;
}

.comment-pinned-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 8px;
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .03em;
    text-transform: uppercase;
    background: var(--ubg-accent, #ec6090);
    color: var(--ubg-accent-ink, #0b0d1a);
    vertical-align: middle;
}

.comment-pinned-tag::before {
    content: "\f08d";                 /* fa-thumbtack */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 9px;
}

/* The pin control sits with Reply/Edit/Delete and is only rendered for
   someone the pinners list allows, so it needs no colour of its own beyond
   reading as another text action. */
.comment-pin {
    background: transparent;
    border: none;
    padding: 0;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--ubg-text-mute, rgba(255, 255, 255, .5));
    transition: color .15s ease;
}

.comment-pin:hover {
    color: var(--ubg-accent, #ec6090);
}

.comment-pin.is-pinned {
    color: var(--ubg-accent, #ec6090);
}

@media (prefers-reduced-motion: reduce) {
    .comment-pin { transition: none; }
}
