/* Modern Comment System Styles - Inspired by flamecomics.xyz */

/* Main Container */
.modern-comments-container {
    background: #1a1a1a;
    border-radius: 12px;
    padding: 24px;
    margin: 20px 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    border: 1px solid #333;
}

/* Inline ad slot inside comments section */
.comment-inline-ad {
    margin: 16px 0 8px;
    padding: 12px;
    border-radius: 8px;
    background: #1b1b1b;
    border: 1px dashed #3a3a3a;
    position: relative;
    overflow: hidden;
    transition: opacity 220ms ease, transform 220ms ease, max-height 220ms ease, padding 220ms ease, margin 220ms ease;
    max-height: 500px; /* large enough to contain typical ad */
}
.comment-inline-ad.closing { opacity: 0; transform: scale(0.98); max-height: 0; padding-top: 0; padding-bottom: 0; margin-top: 0; margin-bottom: 0; }
.comment-inline-ad .ad-slot-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 90px;
    color: #888;
    font-size: 0.9rem;
    background: repeating-linear-gradient(45deg, rgba(255,255,255,0.03) 0, rgba(255,255,255,0.03) 10px, transparent 10px, transparent 20px);
}
.comment-inline-ad .ad-close-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(0,0,0,0.35));
    color: #ddd;
    cursor: pointer;
    box-shadow: 0 6px 14px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.08);
    backdrop-filter: blur(6px);
    transition: transform 180ms ease, background 180ms ease, color 180ms ease, box-shadow 180ms ease;
}
.comment-inline-ad .ad-close-btn:hover { transform: rotate(90deg) scale(1.05); background: linear-gradient(180deg, rgba(255,255,255,0.1), rgba(0,0,0,0.45)); color: #fff; box-shadow: 0 8px 18px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.12); }
.comment-inline-ad .ad-close-btn:active { transform: rotate(90deg) scale(0.96); }
.comment-inline-ad .ad-close-btn:focus { outline: none; box-shadow: 0 0 0 2px rgba(212,175,55,0.35), 0 6px 14px rgba(0,0,0,0.3); }

/* Add spacing between main sections */
.modern-comments-container > * {
    margin-bottom: 24px;
}

.modern-comments-container > *:last-child {
    margin-bottom: 0;
}

/* Login Section */
.modern-login-section {
    text-align: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, #2a2a2a, #1a1a1a);
    border-radius: 8px;
    border: 1px solid #333;
    margin-bottom: 24px;
}

.modern-login-section h3 {
    color: #fff;
    font-size: 1.5rem;
    margin-bottom: 16px;
    font-weight: 600;
}

.modern-login-section p {
    color: #ccc;
    margin-bottom: 24px;
    font-size: 1rem;
}

.modern-login-btn {
    background: linear-gradient(45deg, #d4af37, #b8860b);
    color: #000;
    border: none;
    padding: 12px 32px;
    border-radius: 25px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    margin: 0 8px;
}

.modern-login-btn:hover {
    background: #000;
    color: #d4af37;
    border: 2px solid #d4af37;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.3);
}

/* Comment Form */
.modern-comment-form {
    margin-bottom: 32px;
}

.modern-comment-form-wrapper {
    margin-bottom: 24px;
    position: relative;
}

/* Limit focus glow to the textarea only, not the entire wrapper */
.modern-comment-form-wrapper .modern-comment-textarea { position: relative; z-index: 1; }

.modern-comment-form h3 {
    color: #fff;
    font-size: 1.3rem;
    margin-bottom: 20px;
    font-weight: 600;
}

/* Character Counter */
.character-counter {
    position: absolute;
    bottom: -25px;
    right: 0;
    font-size: 0.8rem;
    color: #888;
    transition: color 0.3s ease;
}

.character-counter.warning {
    color: #ffa500;
}

.character-counter.error {
    color: #f44336;
}

.modern-comment-textarea {
    width: 100%;
    min-height: 120px;
    background: #252525;
    border: 2px solid #333;
    border-radius: 8px;
    padding: 16px;
    color: #fff;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.3s ease;
}

.modern-comment-textarea:focus {
    outline: none;
    border-color: #d4af37;
    box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.35) inset, 0 0 0 2px rgba(212, 175, 55, 0.15);
}

.modern-comment-textarea::placeholder {
    color: #888;
}

.modern-submit-btn {
    background: linear-gradient(45deg, #d4af37, #b8860b);
    color: #000;
    border: none;
    padding: 12px 28px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 12px;
}

.modern-submit-btn:hover {
    background: #000;
    color: #d4af37;
    border: 2px solid #d4af37;
    transform: translateY(-1px);
}

/* Comment Sorting */
.modern-comment-sort {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    border-bottom: 1px solid #333;
    padding-bottom: 16px;
}

.modern-comments-list.sorting {
    opacity: 0.6;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.modern-comments-list.sorting::before {
    content: "Sorting comments...";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 10px 20px;
    border-radius: 4px;
    font-size: 14px;
    color: #666;
    z-index: 10;
}

.sort-btn {
    background: transparent;
    color: #ccc;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.sort-btn:hover,
.sort-btn.active {
    background: #d4af37;
    color: #000;
}

/* Comments List */
.modern-comments-list {
    margin-top: 20px;
}

.no-comments-message {
    text-align: center;
    padding: 40px 20px;
    color: #888;
    font-style: italic;
}

.comments-closed {
    text-align: center;
    color: #888;
    font-style: italic;
    padding: 20px;
}

/* Individual Comment */
.modern-comment-item {
    background: #222;
    border: 1px solid #333;
    border-radius: 8px;
    margin-bottom: 16px;
    transition: all 0.3s ease;
    position: relative;
}

/* Enhanced styling for Admin/Editor comments */
.modern-comment-item.role-admin {
    border-color: rgba(255, 107, 107, 0.45);
    box-shadow: 0 8px 26px rgba(255, 107, 107, 0.12), inset 0 0 0 1px rgba(255,255,255,0.03);
    background: radial-gradient(120% 80% at 0% 0%, rgba(255,107,107,0.06) 0%, transparent 60%), #222;
}

/* Enhanced styling for Patreon/Invincible comments */
.modern-comment-item.role-invincible {
    border-color: rgba(212, 175, 55, 0.45);
    box-shadow: 0 8px 26px rgba(212, 175, 55, 0.12), inset 0 0 0 1px rgba(255,255,255,0.03);
    background: radial-gradient(120% 80% at 0% 0%, rgba(212,175,55,0.08) 0%, transparent 60%), #222;
}
/* Reserved: role-specific wrappers (no-op, kept for clarity) */

.modern-comment-item:hover {
    border-color: #d4af37;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.1);
}

.modern-comment-item.comment-reply {
    margin-left: 40px;
    margin-top: 12px;
    border-left: 3px solid #333; /* neutral for generic replies */
}
/* Role-colored reply thread guides */
.modern-comment-item.role-admin.comment-reply { border-left-color: rgba(255, 107, 107, 0.75); }
.modern-comment-item.role-invincible.comment-reply { border-left-color: rgba(212, 175, 55, 0.8); }
.modern-comment-item.role-emperor.comment-reply { border-left-color: rgba(33, 147, 176, 0.75); }
.modern-comment-item.role-overlord.comment-reply { border-left-color: rgba(142, 45, 226, 0.75); }

.modern-comment-content {
    padding: 20px;
}

/* Comment Header */
.modern-comment-header {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    gap: 12px;
    flex-wrap: nowrap;
}

.modern-comment-avatar img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid #333;
    transition: border-color 0.3s ease;
}

/* Framed avatar wrapper */
.modern-comment-avatar {
    display: inline-flex;
    padding: 2px; /* frame thickness */
    border-radius: 50%;
    background: linear-gradient(135deg, #3a3a3a, #5a5a5a);
    box-shadow: 0 2px 10px rgba(0,0,0,0.35), inset 0 0 0 1px rgba(255,255,255,0.06);
    position: relative;
    z-index: 0;
}
.modern-comment-item:hover .modern-comment-avatar {
    background: linear-gradient(135deg, #666, #888);
}

/* Role-specific avatar frames */
.modern-comment-item.role-admin > .modern-comment-content > .modern-comment-header > .modern-comment-avatar {
    background: conic-gradient(from 0deg, #ff6b6b, #ee5a52, #ff6b6b);
    padding: 3px;
}
.modern-comment-item.role-invincible > .modern-comment-content > .modern-comment-header > .modern-comment-avatar {
    background: conic-gradient(from 0deg, #d4af37, #b8860b, #d4af37);
    padding: 3px;
}
.modern-comment-item.role-emperor > .modern-comment-content > .modern-comment-header > .modern-comment-avatar {
    background: conic-gradient(from 0deg, #6dd5ed, #2193b0, #6dd5ed);
    padding: 3px;
}
.modern-comment-item.role-overlord > .modern-comment-content > .modern-comment-header > .modern-comment-avatar {
    background: conic-gradient(from 0deg, #8e2de2, #4a00e0, #8e2de2);
    padding: 3px;
}

/* Outer glow ring and corner emblem for role-admin */
.modern-comment-item.role-admin > .modern-comment-content > .modern-comment-header > .modern-comment-avatar::before {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    box-shadow: 0 0 0 2px rgba(255,107,107,0.35), 0 0 16px rgba(255,107,107,0.25);
    pointer-events: none;
}
.modern-comment-item.role-admin > .modern-comment-content > .modern-comment-header > .modern-comment-avatar::after {
    content: "\f3ed"; /* fa-shield-alt */
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    position: absolute;
    right: -4px;
    bottom: -4px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #1a1a1a;
    color: #ffefef;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    border: 2px solid #ff6b6b;
    box-shadow: 0 2px 6px rgba(0,0,0,0.35);
}

/* Outer glow ring and crown emblem for role-invincible */
.modern-comment-item.role-invincible > .modern-comment-content > .modern-comment-header > .modern-comment-avatar::before {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    box-shadow: 0 0 0 2px rgba(212,175,55,0.45), 0 0 18px rgba(212,175,55,0.28);
    pointer-events: none;
}
.modern-comment-item.role-invincible > .modern-comment-content > .modern-comment-header > .modern-comment-avatar::after {
    content: "\f521"; /* fa-crown */
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    position: absolute;
    right: -4px;
    bottom: -4px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #1a1a1a;
    color: #d4af37;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    border: 2px solid #d4af37;
    box-shadow: 0 2px 6px rgba(0,0,0,0.35);
}

@keyframes goldPulseFrame {
    0% { box-shadow: 0 0 0 0 rgba(212,175,55,0.35); }
    70% { box-shadow: 0 0 0 8px rgba(212,175,55,0); }
    100% { box-shadow: 0 0 0 0 rgba(212,175,55,0); }
}
.modern-comment-item.role-invincible > .modern-comment-content > .modern-comment-header > .modern-comment-avatar { animation: goldPulseFrame 2.4s infinite ease-out; }

/* Emperor & Overlord: animation at bottom of avatar (rising effect) */
.modern-comment-item.role-emperor > .modern-comment-content > .modern-comment-header > .modern-comment-avatar::before,
.modern-comment-item.role-overlord > .modern-comment-content > .modern-comment-header > .modern-comment-avatar::before {
    content: '';
    position: absolute;
    left: 50%;
    bottom: -6px;
    transform: translateX(-50%);
    width: 60%;
    height: 6px;
    filter: blur(4px);
    border-radius: 50%;
}
.modern-comment-item.role-emperor > .modern-comment-content > .modern-comment-header > .modern-comment-avatar::before { background: radial-gradient(closest-side, rgba(109,213,237,0.7), rgba(33,147,176,0)); }
.modern-comment-item.role-overlord > .modern-comment-content > .modern-comment-header > .modern-comment-avatar::before { background: radial-gradient(closest-side, rgba(142,45,226,0.7), rgba(74,0,224,0)); }

@keyframes riseGlow {
    0% { opacity: 0.2; transform: translate(-50%, 4px) scale(0.9); }
    50% { opacity: 0.7; transform: translate(-50%, 0) scale(1); }
    100% { opacity: 0.2; transform: translate(-50%, 4px) scale(0.9); }
}
.modern-comment-item.role-emperor > .modern-comment-content > .modern-comment-header > .modern-comment-avatar::before,
.modern-comment-item.role-overlord > .modern-comment-content > .modern-comment-header > .modern-comment-avatar::before { animation: riseGlow 2.2s infinite ease-in-out; }

/* Bottom-right emblems for emperor/overlord */
.modern-comment-item.role-emperor > .modern-comment-content > .modern-comment-header > .modern-comment-avatar::after {
    content: "\f6d5"; /* fa-dragon */
    font-family: "Font Awesome 5 Free"; font-weight: 900;
    position: absolute; right: -4px; bottom: -4px; width: 18px; height: 18px; border-radius: 50%;
    background: #0c1a1f; color: #6dd5ed; display: flex; align-items: center; justify-content: center; font-size: 10px;
    border: 2px solid #2193b0; box-shadow: 0 2px 6px rgba(0,0,0,0.35);
}
.modern-comment-item.role-overlord > .modern-comment-content > .modern-comment-header > .modern-comment-avatar::after {
    content: "\f54c"; /* fa-skull */
    font-family: "Font Awesome 5 Free"; font-weight: 900;
    position: absolute; right: -4px; bottom: -4px; width: 18px; height: 18px; border-radius: 50%;
    background: #13001f; color: #c69eff; display: flex; align-items: center; justify-content: center; font-size: 10px;
    border: 2px solid #8e2de2; box-shadow: 0 2px 6px rgba(0,0,0,0.35);
}

.modern-comment-item:hover .modern-comment-avatar img {
    border-color: #d4af37;
}

.modern-comment-meta {
    flex: 1;
}

.modern-comment-author {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.modern-comment-author a,
.modern-comment-author {
    color: #eee; /* default: readers/guests */
    font-weight: 600;
    font-size: 1rem;
    text-decoration: none;
}

.modern-comment-author a:hover {
    color: #fff;
}

/* Role-colored author names - using direct child combinators to prevent style inheritance */
.modern-comment-item.role-admin > .modern-comment-content > .modern-comment-header > .modern-comment-meta > .modern-comment-author a,
.modern-comment-item.role-admin > .modern-comment-content > .modern-comment-header > .modern-comment-meta > .modern-comment-author { color: #ff9a9a; text-shadow: 0 0 6px rgba(255,107,107,0.35); }
.modern-comment-item.role-invincible > .modern-comment-content > .modern-comment-header > .modern-comment-meta > .modern-comment-author a,
.modern-comment-item.role-invincible > .modern-comment-content > .modern-comment-header > .modern-comment-meta > .modern-comment-author { color: #d4af37; text-shadow: 0 0 6px rgba(212,175,55,0.35); }
.modern-comment-item.role-emperor > .modern-comment-content > .modern-comment-header > .modern-comment-meta > .modern-comment-author a,
.modern-comment-item.role-emperor > .modern-comment-content > .modern-comment-header > .modern-comment-meta > .modern-comment-author { color: #6dd5ed; text-shadow: 0 0 6px rgba(109,213,237,0.35); }
.modern-comment-item.role-overlord > .modern-comment-content > .modern-comment-header > .modern-comment-meta > .modern-comment-author a,
.modern-comment-item.role-overlord > .modern-comment-content > .modern-comment-header > .modern-comment-meta > .modern-comment-author { color: #c69eff; text-shadow: 0 0 6px rgba(142,45,226,0.35); }

/* Base badge style */
.role-badge {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #fff;
    font-size: 0.7rem;
    padding: 4px 10px;
    border-radius: 999px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    line-height: 1;
    isolation: isolate;
    background: #444;
    box-shadow: 0 6px 18px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.08);
}

/* Icon inside badge */
.role-badge i { font-size: 11px; margin-right: 6px; }
.role-badge .badge-text { font-size: 11px; }

/* Distinct variants */
.admin-badge { background: linear-gradient(135deg, #ff6b6b, #ee5a52); }
.admin-badge i { color: #fff; }
.invincible-badge { background: linear-gradient(135deg, #d4af37, #b8860b); color: #1a1a1a; }
.invincible-badge i { color: #1a1a1a; }
/* Reader neutral badge */
.reader-badge { 
    background: linear-gradient(180deg, #4b4b4b, #3a3a3a);
    color: #fff; 
    border: 1px solid #555;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), 0 3px 10px rgba(0,0,0,0.2);
}
.reader-badge i { color: #fff; opacity: 0.9; }
/* New role badge colors */
.emperor-badge { background: linear-gradient(135deg, #6dd5ed, #2193b0); }
.overlord-badge { background: linear-gradient(135deg, #8e2de2, #4a00e0); }

.role-badge::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(180deg, rgba(255,255,255,0.16), rgba(255,255,255,0));
    mix-blend-mode: overlay;
    pointer-events: none;
}

.role-badge .sparkle {
    position: absolute;
    right: 8px;
    top: -2px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.9);
    filter: blur(1px);
    animation: sparkle 2.2s infinite ease-in-out;
}

@keyframes sparkle {
    0%, 100% { opacity: 0; transform: translateY(0) scale(0.6); }
    40% { opacity: 1; transform: translateY(-2px) scale(1); }
    60% { opacity: 0; transform: translateY(-4px) scale(0.7); }
}

/* Variants */
.admin-badge {
    background: linear-gradient(135deg, #ff6b6b, #ee5a52);
    box-shadow: 0 8px 22px rgba(255, 107, 107, 0.35), inset 0 1px 0 rgba(255,255,255,0.08);
}

/* Patreon/Invincible badge */
.invincible-badge {
    background: linear-gradient(135deg, #d4af37, #b8860b);
    box-shadow: 0 8px 22px rgba(212, 175, 55, 0.35), inset 0 1px 0 rgba(255,255,255,0.12);
    color: #1a1a1a;
}

/* Reader badge for subscribers (neutralized) */
.reader-badge {
    background: linear-gradient(180deg, #4b4b4b, #3a3a3a);
    color: #fff;
    border: 1px solid #555;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), 0 3px 10px rgba(0,0,0,0.2);
}

.modern-comment-date {
    color: #888;
    font-size: 0.85rem;
}

/* Comment Text */
.modern-comment-text {
    color: #eee;
    line-height: 1.6;
    margin-bottom: 16px;
    font-size: 1rem;
}

.modern-comment-text p {
    margin-bottom: 12px;
}

.comment-awaiting-moderation {
    color: #ffa500;
    font-style: italic;
    display: block;
    margin-bottom: 8px;
}

/* Comment Actions */
.modern-comment-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid #333;
}

.comment-vote-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: nowrap;
}

.vote-btn {
    background: transparent;
    border: 1px solid #444;
    color: #ccc;
    padding: 6px 10px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
}

.vote-btn:hover {
    border-color: #d4af37;
    color: #d4af37;
}

.vote-btn.upvote.active {
    background: #4CAF50;
    border-color: #4CAF50;
    color: #fff;
}

.vote-btn.downvote.active {
    background: #f44336;
    border-color: #f44336;
    color: #fff;
}

.comment-action-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
}

.reply-btn,
.edit-btn,
.report-btn {
    background: transparent;
    border: 1px solid #444;
    color: #ccc;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    line-height: 1;
}

.reply-btn:hover {
    background: #d4af37;
    color: #000;
    border-color: #d4af37;
}

.reply-btn a {
    color: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    line-height: 1;
}

/* Ensure reply icon always visible via pseudo-element */
.reply-btn i { display: none !important; }
.reply-btn a::before {
    content: "\f3e5"; /* fa-reply */
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    display: inline-block;
    font-size: 14px;
    margin-right: 6px;
}

/* Ensure icons are aligned and not overlapping text */
.reply-btn i,
.report-btn i,
.edit-btn i {
    display: inline-block;
    font-size: 0.95em;
    line-height: 1;
}

.reply-btn:hover a {
    color: inherit;
}

.edit-btn:hover {
    background: #2196F3;
    color: #fff;
    border-color: #2196F3;
}

.report-btn:hover {
    background: #f44336;
    color: #fff;
    border-color: #f44336;
}

/* Ensure Report icon always visible and sized correctly */
.report-btn i { display: inline-block !important; font-size: 14px; margin-right: 6px; }
@media (max-width: 480px) {
    .report-btn { font-size: 0; padding: 6px 8px; }
    .report-btn i { font-size: 16px; margin: 0; }
}

/* Comment Navigation */
.modern-comment-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #333;
}

.modern-comment-navigation a {
    background: #333;
    color: #fff;
    padding: 10px 20px;
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.3s ease;
}

.modern-comment-navigation a:hover {
    background: #d4af37;
    color: #000;
}

/* Enhanced Responsive Design */
@media (max-width: 1200px) {
    .modern-comments-container {
        padding: 20px;
        margin: 16px 0;
    }
    
    .modern-comment-item {
        margin-bottom: 15px;
    }
    
    .modern-comment-form-wrapper {
        margin-bottom: 20px;
    }
}

@media (max-width: 768px) {
    .modern-comments-container {
        padding: 16px;
        margin: 16px 0;
    }
    
    .modern-comment-form-wrapper {
        padding: 15px;
        margin: 10px 0;
    }
    
    .modern-comment-textarea {
        min-height: 80px;
        font-size: 14px;
    }
    
    .modern-comment-item {
        padding: 15px;
        margin-bottom: 10px;
    }
    
    .modern-comment-item.comment-reply {
        margin-left: 20px;
    }
    
    .modern-comment-header {
        flex-direction: row;
        align-items: center;
        gap: 10px;
    }
    
    .modern-comment-meta {
        flex: 1 1 auto;
        min-width: 0;
    }
    
    .modern-comment-avatar {
        align-self: center;
    }
    
    .modern-comment-actions {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 6px;
        margin-top: 10px;
        white-space: nowrap;
        flex-wrap: nowrap;
    }
    
    .comment-vote-buttons,
    .comment-action-buttons {
        width: auto;
        flex-wrap: nowrap;
        justify-content: flex-start;
        gap: 6px;
        white-space: nowrap;
        min-width: 0;
        flex: 0 1 auto;
    }
    
    .vote-btn,
    .reply-btn,
    .edit-btn,
    .report-btn {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .modern-comment-sort {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }
    
    .sort-btn {
        padding: 8px 15px;
        font-size: 12px;
    }
    
    .modern-login-btn {
        display: block;
        margin: 8px auto; /* center on mobile */
        width: 100%;
        max-width: 200px;
    }
}

@media (max-width: 480px) {
    .modern-comments-container {
        padding: 12px;
        margin: 0 -10px;
    }
    
    .modern-comment-form-wrapper {
        padding: 12px;
        border-radius: 8px;
    }
    
    .modern-comment-item {
        padding: 12px;
        border-radius: 8px;
        margin-bottom: 8px;
    }
    
    .modern-comment-item.comment-reply {
        margin-left: 10px;
    }
    
    .modern-comment-content {
        padding: 12px;
    }
    
    .modern-comment-avatar img {
        width: 30px;
        height: 30px;
    }
    
    .modern-comment-author { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    
    .modern-comment-date {
        font-size: 11px;
    }
    
    .modern-comment-text {
        font-size: 13px;
        line-height: 1.5;
    }
    
    .vote-btn,
    .reply-btn,
    .edit-btn,
    .report-btn { padding: 6px 8px; font-size: 0.82rem; }
    
    /* Keep actions compact and in 2 columns: votes left, actions right */
    .modern-comment-actions {
        display: grid;
        grid-template-columns: 1fr auto;
        align-items: center;
        gap: 6px;
        overflow-x: auto;
        white-space: nowrap;
    }
    .comment-vote-buttons, .comment-action-buttons { gap: 6px; flex-wrap: nowrap; }
    .vote-btn { padding: 4px 8px; font-size: 0.8rem; }
    .reply-btn, .reply-btn a, .report-btn { font-size: 0; padding: 6px; }
    .reply-btn a::before { font-size: 16px; margin: 0; }
    .reply-btn i, .reply-btn a i { display: none !important; }
    
    .character-counter {
        font-size: 11px;
    }
}

/* Enhanced Animations for Real-time Features */
@keyframes slideInComment {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(212, 175, 55, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(212, 175, 55, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(212, 175, 55, 0);
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.modern-comment-item.new-comment {
    animation: slideInComment 0.5s ease-out;
}

.modern-comment-item.real-time-update {
    animation: fadeInUp 0.6s ease-out;
}

.modern-comment-item.highlight {
    animation: pulse 2s infinite;
}

.vote-btn.voted {
    animation: bounceIn 0.4s ease-out;
}

.modern-comment-form.submitting .modern-submit-btn {
    animation: pulse 1s infinite;
    pointer-events: none;
}

/* Loading states */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #333;
    border-radius: 50%;
    border-top-color: #d4af37;
    animation: spin 1s ease-in-out infinite;
}

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

.modern-comment-item.loading {
    opacity: 0.6;
    pointer-events: none;
}

.modern-comment-item.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
    border: 3px solid #333;
    border-radius: 50%;
    border-top-color: #d4af37;
    animation: spin 1s linear infinite;
}

/* Hide default WordPress comment styles */
#madara-comments {
    display: none !important;
}

.comment-form-comment,
.comment-form-author,
.comment-form-email,
.comment-form-url {
    margin-bottom: 16px;
}

.comment-form-comment label,
.comment-form-author label,
.comment-form-email label,
.comment-form-url label {
    color: #ccc;
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.comment-form-comment textarea,
.comment-form-author input,
.comment-form-email input,
.comment-form-url input {
    width: 100%;
    background: #252525;
    border: 2px solid #333;
    border-radius: 6px;
    padding: 12px;
    color: #fff;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.comment-form-comment textarea:focus,
.comment-form-author input:focus,
.comment-form-email input:focus,
.comment-form-url input:focus {
    outline: none;
    border-color: #d4af37;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
}

.form-submit {
    margin-top: 16px;
}

.form-submit input[type="submit"] {
    background: linear-gradient(45deg, #d4af37, #b8860b);
    color: #000;
    border: none;
    padding: 12px 28px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.form-submit input[type="submit"]:hover {
    background: #000;
    color: #d4af37;
    border: 2px solid #d4af37;
    transform: translateY(-1px);
}