/* EHComments - Frontend Styles */

/* Comment Form Enhancements */
.ehc-comment-form-wrapper {
    margin: 20px 0;
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    padding: 20px;
    background: #f9f9f9;
}

.ehc-comment-type-selector {
    margin-bottom: 15px;
}

.ehc-comment-type-selector label {
    font-weight: bold;
    margin-right: 10px;
    color: #333;
}

.ehc-comment-type-selector select {
    padding: 8px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    font-size: 14px;
    cursor: pointer;
}

/* Editor Toolbar */
.ehc-editor-toolbar {
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-bottom: none;
    padding: 8px;
    display: flex;
    gap: 5px;
    border-radius: 4px 4px 0 0;
}

.ehc-editor-btn {
    background: white;
    border: 1px solid #ccc;
    padding: 6px 10px;
    cursor: pointer;
    border-radius: 3px;
    transition: all 0.3s ease;
}

.ehc-editor-btn:hover {
    background: #e9e9e9;
    border-color: #999;
}

.ehc-editor-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* File Upload */
.ehc-file-upload {
    margin: 15px 0;
    padding: 10px;
    background: #f0f0f0;
    border-radius: 4px;
}

.ehc-file-upload label {
    cursor: pointer;
    color: #0073aa;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.ehc-file-upload label:hover {
    color: #005a87;
}

.ehc-file-upload input[type="file"] {
    display: none;
}

.ehc-file-info {
    font-size: 0.85em;
    color: #666;
    margin-left: 10px;
}

/* Submit Button */
.ehc-submit-btn {
    background: #0073aa !important;
    color: white !important;
    padding: 10px 25px !important;
    border: none !important;
    border-radius: 4px !important;
    font-size: 16px !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    transition: background 0.3s ease !important;
}

.ehc-submit-btn:hover {
    background: #005a87 !important;
}

/* Comment Display */
.ehc-comment-content {
    position: relative;
    padding: 20px;
    background: #fff;
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: box-shadow 0.3s ease;
}

.ehc-comment-content:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* Badges */
.ehc-badges {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.ehc-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8em;
    color: white;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ehc-badge.ehc-instructor {
    background: #ff6b6b;
}

.ehc-badge.ehc-level {
    background: #4ecdc4;
}

.ehc-badge.ehc-completed {
    background: #5f27cd;
}

.ehc-badge.ehc-membership {
    background: #0073aa;
    border: 1px solid rgba(255,255,255,0.3);
}

.ehc-badge.ehc-expiration {
    background: #666;
    font-size: 0.75em;
    padding: 3px 8px;
    opacity: 0.9;
}

/* Comment Types */
.ehc-comment-type {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 0.85em;
    margin-bottom: 10px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ehc-type-question {
    background: #3498db;
    color: white;
}

.ehc-type-answer {
    background: #2ecc71;
    color: white;
}

.ehc-type-resource {
    background: #e74c3c;
    color: white;
}

/* Comment Text */
.ehc-comment-text {
    margin: 15px 0;
    line-height: 1.6;
    color: #333;
}

.ehc-comment-text p {
    margin-bottom: 10px;
}

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

.ehc-comment-text code {
    background: #f4f4f4;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: monospace;
    font-size: 0.9em;
}

.ehc-comment-text pre {
    background: #f4f4f4;
    padding: 15px;
    border-radius: 4px;
    overflow-x: auto;
    margin: 10px 0;
}

.ehc-comment-text a {
    color: #0073aa;
    text-decoration: none;
}

.ehc-comment-text a:hover {
    text-decoration: underline;
}

/* Modern vertical voting system */
.ehc-voting {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    width: 48px;
    margin: 0 8px;
    user-select: none;
}
.ehc-vote {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 2rem;
    color: #bbb;
    transition: color 0.2s, background 0.2s;
    padding: 6px;
    border-radius: 50%;
    outline: none;
    width: 44px;
    height: 44px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.ehc-vote:focus {
    box-shadow: 0 0 0 2px #0073aa;
}
.ehc-vote.ehc-upvote.voted,
.ehc-vote.ehc-upvote:hover {
    color: #e74c3c;
    background: #ffeaea;
}
.ehc-vote.ehc-downvote.voted,
.ehc-vote.ehc-downvote:hover {
    color: #3498db;
    background: #eaf6ff;
}
.ehc-vote .dashicons {
    font-size: 1.5rem;
    margin-bottom: 2px;
}
.ehc-vote .count {
    font-size: 1.1rem;
    font-weight: bold;
    color: #333;
    margin-top: 2px;
    min-width: 1.5em;
    text-align: center;
}
@media (max-width: 600px) {
    .ehc-voting {
        width: 40px;
}
    .ehc-vote {
        width: 36px;
        height: 36px;
        font-size: 1.3rem;
    }
    .ehc-vote .dashicons {
        font-size: 1.1rem;
    }
    .ehc-vote .count {
        font-size: 1rem;
    }
}

/* Helpful Button */
.ehc-helpful {
    margin-left: auto;
}

.ehc-mark-helpful {
    background: #f0f8ff;
    color: #0073aa;
    border: 1px solid #c3e3ff;
    padding: 6px 16px;
    border-radius: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.ehc-mark-helpful:hover {
    background: #e1f1ff;
}
.ehc-mark-helpful:disabled {
    background: #e6f7e8;
    color: #27ae60;
    cursor: default;
    border-color: #a7d7ae;
}

.ehc-mark-helpful .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

/* Action Buttons */
.ehc-edit-btn {
    background: transparent;
    color: #555;
    border: none;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: color 0.2s;
}

.ehc-edit-btn:hover {
    color: #0073aa;
}

.ehc-delete-btn {
    background: transparent;
    color: #555;
    border: none;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: color 0.2s;
}

.ehc-delete-btn:hover {
    color: #d63638;
}
.ehc-delete-btn.ehc-moderator-delete {
    color: #d63638;
}
.ehc-delete-btn.ehc-moderator-delete:hover {
    color: #a02122;
}


/* Positioning for action buttons relative to badges */
.ehc-comment-content:has(.ehc-edit-btn) .ehc-delete-btn {
    /* Styles when both are present */
}

.ehc-comment-content .ehc-edit-btn + .ehc-delete-btn {
    /* Styles for delete when it follows edit */
}

/* Absolute positioning for fine-tuning */
.ehc-comment-content .ehc-edit-btn,
.ehc-comment-content .ehc-delete-btn {
    /* position: absolute; */
    /* top: 20px; */
}
.ehc-comment-content .ehc-edit-btn {
    /* right: 80px; */
}
.ehc-comment-content .ehc-delete-btn:not(.ehc-moderator-delete) {
    /* right: 20px; */
}
.ehc-comment-content .ehc-moderator-delete {
    /* right: 20px; */
}


/* Edit Form */
.ehc-edit-form {
    margin: 15px 0;
}

.ehc-edit-form textarea {
    width: 100%;
    min-height: 120px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 10px;
    font-size: 14px;
    line-height: 1.6;
    transition: border-color 0.2s;
}

.ehc-edit-form textarea:focus {
    border-color: #0073aa;
    outline: none;
}
.ehc-edit-form button {
    background: #0073aa;
    color: white;
    border: none;
    padding: 8px 18px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    margin-right: 10px;
    transition: background 0.2s;
}

.ehc-save-edit {
    
}
.ehc-save-edit:hover {
    background: #005a87;
}
.ehc-cancel-edit {
    background: #f1f1f1;
    color: #555;
    border: 1px solid #ccc;
}
.ehc-cancel-edit:hover {
    background: #e1e1e1;
}

/* Course Discussion Tab */
.ehc-course-discussion {
    padding: 20px;
    background: #fff;
}

.ehc-course-discussion h3 {
    margin-top: 0;
    margin-bottom: 20px;
    border-bottom: 2px solid #0073aa;
    padding-bottom: 10px;
}

.ehc-quick-comment {
    margin-bottom: 25px;
}
.ehc-quick-comment textarea {
    width: 100%;
    min-height: 100px;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 10px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.ehc-quick-comment textarea:focus {
    border-color: #0073aa;
    outline: none;
}
.ehc-quick-comment button {
    background: #0073aa;
    color: white;
    border: none;
    padding: 10px 25px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s;
}

.ehc-quick-comment button:hover {
    background: #005a87;
}

.ehc-discussion-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.ehc-discussion-item {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e1e1e1;
    transition: box-shadow 0.2s;
}

.ehc-discussion-item:hover {
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}
.ehc-comment-author {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.ehc-comment-author img {
    border-radius: 50%;
    width: 40px;
    height: 40px;
}

.author-name {
    font-weight: 600;
    color: #333;
}
.author-name a {
    text-decoration: none;
    color: inherit;
}
.comment-date {
    color: #666;
    font-size: 0.9em;
}


/* File Attachment Display */
.ehc-attachment {
    margin-top: 15px;
    padding: 10px;
    background: #f0f0f0;
    border-radius: 4px;
    display: inline-block;
}

.ehc-attachment a {
    color: #0073aa;
    text-decoration: none;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}
.ehc-attachment a:hover {
    color: #005a87;
}
.ehc-attachment .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}


/* Load More Button */
.ehc-load-more {
    text-align: center;
    margin: 20px 0;
}
.ehc-load-more button {
    background: white;
    color: #0073aa;
    border: 1px solid #0073aa;
    padding: 10px 25px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.ehc-load-more button:hover {
    background: #0073aa;
    color: white;
}
.ehc-load-more button:disabled {
    background: #f1f1f1;
    color: #aaa;
    border-color: #ddd;
    cursor: not-allowed;
}


/* Responsive Adjustments */
@media (max-width: 768px) {
    .ehc-comment-form-wrapper {
        padding: 15px;
    }
    .ehc-editor-toolbar {
        flex-wrap: wrap;
    }
    .ehc-comment-content {
        padding: 15px;
    }
    .ehc-voting {
        flex-wrap: wrap;
    }
    .ehc-course-discussion {
        padding: 15px;
    }
    .comment-date {
        display: block;
        margin-top: 2px;
        margin-left: 0;
    }

    .ehc-comment-author {
        flex-wrap: wrap;
        align-items: flex-start;
    }
}

/* Loading Spinner */
.ehc-loading {
    display: flex;
    justify-content: center;
    padding: 20px;
}
.ehc-spinner {
    width: 30px;
    height: 30px;
    border: 3px solid #f3f3f3;
    border-top-color: #0073aa;
    border-radius: 50%;
    animation: ehc-spin 1s linear infinite;
}

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

/* User Notifications */
.ehc-notification {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 12px 25px;
    border-radius: 30px;
    font-size: 14px;
    z-index: 10000;
    animation: ehc-slide-in 0.5s ease;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

@keyframes ehc-slide-in {
    from {
        bottom: -50px;
        opacity: 0;
    }
    to {
        bottom: 20px;
        opacity: 1;
    }
}

.ehc-notification.error {
    background: #d63638;
}
.ehc-notification.info {
    background: #0073aa;
}

.ehc-notification.success,
.ldec-notification.success {
    background: #e6f7e8 !important;
    color: #27ae60 !important;
    border-left: 6px solid #27ae60 !important;
}

.ehc-notification.error,
.ldec-notification.error {
    background: #fdecea !important;
    color: #d63638 !important;
    border-left: 6px solid #d63638 !important;
}

.ehc-notification.info,
.ldec-notification.info {
    background: #eaf6fb !important;
    color: #0073aa !important;
    border-left: 6px solid #0073aa !important;
}

/* Print Styles */
@media print {
    .ehc-voting,
    .ehc-helpful,
    .ehc-edit-btn,
    .ehc-delete-btn,
    .ehc-load-more,
    .ehc-comment-form-wrapper {
        display: none !important;
    }
    .ehc-comment-content {
        box-shadow: none;
        border: 1px solid #ccc;
        padding: 10px;
    }
}

/* Comment Pending Notice */
.ehc-pending-notice {
    background: #fff8e1;
    border: 1px solid #ffecb3;
    border-left-width: 4px;
    border-left-color: #ffc107;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 15px;
    color: #665b3d;
    display: flex;
    align-items: center;
    gap: 10px;
}
.ehc-pending-notice .dashicons {
    color: #ffc107;
    font-size: 20px;
}

/* New Flexbox structure for header */
.ehc-comment-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.ehc-badges-wrapper {
    flex-grow: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ehc-action-buttons {
    flex-shrink: 0;
    margin-left: 15px;
    display: flex;
    gap: 8px;
}

.ehc-comment-footer {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 15px;
    border-top: 1px solid #f0f0f0;
    padding-top: 15px;
}

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

body .comment-body .comment-author.vcard .ldec-comment-meta-group {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-left: auto;
}

.ldec-comment-meta-group .ldec-badges,
.ldec-comment-meta-group .ldec-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.comment-author.vcard .fn,
.comment-author.vcard .fn a {
    font-weight: bold;
    color: #333;
    text-decoration: none;
    font-size: 1.1em;
    margin: 0;
}

body .comment-body .comment-author.vcard .comment-meta.commentmetadata {
    font-size: 0.9em;
    color: #777;
    order: 3; /* Push to next line on wrap */
    width: 100%;
    margin: 0;
}

body .comment-body .ldec-comment-enhancements-wrapper {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    justify-content: space-between;
}

.ldec-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    align-items: center;
}

.ldec-badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    color: #fff;
    display: inline-block;
}

.instructor-badge {
    background-color: #d9534f;
}

.course-completed-badge {
    background-color: #5bc0de;
}

.wishlist-badge {
    background-color: #5cb85c;
}

.ldec-actions {
    display: flex;
    gap: 10px;
    font-size: 0.9em;
}

.ldec-voting {
    display: flex;
    align-items: center;
    gap: 5px;
}

.ldec-voting a {
    text-decoration: none;
    color: #777;
    font-size: 1.2em;
}

.ldec-voting .vote-count {
    font-weight: bold;
}

.comment-reply-link {
    display: inline-block;
    margin-top: 10px;
    padding: 5px 15px;
    background-color: #f0f0f0;
    border-radius: 4px;
    text-decoration: none;
    color: #333;
    font-size: 0.9em;
    transition: background-color 0.3s;
}

.comment-reply-link:hover {
    background-color: #e0e0e0;
}

/* New, more specific rules for the refactored comment header */
body .comment-body .ehc-comment-header {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 15px;
}

body .comment-body .ehc-comment-header .avatar {
    flex-shrink: 0;
}

body .comment-body .ehc-author-meta {
    display: flex;
    flex-direction: column;
    width: 100%;
}

body .comment-body .ehc-author-line,
body .comment-body .ehc-meta-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

body .comment-body .ehc-author-line {
    margin-bottom: 5px;
}

body .comment-body .ehc-author-line .fn a {
    font-weight: bold;
    font-size: 1.1em;
    color: #333;
    text-decoration: none;
}

body .comment-body .ehc-meta-line .comment-meta-link {
    font-size: 0.9em;
    color: #777;
    text-decoration: none;
}

body .comment-body .ldec-actions a {
    font-size: 0.9em;
    margin-left: 5px;
}

body .comment-body .comment-content {
    padding-left: 0 !important; /* Override theme indentation */
    margin-left: 80px; /* Align with author meta (avatar width + gap) */
    border: none !important;
    padding: 0 !important;
}

/* Hide theme-added elements */
body .comment-body .fn span.says {
    display: none;
}
/* End of new rules */

body .comment-body .ldec-comment-enhancements-wrapper {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    /* margin-top is handled by the new footer */
}

/* Refined Voting Button Styles */
body .comment-body .ldec-voting a {
    text-decoration: none;
    color: #555;
    font-size: 1.4em;
    font-weight: bold;
}
body .comment-body .ldec-voting .vote-count {
    font-weight: bold;
    font-size: 1.1em;
    color: #333;
}

/* Refined Reply Button Style */
body .comment-body .reply .comment-reply-link {
    display: inline-block;
    padding: 6px 14px;
    background-color: #f1f1f1;
    border: 1px solid #ccc;
    border-radius: 4px;
    text-decoration: none;
    color: #333;
    font-size: 0.9em;
    font-weight: 600;
    transition: background-color 0.2s, border-color 0.2s;
    margin: 0;
}

body .comment-body .reply .comment-reply-link:hover {
    background-color: #e9e9e9;
    border-color: #999;
}

/* New Footer container for voting and reply */
body .comment-body .ehc-comment-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-left: 80px; /* Align with comment content */
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid #f0f0f0;
}

/*
==========================================================================
RTL Support - Consolidated & Comprehensive
==========================================================================
*/

/* General Body and Text Alignment */
body[dir="rtl"] .comment-list .comment,
body[dir="rtl"] .comment-body {
    text-align: right;
}

/* Header: Reverse Avatar and Meta content */
body[dir="rtl"] .ehc-comment-header {
    flex-direction: row-reverse;
}

/* Author Meta: Ensure text inside aligns right */
body[dir="rtl"] .ehc-author-meta {
    text-align: right;
}

/* Comment Content: Adjust margin for RTL avatar position */
body[dir="rtl"] .comment-body .comment-content {
    margin-right: 80px; /* Avatar width (65px) + gap (15px) */
    margin-left: 0;
    text-align: right;
}

/* Footer: Reverse Voting/Reply and adjust margin */
body[dir="rtl"] .ehc-comment-footer {
    flex-direction: row-reverse;
    margin-right: 80px;
    margin-left: 0;
}

/* Voting Buttons: Reverse the up/down arrows */
body[dir="rtl"] .ldec-voting {
    flex-direction: row-reverse;
}

/* Action Links: Adjust margin for RTL */
body[dir="rtl"] .ldec-actions a {
    margin-right: 5px;
    margin-left: 0;
}

/* NEW: Additional Enhanced Features */

/* Thread Subscriptions */
.ehc-subscription-wrapper {
    margin-bottom: 20px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 8px;
    text-align: center;
}

.ehc-subscribe-btn {
    background: #3498db;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s ease;
}

.ehc-subscribe-btn:hover {
    background: #2980b9;
}

.ehc-subscribe-btn.subscribed {
    background: #27ae60;
}

.ehc-subscribe-btn.subscribed:hover {
    background: #229954;
}

/* Spam Protection */
.ehc-honeypot {
    position: absolute;
    left: -9999px;
    top: -9999px;
}

.ehc-rate-limit-notice {
    background: #f39c12;
    color: white;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 15px;
    text-align: center;
}

/* Export/Import */
.ehc-export-import-section {
    background: white;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 8px;
    margin-top: 20px;
}

.ehc-export-import-section h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #333;
}

.ehc-export-controls,
.ehc-import-controls {
    margin-bottom: 15px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.ehc-export-format {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    min-width: 100px;
}

.ehc-export-btn,
.ehc-import-btn {
    background: #0073aa;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
}

.ehc-export-btn:hover,
.ehc-import-btn:hover {
    background: #005a87;
}

.ehc-import-file {
    border: 1px solid #ddd;
    padding: 5px;
    border-radius: 4px;
}

/* Enhanced Analytics */
.ehc-analytics-chart {
    background: white;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 8px;
    margin-bottom: 20px;
    }
    
.ehc-chart-container {
    height: 300px;
    position: relative;
    }
    
.ehc-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
    }
    
.ehc-stat-card {
    background: white;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 8px;
    text-align: center;
    }
    
.ehc-stat-number {
    font-size: 2em;
    font-weight: bold;
    color: #0073aa;
    margin-bottom: 5px;
    }
    
.ehc-stat-label {
    color: #666;
    font-size: 0.9em;
}

.ehc-top-lists {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
    }
    
.ehc-top-list {
    background: white;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 8px;
}

.ehc-top-list h4 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #333;
}

.ehc-top-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

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

.ehc-top-name {
    font-weight: bold;
}

.ehc-top-count {
    background: #0073aa;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.85em;
}

/* Notification System */
.ehc-notification-center {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    max-width: 400px;
}

.ehc-notification {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    animation: slideInRight 0.3s ease;
}

.ehc-notification.success {
    border-left: 4px solid #27ae60;
}

.ehc-notification.error {
    border-left: 4px solid #e74c3c;
}

.ehc-notification.warning {
    border-left: 4px solid #f39c12;
}

.ehc-notification.info {
    border-left: 4px solid #3498db;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Loading States */
.ehc-loading {
    position: relative;
    pointer-events: none;
}

.ehc-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Enhanced Mobile Support */
@media (max-width: 480px) {
    .ehc-export-controls,
    .ehc-import-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .ehc-stats-grid {
        grid-template-columns: 1fr;
    }
    
    .ehc-top-lists {
        grid-template-columns: 1fr;
    }
    
    .ehc-notification-center {
        left: 10px;
        right: 10px;
        max-width: none;
    }
    
    .ehc-subscription-wrapper {
        padding: 10px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .ehc-export-import-section,
    .ehc-analytics-chart,
    .ehc-stat-card,
    .ehc-top-list,
    .ehc-notification {
        background: #2c3e50;
        color: #ecf0f1;
        border-color: #34495e;
    }
    
    .ehc-stat-number {
        color: #3498db;
    }
    
    .ehc-top-count {
        background: #3498db;
    }
    
    .ehc-export-format,
    .ehc-import-file {
        background: #34495e;
        color: #ecf0f1;
        border-color: #7f8c8d;
    }
}

/* Print Styles */
@media print {
    .ehc-reactions,
    .ehc-comment-footer,
    .ehc-subscription-wrapper,
    .ehc-comment-search {
        display: none !important;
    }
    
    .ehc-comment-content {
        border: 1px solid #ccc;
        padding: 10px;
        margin-bottom: 15px;
    }
}

/* NEW: Enhanced Features Styles */

/* Reactions */
.ehc-reactions {
    margin-top: 10px;
}

.ehc-reaction-buttons {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.ehc-reaction-btn {
    background: white;
        border: 1px solid #ddd;
    padding: 5px 10px;
    cursor: pointer;
    border-radius: 20px;
    font-size: 1.2em;
    transition: all 0.2s ease;
}

.ehc-reaction-btn:hover {
    background: #f0f0f0;
    transform: scale(1.1);
}

.ehc-reaction-btn.reacted {
    background: #0073aa;
    color: white;
    border-color: #0073aa;
}

.ehc-reactions-summary {
    margin-top: 8px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.ehc-reaction-count {
    background: #f0f0f0;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.85em;
    color: #666;
    }

/* Mentions */
.ehc-mention {
    color: #0073aa;
    text-decoration: none;
    font-weight: bold;
}

.ehc-mention:hover {
    text-decoration: underline;
}

.ehc-mention-suggestions {
    position: absolute;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
}

.ehc-mention-suggestion {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
}

.ehc-mention-suggestion:hover {
    background: #f5f5f5;
}

.ehc-mention-suggestion:last-child {
    border-bottom: none;
}

.ehc-mention-suggestion img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
}

.ehc-mention-name {
    font-weight: bold;
}

.ehc-mention-username {
    color: #666;
    font-size: 0.9em;
}

/* Comment Search */
.ehc-comment-search {
    margin-bottom: 20px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 8px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.ehc-search-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.ehc-search-btn,
.ehc-clear-search {
    padding: 8px 16px;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    background: white;
}

.ehc-search-btn:hover,
.ehc-clear-search:hover {
    background: #f0f0f0;
}

.ehc-search-results {
    margin-top: 20px;
}

.ehc-search-result {
    background: white;
    padding: 15px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
}

.ehc-result-author {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.ehc-result-author img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.ehc-result-date {
    color: #666;
    font-size: 0.9em;
}

.ehc-result-content {
    margin-bottom: 10px;
    color: #333;
}

.ehc-result-link {
    color: #0073aa;
    text-decoration: none;
    font-size: 0.9em;
}

.ehc-result-link:hover {
    text-decoration: underline;
}

/* Comment Reporting */
.ehc-report-comment {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85em;
    display: flex;
    align-items: center;
    gap: 5px;
}

.ehc-report-comment:hover {
    background: #c0392b;
}

.ehc-report-dialog {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.ehc-report-content {
    background: white;
    padding: 25px;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
}

.ehc-report-content h3 {
    margin-top: 0;
    margin-bottom: 15px;
}

.ehc-report-reason {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 15px;
}

.ehc-report-details {
    width: 100%;
    min-height: 100px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 20px;
    resize: vertical;
}

.ehc-report-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.ehc-submit-report {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
}

.ehc-submit-report:hover {
    background: #c0392b;
}

.ehc-cancel-report {
    background: #95a5a6;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
}

.ehc-cancel-report:hover {
    background: #7f8c8d;
}

/* RTL Support for New Features */
[dir="rtl"] .ehc-reaction-buttons {
    flex-direction: row-reverse;
}

[dir="rtl"] .ehc-mention-suggestion {
    flex-direction: row-reverse;
}

[dir="rtl"] .ehc-result-author {
    flex-direction: row-reverse;
}

[dir="rtl"] .ehc-report-actions {
    flex-direction: row-reverse;
}

/* Voting group */
.ehc-voting-group {
    display: flex;
    gap: 16px;
    align-items: center;
    margin-bottom: 8px;
}
.ehc-voting {
    display: flex;
    gap: 8px;
}
.ehc-vote {
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 1.3em;
    color: #333;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, color 0.2s;
    margin: 0 2px;
}
.ehc-vote.voted, .ehc-vote:active {
    border-color: #0073aa;
    background: #f0f8ff;
    color: #0073aa;
}
.ehc-vote:hover {
    border-color: #0073aa;
}
.ehc-vote .count {
    font-size: 0.9em;
    margin-top: 2px;
}

/* Emoji reactions group */
.ehc-reactions-group {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 8px;
}
.ehc-reactions {
    display: flex;
    gap: 8px;
}
.ehc-reaction-btn {
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2em;
    color: #333;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, color 0.2s;
}
.ehc-reaction-btn.reacted, .ehc-reaction-btn:active {
    border-color: #ff9800;
    background: #fff8e1;
    color: #ff9800;
}
.ehc-reaction-btn:hover {
    border-color: #ff9800;
}

.ehc-reactions-summary {
    display: flex;
    gap: 8px;
    margin-top: 4px;
    font-size: 1.1em;
}
.ehc-reaction-count {
    background: #f5f5f5;
    border-radius: 12px;
    padding: 2px 8px;
    color: #333;
}

/* Actions toolbar */
.ehc-actions-toolbar {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.ehc-action-btn {
    background: #f7f7f7;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 1em;
    color: #333;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.ehc-action-btn:hover, .ehc-action-btn:focus {
    background: #0073aa;
    color: #fff;
    border-color: #0073aa;
}
.ehc-action-btn .dashicons {
    font-size: 1.1em;
}

/* Interactive row (voting + reactions) */
.ehc-interactive-row {
    display: flex;
    gap: 32px;
    align-items: center;
    margin-top: 12px;
    margin-bottom: 4px;
    flex-wrap: wrap;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .ehc-interactive-row, .ehc-actions-toolbar {
        flex-direction: column;
        gap: 8px;
        align-items: stretch;
    }
    .ehc-voting-group, .ehc-reactions-group {
        gap: 8px;
    }
}

/* Discourse-style comment nesting and author info */
.ehc-comment-outer-wrapper {
    display: flex;
    align-items: flex-start;
    position: relative;
    margin-bottom: 24px;
}
.ehc-thread-line {
    width: 24px;
    min-width: 24px;
    height: 100%;
    border-left: 3px solid #e0e4ea;
    margin-right: 16px;
    margin-left: -8px;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 0;
}
body[dir="rtl"] .ehc-thread-line {
    border-left: none;
    border-right: 3px solid #e0e4ea;
    margin-left: 16px;
    margin-right: -8px;
    left: auto;
    right: 0;
}
.ehc-comment-outer-wrapper > .comment-body {
    flex: 1;
    position: relative;
    z-index: 1;
}
.ehc-avatar-wrapper {
    margin-right: 18px;
    flex-shrink: 0;
}
body[dir="rtl"] .ehc-avatar-wrapper {
    margin-left: 18px;
    margin-right: 0;
}
.ehc-avatar-img {
    width: 60px !important;
    height: 60px !important;
    border-radius: 50%;
    border: 2px solid #e0e4ea;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    background: #fff;
}
.author-name {
    font-weight: 700;
    font-size: 1.15em;
    color: #222;
    margin-right: 8px;
}
body[dir="rtl"] .author-name {
    margin-left: 8px;
    margin-right: 0;
}
.ehc-badges-wrapper {
    display: flex;
    gap: 6px;
    margin-left: 8px;
}
body[dir="rtl"] .ehc-badges-wrapper {
    margin-right: 8px;
    margin-left: 0;
}
.ehc-comment {
    list-style: none;
    padding-left: 0;
    margin-left: 0;
}
.comment-list .children {
    margin-left: 48px;
    border-left: 0;
    padding-left: 0;
}
body[dir="rtl"] .comment-list .children {
    margin-right: 48px;
    margin-left: 0;
}
/* End Discourse-style */

/* RTL Toggle Button */
.ehc-rtl-toggle {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #0073aa;
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.ehc-rtl-toggle:hover {
    background: #005a87;
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.ehc-rtl-toggle .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

/* RTL mode indicator */
.ehc-rtl-mode .ehc-rtl-toggle {
    background: #e74c3c;
}

.ehc-rtl-mode .ehc-rtl-toggle:hover {
    background: #c0392b;
}

/* RTL toggle positioning for different contexts */
.ehc-comment-form-wrapper {
    position: relative;
}

.comments-area {
    position: relative;
}

/* Responsive RTL toggle */
@media (max-width: 768px) {
    .ehc-rtl-toggle {
        width: 35px;
        height: 35px;
        top: 5px;
        right: 5px;
    }
    
    .ehc-rtl-toggle .dashicons {
        font-size: 16px;
        width: 16px;
        height: 16px;
    }
}

/* RTL toggle for admin */
.wrap .ehc-rtl-toggle {
    position: fixed;
    top: 32px;
    right: 20px;
    z-index: 9999;
}

@media (max-width: 782px) {
    .wrap .ehc-rtl-toggle {
        top: 46px;
        right: 10px;
    }
}

.eh-vote-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 48px;
    margin: 0 8px;
    user-select: none;
}

.eh-vote-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 2rem;
    color: #bbb;
    transition: color 0.2s, background 0.2s;
    padding: 6px;
    border-radius: 50%;
    outline: none;
}

.eh-vote-btn:focus {
    box-shadow: 0 0 0 2px #0073aa;
}

.eh-vote-btn.upvoted,
.eh-vote-btn:hover.up {
    color: #e74c3c;
    background: #ffeaea;
}

.eh-vote-btn.downvoted,
.eh-vote-btn:hover.down {
    color: #3498db;
    background: #eaf6ff;
}

.eh-vote-count {
    font-size: 1.3rem;
    font-weight: bold;
    margin: 4px 0;
    color: #333;
    min-width: 1.5em;
    text-align: center;
}

/* Ensure EHComments stays aligned and inside main content, including LearnDash Focus Mode */
.ehc-comments-area {
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 auto !important;
    float: none !important;
    position: static !important;
    box-sizing: border-box !important;
    z-index: 1 !important;
}

.ld-focus-main .ehc-comments-area {
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 auto !important;
    float: none !important;
    position: static !important;
    box-sizing: border-box !important;
}

/* Defensive CSS Reset for EHComments */
.ehc-comments-area, .ehc-comments-area * {
    box-sizing: border-box !important;
    margin: 0;
    padding: 0;
    font-family: inherit;
    direction: inherit;
}
.ehc-comments-area {
    width: 100% !important;
    clear: both !important;
    float: none !important;
    position: static !important;
    background: #fff;
}
.ehc-comment {
    width: 100% !important;
    display: block;
    clear: both;
}
.ehc-comment-header, .ehc-comment-footer, .ehc-interactive-row {
    display: flex !important;
    flex-wrap: wrap;
    align-items: flex-start;
    width: 100%;
}

/* LearnDash Focus Mode Compatibility */
.learndash-focus .ehc-comments-area,
.ld-focus-main .ehc-comments-area {
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    float: none !important;
    position: static !important;
    box-sizing: border-box !important;
    background: #fff !important;
    border: none !important;
    border-radius: 0 !important;
    z-index: 1 !important;
    direction: rtl !important;
    text-align: right !important;
}

.learndash-focus .ehc-comments-area .comment-list,
.ld-focus-main .ehc-comments-area .comment-list {
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    text-align: right !important;
}

.learndash-focus .ehc-comment,
.ld-focus-main .ehc-comment {
    width: 100% !important;
    margin: 0 0 15px 0 !important;
    padding: 15px !important;
    box-sizing: border-box !important;
    text-align: right !important;
}

.learndash-focus .ehc-comment-header,
.ld-focus-main .ehc-comment-header {
    flex-direction: row-reverse !important;
    justify-content: flex-end !important;
}

.learndash-focus .ehc-comment-footer,
.ld-focus-main .ehc-comment-footer {
    flex-direction: row-reverse !important;
    justify-content: flex-end !important;
}

.learndash-focus .ehc-comment-content,
.ld-focus-main .ehc-comment-content {
    text-align: right !important;
}

.learndash-focus .ehc-comment-author,
.ld-focus-main .ehc-comment-author {
    flex-direction: row-reverse !important;
    justify-content: flex-end !important;
}

.learndash-focus .ehc-comment-author img,
.ld-focus-main .ehc-comment-author img {
    margin-left: 12px !important;
    margin-right: 0 !important;
}

.learndash-focus .ehc-load-more,
.ld-focus-main .ehc-load-more {
    text-align: center !important;
    margin: 20px 0 !important;
}

/* Responsive fix for mobile */
@media (max-width: 768px) {
    .learndash-focus .ehc-comments-area,
    .ld-focus-main .ehc-comments-area {
        padding: 0 !important;
        margin: 0 !important;
    }
}

/* Enhanced Mobile Responsiveness for EHComments */

/* Large tablets and small desktops */
@media (max-width: 1024px) {
    .ehc-comment-content {
        padding: 16px;
        margin-bottom: 16px;
    }
    
    .ehc-comment-header {
        flex-direction: column;
        gap: 8px;
    }
    
    .ehc-actions-toolbar {
        justify-content: center;
        gap: 12px;
    }
    
    .ehc-comment-search {
        flex-direction: column;
        gap: 8px;
    }
    
    .ehc-search-input {
        margin-bottom: 8px;
    }
}

/* Tablets */
@media (max-width: 768px) {
    .ehc-comment-form-wrapper {
        padding: 15px;
    }
    
    .ehc-editor-toolbar {
        flex-wrap: wrap;
        gap: 4px;
    }
    
    .ehc-comment-content {
        padding: 15px;
    }
    
    .ehc-voting {
        flex-wrap: wrap;
        width: auto;
        margin: 0 4px;
    }
    
    .ehc-course-discussion {
        padding: 15px;
    }
    
    .comment-date {
        display: block;
        margin-top: 2px;
        margin-left: 0;
        font-size: 0.85em;
    }

    .ehc-comment-author {
        flex-wrap: wrap;
        align-items: flex-start;
    }
    
    /* Better avatar and content layout */
    .ehc-comment-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .ehc-avatar-wrapper {
        align-self: flex-start;
    }
    
    .ehc-avatar-img {
        width: 40px;
        height: 40px;
    }
    
    /* Action buttons optimization */
    .ehc-actions-toolbar {
        flex-wrap: wrap;
        justify-content: space-between;
        gap: 8px;
    }
    
    .ehc-action-btn {
        flex: 1;
        min-width: calc(50% - 4px);
        justify-content: center;
        padding: 10px 8px;
        font-size: 0.9em;
    }
    
    /* Badges responsive layout */
    .ehc-badges {
        gap: 4px;
    }
    
    .ehc-badge {
        font-size: 0.75em;
        padding: 3px 8px;
    }
    
    /* Interactive elements optimization */
    .ehc-interactive-row {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    
    .ehc-voting-group, .ehc-reactions-group {
        width: 100%;
        justify-content: center;
    }
    
    /* Comment search responsive */
    .ehc-comment-search {
        padding: 12px;
        flex-direction: column;
        align-items: stretch;
    }
    
    .ehc-search-input {
        margin-bottom: 8px;
    }
    
    .ehc-search-btn, .ehc-clear-search {
        width: 100%;
        margin: 2px 0 !important;
    }
    
    /* Form elements */
    .ehc-edit-form textarea {
        min-height: 100px;
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .ehc-comment-form-wrapper textarea {
        font-size: 16px; /* Prevent zoom on iOS */
        min-height: 120px;
    }
    
    /* Notification positioning */
    .ehc-notification {
        left: 10px;
        right: 10px;
        transform: none;
        max-width: none;
    }
    
    /* Thread lines for better mobile readability */
    .ehc-thread-line {
        width: 2px;
        left: 15px;
    }
}

/* Small tablets and large phones */
@media (max-width: 600px) {
    .ehc-voting {
        width: 40px;
    }
    
    .ehc-vote {
        width: 36px;
        height: 36px;
        font-size: 1.3rem;
        margin: 2px 0;
        padding: 4px;
    }
    
    .ehc-vote .dashicons {
        font-size: 1.1rem;
    }
    
    .ehc-vote .count {
        font-size: 0.9rem;
        margin: 2px 0;
    }
    
    /* Enhanced mobile layout */
    .ehc-comment-content {
        padding: 12px;
        margin-bottom: 12px;
    }
    
    .ehc-comment-header {
        margin-bottom: 10px;
    }
    
    .ehc-author-meta {
        width: 100%;
    }
    
    .ehc-author-line {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    /* Improved action button layout */
    .ehc-actions-toolbar {
        gap: 6px;
    }
    
    .ehc-action-btn {
        min-width: auto;
        flex: 1;
        padding: 8px 6px;
        font-size: 0.85em;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .ehc-action-btn .dashicons {
        font-size: 14px;
        margin-right: 4px;
    }
    
    /* Interactive row mobile optimization */
    .ehc-interactive-row, .ehc-actions-toolbar {
        flex-direction: column;
        gap: 8px;
    }
    
    .ehc-voting-group, .ehc-reactions-group {
        justify-content: center;
        margin: 0;
    }
    
    /* Typography improvements */
    .ehc-comment-text {
        font-size: 0.95em;
        line-height: 1.5;
    }
    
    .author-name {
        font-size: 0.95em;
    }
    
    .comment-date {
        font-size: 0.8em;
    }
    
    /* Form improvements */
    .ehc-comment-form-wrapper {
        padding: 12px;
        margin: 15px 0;
    }
    
    .ehc-editor-toolbar {
        padding: 6px;
        gap: 3px;
    }
    
    .ehc-editor-btn {
        padding: 4px 6px;
        min-width: 32px;
    }
    
    /* Better button sizing for touch */
    .ehc-subscribe-btn, .ehc-load-more button {
        padding: 12px 16px;
        font-size: 0.9em;
    }
    
    /* Reactions mobile optimization */
    .ehc-reaction-buttons {
        justify-content: center;
        gap: 4px;
    }
    
    .ehc-reaction-btn {
        padding: 6px 8px;
        font-size: 1em;
        min-width: 36px;
        min-height: 36px;
    }
}

/* Small phones */
@media (max-width: 480px) {
    .ehc-export-controls,
    .ehc-import-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .ehc-stats-grid {
        grid-template-columns: 1fr;
    }
    
    .ehc-top-lists {
        grid-template-columns: 1fr;
    }
    
    .ehc-notification-center {
        left: 10px;
        right: 10px;
        max-width: none;
    }
    
    .ehc-subscription-wrapper {
        padding: 10px;
    }
    
    /* Ultra-mobile optimizations */
    .ehc-comment-content {
        padding: 10px;
        margin-bottom: 10px;
    }
    
    .ehc-avatar-img {
        width: 32px;
        height: 32px;
    }
    
    .ehc-comment-header {
        gap: 8px;
    }
    
    .ehc-actions-toolbar {
        flex-direction: column;
        gap: 6px;
    }
    
    .ehc-action-btn {
        width: 100%;
        justify-content: center;
        padding: 10px;
        font-size: 0.9em;
    }
    
    /* Compact voting */
    .ehc-voting {
        flex-direction: row;
        width: auto;
        gap: 8px;
        justify-content: center;
        align-items: center;
    }
    
    .ehc-vote {
        width: 32px;
        height: 32px;
        font-size: 1.1rem;
    }
    
    .ehc-vote .count {
        font-size: 0.8rem;
    }
    
    /* Compact form elements */
    .ehc-comment-form-wrapper {
        padding: 8px;
        margin: 10px 0;
    }
    
    .ehc-editor-toolbar {
        padding: 4px;
        gap: 2px;
    }
    
    .ehc-editor-btn {
        padding: 6px;
        min-width: 30px;
        min-height: 30px;
    }
    
    /* Typography for small screens */
    .ehc-comment-text {
        font-size: 0.9em;
        line-height: 1.4;
    }
    
    .ehc-badge {
        font-size: 0.7em;
        padding: 2px 6px;
    }
    
    .author-name {
        font-size: 0.9em;
    }
    
    .comment-date {
        font-size: 0.75em;
    }
    
    /* Search improvements */
    .ehc-comment-search {
        padding: 8px;
    }
    
    .ehc-search-input {
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 10px;
    }
    
    /* Load more button */
    .ehc-load-more {
        margin: 15px 0;
    }
    
    .ehc-load-more button {
        width: 100%;
        padding: 12px;
        font-size: 0.9em;
    }
}

/* Very small phones and landscape orientation */
@media (max-width: 360px) {
    .ehc-comment-content {
        padding: 8px;
        border-radius: 6px;
    }
    
    .ehc-comment-header {
        flex-direction: column;
        gap: 6px;
    }
    
    .ehc-avatar-img {
        width: 28px;
        height: 28px;
    }
    
    .ehc-author-line {
        flex-direction: column;
        gap: 2px;
    }
    
    .ehc-badges {
        gap: 2px;
    }
    
    .ehc-badge {
        font-size: 0.65em;
        padding: 1px 4px;
    }
    
    .ehc-actions-toolbar {
        gap: 4px;
    }
    
    .ehc-action-btn {
        padding: 8px 4px;
        font-size: 0.8em;
    }
    
    .ehc-action-btn .dashicons {
        font-size: 12px;
    }
    
    /* Ultra-compact voting */
    .ehc-vote {
        width: 28px;
        height: 28px;
        font-size: 1rem;
    }
    
    .ehc-vote .count {
        font-size: 0.75rem;
    }
    
    /* Form elements ultra-compact */
    .ehc-comment-form-wrapper {
        padding: 6px;
        margin: 8px 0;
    }
    
    .ehc-editor-btn {
        padding: 4px;
        min-width: 28px;
        min-height: 28px;
    }
    
    .ehc-comment-text {
        font-size: 0.85em;
        line-height: 1.3;
    }
    
    .author-name {
        font-size: 0.85em;
    }
    
    .comment-date {
        font-size: 0.7em;
    }
}

/* Landscape phone orientation */
@media (max-height: 500px) and (orientation: landscape) {
    .ehc-comment-content {
        padding: 8px 12px;
    }
    
    .ehc-comment-header {
        flex-direction: row;
        align-items: center;
        gap: 8px;
    }
    
    .ehc-avatar-img {
        width: 32px;
        height: 32px;
    }
    
    .ehc-actions-toolbar {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 4px;
    }
    
    .ehc-action-btn {
        flex: 1;
        min-width: auto;
        padding: 6px 8px;
    }
    
    .ehc-voting {
        flex-direction: row;
        gap: 6px;
    }
    
    .ehc-interactive-row {
        flex-direction: row;
        gap: 8px;
        justify-content: space-between;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .ehc-vote, .ehc-action-btn, .ehc-reaction-btn {
        min-height: 44px; /* Apple recommended touch target size */
        min-width: 44px;
    }
    
    .ehc-editor-btn {
        min-height: 36px;
        min-width: 36px;
    }
    
    /* Larger touch targets for better usability */
    .ehc-subscribe-btn, .ehc-load-more button {
        min-height: 44px;
        padding: 12px 16px;
    }
    
    /* Better spacing for touch */
    .ehc-actions-toolbar {
        gap: 8px;
    }
    
    .ehc-reaction-buttons {
        gap: 6px;
    }
    
    .ehc-voting {
        gap: 8px;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .ehc-avatar-img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
    
    .ehc-badge {
        border-radius: 12px;
    }
    
    .ehc-reaction-btn {
        border-radius: 18px;
    }
}

/* Additional Mobile Enhancement Styles */

/* Mobile device specific optimizations */
.ehc-mobile-device .ehc-comment-content {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.ehc-mobile-device .ehc-comment-text {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* Touch-active states */
.ehc-touch-active {
    background-color: rgba(0, 115, 170, 0.05) !important;
    transform: scale(0.98);
    transition: all 0.15s ease;
}

/* Dynamic layout classes */
.ehc-ultra-mobile .ehc-comment-content {
    padding: 8px !important;
    border-radius: 6px !important;
}

.ehc-ultra-mobile .ehc-avatar-img {
    width: 28px !important;
    height: 28px !important;
}

.ehc-tablet .ehc-comment-content {
    padding: 12px !important;
}

.ehc-tablet .ehc-avatar-img {
    width: 40px !important;
    height: 40px !important;
}

.ehc-desktop .ehc-comment-content {
    padding: 20px !important;
}

.ehc-desktop .ehc-avatar-img {
    width: 60px !important;
    height: 60px !important;
}

/* Vertical layout for action buttons */
.ehc-vertical-layout.ehc-actions-toolbar {
    flex-direction: column !important;
    gap: 6px !important;
}

.ehc-vertical-layout .ehc-action-btn {
    width: 100% !important;
    justify-content: center !important;
}

/* Compact voting layout */
.ehc-compact-voting.ehc-voting {
    flex-direction: row !important;
    gap: 8px !important;
    justify-content: center !important;
    width: auto !important;
}

.ehc-compact-voting .ehc-vote {
    margin: 0 !important;
}

/* Compact actions toolbar */
.ehc-compact-actions.ehc-actions-toolbar {
    flex-wrap: wrap !important;
    gap: 4px !important;
}

.ehc-compact-actions .ehc-action-btn {
    flex: 1 !important;
    min-width: calc(50% - 2px) !important;
    font-size: 0.8em !important;
    padding: 6px !important;
}

/* Swipe reveal functionality */
.ehc-swipe-reveal {
    animation: slideInFromRight 0.3s ease;
    background: rgba(0, 115, 170, 0.1);
    border-radius: 4px;
    padding: 4px;
}

@keyframes slideInFromRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Overflow menu styles */
.ehc-overflow-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    min-width: 150px;
}

.ehc-overflow-menu .ehc-action-btn {
    width: 100%;
    text-align: left;
    border: none;
    background: none;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ehc-overflow-menu .ehc-action-btn:hover {
    background: #f5f5f5;
}

.ehc-overflow-btn {
    position: relative;
}

/* Form layout variations */
.ehc-vertical-form .ehc-editor-toolbar {
    margin-bottom: 8px !important;
}

.ehc-vertical-form .ehc-comment-type-selector {
    margin-bottom: 8px !important;
}

.ehc-compact-toolbar {
    padding: 4px !important;
    gap: 2px !important;
}

.ehc-compact-toolbar .ehc-editor-btn {
    min-width: 30px !important;
    min-height: 30px !important;
    padding: 4px !important;
}

/* Virtual keyboard support */
.ehc-keyboard-open .ehc-comments-area {
    margin-bottom: 300px; /* Extra space when keyboard is open */
}

.ehc-keyboard-open .ehc-notification {
    bottom: 320px !important; /* Move notifications above keyboard */
}

/* Better focus states for accessibility on mobile */
@media (hover: none) and (pointer: coarse) {
    .ehc-action-btn:focus,
    .ehc-vote:focus,
    .ehc-reaction-btn:focus {
        outline: 2px solid #0073aa;
        outline-offset: 2px;
        background: rgba(0, 115, 170, 0.1);
    }
    
    .ehc-editor-btn:focus {
        outline: 2px solid #0073aa;
        outline-offset: 1px;
        background: rgba(0, 115, 170, 0.1);
    }
}

/* Improved spacing for small screens */
@media (max-width: 360px) {
    .ehc-comment-list .children {
        margin-left: 15px !important;
    }
    
    .ehc-thread-line {
        left: 10px !important;
    }
    
    /* Ultra-compact badge layout */
    .ehc-badges-wrapper {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 2px !important;
    }
    
    .ehc-badge {
        display: inline-block !important;
        margin: 1px 2px !important;
    }
}

/* Enhanced loading states for mobile */
.ehc-mobile-device .ehc-loading {
    padding: 30px 20px !important;
}

.ehc-mobile-device .ehc-spinner {
    width: 24px !important;
    height: 24px !important;
    border-width: 2px !important;
}

/* Mobile-optimized reaction buttons */
@media (max-width: 480px) {
    .ehc-reaction-buttons {
        justify-content: center !important;
        flex-wrap: wrap !important;
        gap: 6px !important;
    }
    
    .ehc-reaction-btn {
        min-width: 36px !important;
        min-height: 36px !important;
        padding: 6px !important;
        font-size: 1em !important;
    }
    
    .ehc-reactions-summary {
        justify-content: center !important;
        text-align: center !important;
    }
}

/* Comment search mobile optimization */
@media (max-width: 600px) {
    .ehc-comment-search {
        position: sticky;
        top: 0;
        z-index: 10;
        background: white;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        margin: 0 0 15px 0;
    }
    
    .ehc-search-input {
        width: 100% !important;
        box-sizing: border-box !important;
    }
    
    .ehc-search-btn,
    .ehc-clear-search {
        width: 100% !important;
        margin: 2px 0 !important;
    }
}

/* Improved thread visualization on mobile */
@media (max-width: 768px) {
    .comment-list .children {
        border-left: 2px solid #e1e1e1;
        margin-left: 20px;
        padding-left: 15px;
    }
    
    body[dir="rtl"] .comment-list .children {
        border-left: none;
        border-right: 2px solid #e1e1e1;
        margin-left: 0;
        margin-right: 20px;
        padding-left: 0;
        padding-right: 15px;
    }
}

/* Performance optimizations for mobile */
.ehc-mobile-device .ehc-comment-content {
    will-change: transform;
    contain: layout style paint;
}

.ehc-mobile-device .ehc-avatar-img {
    will-change: transform;
    contain: layout style paint;
}

/* Dark mode mobile adjustments */
@media (prefers-color-scheme: dark) and (max-width: 768px) {
    .ehc-comment-content {
        background: #2c3e50 !important;
        border-color: #34495e !important;
        color: #ecf0f1 !important;
    }
    
    .ehc-comment-search {
        background: #34495e !important;
        border-color: #7f8c8d !important;
    }
    
    .ehc-search-input {
        background: #2c3e50 !important;
        color: #ecf0f1 !important;
        border-color: #7f8c8d !important;
    }
    
    .ehc-touch-active {
        background-color: rgba(52, 152, 219, 0.1) !important;
    }
}

/* Print optimizations for mobile */
@media print {
    .ehc-actions-toolbar,
    .ehc-interactive-row,
    .ehc-comment-search,
    .ehc-load-more,
    .ehc-swipe-reveal {
        display: none !important;
    }
    
    .ehc-comment-content {
        border: 1px solid #999 !important;
        break-inside: avoid !important;
        page-break-inside: avoid !important;
    }
}