/**
 * Modern Comments Styling - Professional Design
 * Primary Color: #006aff
 * Design: Clean, modern, and professional
 */

/* ========================================
   VARIABLES
   ======================================== */
:root {
    --comment-primary-color: #006aff;
    --comment-primary-hover: #0056cc;
    --comment-bg-light: #f8f9fa;
    --comment-border: #e1e8ed;
    --comment-text: #1a1a1a;
    --comment-text-secondary: #536471;
    --comment-avatar-size: 48px;
    --comment-spacing: 20px;
    --comment-border-radius: 12px;
    --comment-shadow: 0 2px 8px rgba(0, 106, 255, 0.08);
    --comment-shadow-hover: 0 4px 16px rgba(0, 106, 255, 0.15);
}

/* Dark mode support */
[data-theme="dark"] {
    --comment-bg-light: #1a1a1a;
    --comment-border: #2f3336;
    --comment-text: #e7e9ea;
    --comment-text-secondary: #8b98a5;
}

/* ========================================
   COMMENTS WRAPPER
   ======================================== */
.modern-comments-wrapper {
    max-width: 850px;
    margin: 50px auto;
    padding: 0;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

[data-theme="dark"] .modern-comments-wrapper {
    background: #1a1a1a;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* ========================================
   COMMENTS HEADER
   ======================================== */
.comments-header {
    margin-bottom: 0;
    padding: 15px 20px;
    background: var(--comment-primary-color);
    background: linear-gradient(135deg, var(--comment-primary-color) 0%, var(--comment-primary-hover) 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.comments-count-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.comments-icon {
    width: 32px;
    height: 32px;
    stroke: white;
    flex-shrink: 0;
}

.comments-title {
    font-size: 20px;
    font-weight: 700;
    color: white;
    margin: 0;
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.comments-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 10px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 20px;
    font-size: 16px;
    font-weight: 700;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

/* ========================================
   COMMENT SORTING
   ======================================== */
.comment-sort-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.comment-sort-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 600;
    color: white;
    margin: 0;
    white-space: nowrap;
}

.sort-icon {
    width: 16px;
    height: 16px;
    stroke: white;
}

.comment-sort-select {
    padding: 8px 30px 8px 12px;
    font-size: 14px;
    font-weight: 600;
    color: var(--comment-text);
    background: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23006aff' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px;
    min-width: 160px;
}

.comment-sort-select:hover {
    background-color: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.comment-sort-select:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.5);
}

.comments-loading {
    text-align: center;
    padding: 40px 20px;
}

.comments-loading .spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 15px;
    border: 4px solid rgba(0, 106, 255, 0.1);
    border-top-color: var(--comment-primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.comments-loading p {
    color: var(--comment-text-secondary);
    font-size: 14px;
    font-weight: 600;
    margin: 0;
}

.no-comments-message {
    padding: 40px 20px;
    text-align: center;
    color: var(--comment-text-secondary);
    font-size: 16px;
    font-style: italic;
}

/* Responsive design for sorting */
@media (max-width: 768px) {
    .comments-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .comment-sort-wrapper {
        width: 100%;
        margin-left: 0;
    }
    
    .comment-sort-select {
        flex: 1;
        min-width: auto;
    }
}

@media (max-width: 480px) {
    .comment-sort-label {
        font-size: 13px;
    }
    
    .comment-sort-select {
        font-size: 13px;
        padding: 6px 25px 6px 10px;
    }
}

/* ========================================
   CODE BLOCKS IN COMMENTS
   ======================================== */
.comment-code-block {
    margin: 15px 0;
    background: #1e1e1e;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: #252526;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.code-language {
    font-size: 11px;
    font-weight: 600;
    color: #9cdcfe;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
}

.code-copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.05);
    color: #cccccc;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
}

.code-copy-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.code-copy-btn:active {
    transform: scale(0.95);
}

.code-copy-btn.copied {
    background: #4ec9b0;
    border-color: #4ec9b0;
    color: #1e1e1e;
}

.code-copy-btn svg {
    width: 13px;
    height: 13px;
}

.comment-code-block pre {
    margin: 0 !important;
    padding: 16px !important;
    background: #1e1e1e !important;
    border-radius: 0 !important;
    overflow-x: auto;
    font-size: 13px !important;
    line-height: 1.6 !important;
}

.comment-code-block code {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace !important;
    font-size: 13px !important;
    color: #d4d4d4 !important;
    text-shadow: none !important;
    background: transparent !important;
    padding: 0 !important;
}

/* Inline code */
.comment-content code.inline-code {
    padding: 2px 5px;
    background: rgba(0, 106, 255, 0.08);
    color: #006aff;
    border-radius: 3px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
    font-size: 0.9em;
    border: 1px solid rgba(0, 106, 255, 0.15);
    font-weight: 500;
}

[data-theme="dark"] .comment-content code.inline-code {
    background: rgba(0, 106, 255, 0.15);
    border-color: rgba(0, 106, 255, 0.25);
}

/* Scrollbar for code blocks */
.comment-code-block pre::-webkit-scrollbar {
    height: 6px;
}

.comment-code-block pre::-webkit-scrollbar-track {
    background: #252526;
}

.comment-code-block pre::-webkit-scrollbar-thumb {
    background: #4e4e4e;
    border-radius: 3px;
}

.comment-code-block pre::-webkit-scrollbar-thumb:hover {
    background: #5e5e5e;
}

/* Responsive code blocks */
@media (max-width: 768px) {
    .comment-code-block pre {
        font-size: 12px !important;
        padding: 12px !important;
    }
    
    .comment-code-block code {
        font-size: 12px !important;
    }
    
    .code-header {
        padding: 8px 12px;
    }
    
    .code-language {
        font-size: 10px;
    }
    
    .code-copy-btn {
        font-size: 10px;
        padding: 3px 8px;
    }
}

/* ========================================
   COMMENT LIST
   ======================================== */
.modern-comment-list {
    list-style: none;
    padding: 0;
    margin: 0 0 30px 0;
    background: var(--comment-bg-light);
    border: 1px solid var(--comment-border);
    border-radius: 0;
    overflow: hidden;
}

.modern-comment-list .comment {
    margin-bottom: 0;
    position: relative;
}

.modern-comment-list > .comment {
    border-bottom: 1px solid var(--comment-border);
}

.modern-comment-list > .comment:last-child {
    border-bottom: none;
}

.modern-comment-list .comment-body {
    display: flex;
    gap: 15px;
    background: transparent;
    border: none;
    border-left: 4px solid transparent;
    border-radius: 0;
    padding: 20px;
    transition: all 0.3s ease;
}

.modern-comment-list .comment-body:hover {
    background: rgba(0, 106, 255, 0.03);
    border-left-color: var(--comment-primary-color);
}

[data-theme="dark"] .modern-comment-list .comment-body:hover {
    background: rgba(0, 106, 255, 0.08);
}

/* ========================================
   COMMENT AUTHOR & AVATAR
   ======================================== */
.comment-author.vcard {
    flex-shrink: 0;
    position: relative;
}

.comment-author.vcard img.avatar {
    width: var(--comment-avatar-size);
    height: var(--comment-avatar-size);
    border-radius: 50%;
    border: 2px solid var(--comment-primary-color);
    transition: transform 0.3s ease;
    position: relative;
    z-index: 2;
    background: white;
}

[data-theme="dark"] .comment-author.vcard img.avatar {
    background: #1a1a1a;
}

.comment-body:hover .comment-author.vcard img.avatar {
    transform: scale(1.05);
}

/* ========================================
   COMMENT CONTENT WRAPPER
   ======================================== */
.comment-content-wrapper {
    flex: 1;
    min-width: 0;
}

.comment-author-info {
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.comment-author-name {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.comment-author-info .fn {
    font-size: 16px;
    font-weight: 700;
    color: var(--comment-text);
}

.comment-author-info .fn a {
    color: var(--comment-primary-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

.comment-author-info .fn a:hover {
    color: var(--comment-primary-hover);
    text-decoration: underline;
}

/* شارة التعليق المثبت - تصميم بسيط وصغير */
.pinned-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 6px;
    background: #53b610;
    color: #fff;
    border-radius: 3px;
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.pinned-icon {
    width: 8px;
    height: 8px;
    fill: currentColor;
}

[data-theme="dark"] .pinned-badge {
    background: #53b610;
}

/* شارة الأدمن - تصميم بسيط وصغير */
.admin-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 6px;
    background: #006aff;
    color: #fff;
    border-radius: 3px;
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.admin-icon {
    width: 8px;
    height: 8px;
    fill: currentColor;
}

[data-theme="dark"] .admin-badge {
    background: #006aff;
}

/* تصميم خاص لتعليقات الأدمن */
.comment-body:has(.admin-badge) {
    background: linear-gradient(135deg, 
        rgba(0, 106, 255, 0.02) 0%, 
        rgba(0, 106, 255, 0.01) 100%
    );
    border-left-width: 3px;
    border-left-color: #006aff;
}

[data-theme="dark"] .comment-body:has(.admin-badge) {
    background: linear-gradient(135deg, 
        rgba(0, 106, 255, 0.05) 0%, 
        rgba(0, 106, 255, 0.02) 100%
    );
}

/* تصميم خاص للتعليق المثبت */
.comment.pinned > .comment-body,
.modern-comment-list > .comment:has(.pinned-badge) > .comment-body {
    background: linear-gradient(135deg, 
        rgba(83, 182, 16, 0.03) 0%, 
        rgba(83, 182, 16, 0.01) 100%
    );
    border-left-width: 3px;
    border-left-color: #53b610;
}

[data-theme="dark"] .comment.pinned > .comment-body,
[data-theme="dark"] .modern-comment-list > .comment:has(.pinned-badge) > .comment-body {
    background: linear-gradient(135deg, 
        rgba(83, 182, 16, 0.06) 0%, 
        rgba(83, 182, 16, 0.03) 100%
    );
}

/* ========================================
   أزرار التفاعل - Comment Reactions
   ======================================== */

.comment-actions-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    margin-top: 12px;
    padding-top: 0;
    border-top: none;
}

.comment-author-actions {
    display: flex;
    align-items: center;
}

.comment-author-actions .comment-reply-link {
    color: var(--comment-primary-color);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    padding: 0;
    background: none;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.comment-author-actions .comment-reply-link:hover {
    color: #0052cc;
    text-decoration: underline;
}

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

.reaction-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--comment-bg-light);
    border: 1px solid var(--comment-border-color);
    border-radius: 20px;
    color: var(--comment-text-secondary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.reaction-btn:hover {
    background: rgba(0, 106, 255, 0.08);
    border-color: rgba(0, 106, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 106, 255, 0.15);
}

.reaction-btn:active {
    transform: translateY(0);
}

.reaction-btn.active {
    background: linear-gradient(135deg, rgba(0, 106, 255, 0.15) 0%, rgba(0, 106, 255, 0.1) 100%);
    border-color: var(--comment-primary-color);
    color: var(--comment-primary-color);
}

.reaction-btn.like-btn.active {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.15) 0%, rgba(76, 175, 80, 0.1) 100%);
    border-color: #4CAF50;
    color: #4CAF50;
}

.reaction-btn.dislike-btn.active {
    background: linear-gradient(135deg, rgba(244, 67, 54, 0.15) 0%, rgba(244, 67, 54, 0.1) 100%);
    border-color: #f44336;
    color: #f44336;
}

.reaction-icon {
    width: 16px;
    height: 16px;
    fill: currentColor;
    transition: transform 0.3s ease;
}

.reaction-btn:hover .reaction-icon {
    transform: scale(1.2);
}

.reaction-btn.active .reaction-icon {
    animation: reactionPop 0.5s ease;
}

@keyframes reactionPop {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.3);
    }
    100% {
        transform: scale(1);
    }
}

.reaction-count {
    min-width: 20px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

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

/* Dark mode support */
[data-theme="dark"] .reaction-btn {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .reaction-btn:hover {
    background: rgba(0, 106, 255, 0.15);
    border-color: rgba(0, 106, 255, 0.4);
}

[data-theme="dark"] .reaction-btn.active {
    background: linear-gradient(135deg, rgba(0, 106, 255, 0.2) 0%, rgba(0, 106, 255, 0.15) 100%);
}

/* Responsive design */
@media (max-width: 600px) {
    .comment-actions-wrapper {
        flex-direction: column-reverse;
        align-items: flex-start;
        gap: 10px;
    }
    
    .comment-reactions {
        width: 100%;
        justify-content: flex-start;
        margin-right: 0;
    }
    
    .comment-author-actions {
        width: 100%;
        margin-left: 0;
    }
    
    .reaction-btn {
        padding: 5px 10px;
        font-size: 12px;
    }
    
    .reaction-icon {
        width: 14px;
        height: 14px;
    }
}

/* زر الرد في اليسار - كرابط */
.comment-author-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.comment-author-actions .comment-reply-link,
.comment-author-actions .comment-edit-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    color: var(--comment-text-secondary);
    text-decoration: none;
    transition: all 0.2s ease;
    padding: 0;
    background: none;
    border: none;
    cursor: pointer;
}

.comment-author-actions .comment-reply-link:hover,
.comment-author-actions .comment-edit-link:hover {
    color: var(--comment-primary-color);
}

.comment-author-actions .action-icon {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    transition: transform 0.2s ease;
}

.comment-author-actions .comment-reply-link:hover .action-icon {
    transform: translateX(-2px);
}

.comment-author-actions .comment-edit-link:hover .action-icon {
    transform: scale(1.1);
}

.comment-metadata {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: var(--comment-text-secondary);
}

.comment-metadata a {
    color: var(--comment-text-secondary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.comment-metadata a:hover {
    color: var(--comment-primary-color);
}

/* ========================================
   COMMENT CONTENT
   ======================================== */
.comment-content {
    font-size: 15px;
    line-height: 1.6;
    color: var(--comment-text);
    margin-bottom: 12px;
    word-wrap: break-word;
}

.comment-content p {
    margin: 0 0 10px 0;
}

.comment-content p:last-child {
    margin-bottom: 0;
}

.comment-content a {
    color: var(--comment-primary-color);
    text-decoration: underline;
}

.comment-content a:hover {
    color: var(--comment-primary-hover);
}

/* ========================================
   COMMENT AWAITING MODERATION
   ======================================== */
.comment-awaiting-moderation {
    display: inline-block;
    padding: 8px 16px;
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
    border-radius: 6px;
    font-size: 14px;
    font-style: normal;
    margin-bottom: 12px;
}

[data-theme="dark"] .comment-awaiting-moderation {
    background: #3d3000;
    color: #ffd93d;
    border-color: #5c4700;
}

/* ========================================
   COMMENT ACTIONS - زر الرد كرابط احترافي
   ======================================== */
.comment-actions {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 12px;
}

.comment-reply {
    display: inline-block;
}

.comment-reply a.comment-reply-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 0;
    background: transparent;
    color: var(--comment-primary-color);
    border: none;
    border-radius: 0;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.comment-reply a.comment-reply-link:hover {
    color: var(--comment-primary-hover);
    transform: translateX(-2px);
}

.comment-reply a.comment-reply-link::before {
    content: "↩";
    font-size: 14px;
    opacity: 0.8;
}

/* ========================================
   THREADED COMMENTS - border داخل كل box
   ======================================== */
.modern-comment-list .children {
    list-style: none;
    padding-left: 0;
    margin: 0;
    margin-left: 60px;
    position: relative;
    background: rgba(0, 106, 255, 0.02);
    border-top: 1px solid var(--comment-border);
}

[data-theme="dark"] .modern-comment-list .children {
    background: rgba(0, 106, 255, 0.05);
}

.modern-comment-list .children .comment {
    margin-bottom: 0;
    position: relative;
    border-bottom: 1px solid rgba(0, 106, 255, 0.1);
}

.modern-comment-list .children .comment:last-child {
    border-bottom: none;
}

/* border يساري لكل comment box */
.modern-comment-list .children .comment-body {
    background: transparent;
    position: relative;
    border-left: 3px solid var(--comment-primary-color);
    padding-left: 20px;
}

.modern-comment-list .children .comment-body:hover {
    background: rgba(0, 106, 255, 0.05);
    border-left-color: var(--comment-primary-hover);
}

[data-theme="dark"] .modern-comment-list .children .comment-body:hover {
    background: rgba(0, 106, 255, 0.12);
}

/* المستوى الثاني */
.modern-comment-list .children .children {
    margin-left: 60px;
    background: rgba(0, 106, 255, 0.03);
}

[data-theme="dark"] .modern-comment-list .children .children {
    background: rgba(0, 106, 255, 0.08);
}

.modern-comment-list .children .children .comment-body {
    border-left-width: 3px;
}

/* المستوى الثالث */
.modern-comment-list .children .children .children {
    margin-left: 60px;
    background: rgba(0, 106, 255, 0.04);
}

[data-theme="dark"] .modern-comment-list .children .children .children {
    background: rgba(0, 106, 255, 0.1);
}

.modern-comment-list .children .children .children .comment-body {
    border-left-width: 3px;
}

/* ========================================
   COMMENT FORM
   ======================================== */
#respond {
    border-top: 2px solid var(--comment-border);
}

.modern-comment-form {
    background: var(--comment-bg-light);
    border: none;
    border-radius: 0;
    padding: 30px;
    margin-bottom: 0;
    position: relative;
}

.comment-help-text {
    display: block;
    margin-top: 8px;
    padding: 10px 12px;
    background: rgba(0, 106, 255, 0.05);
    border-left: 3px solid var(--comment-primary-color);
    border-radius: 4px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--comment-text-secondary);
}

.comment-help-text code {
    padding: 2px 5px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 3px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
    font-size: 12px;
    color: #006aff;
    font-weight: 600;
}

[data-theme="dark"] .comment-help-text {
    background: rgba(0, 106, 255, 0.1);
}

[data-theme="dark"] .comment-help-text code {
    background: rgba(255, 255, 255, 0.1);
    color: #4ec9b0;
}

/* ========================================
   COMMENT TOOLBAR
   ======================================== */
.comment-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 8px;
    background: var(--comment-bg-light);
    border: 2px solid var(--comment-border-color);
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    margin-bottom: 0;
}

.comment-form-comment .comment-toolbar + textarea {
    border-radius: 0 0 8px 8px;
    border-top-color: transparent;
}

.toolbar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 6px;
    background: white;
    border: 1px solid var(--comment-border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--comment-text);
}

.toolbar-btn:hover {
    background: var(--comment-primary-color);
    border-color: var(--comment-primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0, 106, 255, 0.3);
}

.toolbar-btn:active {
    transform: translateY(0);
}

.toolbar-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
}

.toolbar-separator {
    width: 1px;
    height: 32px;
    background: var(--comment-border-color);
    margin: 0 4px;
}

[data-theme="dark"] .toolbar-btn {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: #fff;
}

[data-theme="dark"] .toolbar-btn:hover {
    background: var(--comment-primary-color);
    border-color: var(--comment-primary-color);
}

/* Responsive toolbar */
@media (max-width: 480px) {
    .comment-toolbar {
        padding: 6px;
        gap: 3px;
    }
    
    .toolbar-btn {
        width: 28px;
        height: 28px;
        padding: 4px;
    }
    
    .toolbar-btn svg {
        width: 14px;
        height: 14px;
    }
}

/* ========================================
   BBCode & Markdown Styles
   ======================================== */
.comment-quote {
    margin: 15px 0;
    padding: 15px 20px;
    background: rgba(0, 106, 255, 0.05);
    border-left: 4px solid var(--comment-primary-color);
    border-radius: 4px;
    font-style: italic;
    color: var(--comment-text-secondary);
}

.comment-quote cite {
    display: block;
    font-weight: 700;
    color: var(--comment-primary-color);
    font-style: normal;
    margin-bottom: 8px;
    font-size: 14px;
}

.comment-quote div {
    font-style: italic;
}

.comment-image {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 15px 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    display: block;
}

.comment-list-bbcode,
.comment-list-markdown {
    margin: 15px 0;
    padding-left: 25px;
    list-style: disc;
}

.comment-list-bbcode li,
.comment-list-markdown li {
    margin: 8px 0;
    line-height: 1.6;
}

.comment-separator {
    margin: 20px 0;
    border: none;
    border-top: 2px solid var(--comment-border-color);
}

[data-theme="dark"] .comment-quote {
    background: rgba(0, 106, 255, 0.1);
}

[data-theme="dark"] .comment-image {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Reply form styling - when replying to a comment */
#comments .comment .comment-respond {
    margin: 0;
    padding: 0;
    border-top: 3px solid var(--comment-primary-color);
    background: linear-gradient(to bottom, rgba(0, 106, 255, 0.08), rgba(0, 106, 255, 0.02));
}

[data-theme="dark"] #comments .comment .comment-respond {
    background: linear-gradient(to bottom, rgba(0, 106, 255, 0.15), rgba(0, 106, 255, 0.05));
}

#comments .comment .comment-respond .modern-comment-form {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 25px;
    margin: 0;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modern-comment-reply-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--comment-text);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 0;
}

[data-theme="dark"] .modern-comment-reply-title {
    background: rgba(0, 0, 0, 0.2);
}

.modern-comment-reply-title::before {
    content: "💬";
    font-size: 24px;
    flex-shrink: 0;
}

/* Reply form title - special styling */
#comments .comment .comment-respond .modern-comment-reply-title {
    background: linear-gradient(135deg, rgba(0, 106, 255, 0.15), rgba(0, 106, 255, 0.05));
    border: 2px solid var(--comment-primary-color);
    box-shadow: 0 2px 8px rgba(0, 106, 255, 0.1);
}

[data-theme="dark"] #comments .comment .comment-respond .modern-comment-reply-title {
    background: linear-gradient(135deg, rgba(0, 106, 255, 0.25), rgba(0, 106, 255, 0.1));
}

#comments .comment .comment-respond .modern-comment-reply-title::before {
    content: "↩";
    background: linear-gradient(135deg, var(--comment-primary-color), var(--comment-primary-hover));
    color: white;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 18px;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(0, 106, 255, 0.3);
}

.modern-comment-reply-title small {
    margin-left: auto;
}

.modern-comment-reply-title small a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: white;
    background: #6c757d;
    padding: 8px 16px;
    border-radius: 20px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.modern-comment-reply-title small a:hover {
    background: #e74c3c;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

.modern-comment-reply-title small a::before {
    content: "✕";
    font-size: 14px;
    font-weight: 700;
}

/* ========================================
   FORM FIELDS
   ======================================== */
.modern-comment-form .comment-form-comment,
.modern-comment-form .comment-form-author,
.modern-comment-form .comment-form-email,
.modern-comment-form .comment-form-url {
    margin-bottom: 20px;
}

.modern-comment-form label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--comment-text);
    margin-bottom: 8px;
}

.modern-comment-form input[type="text"],
.modern-comment-form input[type="email"],
.modern-comment-form input[type="url"],
.modern-comment-form textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--comment-border);
    border-radius: 8px;
    font-size: 15px;
    color: var(--comment-text);
    background: white;
    transition: all 0.3s ease;
    font-family: inherit;
}

[data-theme="dark"] .modern-comment-form input[type="text"],
[data-theme="dark"] .modern-comment-form input[type="email"],
[data-theme="dark"] .modern-comment-form input[type="url"],
[data-theme="dark"] .modern-comment-form textarea {
    background: #000;
}

/* Special styling for reply form fields */
#comments .comment .comment-respond .modern-comment-form input[type="text"],
#comments .comment .comment-respond .modern-comment-form input[type="email"],
#comments .comment .comment-respond .modern-comment-form input[type="url"],
#comments .comment .comment-respond .modern-comment-form textarea {
    background: rgba(255, 255, 255, 0.8);
    border-color: rgba(0, 106, 255, 0.2);
}

[data-theme="dark"] #comments .comment .comment-respond .modern-comment-form input[type="text"],
[data-theme="dark"] #comments .comment .comment-respond .modern-comment-form input[type="email"],
[data-theme="dark"] #comments .comment .comment-respond .modern-comment-form input[type="url"],
[data-theme="dark"] #comments .comment .comment-respond .modern-comment-form textarea {
    background: rgba(0, 0, 0, 0.5);
}

.modern-comment-form input[type="text"]:focus,
.modern-comment-form input[type="email"]:focus,
.modern-comment-form input[type="url"]:focus,
.modern-comment-form textarea:focus {
    outline: none;
    border-color: var(--comment-primary-color);
    box-shadow: 0 0 0 3px rgba(0, 106, 255, 0.1);
    background: white;
}

[data-theme="dark"] .modern-comment-form input[type="text"]:focus,
[data-theme="dark"] .modern-comment-form input[type="email"]:focus,
[data-theme="dark"] .modern-comment-form input[type="url"]:focus,
[data-theme="dark"] .modern-comment-form textarea:focus {
    background: #000;
}

.modern-comment-form textarea {
    min-height: 120px;
    resize: vertical;
    line-height: 1.6;
}

/* ========================================
   SUBMIT BUTTON - نفس شكل زر الرد تماماً
   ======================================== */
.form-submit {
    margin-bottom: 0 !important;
}

.modern-submit-button,
button.modern-submit-button {
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
    padding: 6px 16px !important;
    background: transparent !important;
    color: var(--comment-primary-color) !important;
    border: 1px solid var(--comment-primary-color) !important;
    border-radius: 6px;
    font-size: 14px !important;
    font-weight: 600;
    line-height: normal;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: none !important;
    letter-spacing: normal;
    box-shadow: none !important;
    text-decoration: none;
}

.modern-submit-button::before,
button.modern-submit-button::before {
    content: "↩";
    font-size: 16px;
    font-weight: normal;
}

.modern-submit-button:hover,
button.modern-submit-button:hover {
    background: var(--comment-primary-color) !important;
    color: white !important;
    transform: none;
    box-shadow: none !important;
}

.modern-submit-button:active,
button.modern-submit-button:active {
    transform: scale(0.98);
}

.modern-submit-button:disabled,
button.modern-submit-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ========================================
   FORM NOTES
   ======================================== */
.comment-notes,
.form-allowed-tags {
    font-size: 13px;
    color: var(--comment-text-secondary);
    margin-bottom: 20px;
    line-height: 1.5;
    padding: 12px 16px;
    background: rgba(0, 106, 255, 0.05);
    border-left: 3px solid var(--comment-primary-color);
    border-radius: 6px;
}

[data-theme="dark"] .comment-notes,
[data-theme="dark"] .form-allowed-tags {
    background: rgba(0, 106, 255, 0.1);
}

.required {
    color: #e74c3c;
    font-weight: 700;
}

.comment-notes #email-notes {
    display: block;
    margin-bottom: 5px;
}

/* ========================================
   NO COMMENTS MESSAGE
   ======================================== */
.no-comments {
    text-align: center;
    padding: 40px 20px;
    background: var(--comment-bg-light);
    border: 2px dashed var(--comment-border);
    border-radius: var(--comment-border-radius);
    color: var(--comment-text-secondary);
    font-size: 16px;
    position: relative;
}

.no-comments::before {
    content: "🔒";
    display: block;
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}

/* ========================================
   COMMENTS NAVIGATION
   ======================================== */
.comment-navigation {
    margin: 30px 0;
}

.comment-navigation .nav-links {
    display: flex;
    justify-content: space-between;
    gap: 20px;
}

.comment-navigation a {
    display: inline-flex;
    align-items: center;
    padding: 10px 20px;
    background: var(--comment-bg-light);
    border: 1px solid var(--comment-border);
    border-radius: 8px;
    color: var(--comment-primary-color);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
}

.comment-navigation a:hover {
    background: var(--comment-primary-color);
    color: white;
    border-color: var(--comment-primary-color);
}

/* ========================================
   CAPTCHA STYLING
   ======================================== */
.modern-comment-form .cf-turnstile,
.modern-comment-form .comment-form-turnstile {
    margin: 15px 0;
    display: block;
}

/* Ensure Captcha appears properly in reply forms */
#comments .comment-respond .cf-turnstile,
#comments .comment-respond .comment-form-turnstile {
    margin: 15px 0;
}

/* Hide any duplicate or broken Turnstile widgets */
.cf-turnstile > div:not(:first-child) {
    display: none !important;
}

/* Fix for Cloudflare widget container */
.cf-turnstile {
    min-height: 65px;
    position: relative;
    overflow: hidden;
}

.cf-turnstile iframe {
    max-width: 100%;
    display: block;
}

/* Hide empty or broken Cloudflare elements */
.cf-turnstile > div:empty {
    display: none !important;
}

.cf-turnstile > div[style*="height: 0"] {
    display: none !important;
}

/* Fix white rectangles issue */
.cf-turnstile::before {
    display: none !important;
}

.cf-turnstile::after {
    display: none !important;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */
@media (max-width: 768px) {
    .modern-comments-wrapper {
        padding: 0;
        margin: 30px 15px;
        border-radius: 12px;
    }

    .comments-header {
        padding: 20px;
    }

    .comments-title {
        font-size: 22px;
    }

    .comments-icon {
        width: 24px;
        height: 24px;
    }

    .modern-comment-list .comment-body {
        flex-direction: column;
        padding: 15px;
    }

    .comment-author.vcard {
        display: flex;
        align-items: center;
        margin-bottom: 10px;
    }

    .comment-author.vcard img.avatar {
        width: 40px;
        height: 40px;
    }

    .modern-comment-list .children {
        margin-left: 50px;
    }
    
    .modern-comment-list .children .comment-body {
        padding-left: 15px;
    }
    
    .modern-comment-list .children .children {
        margin-left: 50px;
    }

    .modern-comment-form {
        padding: 20px;
    }
    
    #comments .comment .comment-respond .modern-comment-form {
        padding: 20px 15px;
    }

    .modern-comment-reply-title {
        font-size: 18px;
        padding: 12px 15px;
    }
    
    .modern-comment-reply-title::before {
        font-size: 20px;
    }
    
    #comments .comment .comment-respond .modern-comment-reply-title::before {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }
    
    .modern-comment-reply-title small a {
        font-size: 12px;
        padding: 6px 12px;
    }

    .modern-comment-form textarea {
        min-height: 100px;
    }

    .modern-submit-button {
        width: 100%;
        justify-content: center;
    }
    
    .cf-turnstile,
    .comment-form-turnstile {
        transform: scale(0.9);
        transform-origin: left center;
    }
}

@media (max-width: 480px) {
    .modern-comments-wrapper {
        padding: 0;
        border-radius: 10px;
        margin: 20px 10px;
    }

    .comments-header {
        padding: 15px;
    }

    .comments-count-wrapper {
        gap: 8px;
    }

    .comments-title {
        font-size: 18px;
        flex-wrap: wrap;
    }

    .comments-count {
        min-width: 28px;
        height: 28px;
        font-size: 14px;
    }

    .modern-comment-list .comment-body {
        padding: 12px;
    }

    .modern-comment-list .children {
        margin-left: 40px;
    }
    
    .modern-comment-list .children .comment-body {
        padding-left: 12px;
        border-left-width: 2px;
    }
    
    .modern-comment-list .children .children {
        margin-left: 40px;
    }
    
    .modern-comment-list .children .children .children {
        margin-left: 40px;
    }

    .comment-author-info .fn {
        font-size: 14px;
    }

    .comment-metadata {
        font-size: 12px;
        gap: 8px;
    }

    .comment-content {
        font-size: 14px;
    }
    
    .modern-comment-form {
        padding: 15px;
    }
    
    #comments .comment .comment-respond .modern-comment-form {
        padding: 15px 12px;
    }
    
    .modern-comment-reply-title {
        font-size: 16px;
        padding: 10px 12px;
        gap: 8px;
    }
    
    .modern-comment-reply-title::before {
        font-size: 18px;
    }
    
    #comments .comment .comment-respond .modern-comment-reply-title::before {
        width: 24px;
        height: 24px;
        font-size: 12px;
    }
    
    .modern-comment-reply-title small a {
        font-size: 11px;
        padding: 5px 10px;
    }
    
    .cf-turnstile,
    .comment-form-turnstile {
        transform: scale(0.85);
        transform-origin: left center;
    }
}

/* ========================================
   ACCESSIBILITY
   ======================================== */
.screen-reader-text {
    border: 0;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
    word-wrap: normal !important;
}

/* ========================================
   RESPONSIVE DESIGN - MOBILE OPTIMIZATIONS
   ======================================== */

/* Tablets and small laptops */
@media (max-width: 768px) {
    .comments-header {
        padding: 20px;
    }
    
    .comments-title {
        font-size: 24px;
    }
    
    .comments-icon {
        width: 28px;
        height: 28px;
    }
    
    .modern-comment-list .comment-body {
        padding: 16px;
        gap: 12px;
    }
    
    .comment-author .avatar {
        width: 40px;
        height: 40px;
    }
    
    .comment-author-name {
        font-size: 15px;
    }
    
    .comment-content {
        font-size: 14px;
    }
}

/* Mobile phones */
@media (max-width: 480px) {
    /* Header */
    .comments-header {
        padding: 15px;
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .comments-title {
        font-size: 20px;
    }
    
    .comments-icon {
        width: 24px;
        height: 24px;
    }
    
    .comments-count {
        min-width: 28px;
        height: 28px;
        font-size: 14px;
        padding: 0 8px;
    }
    
    /* Comment sorting */
    .comment-sort-wrapper {
        width: 100%;
        margin-left: 0;
    }
    
    .comment-sort-label {
        font-size: 12px;
    }
    
    .comment-sort-select {
        font-size: 12px;
        padding: 6px 25px 6px 10px;
        min-width: 140px;
    }
    
    /* Comment list */
    .modern-comment-list .comment-body {
        flex-direction: column;
        padding: 12px;
        gap: 12px;
    }
    
    .comment-author {
        width: 100%;
        display: flex;
        flex-direction: row;
        align-items: flex-start;
        gap: 10px;
    }
    
    .comment-author .avatar {
        width: 36px;
        height: 36px;
        flex-shrink: 0;
    }
    
    .comment-content-wrapper {
        width: 100%;
    }
    
    /* Author info */
    .comment-author-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .comment-author-name {
        font-size: 14px;
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
    
    .comment-metadata {
        font-size: 12px;
        gap: 8px;
    }
    
    /* Badges - smaller on mobile */
    .pinned-badge,
    .admin-badge {
        padding: 2px 5px;
        font-size: 8px;
        gap: 2px;
    }
    
    .pinned-icon,
    .admin-icon {
        width: 7px;
        height: 7px;
    }
    
    /* Action buttons */
    .comment-author-actions {
        width: 100%;
        margin-left: 0;
        margin-top: 8px;
        gap: 12px;
        justify-content: flex-start;
    }
    
    .comment-author-actions .comment-reply-link,
    .comment-author-actions .comment-edit-link {
        font-size: 12px;
    }
    
    .comment-author-actions .action-icon {
        width: 12px;
        height: 12px;
    }
    
    /* Comment content */
    .comment-content {
        font-size: 14px;
        line-height: 1.5;
        margin-bottom: 10px;
    }
    
    /* Threaded comments - reduce indentation on mobile */
    .comment .children {
        margin-left: 20px !important;
    }
    
    .comment .children .children {
        margin-left: 15px !important;
    }
    
    /* Comment form */
    .modern-comment-form {
        padding: 15px;
    }
    
    .modern-comment-reply-title {
        font-size: 20px;
        margin-bottom: 15px;
    }
    
    .comment-form-comment label,
    .comment-form-author label,
    .comment-form-email label,
    .comment-form-url label {
        font-size: 13px;
    }
    
    .modern-comment-form input[type="text"],
    .modern-comment-form input[type="email"],
    .modern-comment-form input[type="url"],
    .modern-comment-form textarea {
        padding: 10px 12px;
        font-size: 14px;
    }
    
    .modern-comment-form textarea {
        min-height: 100px;
    }
    
    /* Toolbar */
    .comment-toolbar {
        padding: 6px;
        gap: 3px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .toolbar-btn {
        width: 32px;
        height: 32px;
        padding: 6px;
        flex-shrink: 0;
    }
    
    .toolbar-btn svg {
        width: 14px;
        height: 14px;
    }
    
    .toolbar-separator {
        height: 28px;
    }
    
    /* Help text */
    .comment-help-text {
        font-size: 11px;
        padding: 8px 10px;
    }
    
    .comment-help-text code {
        font-size: 10px;
    }
    
    /* Submit button */
    .modern-submit-button {
        width: 100%;
        padding: 12px 20px;
        font-size: 14px;
    }
    
    /* Code blocks */
    .comment-code-block {
        margin: 12px 0;
    }
    
    .code-header {
        padding: 8px 10px;
    }
    
    .code-language {
        font-size: 9px;
    }
    
    .code-copy-btn {
        font-size: 9px;
        padding: 3px 6px;
    }
    
    .code-copy-btn svg {
        width: 11px;
        height: 11px;
    }
    
    .comment-code-block pre {
        font-size: 11px !important;
        padding: 10px !important;
    }
    
    .comment-code-block code {
        font-size: 11px !important;
    }
    
    /* Inline code */
    .comment-content code.inline-code {
        font-size: 12px;
        padding: 1px 4px;
    }
    
    /* BBCode elements */
    .comment-quote {
        padding: 10px 12px;
        margin: 10px 0;
        font-size: 13px;
    }
    
    .comment-quote cite {
        font-size: 12px;
        margin-bottom: 6px;
    }
    
    .comment-image {
        margin: 10px 0;
    }
    
    /* Reactions */
    .comment-reactions {
        gap: 6px;
        flex-wrap: wrap;
    }
    
    .reaction-btn {
        padding: 5px 10px;
        font-size: 12px;
        border-radius: 16px;
    }
    
    .reaction-icon {
        width: 14px;
        height: 14px;
    }
    
    .reaction-count {
        min-width: 18px;
        font-size: 12px;
    }
    
    /* Navigation */
    .comment-navigation {
        flex-direction: column;
        gap: 10px;
        padding: 12px 0;
    }
    
    .comment-navigation .nav-links {
        flex-direction: column;
        width: 100%;
        gap: 10px;
    }
    
    .comment-navigation a {
        width: 100%;
        justify-content: center;
        padding: 10px 16px;
        font-size: 13px;
    }
    
    /* Turnstile */
    .comment-form-turnstile {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .cf-turnstile {
        max-width: 100%;
    }
}

/* Very small phones */
@media (max-width: 360px) {
    .comments-header {
        padding: 12px;
    }
    
    .comments-title {
        font-size: 18px;
    }
    
    .modern-comment-list .comment-body {
        padding: 10px;
    }
    
    .comment-author .avatar {
        width: 32px;
        height: 32px;
    }
    
    .comment-author-name {
        font-size: 13px;
    }
    
    .comment-content {
        font-size: 13px;
    }
    
    .comment .children {
        margin-left: 15px !important;
    }
    
    .comment .children .children {
        margin-left: 10px !important;
    }
    
    .modern-comment-form {
        padding: 12px;
    }
    
    .toolbar-btn {
        width: 28px;
        height: 28px;
        padding: 5px;
    }
    
    .toolbar-btn svg {
        width: 12px;
        height: 12px;
    }
}

/* Landscape mode on phones */
@media (max-width: 768px) and (orientation: landscape) {
    .comment-toolbar {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .modern-comment-form textarea {
        min-height: 80px;
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    /* Increase touch targets */
    .toolbar-btn {
        min-width: 36px;
        min-height: 36px;
    }
    
    .comment-author-actions .comment-reply-link,
    .comment-author-actions .comment-edit-link {
        padding: 8px;
        margin: -8px;
    }
    
    .reaction-btn {
        min-height: 36px;
    }
    
    .code-copy-btn {
        min-height: 32px;
        padding: 6px 10px;
    }
}
@media print {
    .comment-reply,
    .modern-comment-form,
    .comment-navigation {
        display: none;
    }

    .modern-comment-list .comment-body {
        border: 1px solid #ddd;
        box-shadow: none;
    }
}
