/* ═══ Comments — shared styles for the whole site ═══
 *
 * Used by: case page, blog (insights) page, and any future content type
 * with comments. Loaded explicitly via <link> on pages that render the
 * comments partial.
 *
 * See also:
 *   resources/views/partials/comments/comments-{lang}.blade.php — markup
 *   public/js/comments.js                                      — behaviour
 *   .agents/workflows/design_system_guideline.md               — usage docs
 */

/* ─── Comments Section ─── */
.case-comments-section {
    border-top: 1px solid rgba(255,255,255,0.06);
    padding-top: 2.5rem;
    margin-top: 4rem;
}
.case-comments-heading {
    font-size: 1.35rem;
    font-weight: 700;
    color: #fff;
    margin: 0 0 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}
.case-comments-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    min-width: 1.6rem;
    height: 1.4rem;
    padding: 0 0.45rem;
    border-radius: 9999px;
    background: rgba(59,130,246,0.15);
    color: rgba(96,165,250,0.7);
    font-weight: 600;
}
.case-comments-list { max-width: 700px; }
.case-comment {
    display: flex;
    gap: 0.85rem;
    padding: 1.25rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    scroll-margin-top: 5rem;
}
.case-comment:first-child { padding-top: 0; }
.case-comment-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(59,130,246,0.2), rgba(59,130,246,0.05));
    color: #60a5fa;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
    border: 1px solid rgba(59,130,246,0.15);
    object-fit: cover;
}
.case-comment-body { flex: 1; min-width: 0; }
.case-comment-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.4rem;
}
.case-comment-name { font-size: 0.82rem; font-weight: 600; color: #fff; }
.case-comment-date { font-size: 0.7rem; color: rgba(255,255,255,0.3); }
.case-comment-text {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.65);
    line-height: 1.6;
}
.case-comment-text strong, .case-comment-text b { font-weight: 700; color: rgba(255,255,255,0.82); }
.case-comment-text em, .case-comment-text i:not(.fas):not(.far):not(.fab) { font-style: italic; }
.case-comment-text s, .case-comment-text del, .case-comment-text strike { text-decoration: line-through; opacity: 0.55; }
.case-comment-text a {
    color: #60a5fa;
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px solid rgba(96,165,250,0.25);
    transition: color 0.2s, border-color 0.2s;
}
.case-comment-text a:hover { color: #93c5fd; border-color: rgba(147,197,253,0.4); }
.case-comment-text ul, .case-comment-text ol { margin: 0.5rem 0; padding-left: 1.4rem; }
.case-comment-text ul { list-style: disc; }
.case-comment-text ol { list-style: decimal; }
.case-comment-text li { margin-bottom: 0.25rem; padding-left: 0.2rem; }
.case-comment-text li::marker { color: rgba(255,255,255,0.25); }
.case-comment-text blockquote {
    margin: 0.6rem 0;
    padding: 0.55rem 0.9rem;
    border-left: 2px solid rgba(96,165,250,0.3);
    background: rgba(96,165,250,0.04);
    border-radius: 0 0.4rem 0.4rem 0;
    color: rgba(255,255,255,0.55);
    font-size: 0.8rem;
    font-style: italic;
}
.case-comment-text img {
    max-width: 260px;
    max-height: 180px;
    object-fit: cover;
    border-radius: 0.5rem;
    margin: 0.6rem 0;
    border: 1px solid rgba(255,255,255,0.08);
    cursor: zoom-in;
    transition: opacity 0.2s;
    display: block;
}
.case-comment-text img:hover { opacity: 0.85; }

/* Editable area rich text */
.case-comment-editable strong, .case-comment-editable b { font-weight: 700; color: rgba(255,255,255,0.82); }
.case-comment-editable em { font-style: italic; }
.case-comment-editable s, .case-comment-editable del { text-decoration: line-through; opacity: 0.55; }
.case-comment-editable a { color: #60a5fa; text-decoration: underline; text-underline-offset: 2px; }
.case-comment-editable ul, .case-comment-editable ol { margin: 0.4rem 0; padding-left: 1.4rem; }
.case-comment-editable ul { list-style: disc; }
.case-comment-editable ol { list-style: decimal; }
.case-comment-editable li { margin-bottom: 0.2rem; }
.case-comment-editable li::marker { color: rgba(255,255,255,0.25); }
.case-comment-editable blockquote cite,
.case-comment-text blockquote cite {
    font-style: italic;
    font-weight: 600;
    font-size: 0.78rem;
    color: #60a5fa;
}
.case-comment-editable blockquote {
    margin: 0.5rem 0; padding: 0.5rem 0.8rem;
    border-left: 2px solid rgba(96,165,250,0.3);
    background: rgba(96,165,250,0.04);
    border-radius: 0 0.4rem 0.4rem 0;
    color: rgba(255,255,255,0.55); font-style: italic;
}
.case-comment-editable img { max-width: 260px; max-height: 180px; object-fit: cover; border-radius: 0.5rem; margin: 0.5rem 0; border: 1px solid rgba(255,255,255,0.08); display: block; font-size: 0; color: transparent; }

.case-comment-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 0.5rem;
}
.case-comment-action {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.72rem;
    color: rgba(255,255,255,0.3);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    border-radius: 0.3rem;
    font-family: inherit;
    transition: all 0.2s;
}
.case-comment-action:hover {
    color: rgba(255,255,255,0.6);
    background: rgba(255,255,255,0.04);
}
.case-comment-action--own {
    cursor: default;
    opacity: 0.4;
}
.case-comment-action--own:hover {
    color: rgba(255,255,255,0.3);
    background: none;
}
.case-comment-action.voted { color: #60a5fa; }

.case-comment-form {
    margin-top: 1.5rem;
    max-width: 700px;
}
.case-comment-editor {
    border-radius: 0.75rem;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.03);
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.case-comment-editor:focus-within {
    border-color: rgba(59,130,246,0.4);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.08), 0 0 20px rgba(59,130,246,0.05);
}
.case-comment-toolbar {
    display: flex;
    align-items: center;
    gap: 0.15rem;
    padding: 0.4rem 0.6rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.ce-tb-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.8rem;
    height: 1.8rem;
    border-radius: 0.35rem;
    border: none;
    background: transparent;
    color: rgba(255,255,255,0.35);
    font-size: 0.72rem;
    cursor: pointer;
    transition: all 0.15s ease;
}
.ce-tb-btn:hover { background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.7); }
.ce-tb-btn.active { background: rgba(59,130,246,0.12); color: #60a5fa; }
.ce-tb-sep {
    width: 1px;
    height: 1rem;
    background: rgba(255,255,255,0.06);
    margin: 0 0.25rem;
}
.case-comment-editable {
    min-height: 80px;
    padding: 0.85rem 1rem;
    color: #fff;
    font-size: 0.85rem;
    font-family: inherit;
    line-height: 1.6;
    outline: none;
}
.case-comment-editable:empty::before {
    content: attr(data-placeholder);
    color: rgba(255,255,255,0.25);
    pointer-events: none;
}
.case-comment-submit {
    margin-top: 0.75rem;
    padding: 0.6rem 1.5rem;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
    font-size: 0.82rem;
    font-weight: 600;
    border: none;
    border-radius: 0.6rem;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
    box-shadow: 0 2px 12px rgba(37,99,235,0.3);
}
.case-comment-submit:hover {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    box-shadow: 0 2px 20px rgba(37,99,235,0.4);
}

/* ─── Link inline popup (under toolbar button) ─── */
.ce-link-popup {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    margin-top: 0.25rem;
    background: #1a1b2e;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 0.5rem;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    z-index: 100;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.15s, transform 0.15s;
}
.ce-link-popup.open {
    opacity: 1;
    transform: translateY(0);
}
.ce-link-popup .ce-link-input {
    flex: 1;
    min-width: 0;
    padding: 0.5rem 0.7rem;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 0.35rem;
    color: #fff;
    font-size: 0.8rem;
    font-family: inherit;
    outline: none;
    box-sizing: border-box;
}
.ce-link-popup .ce-link-input:focus { border-color: #3b82f6; }
.ce-link-popup .ce-link-input::placeholder { color: rgba(255,255,255,0.3); }
.ce-link-go {
    padding: 0.4rem 0.6rem;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 0.35rem;
    cursor: pointer;
    font-size: 0.75rem;
    flex-shrink: 0;
    transition: background 0.2s;
}
.ce-link-go:hover { background: #3b82f6; }
.ce-link-close {
    padding: 0.4rem 0.45rem;
    background: none;
    color: rgba(255,255,255,0.4);
    border: none;
    border-radius: 0.35rem;
    cursor: pointer;
    font-size: 0.75rem;
    flex-shrink: 0;
    transition: color 0.2s;
}
.ce-link-close:hover { color: rgba(255,255,255,0.8); }

/* ─── Confirm modal (delete etc.) ─── */
.ce-link-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0);
    backdrop-filter: blur(0);
    transition: background 0.2s, backdrop-filter 0.2s;
}
.ce-link-overlay.open {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}
.ce-link-box {
    background: #1a1b2e;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.75rem;
    padding: 1.5rem;
    width: 90%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    transform: translateY(12px) scale(0.97);
    opacity: 0;
    transition: transform 0.2s, opacity 0.2s;
}
.ce-link-overlay.open .ce-link-box {
    transform: translateY(0) scale(1);
    opacity: 1;
}
.ce-link-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 0.75rem;
}
.ce-link-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1rem;
}
.ce-link-btn {
    padding: 0.45rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: inherit;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background 0.2s;
}
.ce-link-cancel {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.7);
}
.ce-link-cancel:hover { background: rgba(255, 255, 255, 0.12); }
.ce-link-ok {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
}
.ce-link-ok:hover { background: linear-gradient(135deg, #3b82f6, #2563eb); }

/* ─── Reply indicator ─── */
.case-comment-reply-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.8rem;
    background: rgba(255, 255, 255, 0.06);
    border-left: 3px solid var(--accent, #00d4ff);
    border-radius: 4px;
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 0.5rem;
}
.case-comment-reply-indicator i {
    color: var(--accent, #00d4ff);
    font-size: 0.75rem;
}
.case-reply-cancel {
    margin-left: auto;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    padding: 0.2rem;
    font-size: 0.75rem;
    transition: color 0.2s;
}
.case-reply-cancel:hover {
    color: rgba(255, 255, 255, 0.8);
}

/* ─── Comment delete button (admin) ─── */
.case-comment-delete {
    color: #ff4d4f !important;
    opacity: 0.6;
    transition: opacity 0.2s;
}
.case-comment-delete:hover {
    opacity: 1;
}

/* ─── Inline comment edit ─── */
.case-comment-edit-wrap { margin-top: 0.5rem; }
.case-comment-edit-buttons {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
}
.case-comment-edit-buttons .case-comment-submit {
    margin-top: 0;
}
.case-comment-edit-buttons .ce-edit-cancel {
    padding: 0.6rem 1.5rem;
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.7);
    font-size: 0.82rem;
    font-weight: 600;
    border: none;
    border-radius: 0.6rem;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s;
    box-shadow: none;
}
.case-comment-edit-buttons .ce-edit-cancel:hover { background: rgba(255,255,255,0.12); }

/* ─── Editor image wrapper with delete ─── */
.ce-img-wrapper {
    display: inline-flex;
    align-items: flex-start;
    gap: 0.4rem;
    max-width: 100%;
    margin: 0.4rem 0;
    line-height: 0;
}
.ce-img-wrapper img {
    display: block;
    max-width: calc(100% - 32px);
    height: auto;
    border-radius: 6px;
}
.ce-img-delete {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: #ff4d4f;
    font-size: 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    z-index: 2;
}
.ce-img-delete:hover {
    background: rgba(0, 0, 0, 0.9);
    color: #ff7875;
}
.ce-img-deleting {
    opacity: 0.4;
    pointer-events: none;
}

/* ─── Mobile overrides ─── */
@media (max-width: 767px) {
    .case-comments-section { padding: 2rem 1rem; }
    .case-comments-heading { font-size: 1.1rem; }
    .case-comment { gap: 0.65rem; padding: 1rem 0; }
    .case-comment-avatar { width: 30px; height: 30px; font-size: 0.65rem; }
    .case-comment-name { font-size: 0.78rem; }
    .case-comment-date { font-size: 0.6rem; }
    .case-comment-text { font-size: 0.8rem; line-height: 1.55; }
    .case-comment-text img { max-width: 200px; max-height: 140px; }
    .case-comment-action { font-size: 0.7rem; }

    .case-comment-form { max-width: 100%; }
    .case-comment-toolbar { gap: 0.1rem; padding: 0.3rem 0.4rem; }
    .ce-tb-btn { width: 1.6rem; height: 1.6rem; font-size: 0.65rem; }
    .ce-tb-sep { margin: 0 0.15rem; }
    .case-comment-editable { min-height: 60px; padding: 0.7rem 0.8rem; font-size: 0.8rem; }
    .case-comment-submit { font-size: 0.78rem; padding: 0.55rem 1.2rem; }
}

/* ─── Toolbar button spinner ─── */
.ce-tb-btn.loading {
    pointer-events: none;
    position: relative;
    color: transparent !important;
}
.ce-tb-btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 14px;
    height: 14px;
    margin: -7px 0 0 -7px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--accent, #00d4ff);
    border-radius: 50%;
    animation: ce-spin 0.6s linear infinite;
}
@keyframes ce-spin {
    to { transform: rotate(360deg); }
}

/* ─── Translate button (inside actions row) ─── */
.case-comment-translate-btn.loading {
    pointer-events: none;
    opacity: 0.5;
}
