/* ============================================================================ */
/* COMMUNITY GALLERY - CLEAN INSTAGRAM-LIKE DESIGN */
/* ============================================================================ */

/* Prevent horizontal scroll on entire page */
html, body {
    overflow-x: hidden;
    max-width: 100vw;
}

* {
    max-width: 100%;
}

:root {
    --community-accent: #FF6B9D;
    --community-warm: #FFA07A;
    --community-text: #262626;
    --community-text-light: #8E8E8E;
    --community-border: #DBDBDB;
    --community-bg: #FAFAFA;
}

/* ============================================================================ */
/* PROFILE SETTINGS MODAL */
/* ============================================================================ */

.profile-section {
    margin-bottom: 30px;
}

.profile-label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--community-text);
    font-size: 14px;
}

.profile-input,
.profile-textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--community-border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
    background: white;
}

.profile-input:focus,
.profile-textarea:focus {
    outline: none;
    border-color: var(--community-text);
}

.help-text {
    font-size: 12px;
    color: var(--community-text-light);
    margin-top: 6px;
}

.required {
    color: #ED4956;
}

.avatar-upload-container {
    display: flex;
    align-items: center;
    gap: 24px;
}

.avatar-preview {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: var(--community-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid var(--community-border);
    flex-shrink: 0;
}

.avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#avatarPlaceholder {
    color: var(--community-text-light);
    font-size: 14px;
    text-align: center;
}

.avatar-upload-controls {
    flex: 1;
}

.privacy-notice {
    background: #F0FFF4;
    border: 1px solid #58CC02;
    border-radius: 8px;
    padding: 16px;
    font-size: 13px;
    color: var(--community-text);
    line-height: 1.5;
}

/* ============================================================================ */
/* COMMUNITY GALLERY MODAL */
/* ============================================================================ */

.community-filters {
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    background: white;
    border-bottom: 1px solid var(--community-border);
}

.filter-select,
.filter-search {
    padding: 8px 12px;
    border: 1px solid var(--community-border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
    background: white;
}

.filter-search {
    flex: 1;
}

.filter-select:focus,
.filter-search:focus {
    outline: none;
    border-color: var(--community-text);
}

.community-gallery-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: var(--community-bg);
}

.community-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

/* Community Card */
.community-card {
    position: relative;
    background: white;
    border: 1px solid var(--community-border);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s;
}

.community-card:hover {
    transform: translateY(-4px);
}

/* Add Post Card - Matches community card style */
.add-post-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: 2px dashed rgba(102, 126, 234, 0.5);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    position: relative;
    overflow: hidden;
}

@media (max-width: 768px) {
    .add-post-card {
        min-height: 120px;
        flex-direction: row;
        gap: 16px;
        padding: 20px;
    }
}

.add-post-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0) 100%);
    opacity: 0;
    transition: opacity 0.3s;
}

.add-post-card:hover::before {
    opacity: 1;
}

.add-post-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.3);
    border-color: rgba(102, 126, 234, 0.8);
}

.add-post-icon {
    font-size: 64px;
    margin-bottom: 16px;
    color: white;
    transition: transform 0.3s;
}

.add-post-card:hover .add-post-icon {
    transform: scale(1.1) rotate(90deg);
}

.add-post-text {
    font-size: 20px;
    font-weight: 600;
    color: white;
    text-align: center;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

@media (max-width: 768px) {
    .add-post-icon {
        font-size: 32px;
        margin-bottom: 0;
    }

    .add-post-text {
        font-size: 16px;
    }
}

/* Dark Mode - Add Post Card */
body.dark-mode .add-post-card {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    border: 2px dashed rgba(168, 168, 168, 0.3);
}

body.dark-mode .add-post-card:hover {
    border-color: rgba(168, 168, 168, 0.6);
    box-shadow: 0 8px 24px rgba(255, 107, 157, 0.2);
    background: linear-gradient(135deg, #3d4858 0%, #2a3142 100%);
}

.community-card-image {
    width: 100%;
    height: 300px;
    object-fit: cover;
    background: var(--community-bg);
}

.community-card-info {
    padding: 16px;
}

.community-card-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--community-text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.community-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    color: var(--community-text-light);
}

.community-card-author {
    display: flex;
    align-items: center;
    gap: 8px;
}

.community-card-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, #FF6B9D, #FFA07A);
    object-fit: cover;
}

.community-card-stats {
    display: flex;
    gap: 12px;
}

.community-card-featured {
    position: absolute;
    top: 12px;
    right: 12px;
    background: linear-gradient(135deg, #FFC800, #FF9600);
    color: white;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    z-index: 100;
    pointer-events: none;
}

/* Loading & Empty States */
.loading-indicator,
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--community-text-light);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--community-border);
    border-top-color: var(--community-accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}

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

.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--community-text);
    margin-bottom: 8px;
}

.community-load-more {
    padding: 20px;
    text-align: center;
    border-top: 1px solid var(--community-border);
    background: white;
}

/* ============================================================================ */
/* COMMUNITY DETAIL MODAL - INSTAGRAM STYLE */
/* ============================================================================ */

/* Fix modal header alignment */
#communityDetailModal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--community-border);
    margin-bottom: 0;
    position: static; /* Ensure header is NOT sticky */
}

#communityDetailModal .modal-header h2 {
    margin: 0;
    padding-top: 4px;
    padding-left: 8px;
    font-size: 20px;
    font-weight: 600;
}

#communityDetailModal .modal-header .close-modal {
    margin: 0;
    padding: 0;
    line-height: 1;
}

/* Modal scrolls as ONE unit - no nested scrollbars */
#communityDetailModal .modal-content {
    max-width: 1000px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto; /* Modal content scrolls, not the modal itself */
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    -webkit-overflow-scrolling: touch;
}

/* Ensure modal itself doesn't scroll for community detail */
#communityDetailModal.modal {
    overflow: hidden; /* Prevent double scroll - only modal-content scrolls */
}

.community-detail-container {
    display: flex;
    flex-direction: column;
    background: white;
    width: 100%;
    overflow-x: hidden;
    overflow-y: visible; /* Prevent nested scroll - let modal handle it */
}

/* Image Section - Clean, simple */
.community-detail-image-container {
    position: relative;
    width: 100%;
    background: #000;
    display: flex;
    align-items: flex-start; /* Align to top to prevent cropping */
    justify-content: center;
    min-height: 400px;
    max-height: 600px; /* Limit max height to prevent covering content below */
    padding-top: 0; /* Remove top padding to bring image closer to title */
    padding-bottom: 0; /* Remove padding - carousel indicator now fits in the gap below */
    flex-shrink: 0; /* Prevent image from shrinking */
}

.community-detail-image {
    width: 100%;
    max-height: 600px;
    max-width: 100%;
    object-fit: contain;
    background: #000;
    display: block; /* Remove any inline spacing */
}

/* Image Carousel */
.image-carousel {
    position: relative;
    width: 100%;
    overflow: hidden;
    min-height: 400px; /* Ensure carousel has minimum height */
    max-height: 600px; /* Limit max height to prevent covering content */
}

.image-carousel-track {
    display: flex;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    align-items: flex-start; /* Align to top to prevent cropping */
}

.image-carousel-slide {
    min-width: 100%;
    min-height: 400px; /* Match container min-height */
    max-height: 600px; /* Limit max height */
    display: flex;
    align-items: flex-start; /* Align to top instead of center to show full image from top */
    justify-content: center;
    background: #000;
    padding-top: 0; /* Remove top padding to bring image closer to title */
}

.carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: background 0.2s;
}

.carousel-arrow:hover {
    background: white;
}

.carousel-arrow.prev {
    left: 12px;
}

.carousel-arrow.next {
    right: 12px;
}

.carousel-dots {
    position: absolute;
    bottom: 16px; /* Position inside the image container for visibility */
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 10;
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.5); /* Semi-transparent dark background for visibility */
    border-radius: 12px;
    backdrop-filter: blur(4px); /* Slight blur effect for modern look */
}

.carousel-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.3); /* Subtle border for definition */
}

.carousel-dot:hover {
    background: rgba(255, 255, 255, 0.9);
    transform: scale(1.2);
}

.carousel-dot.active {
    background: white;
    width: 24px;
    border-radius: 4px;
    border-color: white;
}

/* Info Section - Instagram style */
.community-detail-info {
    padding: 20px; /* Clean, balanced padding */
    padding-bottom: 250px; /* Extra bottom padding to ensure scroll goes all the way to the bottom */
    background: white;
    overflow-y: visible; /* Prevent nested scroll - let modal handle it */
}

/* Description - Appears first after image */
.community-detail-description {
    font-size: 14px;
    line-height: 1.6;
    color: var(--community-text);
    margin-top: 16px; /* Space after image */
    margin-bottom: 20px; /* Space before action buttons */
    white-space: pre-wrap;
    min-height: 20px; /* Ensure space is reserved even if empty */
}

/* Actions - Clean button row */
.community-actions {
    display: flex;
    gap: 12px;
    padding: 16px 0;
    border-top: 1px solid var(--community-border);
    border-bottom: 1px solid var(--community-border);
    margin-bottom: 20px; /* Space before meta section */
    overflow-x: auto; /* Allow horizontal scroll if needed on very small screens */
    -webkit-overflow-scrolling: touch;
}

.btn-action {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: white;
    border: 1px solid var(--community-border);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--community-text);
}

.btn-action.hidden {
    display: none !important;
}

.btn-action:hover {
    background: var(--community-bg);
    transform: scale(1.05);
}

.btn-action.liked {
    color: #ED4956;
    border-color: #ED4956;
}

/* Meta Info */
.community-detail-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--community-border);
    margin-bottom: 20px;
}

.community-author {
    display: flex;
    align-items: center;
    gap: 12px;
}

.author-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #CE82FF, #1CB0F6);
    object-fit: cover;
}

.author-name {
    font-weight: 600;
    color: var(--community-text);
    font-size: 14px;
}

.author-date {
    font-size: 12px;
    color: var(--community-text-light);
    margin-top: 2px;
}

.community-stats {
    display: flex;
    gap: 16px;
    font-size: 14px;
    color: var(--community-text-light);
}

/* ============================================================================ */
/* COMMENTS - INSTAGRAM STYLE (CLEAN & MINIMAL) */
/* ============================================================================ */

.comments-section {
    padding: 0;
}

.comments-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--community-text);
}

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

/* Clean Instagram-style comment - COMPACT */
.comment-item {
    display: flex;
    gap: 12px;
    padding: 8px 0;
    background: transparent;
    border: none;
}

.comment-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #FF6B9D, #FFA07A);
    object-fit: cover;
    flex-shrink: 0;
    cursor: pointer;
}

.comment-header {
    flex: 1;
    min-width: 0;
}

/* Instagram style: username and text on SAME line, heart on RIGHT */
.comment-author {
    display: flex;
    align-items: flex-start;
    gap: 4px;
    line-height: 18px;
    margin-bottom: 4px;
}

.comment-author-text {
    flex: 1;
    min-width: 0;
}

.comment-author-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--community-text);
    cursor: pointer;
    margin-right: 6px;
}

.comment-author-name:hover {
    opacity: 0.7;
}

.comment-content {
    font-size: 14px;
    line-height: 18px;
    color: var(--community-text);
    font-weight: 400;
    word-wrap: break-word;
}

/* Twemoji flag emoji size fix - constrain to text size */
.comment-content img.emoji {
    width: 1.2em;
    height: 1.2em;
    display: inline;
    vertical-align: text-bottom;
    margin: 0 0.05em;
}

/* Clickable @mentions */
.mention-link {
    color: #0095F6;
    cursor: pointer;
    font-weight: 600;
}

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

/* Heart/Like button on the RIGHT (Instagram style) */
.comment-like-heart {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    font-size: 12px;
    line-height: 18px;
    flex-shrink: 0;
    margin-left: 8px;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.comment-like-heart:hover {
    opacity: 1;
}

.comment-like-heart.liked {
    opacity: 1;
}

/* Instagram style: compact footer on LEFT (timestamp, Reply, like count) */
.comment-footer {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 12px;
    line-height: 18px;
    color: var(--community-text-light);
}

.comment-date {
    color: var(--community-text-light);
    font-weight: 500;
}

.comment-reply-btn {
    background: transparent;
    border: none;
    color: var(--community-text-light);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
}

.comment-reply-btn:hover {
    opacity: 0.6;
}

.like-count {
    color: var(--community-text-light);
    font-weight: 600;
    font-size: 12px;
}

.comment-edited {
    font-size: 12px;
    color: var(--community-text-light);
    font-weight: 400;
}

/* Comment Actions - Vertical ellipsis menu (Instagram style) */
.comment-actions {
    position: relative;
}

.comment-action-btn {
    background: transparent;
    border: none;
    font-size: 16px;
    cursor: pointer;
    padding: 0;
    color: var(--community-text-light);
    line-height: 18px;
}

.comment-action-btn:hover {
    color: var(--community-text);
}

.comment-action-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid var(--community-border);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    min-width: 120px;
    z-index: 100;
    display: none;
}

.comment-action-menu.show {
    display: block;
}

.comment-action-menu button {
    display: block;
    width: 100%;
    padding: 12px 16px;
    background: transparent;
    border: none;
    text-align: left;
    font-size: 14px;
    cursor: pointer;
    color: var(--community-text);
    transition: background 0.2s;
}

.comment-action-menu button:hover {
    background: var(--community-bg);
}

.comment-action-menu button:first-child {
    border-radius: 8px 8px 0 0;
}

.comment-action-menu button:last-child {
    border-radius: 0 0 8px 8px;
}

/* Edit Form */
.comment-edit-form {
    margin-top: 12px;
}

.comment-edit-input {
    width: 100%;
    min-height: 80px;
    padding: 12px;
    border: 1px solid var(--community-border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
}

.comment-edit-input:focus {
    outline: none;
    border-color: var(--community-text);
}

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

.comment-edit-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.comment-edit-btn.save {
    background: #0095F6;
    color: white;
}

.comment-edit-btn.save:hover {
    background: #0081D6;
}

.comment-edit-btn.cancel {
    background: var(--community-bg);
    color: var(--community-text);
}

.comment-edit-btn.cancel:hover {
    background: var(--community-border);
}

/* Reply Form */
.comment-reply-form {
    margin-top: 12px;
    padding-left: 0;
}

.comment-reply-input {
    width: 100%;
    min-height: 70px;
    padding: 12px;
    border: 1px solid var(--community-border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
}

.comment-reply-input:focus {
    outline: none;
    border-color: var(--community-text);
}

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

.reply-char-count {
    font-size: 12px;
    color: var(--community-text-light);
    margin-right: auto;
}

.comment-reply-submit,
.comment-reply-cancel {
    padding: 6px 16px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.comment-reply-submit {
    background: #0095F6;
    color: white;
}

.comment-reply-submit:hover {
    background: #0081D6;
}

.comment-reply-cancel {
    background: transparent;
    color: var(--community-text-light);
}

.comment-reply-cancel:hover {
    color: var(--community-text);
}

/* Nested Replies - Instagram style (only ONE level) */
.comment-replies {
    margin-top: 8px;
    padding-left: 24px;
}

.comment-reply {
    margin-top: 0;
}

.collapse-btn-container {
    margin: 8px 0;
}

.collapse-replies-btn {
    background: transparent;
    border: none;
    color: var(--community-text-light);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}

.collapse-replies-btn:hover {
    color: var(--community-text);
}

.collapse-icon {
    font-size: 10px;
    transition: transform 0.2s;
}

.collapse-replies-btn.collapsed .collapse-icon {
    transform: rotate(-90deg);
}

/* Comment Form */
.comment-form {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--community-border);
}

.comment-textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--community-border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 80px;
}

.comment-textarea:focus {
    outline: none;
    border-color: var(--community-text);
}

.comment-form-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    gap: 20px;
}

.char-count {
    font-size: 12px;
    color: var(--community-text-light);
    flex: 1;
    min-width: 60px;
}

.btn-sm {
    white-space: nowrap;
    flex-shrink: 0;
    padding: 8px 16px;
    font-size: 14px;
    min-width: fit-content;
    max-width: 120px;
}

.sign-in-prompt {
    background: var(--community-bg);
    border: 1px solid var(--community-border);
    border-radius: 8px;
    padding: 16px;
    text-align: center;
}

.sign-in-prompt a {
    color: #0095F6;
    text-decoration: none;
    font-weight: 600;
}

.sign-in-prompt a:hover {
    text-decoration: underline;
}

/* Emoji Picker */
.emoji-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
}

.emoji-btn:hover {
    background: var(--community-bg);
}

/* Desktop-only elements (like emoji picker button) */
.desktop-only {
    display: block;
}

@media (max-width: 768px) {
    .desktop-only {
        display: none !important;
    }
}

.emoji-picker {
    position: absolute;
    right: 12px;
    top: 50px;
    background: white;
    border: 1px solid var(--community-border);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    z-index: 1000;
    width: 280px;
}

.emoji-picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid var(--community-border);
}

.emoji-close-btn {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
}

.emoji-close-btn:hover {
    background: var(--community-bg);
}

.emoji-tabs {
    display: flex;
    justify-content: space-around;
    padding: 6px;
    border-bottom: 1px solid var(--community-border);
    background: var(--community-bg);
}

.emoji-tab {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    opacity: 0.5;
}

.emoji-tab:hover {
    opacity: 0.75;
}

.emoji-tab.active {
    opacity: 1;
    background: white;
}

.emoji-grid-container {
    padding: 10px;
    max-height: 200px;
    overflow-y: auto;
}

.emoji-category {
    font-size: 18px;
    line-height: 1.4;
}

.emoji-category span {
    display: inline-block;
    padding: 3px;
    cursor: pointer;
    border-radius: 4px;
}

.emoji-category span:hover {
    background: var(--community-bg);
}

/* Emoji picker Twemoji images (for flag emojis) */
.emoji-category .emoji-picker-img {
    width: 1.2em;
    height: 1.2em;
    display: inline-block;
    vertical-align: middle;
    padding: 3px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.emoji-category .emoji-picker-img:hover {
    background: var(--community-bg);
}

/* ============================================================================ */
/* TERMS & CONDITIONS MODAL */
/* ============================================================================ */

.terms-content h3 {
    font-size: 18px;
    font-weight: 700;
    margin: 24px 0 12px 0;
    color: var(--community-text);
}

.terms-content p, .terms-content li {
    font-size: 14px;
    line-height: 1.6;
    color: var(--community-text);
    margin-bottom: 12px;
}

.terms-content ul {
    margin: 12px 0 12px 24px;
}

.terms-content li {
    margin-bottom: 8px;
}

.terms-intro {
    font-size: 15px;
    font-weight: 500;
    background: var(--community-bg);
    padding: 16px;
    border-radius: 8px;
    border-left: 4px solid var(--community-accent);
    margin-bottom: 24px;
}

.terms-footer {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 2px solid var(--community-border);
}

.terms-footer p {
    font-size: 14px;
    margin-bottom: 8px;
}

.terms-date {
    font-size: 12px;
    color: var(--community-text-light);
    font-style: italic;
}

/* ============================================================================ */
/* USER PROFILE MODAL */
/* ============================================================================ */

.user-profile-container {
    padding: 0;
    width: 100%;
    overflow-x: hidden;
    max-width: 100%;
}

.profile-header {
    display: flex;
    gap: 16px;
    padding: 20px;
    border-bottom: 1px solid var(--community-border);
    align-items: flex-start;
    background: var(--community-bg);
}

.profile-user-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    background: linear-gradient(135deg, #FF6B9D, #FFA07A);
    flex-shrink: 0;
}

.profile-user-info {
    flex: 1;
    min-width: 0; /* Allows text truncation */
}

.profile-user-name {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 6px 0;
    color: var(--community-text);
    word-wrap: break-word;
}

.profile-user-bio {
    font-size: 13px;
    line-height: 1.4;
    color: var(--community-text);
    margin: 0 0 6px 0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.profile-user-joined {
    font-size: 11px;
    color: var(--community-text-light);
    margin: 0;
}

.profile-stats {
    display: flex;
    justify-content: space-around;
    padding: 16px 20px;
    border-bottom: 1px solid var(--community-border);
    background: var(--community-bg);
    gap: 12px;
}

.profile-stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.profile-stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--community-text);
}

.profile-stat-label {
    font-size: 11px;
    color: var(--community-text-light);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.profile-tabs {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--community-border);
    background: var(--community-bg);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.profile-tab {
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: var(--community-text-light);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}

.profile-tab.active {
    color: var(--community-text);
    border-bottom-color: var(--community-accent);
}

.profile-tab:hover {
    color: var(--community-text);
}

/* Profile Actions Menu (vertical ellipses) */
.profile-actions-menu {
    margin-left: auto;
    position: relative;
    flex-shrink: 0;
}

.profile-menu-btn {
    padding: 8px 12px;
    border: 1px solid var(--community-border);
    background: white;
    color: var(--community-text);
    font-size: 18px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.profile-menu-btn:hover {
    background: var(--community-bg);
}

.profile-menu-dropdown {
    position: fixed; /* Use fixed to avoid being clipped by overflow containers */
    background: white;
    border: 1px solid var(--community-border);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 180px;
    z-index: 99999; /* Very high z-index to appear above everything */
    overflow: hidden;
}

.profile-menu-dropdown button {
    display: block;
    width: 100%;
    padding: 12px 16px;
    background: white;
    border: none;
    text-align: left;
    font-size: 14px;
    color: var(--community-text);
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid var(--community-border);
}

.profile-menu-dropdown button:last-child {
    border-bottom: none;
}

.profile-menu-dropdown button:hover {
    background: var(--community-bg);
}

/* Compact Achievement Emojis */
.profile-compact-achievements {
    margin-top: 12px;
}

.compact-achievements-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px 0;
}

.compact-achievement-emojis {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

.compact-achievement-emojis .achievement-emoji {
    font-size: 20px;
    cursor: pointer;
    transition: transform 0.2s;
    position: relative;
}

.compact-achievement-emojis .achievement-emoji:hover {
    transform: scale(1.2);
}

.toggle-icon {
    font-size: 12px;
    color: #9ca3af;
    transition: transform 0.3s;
}

.toggle-icon.expanded {
    transform: rotate(180deg);
}

.compact-achievements-list {
    margin-top: 12px;
    padding: 12px;
    background: var(--community-bg);
    border-radius: 8px;
    border: 1px solid var(--community-border);
}

.compact-achievement-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    margin-bottom: 8px;
    border-radius: 6px;
    background: white;
}

.compact-achievement-item:last-child {
    margin-bottom: 0;
}

.compact-achievement-item .achievement-icon {
    font-size: 24px;
}

.compact-achievement-item .achievement-info {
    flex: 1;
}

.compact-achievement-item .achievement-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--community-text);
}

.compact-achievement-item .achievement-description {
    font-size: 12px;
    color: #6b7280;
    margin-top: 2px;
}

.profile-content-section {
    padding: 20px 16px;
}

.profile-posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.profile-post-card {
    position: relative;
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 1;
    background: var(--community-bg);
    border: 1px solid var(--community-border);
    transition: transform 0.2s;
}

.profile-post-card:hover {
    transform: scale(1.05);
}

.profile-post-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-post-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    opacity: 0;
    transition: opacity 0.2s;
    color: white;
    font-size: 14px;
    font-weight: 600;
}

.profile-post-card:hover .profile-post-overlay {
    opacity: 1;
}

.profile-no-posts {
    text-align: center;
    padding: 60px 20px;
    color: var(--community-text-light);
}

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

.profile-comment-item {
    padding: 16px;
    background: var(--community-bg);
    border: 1px solid var(--community-border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.profile-comment-item:hover {
    border-color: var(--community-accent);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.profile-comment-post-title {
    font-size: 12px;
    color: var(--community-text-light);
    margin-bottom: 8px;
}

.profile-comment-content {
    font-size: 14px;
    color: var(--community-text);
    margin-bottom: 8px;
    line-height: 1.5;
}

.profile-comment-date {
    font-size: 12px;
    color: var(--community-text-light);
}

/* Achievement Badges Section */
.profile-badges-section {
    padding: 16px;
    border-bottom: 1px solid var(--community-border);
    background: white;
}

.profile-badges-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--community-text);
    margin: 0 0 12px 0;
    text-align: left;
}

.profile-badges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
}

.badge-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px;
    background: var(--community-bg);
    border: 1px solid var(--community-border);
    border-radius: 8px;
    text-align: center;
    transition: all 0.2s;
    cursor: pointer;
    position: relative;
}

.badge-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.badge-item.rarity-common {
    border-color: #9E9E9E;
}

.badge-item.rarity-uncommon {
    border-color: #4CAF50;
}

.badge-item.rarity-rare {
    border-color: #2196F3;
}

.badge-item.rarity-epic {
    border-color: #9C27B0;
}

.badge-item.rarity-legendary {
    border-color: #FF9800;
    background: linear-gradient(135deg, #FFF9E6, #FFECB3);
}

/* Locked/Secret badges */
.badge-item.badge-locked {
    opacity: 0.5;
    background: #F5F5F5;
    border-color: #BDBDBD !important;
    filter: grayscale(100%);
}

.badge-item.badge-locked:hover {
    opacity: 0.7;
}

.badge-icon {
    font-size: 32px;
    margin-bottom: 8px;
    line-height: 1;
}

.badge-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--community-text);
    margin-bottom: 4px;
    line-height: 1.2;
}

.badge-category {
    font-size: 10px;
    color: var(--community-text-light);
    text-transform: uppercase;
    font-weight: 600;
}

.badge-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    line-height: 1.4;
    max-width: 200px;
    white-space: normal;
    z-index: 1000;
    margin-bottom: 8px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.badge-item:hover .badge-tooltip {
    opacity: 1;
}

.badge-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(0,0,0,0.9);
}

/* ============================================================================
   POKEDEX-STYLE ACHIEVEMENTS TAB
   ============================================================================ */

.pokedex-container {
    padding: 20px;
    background: linear-gradient(to bottom, #f8f9fa, #ffffff);
    border: 3px solid #2c3e50;
    border-radius: 12px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.pokedex-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: linear-gradient(135deg, #7c9cbf, #5a7fa0);
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
}

.pokedex-title {
    font-size: 24px;
    font-weight: bold;
    color: white;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    letter-spacing: 1px;
}

.pokedex-completion {
    font-size: 16px;
    font-weight: 600;
    color: white;
    background: rgba(0,0,0,0.2);
    padding: 8px 16px;
    border-radius: 20px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.pokedex-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    padding: 0;
}

.pokedex-entry {
    position: relative;
    background: white;
    border: 2px solid #34495e;
    border-radius: 8px;
    padding: 16px;
    transition: all 0.3s ease;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.pokedex-entry:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

.pokedex-entry.locked {
    background: linear-gradient(135deg, #95a5a6, #7f8c8d);
    border-color: #5a6268;
    opacity: 0.6;
}

.pokedex-entry.locked:hover {
    opacity: 0.8;
}

.pokedex-entry-number {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 12px;
    font-weight: bold;
    color: #95a5a6;
    background: rgba(255,255,255,0.8);
    padding: 2px 6px;
    border-radius: 4px;
}

.pokedex-entry.locked .pokedex-entry-number {
    color: #ecf0f1;
    background: rgba(0,0,0,0.3);
}

.pokedex-entry-icon {
    font-size: 48px;
    text-align: center;
    margin: 12px 0;
    filter: none;
}

.pokedex-entry.locked .pokedex-entry-icon {
    filter: brightness(0) saturate(0);
    opacity: 0.4;
}

.pokedex-entry-name {
    font-size: 16px;
    font-weight: bold;
    color: #2c3e50;
    text-align: center;
    margin-bottom: 8px;
}

.pokedex-entry.locked .pokedex-entry-name {
    color: #ecf0f1;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.pokedex-entry-description {
    font-size: 13px;
    color: #5a6268;
    text-align: center;
    line-height: 1.4;
    min-height: 40px;
}

.pokedex-entry.locked .pokedex-entry-description {
    color: #ecf0f1;
    font-style: italic;
}

.pokedex-entry-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--community-border);
}

.pokedex-entry.locked .pokedex-entry-meta {
    border-top-color: rgba(236, 240, 241, 0.3);
}

.pokedex-entry-rarity {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    padding: 4px 8px;
    border-radius: 4px;
    background: var(--community-bg);
}

.pokedex-entry.rarity-common .pokedex-entry-rarity {
    background: #9E9E9E;
    color: white;
}

.pokedex-entry.rarity-uncommon .pokedex-entry-rarity {
    background: #4CAF50;
    color: white;
}

.pokedex-entry.rarity-rare .pokedex-entry-rarity {
    background: #2196F3;
    color: white;
}

.pokedex-entry.rarity-epic .pokedex-entry-rarity {
    background: #9C27B0;
    color: white;
}

.pokedex-entry.rarity-legendary .pokedex-entry-rarity {
    background: linear-gradient(135deg, #FF9800, #F57C00);
    color: white;
    box-shadow: 0 0 8px rgba(255, 152, 0, 0.5);
}

.pokedex-entry-category {
    font-size: 11px;
    color: var(--community-text-light);
    text-transform: uppercase;
}

.pokedex-entry-earned {
    font-size: 11px;
    color: #27ae60;
    font-weight: 600;
    text-align: center;
    margin-top: 8px;
}

@media (max-width: 768px) {
    .profile-header {
        flex-direction: row;
        padding: 16px;
    }

    .profile-user-avatar {
        width: 70px;
        height: 70px;
    }

    .profile-user-name {
        font-size: 18px;
    }

    .profile-stats {
        padding: 12px 16px;
        gap: 8px;
    }

    .profile-stat-value {
        font-size: 18px;
    }

    .profile-stat-label {
        font-size: 10px;
    }

    .profile-tabs {
        padding: 10px 12px;
        gap: 2px;
    }

    .profile-tab {
        padding: 6px 12px;
        font-size: 12px;
    }

    .profile-menu-btn {
        padding: 6px 10px;
        font-size: 16px;
    }

    .compact-achievement-emojis .achievement-emoji {
        font-size: 18px;
    }

    .profile-badges-section {
        padding: 12px;
    }

    /* Hide Achievements tab button on mobile - show in header instead */
    #achievementsTab {
        display: none !important;
    }

    /* Make compact achievements more prominent on mobile */
    .profile-compact-achievements {
        margin-top: 16px;
        padding: 12px;
        background: var(--community-bg);
        border-radius: 8px;
        border: 1px solid var(--community-border);
    }

    .compact-achievements-toggle {
        padding: 12px 8px;
    }

    .compact-achievement-emojis {
        gap: 8px;
    }

    .profile-badges-grid {
        grid-template-columns: repeat(auto-fill, minmax(85px, 1fr));
        gap: 8px;
    }

    .badge-item {
        padding: 8px;
    }

    .badge-icon {
        font-size: 24px;
    }

    .badge-name {
        font-size: 11px;
    }

    .profile-content-section {
        padding: 16px 12px;
    }

    .pokedex-container {
        padding: 12px;
    }

    .pokedex-header {
        padding: 12px 16px;
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }

    .pokedex-title {
        font-size: 20px;
    }

    .pokedex-completion {
        font-size: 14px;
        padding: 6px 12px;
    }

    .pokedex-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 12px;
    }

    .profile-posts-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 12px;
    }
}

/* ============================================================================ */
/* SHARE TO COMMUNITY MODAL */
/* ============================================================================ */

.share-preview-container {
    margin-bottom: 24px;
}

.share-preview-image {
    width: 100%;
    max-height: 300px;
    object-fit: contain;
    border-radius: 8px;
    background: var(--community-bg);
    border: 1px solid var(--community-border);
}

.form-group {
    margin-bottom: 20px;
}

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

.form-input,
.form-textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--community-border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
    background: white;
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--community-text);
}

.share-notice {
    background: #FFF9E6;
    border: 1px solid #FFC800;
    border-radius: 8px;
    padding: 16px;
    font-size: 13px;
    color: var(--community-text);
    line-height: 1.5;
    margin-bottom: 20px;
}

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

@media (max-width: 768px) {
    /* Lock body on mobile when modal open */
    body.modal-open {
        overflow: hidden;
        position: fixed;
        width: 100%;
        height: 100%;
    }

    .modal {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Community detail modal on mobile */
    #communityDetailModal.modal {
        overflow: hidden !important; /* Modal itself doesn't scroll */
    }

    #communityDetailModal .modal-content {
        max-width: 100%;
        width: 100%;
        max-height: 100vh; /* Full viewport height */
        min-height: 100vh;
        margin: 0;
        border-radius: 0;
        overflow-y: auto !important; /* Modal-content scrolls on mobile */
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch;
    }

    /* Ensure header is not sticky on mobile */
    #communityDetailModal .modal-header {
        position: static !important;
    }

    /* Ensure no nested scrolling containers on mobile */
    .community-detail-container,
    .community-detail-info {
        overflow-y: visible !important;
        max-height: none !important;
    }

    .community-filters {
        flex-direction: column;
        padding: 12px;
    }

    .community-gallery-grid {
        grid-template-columns: 1fr;
        gap: 16px;
        padding: 12px;
    }

    .community-card-image {
        height: 250px;
    }

    .community-detail-image-container {
        min-height: 300px;
        max-height: 500px; /* Limit height on mobile */
        padding-bottom: 0; /* No extra padding needed - dots fit in gap */
    }

    .community-detail-image {
        max-height: 500px; /* Match container on mobile */
    }

    .community-detail-info {
        padding: 16px; /* Balanced padding for mobile */
        padding-bottom: 200px; /* Extra bottom padding for mobile to ensure scroll goes all the way */
        margin-top: 0; /* Start immediately after image */
    }

    .community-detail-description {
        margin-top: 0; /* Less top margin on mobile */
        margin-bottom: 16px; /* Slightly less space on mobile */
    }

    .carousel-dots {
        bottom: 12px; /* Position inside container on mobile */
        padding: 4px 10px; /* Slightly smaller on mobile */
    }

    .community-actions {
        flex-wrap: nowrap;
        gap: 8px;
        padding: 12px 0;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-bottom: 16px;
    }

    .btn-action {
        flex: 0 0 auto;
        min-width: fit-content;
        padding: 8px 12px;
        font-size: 13px;
        white-space: nowrap;
    }

    .comment-form-footer {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
    }

    .btn-sm {
        flex-shrink: 0;
        min-width: fit-content;
    }

    /* Hide carousel arrows on mobile - swipe only */
    .carousel-arrow {
        display: none;
    }

    .emoji-picker {
        display: none !important;
    }

    .avatar-upload-container {
        flex-direction: column;
        text-align: center;
    }
}

/* ============================================================================ */
/* DARK MODE SUPPORT */
/* ============================================================================ */

body.dark-mode {
    --community-text: #FFFFFF;
    --community-text-light: #A8A8A8;
    --community-border: #363636;
    --community-bg: #1A1A1A;
}

body.dark-mode .modal-content {
    background: #000000;
}

body.dark-mode .community-card,
body.dark-mode .community-detail-info,
body.dark-mode .community-detail-container,
body.dark-mode .filter-select,
body.dark-mode .filter-search,
body.dark-mode .profile-input,
body.dark-mode .profile-textarea,
body.dark-mode .form-input,
body.dark-mode .form-textarea,
body.dark-mode .comment-textarea,
body.dark-mode .comment-edit-input,
body.dark-mode .comment-reply-input {
    background: #000000;
    border-color: var(--community-border);
    color: var(--community-text);
}

body.dark-mode .community-gallery-container,
body.dark-mode .community-filters,
body.dark-mode .community-load-more {
    background: #000000;
}

body.dark-mode .btn-action {
    background: #1A1A1A;
    border-color: var(--community-border);
    color: var(--community-text);
}

body.dark-mode .btn-action:hover {
    background: #262626;
}

body.dark-mode .community-detail-image-container {
    background: #000000;
}

body.dark-mode .carousel-arrow {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

body.dark-mode .carousel-arrow:hover {
    background: rgba(255, 255, 255, 0.25);
}

body.dark-mode .emoji-picker {
    background: #1A1A1A;
    border-color: var(--community-border);
}

body.dark-mode .emoji-picker-header,
body.dark-mode .emoji-tabs {
    background: #000000;
    border-color: var(--community-border);
}

body.dark-mode .emoji-tab.active {
    background: #262626;
}

body.dark-mode .emoji-category span:hover {
    background: #262626;
}

body.dark-mode .sign-in-prompt,
body.dark-mode .share-notice,
body.dark-mode .privacy-notice {
    background: #1A1A1A;
    border-color: var(--community-border);
    color: var(--community-text);
}

body.dark-mode .comment-edit-btn.cancel,
body.dark-mode .comment-reply-cancel {
    background: #1A1A1A;
}

body.dark-mode .comment-edit-btn.cancel:hover {
    background: #262626;
}

body.dark-mode .comment-action-menu {
    background: #1A1A1A;
    border-color: var(--community-border);
}

body.dark-mode .comment-action-menu button:hover {
    background: #262626;
}

/* Dark mode: Profile Actions Menu */
body.dark-mode .profile-menu-btn {
    background: #1A1A1A;
    border-color: var(--community-border);
    color: var(--community-text);
}

body.dark-mode .profile-menu-btn:hover {
    background: #262626;
}

body.dark-mode .profile-menu-dropdown {
    background: #1A1A1A;
    border-color: var(--community-border);
}

body.dark-mode .profile-menu-dropdown button {
    background: #1A1A1A;
    color: var(--community-text);
    border-bottom-color: var(--community-border);
}

body.dark-mode .profile-menu-dropdown button:hover {
    background: #262626;
}

body.dark-mode .compact-achievements-list {
    background: #0a0a0a;
    border-color: var(--community-border);
}

body.dark-mode .compact-achievement-item {
    background: #1A1A1A;
}

/* Dark mode: Badges */
body.dark-mode .profile-badges-section {
    background: #000000;
    border-color: var(--community-border);
}

body.dark-mode .badge-item {
    background: #1A1A1A;
    border-color: var(--community-border);
}

body.dark-mode .badge-item.badge-locked {
    background: #0a0a0a;
    border-color: #363636;
}

body.dark-mode .badge-name,
body.dark-mode .pokedex-entry-name {
    color: var(--community-text);
}

body.dark-mode .badge-category,
body.dark-mode .pokedex-entry-category {
    color: var(--community-text-light);
}

/* Dark mode: Pokedex Achievements */
body.dark-mode .pokedex-container {
    background: linear-gradient(to bottom, #1A1A1A, #000000);
    border-color: #363636;
}

body.dark-mode .pokedex-header {
    background: linear-gradient(135deg, #4a5568, #2d3748);
    box-shadow: 0 4px 6px rgba(0,0,0,0.4);
}

body.dark-mode .pokedex-entry {
    background: #1A1A1A;
    border-color: #363636;
}

body.dark-mode .pokedex-entry:hover {
    background: #262626;
}

body.dark-mode .pokedex-entry.locked {
    background: linear-gradient(135deg, #2c2c2c, #1a1a1a);
    border-color: #4a4a4a;
}

body.dark-mode .pokedex-entry-description {
    color: var(--community-text-light);
}

body.dark-mode .pokedex-entry.locked .pokedex-entry-name,
body.dark-mode .pokedex-entry.locked .pokedex-entry-description {
    color: #666666;
}

body.dark-mode .pokedex-entry-meta {
    border-top-color: var(--community-border);
}

body.dark-mode .pokedex-entry.locked .pokedex-entry-meta {
    border-top-color: rgba(54, 54, 54, 0.5);
}

body.dark-mode .pokedex-entry-number {
    background: rgba(0, 0, 0, 0.5);
    color: var(--community-text-light);
}

body.dark-mode .pokedex-entry.locked .pokedex-entry-number {
    background: rgba(0, 0, 0, 0.7);
    color: #4a4a4a;
}
