/**
 * Styles dla Komentarzy na Tablicy
 * Customer Management Plugin
 * ZGODNY ZE STYLEM LINK/VIDEO POPUP
 */

/* ============================================
   POPUP KOMENTARZY - MODAL
   ============================================ */

.comments-popup-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.comments-popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
}

.comments-popup-content {
    position: relative;
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 700px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* ============================================
   HEADER POPUP'A
   ============================================ */

.comments-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #e5e5e5;
    flex-shrink: 0;
}

.comments-popup-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #1a1a1a;
}

.comments-popup-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #666;
    transition: all 0.2s;
}

.comments-popup-close:hover {
    background: #f5f5f5;
}

/* ============================================
   BODY POPUP'A
   ============================================ */

.comments-popup-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

/* Post w popup'ie */
.comments-popup-post {
    margin-bottom: 20px;
}

.comments-popup-post .tablica-post {
    margin-bottom: 0;
    border: none;
    padding: 0;
}

.comments-popup-post .tablica-post:hover {
    box-shadow: none;
    background: transparent;
}

.comments-popup-post .post-actions {
    display: none;
}

/* Separator */
.comments-separator {
    height: 1px;
    background: #e5e5e5;
    margin: 20px 0;
}

/* ============================================
   POLE DODAWANIA KOMENTARZA
   ============================================ */

.comment-add-box {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.comment-add-avatar {
    flex-shrink: 0;
}

.comment-add-avatar img {
    border-radius: 50%;
    width: 32px;
    height: 32px;
}

.comment-add-input-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.comment-input {
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    min-height: 60px;
    max-height: 150px;
    transition: all 0.2s;
    outline: none;
}

.comment-input:focus {
    border-color: #2271b1;
}

/* ============================================
   MINI-EDYTOR (contenteditable) dla komentarzy/odpowiedzi
   ============================================ */

.cmp-rich-editor {
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Placeholder dla contenteditable */
.cmp-rich-editor:empty:before {
    content: attr(data-placeholder);
    color: #999;
    pointer-events: none;
}

.cmp-rich-editor.is-disabled {
    pointer-events: none;
    opacity: 0.7;
    background: #f5f5f5;
}

/* Węższy padding w edytorze odpowiedzi */
.comment-reply-editor.cmp-rich-editor {
    padding: 8px 12px;
    font-size: 13px;
    min-height: 36px;
    max-height: 100px;
}
.comment-add-actions {
    display: flex;
    gap: 4px;
    align-items: center;
}

.comment-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 6px;
    font-size: 16px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
}

.comment-action-btn:hover {
    background: #f5f5f5;
}

/* ============================================
   PRZYCISK DODAWANIA KOMENTARZA
   ============================================ */

.comment-submit-wrapper {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 24px;
}

.comment-submit-wrapper .tablica-btn {
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.comment-submit-wrapper .tablica-btn-primary {
    background: #ffc107;
    color: #1a1a1a;
}

.comment-submit-wrapper .tablica-btn-primary:hover {
    background: #ffb300;
}

.comment-submit-wrapper .tablica-btn-primary:disabled {
    background: #e5e5e5;
    color: #999;
    cursor: not-allowed;
}

/* ============================================
   LISTA KOMENTARZY
   ============================================ */

.comments-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.comments-loading,
.comments-error,
.comments-empty {
    text-align: center;
    padding: 32px 16px;
    color: #666;
    font-size: 15px;
}

.comments-error {
    color: #d63638;
}

/* ============================================
   POJEDYNCZY KOMENTARZ
   ============================================ */

.comment-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;
    transition: background 0.2s;
}

.comment-item:hover {
    background: #f9f9f9;
}

/* Podświetlenie komentarza po przejściu z powiadomień */
.cmp-comment-highlight {
    outline: 2px solid rgba(0, 0, 0, 0.6);
    outline-offset: 2px;
    background: rgba(255, 233, 166, 0.45);
}

.comment-avatar {
    flex-shrink: 0;
}

.comment-avatar img {
    border-radius: 50%;
    width: 32px;
    height: 32px;
}

.comment-content-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.comment-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.comment-author {
    font-weight: 600;
    font-size: 14px;
    color: #1a1a1a;
}

.comment-date {
    font-size: 12px;
    color: #999;
}

.comment-content {
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    word-wrap: break-word;
}

/* ============================================
   AKCJE KOMENTARZA
   ============================================ */

.comment-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-top: 4px;
}

.comment-like-btn,
.comment-reply-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 13px;
    color: #666;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
    font-weight: 500;
}

/* Kosz (tylko admin) */
.comment-delete-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 13px;
    color: #b32d2e;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.comment-delete-btn:hover {
    background: #ffe8e8;
}

.comment-delete-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.comment-delete-btn .trash-icon {
    font-size: 14px;
    line-height: 1;
}

.comment-like-btn:hover,
.comment-reply-btn:hover {
    background: #e5e5e5;
    color: #333;
}

.comment-like-btn.liked {
    color: #2271b1;
}

.comment-like-btn.liked .like-icon {
    transform: scale(1.2);
}

.like-icon {
    font-size: 14px;
    transition: transform 0.2s;
}

.like-count {
    font-size: 13px;
    min-width: 16px;
    text-align: center;
}

/* ============================================
   ODPOWIEDZI
   ============================================ */

.comment-replies {
    margin-top: 12px;
    padding-left: 44px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.comment-reply {
    background: #f5f5f5;
    border-left: 2px solid #ddd;
}

/* ============================================
   POLE ODPOWIEDZI
   ============================================ */

.comment-reply-box {
    margin-top: 12px;
    padding: 12px;
    background: #f5f5f5;
    border-radius: 8px;
    display: flex;
    gap: 12px;
}

.comment-reply-input {
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    font-family: inherit;
    resize: none;
    min-height: 36px;
    max-height: 100px;
    transition: all 0.2s;
    outline: none;
}

.comment-reply-input:focus {
    border-color: #2271b1;
    background: #fff;
}

.comment-reply-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    justify-content: flex-end;
}

.comment-reply-cancel-btn,
.comment-reply-submit-btn {
    padding: 6px 16px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.comment-reply-cancel-btn {
    background: #f5f5f5;
    color: #666;
}

.comment-reply-cancel-btn:hover {
    background: #e5e5e5;
    color: #333;
}

.comment-reply-submit-btn {
    background: #ffc107;
    color: #1a1a1a;
}

.comment-reply-submit-btn:hover {
    background: #ffb300;
}

.comment-reply-submit-btn:disabled {
    background: #e5e5e5;
    color: #999;
    cursor: not-allowed;
}

/* ============================================
   LICZNIK KOMENTARZY
   ============================================ */

.comment-count {
    display: inline-block;
    margin-left: 4px;
    color: #666;
    font-size: 13px;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .comments-popup-content {
        width: 95%;
        max-width: 100%;
        max-height: 95vh;
        border-radius: 8px;
    }
    
    .comments-popup-header {
        padding: 16px;
    }
    
    .comments-popup-body {
        padding: 16px;
    }
    
    .comment-replies {
        padding-left: 24px;
    }
    
    .comment-add-actions {
        flex-wrap: wrap;
    }
}


/* ============================================
   COMMENT TOOL MODALS (LINK / VIDEO / GIF / ATTACH)
   ============================================ */

.comment-tool-modal {
    position: fixed;
    inset: 0;
    /*
      Musi być wyżej niż .cmp-tablica-modal (z-index: 99999)
      żeby popupy narzędzi (link/plik/wideo/gif) nie otwierały się "pod" modalką dodawania posta.
    */
    z-index: 100200;
    display: flex;
    align-items: center;
    justify-content: center;
}

.comment-tool-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
}

.comment-tool-content {
    position: relative;
    background: #fff;
    border-radius: 12px;
    width: 92%;
    max-width: 520px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.comment-tool-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 18px;
    border-bottom: 1px solid #e5e5e5;
}

.comment-tool-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #1a1a1a;
}

.comment-tool-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #666;
    transition: all 0.2s;
}

.comment-tool-close:hover {
    background: #f5f5f5;
    color: #333;
}

.comment-tool-body {
    padding: 16px 18px;
}

.comment-tool-body input[type="url"] {
    width: 100%;
    border: 1px solid #d6d6d6;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 14px;
    outline: none;
}

.comment-tool-body input[type="url"]:focus {
    border-color: #111;
}

.comment-tool-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 12px;
}

.comment-tool-divider {
    margin-top: 10px;
    margin-bottom: 8px;
    font-size: 12px;
    color: #666;
}

.comment-attach-upload-status {
    margin-top: 10px;
    font-size: 13px;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid #e5e5e5;
    display: none;
}

.comment-attach-upload-status.is-loading {
    background: #fff7e0;
    color: #6b5b00;
}

.comment-attach-upload-status.is-success {
    background: #e7f7ea;
    color: #1e6f2b;
}

.comment-attach-upload-status.is-error {
    background: #fbeaea;
    color: #a40000;
}

/* ============================================
   EMOJI PICKER (KOMENTARZE)
   ============================================ */

#comment-emoji-picker-container {
    position: absolute;
    /* musi być ponad .cmp-tablica-modal (99999) */
    z-index: 100210;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    padding: 10px;
    box-shadow: 0 12px 30px rgba(0,0,0,0.18);
    max-height: 240px;
    overflow: auto;
}

.comment-emoji-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.comment-emoji-item {
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    padding: 6px;
    border-radius: 8px;
    user-select: none;
}

.comment-emoji-item:hover {
    background: #f3f3f3;
}


/* Emoji picker (POST) — taki sam wygląd jak w komentarzach */
#post-emoji-picker-container {
    position: absolute;
    /* musi być ponad .cmp-tablica-modal (99999) */
    z-index: 100210;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    padding: 10px;
    box-shadow: 0 12px 30px rgba(0,0,0,0.18);
    max-height: 240px;
    overflow: auto;
}


/* ============================================
   FORMATOWANIE TEKSTU (komentarze/odpowiedzi)
   ============================================ */

.comment-action-btn[data-tool="bold"] {
    font-weight: 700;
}

.comment-action-btn[data-tool="italic"] {
    font-style: italic;
}

.comment-action-btn[data-tool="underline"] {
    text-decoration: underline;
}

.comment-action-btn[data-tool="ol"],
.comment-action-btn[data-tool="ul"] {
    font-size: 14px;
}

.cmp-format-btn {
    display: inline-block;
    line-height: 1;
}

.cmp-format-bold {
    font-weight: 700;
}

.cmp-format-italic {
    font-style: italic;
}

.cmp-format-underline {
    text-decoration: underline;
}

/* Lekkie dopieszczenie list w treści komentarza */
.comment-content ul,
.comment-content ol {
    margin: 6px 0 6px 18px;
    padding-left: 18px;
}

.comment-content li {
    margin: 2px 0;
}
