/* Styles for comments like/dislike UI - matching admin style */
.comment-actions { display: flex; gap: 0.75rem; align-items: center; }
.like-btn, .dislike-btn, .edit-btn, .delete-btn { display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px; border-radius: 4px; font-size: 0.75rem; border: 1px solid transparent; transition: all 0.2s ease; cursor: pointer; background: transparent; }
.like-btn { color: #10b981; border-color: rgba(16, 185, 129, 0.3); }
.like-btn:hover { background: rgba(16, 185, 129, 0.1); border-color: #10b981; }
.dislike-btn { color: #ef4444; border-color: rgba(239, 68, 68, 0.3); }
.dislike-btn:hover { background: rgba(239, 68, 68, 0.1); border-color: #ef4444; }
.reply-btn, .edit-btn { color: #3b82f6; border-color: rgba(59, 130, 246, 0.3); }
.reply-btn:hover, .edit-btn:hover { background: rgba(59, 130, 246, 0.1); border-color: #3b82f6; }
.delete-btn { color: #ef4444; border-color: rgba(239, 68, 68, 0.3); }
.delete-btn:hover { background: rgba(239, 68, 68, 0.1); border-color: #ef4444; }
.likes-count { font-weight: 600; color: #10b981; }
.dislikes-count { font-weight: 600; color: #ef4444; }

/* Active state when current user has liked/disliked */
.like-active { background-color: #10b981; color: #fff; border-color: #10b981; }
.like-active .likes-count { color: #fff !important; }
.dislike-active { background-color: #ef4444; color: #fff; border-color: #ef4444; }
.dislike-active .dislikes-count { color: #fff !important; }

/* Small pulse animation helper */
.likes-count.pulse {
  transform-origin: center center;
  animation: likesPulse 0.25s ease-out;
}
@keyframes likesPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.25); }
  100% { transform: scale(1); }
}
/* =========================
   Comments Component Styles
   ========================= */

/* Container */
.comments-container {
    margin: 2rem 0;
    padding: 1.5rem;
    background: #000000;
    border-radius: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    border: 1px solid #333333;
}

/* Comment Form */
.comment-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.comment-form textarea {
    resize: vertical;
    min-height: 80px;
    padding: 0.75rem 1rem;
    border: 1px solid #444444;
    background-color: #1a1a1a;
    color: #ffffff;
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.comment-form textarea:focus {
    border-color: #3b82f6;
    outline: none;
}

.comment-form .comment-submit-btn {
    align-self: flex-end;
    background: linear-gradient(90deg, #3b82f6, #2563eb);
    color: #fff;
    border: none;
    border-radius: 0.75rem;
    padding: 0.6rem 1.5rem;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}

.comment-form .comment-submit-btn:hover {
    background: linear-gradient(90deg, #2563eb, #1d4ed8);
    transform: translateY(-1px);
}

/* Reply Form */
.reply-form {
    margin-top: 1rem;
    padding: 1rem;
    background: #1a1a1a;
    border-radius: 0.75rem;
    border: 1px solid #333333;
}

.reply-form.hidden {
    display: none;
}

.reply-form-inner textarea {
    resize: vertical;
    min-height: 60px;
    padding: 0.5rem 0.75rem;
    border: 1px solid #444444;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    background: #1a1a1a;
    color: #ffffff;
    transition: border-color 0.2s;
}

.reply-form-inner textarea:focus {
    border-color: #3b82f6;
    outline: none;
}

.reply-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.cancel-reply-btn {
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
    color: #fff;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(107, 114, 128, 0.2);
}

.cancel-reply-btn:hover {
    background: linear-gradient(135deg, #4b5563 0%, #374151 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(107, 114, 128, 0.3);
}

.submit-reply-btn {
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #fff;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
}

.submit-reply-btn:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* Edit Form */
.edit-form {
    margin-top: 1rem;
    padding: 1rem;
    background: #fef3c7;
    border-radius: 0.75rem;
    border: 1px solid #fbbf24;
}

.edit-form.hidden {
    display: none;
}

.edit-form-inner textarea {
    resize: vertical;
    min-height: 60px;
    padding: 0.5rem 0.75rem;
    border: 1px solid #f59e0b;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    background: #1a1a1a;
    color: #ffffff;
    transition: border-color 0.2s;
}

.edit-form-inner textarea:focus {
    border-color: #f59e0b;
    outline: none;
}

.edit-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.cancel-edit-btn {
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
    color: #fff;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(107, 114, 128, 0.2);
}

.cancel-edit-btn:hover {
    background: linear-gradient(135deg, #4b5563 0%, #374151 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(107, 114, 128, 0.3);
}

.submit-edit-btn {
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #fff;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.2);
}

.submit-edit-btn:hover {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

/* Comments List */
.comments-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.comment-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.25rem 0;
    border-bottom: 1px solid #333333;
    background-color: transparent;
}

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

.comment-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.comment-avatar:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.comment-avatar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.3) 0%, rgba(255, 255, 255, 0.1) 50%, rgba(255, 255, 255, 0) 100%);
    border-radius: 50%;
    pointer-events: none;
}

.comment-avatar:hover::before {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.4) 0%, rgba(255, 255, 255, 0.2) 50%, rgba(255, 255, 255, 0.1) 100%);
}

.comment-content {
    flex: 1;
}

.comment-author {
    font-weight: 600;
    color: #ffffff;
    font-size: 1rem;
    margin-bottom: 0.15rem;
}

.comment-meta {
    font-size: 0.85rem;
    color: #9ca3af;
    margin-bottom: 0.5rem;
}

.comment-text {
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    line-height: 1.5;
    word-break: break-word;
}

.comment-actions {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
    opacity: 1 !important;
    margin-top: 0.75rem;
}

.comment-action-btn {
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.85rem;
}

.comment-action-btn:hover {
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.1);
    text-decoration: none;
}

.comment-action-btn.delete:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.comment-action-btn.edit:hover {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.1);
}

/* Icon styling */
.comment-action-btn svg {
    width: 14px;
    height: 14px;
}

/* Threaded Comments Styles */
.comment-wrapper {
    position: relative;
}

.comment-wrapper.comment-reply {
    margin-left: 0.5rem;
}

.replies-container {
    position: relative;
    margin-left: 0;
    margin-top: 0.5rem;
    padding-left: 0.5rem;
    border-left: none;
}

.replies-container::before {
    content: '';
    position: absolute;
    left: -2px;
    top: 0;
    bottom: 0;
    width: 1px;
    background: linear-gradient(to bottom, #4b5563, transparent);
}

/* Style compact pour les réponses */
.comment-wrapper.comment-reply .comment-item {
    padding: 0.75rem 0;
    border-bottom: 1px solid #374151;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
}

.comment-wrapper.comment-reply .comment-avatar {
    width: 32px;
    height: 32px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.comment-wrapper.comment-reply .comment-author {
    font-size: 0.875rem;
    font-weight: 500;
}

.comment-wrapper.comment-reply .comment-meta {
    font-size: 0.75rem;
}

.comment-wrapper.comment-reply .comment-text {
    font-size: 0.875rem;
}

.comment-wrapper.comment-reply .comment-actions {
    font-size: 0.75rem;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

/* Dark mode support for threaded comments */
@media (prefers-color-scheme: dark) {
    .replies-container {
        border-left-color: #374151;
    }
    
    .replies-container::before {
        background: linear-gradient(to bottom, #4b5563, transparent);
    }
}

/* Dark mode styles */
@media (prefers-color-scheme: dark) {
    .comments-container {
        background: #1f2937;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }
    
    .comment-form textarea {
        background: #374151;
        color: #f9fafb;
        border-color: #4b5563;
    }
    
    .comment-form textarea:focus {
        border-color: #60a5fa;
    }
    
    .reply-form {
        background: #374151;
        border-color: #4b5563;
    }
    
    .reply-form-inner textarea {
        background: #1f2937;
        color: #f9fafb;
        border-color: #4b5563;
    }
    
    .reply-form-inner textarea:focus {
        border-color: #60a5fa;
    }
    
    .edit-form {
        background: #451a03;
        border-color: #92400e;
    }
    
    .edit-form-inner textarea {
        background: #1f2937;
        color: #f9fafb;
        border-color: #92400e;
    }
    
    .edit-form-inner textarea:focus {
        border-color: #fbbf24;
    }
    
    .comment-action-btn:hover {
        background: #374151;
        color: #f9fafb;
    }
}

/* Loading states */
.reply-btn.loading {
    opacity: 0.7;
    cursor: not-allowed;
}

.submit-reply-btn.loading {
    position: relative;
    color: transparent;
}

.submit-reply-btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1rem;
    height: 1rem;
    margin: -0.5rem 0 0 -0.5rem;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Error & Success Messages */
.comment-message {
    margin-top: 0.5rem;
    font-size: 0.95rem;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
}

.comment-message.error {
    background: #fee2e2;
    color: #b91c1c;
}

.comment-message.success {
    background: #dcfce7;
    color: #15803d;
}

/* Responsive Design */
@media (max-width: 640px) {
    .comments-container {
        padding: 1rem;
    }
    
    .comment-item {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .comment-replies {
        margin-left: 1rem;
        padding-left: 0.75rem;
    }
    
    .replies-container {
        margin-left: 1rem;
        padding-left: 1rem;
    }
    
    .comment-wrapper.comment-reply {
        margin-left: 0.5rem;
    }
    
    .reply-form .flex {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .cancel-reply-btn,
    .submit-reply-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Styles pour les différentes palettes de couleurs */
/* Palettes rouges */
.bg-gradient-to-br.from-red-400.to-red-500 {
    background: linear-gradient(135deg, #f87171, #ef4444);
}

.bg-gradient-to-br.from-orange-400.to-orange-500 {
    background: linear-gradient(135deg, #fb923c, #f97316);
}

.bg-gradient-to-br.from-yellow-400.to-yellow-500 {
    background: linear-gradient(135deg, #facc15, #eab308);
}

.bg-gradient-to-br.from-amber-400.to-amber-500 {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
}

/* Palettes bleues */
.bg-gradient-to-br.from-blue-400.to-blue-500 {
    background: linear-gradient(135deg, #60a5fa, #3b82f6);
}

.bg-gradient-to-br.from-cyan-400.to-cyan-500 {
    background: linear-gradient(135deg, #22d3ee, #06b6d4);
}

.bg-gradient-to-br.from-teal-400.to-teal-500 {
    background: linear-gradient(135deg, #2dd4bf, #14b8a6);
}

.bg-gradient-to-br.from-indigo-400.to-indigo-500 {
    background: linear-gradient(135deg, #818cf8, #6366f1);
}

/* Palettes vertes */
.bg-gradient-to-br.from-green-400.to-green-500 {
    background: linear-gradient(135deg, #4ade80, #22c55e);
}

.bg-gradient-to-br.from-emerald-400.to-emerald-500 {
    background: linear-gradient(135deg, #34d399, #10b981);
}

.bg-gradient-to-br.from-lime-400.to-lime-500 {
    background: linear-gradient(135deg, #a3e635, #84cc16);
}

/* Palettes violettes */
.bg-gradient-to-br.from-purple-400.to-purple-500 {
    background: linear-gradient(135deg, #c084fc, #a855f7);
}

.bg-gradient-to-br.from-violet-400.to-violet-500 {
    background: linear-gradient(135deg, #a78bfa, #6d28d9);
}

.bg-gradient-to-br.from-fuchsia-400.to-fuchsia-500 {
    background: linear-gradient(135deg, #e879f9, #d946ef);
}

.bg-gradient-to-br.from-pink-400.to-pink-500 {
    background: linear-gradient(135deg, #f472b6, #ec4899);
}

.bg-gradient-to-br.from-rose-400.to-rose-500 {
    background: linear-gradient(135deg, #fb7185, #f43f5e);
}

/* Mode sombre pour les gradients */
@media (prefers-color-scheme: dark) {
    .dark\:from-red-600.dark\:to-red-700 {
        background: linear-gradient(135deg, #dc2626, #b91c1c);
    }
    
    .dark\:from-orange-600.dark\:to-orange-700 {
        background: linear-gradient(135deg, #ea580c, #c2410c);
    }
    
    .dark\:from-yellow-600.dark\:to-yellow-700 {
        background: linear-gradient(135deg, #ca8a04, #a16207);
    }
    
    .dark\:from-amber-600.dark\:to-amber-700 {
        background: linear-gradient(135deg, #d97706, #b45309);
    }
    
    .dark\:from-blue-600.dark\:to-blue-700 {
        background: linear-gradient(135deg, #2563eb, #1d4ed8);
    }
    
    .dark\:from-cyan-600.dark\:to-cyan-700 {
        background: linear-gradient(135deg, #0891b2, #0e7490);
    }
    
    .dark\:from-teal-600.dark\:to-teal-700 {
        background: linear-gradient(135deg, #0d9488, #0f766e);
    }
    
    .dark\:from-indigo-600.dark\:to-indigo-700 {
        background: linear-gradient(135deg, #4f46e5, #4338ca);
    }
    
    .dark\:from-green-600.dark\:to-green-700 {
        background: linear-gradient(135deg, #16a34a, #15803d);
    }
    
    .dark\:from-emerald-600.dark\:to-emerald-700 {
        background: linear-gradient(135deg, #059669, #047857);
    }
    
    .dark\:from-lime-600.dark\:to-lime-700 {
        background: linear-gradient(135deg, #65a30d, #4d7c0f);
    }
    
    .dark\:from-purple-600.dark\:to-purple-700 {
        background: linear-gradient(135deg, #9333ea, #7c3aed);
    }
    
    .dark\:from-violet-600.dark\:to-violet-700 {
        background: linear-gradient(135deg, #7c3aed, #6d28d9);
    }
    
    .dark\:from-fuchsia-600.dark\:to-fuchsia-700 {
        background: linear-gradient(135deg, #c026d3, #a21caf);
    }
    
    .dark\:from-pink-600.dark\:to-pink-700 {
        background: linear-gradient(135deg, #db2777, #be185d);
    }
    
    .dark\:from-rose-600.dark\:to-rose-700 {
        background: linear-gradient(135deg, #e11d48, #be123c);
    }
}

/* ========================= 
   Light Mode Styles
   ========================= */

body.light-mode .comments-container {
    background: #ffffff !important;
    border-color: #e5e7eb !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
}

/* Override Tailwind dark-mode classes for light mode */
body.light-mode .comment-item.bg-gray-900 {
    background-color: #ffffff !important;
    border-color: #e5e7eb !important;
}

body.light-mode .comment-item.border-gray-800 {
    border-color: #e5e7eb !important;
}

body.light-mode .comment-item .text-white,
body.light-mode .comment-author.text-white {
    color: var(--text-primary) !important;
    font-weight: 600;
}

body.light-mode .comment-item {
    border-bottom-color: #e5e7eb !important;
}

body.light-mode .comment-author {
    color: #1f2937 !important;
}

body.light-mode .comment-meta {
    color: #000000 !important;
    font-weight: 600;
}

body.light-mode .comment-text {
    color: var(--text-primary) !important;
    font-weight: 500;
}

body.light-mode .comment-action-btn {
    color: #6b7280 !important;
}

body.light-mode .comment-action-btn:hover {
    color: #2563eb !important;
    background: rgba(37, 99, 235, 0.1) !important;
}

body.light-mode .comment-action-btn.delete:hover {
    color: #dc2626 !important;
    background: rgba(220, 38, 38, 0.1) !important;
}

body.light-mode .comment-action-btn.edit:hover {
    color: #d97706 !important;
    background: rgba(217, 119, 6, 0.1) !important;
}

body.light-mode .comment-form textarea {
    background-color: #ffffff !important;
    border-color: #d1d5db !important;
    color: #1f2937 !important;
}

body.light-mode .comment-form textarea:focus {
    border-color: #3b82f6 !important;
    background-color: #ffffff !important;
}

body.light-mode .comment-form textarea::placeholder {
    color: #9ca3af !important;
}

body.light-mode .reply-form {
    background: #f9fafb !important;
    border-color: #e5e7eb !important;
}

body.light-mode .reply-form-inner textarea {
    background-color: #ffffff !important;
    border-color: #d1d5db !important;
    color: #1f2937 !important;
}

body.light-mode .reply-form-inner textarea:focus {
    border-color: #3b82f6 !important;
}

body.light-mode .edit-form {
    background: #fef3c7 !important;
    border-color: #fbbf24 !important;
}

body.light-mode .edit-form-inner textarea {
    background-color: #ffffff !important;
    border-color: #f59e0b !important;
    color: #1f2937 !important;
}

body.light-mode .edit-form-inner textarea:focus {
    border-color: #f59e0b !important;
}

/* Light mode button styles */
body.light-mode .reply-btn,
body.light-mode .edit-btn {
    color: #2563eb !important;
    border-color: rgba(37, 99, 235, 0.3) !important;
}

body.light-mode .reply-btn:hover,
body.light-mode .edit-btn:hover {
    background: rgba(37, 99, 235, 0.1) !important;
    border-color: #2563eb !important;
    color: #1d4ed8 !important;
}

body.light-mode .delete-btn {
    color: #dc2626 !important;
    border-color: rgba(220, 38, 38, 0.3) !important;
}

body.light-mode .delete-btn:hover {
    background: rgba(220, 38, 38, 0.1) !important;
    border-color: #dc2626 !important;
    color: #b91c1c !important;
}

body.light-mode .like-btn {
    color: #059669 !important;
    border-color: rgba(5, 150, 105, 0.3) !important;
}

body.light-mode .like-btn:hover {
    background: rgba(5, 150, 105, 0.1) !important;
    border-color: #059669 !important;
}

body.light-mode .dislike-btn {
    color: #dc2626 !important;
    border-color: rgba(220, 38, 38, 0.3) !important;
}

body.light-mode .dislike-btn:hover {
    background: rgba(220, 38, 38, 0.1) !important;
    border-color: #dc2626 !important;
}

body.light-mode .like-active {
    background-color: #059669 !important;
    color: #fff !important;
    border-color: #059669 !important;
}

body.light-mode .dislike-active {
    background-color: #dc2626 !important;
    color: #fff !important;
    border-color: #dc2626 !important;
}

body.light-mode .comment-form .comment-submit-btn {
    background: linear-gradient(90deg, #2563eb, #1d4ed8) !important;
    color: #fff !important;
}

body.light-mode .comment-form .comment-submit-btn:hover {
    background: linear-gradient(90deg, #1d4ed8, #1e40af) !important;
}

/* Override all text-white classes in light mode for comments */
body.light-mode .comment-item .text-white,
body.light-mode .text-sm.font-semibold.text-white {
    color: #1f2937 !important;
}

body.light-mode .comment-item .text-gray-400,
body.light-mode .comment-item .text-gray-500,
body.light-mode .text-xs.text-gray-400 {
    color: var(--text-secondary) !important;
}

body.light-mode .comment-item .text-white.dark\:text-white {
    color: var(--text-primary) !important;
}

body.light-mode .comment-wrapper.comment-reply .comment-item {
    background: var(--glass-bg) !important;
    border-bottom-color: var(--glass-border) !important;
    border-left: 3px solid rgba(139, 92, 246, 0.2) !important;
}