/* CO-READIT - Dynamic Application Styles */

/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

/* Hide scrollbars globally while maintaining scroll functionality */
* {
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

*::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

button {
    -webkit-tap-highlight-color: transparent;
}

:root {
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --secondary-color: #10b981;
    --secondary-hover: #059669;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-primary: #ffffff;
    --bg-secondary: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --hover-bg: #f1f5f9;
}

/* ========== DARK MODE ========== */
[data-theme="dark"] {
    /* Primary colors - slightly brighter for dark mode */
    --primary-color: #60a5fa;
    --primary-hover: #3b82f6;
    --secondary-color: #34d399;
    --secondary-hover: #10b981;
    
    /* Semantic colors - adjusted for dark backgrounds */
    --success-color: #34d399;
    --error-color: #f87171;
    --warning-color: #fbbf24;
    --info-color: #60a5fa;
    
    /* Backgrounds - dark grays */
    --bg-primary: #1a1a1b;
    --bg-secondary: #030303;
    --bg-tertiary: #272729;
    --bg-elevated: #2d2d2f;
    
    /* Text colors */
    --text-primary: #d7dadc;
    --text-secondary: #818384;
    --text-muted: #6b6d6e;
    --text-link: #60a5fa;
    
    /* Borders */
    --border-color: #343536;
    --border-light: #3a3b3c;
    --border-dark: #2a2a2b;
    
    /* Interactive states */
    --hover-bg: #2a2a2b;
    --active-bg: #343536;
    --focus-ring: rgba(96, 165, 250, 0.5);
    
    /* Shadows - more subtle in dark mode */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.5);
    
    /* Scrollbar */
    --scrollbar-bg: #2a2a2b;
    --scrollbar-thumb: #4a4a4b;
    
    /* Input fields */
    --input-bg: #272729;
    --input-border: #3a3b3c;
    --input-focus-border: #60a5fa;
    
    /* Cards */
    --card-bg: #1a1a1b;
    --card-hover-bg: #232325;
    
    /* Modal/Overlay */
    --modal-bg: #1a1a1b;
    --overlay-bg: rgba(0, 0, 0, 0.75);
    
    /* Code blocks */
    --code-bg: #272729;
    --code-border: #3a3b3c;
    
    /* Success/Error backgrounds for dark mode */
    --success-bg: rgba(52, 211, 153, 0.15);
    --error-bg: rgba(248, 113, 113, 0.15);
    --warning-bg: rgba(251, 191, 36, 0.15);
    --info-bg: rgba(96, 165, 250, 0.15);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-secondary);
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 5px;
}

/* Header */
.header {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo a {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--primary-color);
    font-weight: 700;
    font-size: 20px;
}

.logo img {
    border-radius: 50%;
    width: 40px;
    height: 40px;
}

.nav {
    display: flex;
    gap: 20px;
    align-items: center;
}

.nav-link {
    color: var(--text-primary);
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 4px;
    transition: background 0.2s;
}

.nav-link:hover {
    background: var(--hover-bg);
}

/* Buttons */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: #2563eb;
}

.btn-primary:active {
    background: #2563eb;
    transform: scale(0.98);
}

.btn-secondary {
    background: #64748b;
    color: white;
}

.btn-secondary:hover {
    background: #475569;
}

.btn-secondary:active {
    background: #475569;
    transform: scale(0.98);
}

.btn-block {
    width: 100%;
    display: block;
}

/* Thread Cards */
/* Thread Cards */
.thread-card {
    background: var(--bg-primary);
    border-bottom: 0.7px solid var(--border-color);
    border-left: none;
    border-right: none;
    border-radius: 0;
    margin-bottom: 0;
    display: flex;
    overflow: hidden;
    transition: background-color 0.2s, border-color 0.2s;
    cursor: pointer;
    position: relative;
}

.thread-card:hover {
    border-color: var(--text-primary);
    background-color: #f6f7f8;
    border-radius: 15px;
}

.thread-card:active {
    background-color: #f6f7f8;
}

.thread-card.clicked {
    background-color: #f6f7f8;
}

/* Remove any text decoration from saved comment threads */
.saved-comment-thread .thread-card,
.saved-comment-thread .thread-card:hover,
.saved-comment-thread .thread-card:active,
.saved-comment-thread .thread-card.clicked,
.saved-comment-thread .thread-card * {
    text-decoration: none;
}

.saved-comment-thread .thread-card a,
.saved-comment-thread .thread-card a:hover,
.saved-comment-thread .thread-card a:active,
.saved-comment-thread .thread-card a:visited {
    text-decoration: none;
}

/* Voting Section */
.thread-votes {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 4px;
    background: var(--bg-secondary);
    min-width: 40px;
}

.vote-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px;
    border-radius: 2px;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.vote-btn img {
    width: 20px;
    height: 20px;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.vote-btn:hover img {
    opacity: 1;
}

.vote-btn:hover {
    background: rgba(0, 0, 0, 0.04);
}

.vote-btn.upvote.active img {
    opacity: 1;
    filter: invert(45%) sepia(96%) saturate(1952%) hue-rotate(14deg) brightness(99%) contrast(94%);
}

.vote-btn.downvote.active img {
    opacity: 1;
    filter: invert(31%) sepia(83%) saturate(4586%) hue-rotate(235deg) brightness(91%) contrast(101%);
}

.vote-count {
    font-weight: 700;
    font-size: 12px;
    color: var(--text-primary);
    user-select: none;
}

/* Thread Content */
.thread-content {
    flex: 1;
    padding: 3px 5px;
}

.thread-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.thread-icon {
    width: 25px;
    height: 25px;
    border-radius: 50%;
}

.circle-name {
    color: var(--text-primary);
    font-weight: 700;
    text-decoration: none;
    font-size: 12px;
}

.circle-name:hover {
    text-decoration: underline;
}

.meta-separator {
    color: var(--text-secondary);
}

.thread-author {
    font-size: 14px;
    text-decoration: none;
    color: var(--text-secondary);
}

.thread-time {
    font-size: 12px;
    color: var(--text-secondary);
}

.thread-title {
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 8px;
    margin-top: -10px;
    line-height: 1.3;
}

.thread-title a {
    color: var(--text-primary);
    text-decoration: none;
    pointer-events: none;
}

.thread-title a:hover {
    text-decoration: none;
}

/* Thread Awards Display */
.thread-awards {
    display: flex !important;
    flex-wrap: wrap;
    gap: 6px;
    margin: 4px 0 8px 0;
}

.thread-award-badge {
    display: inline-flex !important;
    align-items: center;
    gap: 3px;
    padding: 3px 8px;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 1px solid #f59e0b;
    border-radius: 12px;
    font-size: 13px;
    cursor: default;
    transition: transform 0.15s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.thread-award-badge:hover {
    transform: scale(1.05);
}

.thread-award-badge .thread-award-icon {
    font-size: 16px;
    line-height: 1;
}

.thread-award-badge .award-count {
    font-size: 12px;
    font-weight: 600;
    color: #92400e;
    min-width: 12px;
    text-align: center;
}

/* Dark mode awards */
[data-theme="dark"] .thread-awards .thread-award-badge,
.dark .thread-award-badge {
    background: linear-gradient(135deg, #422006 0%, #78350f 100%);
    border-color: #b45309;
}

[data-theme="dark"] .thread-award-badge .award-count,
.dark .thread-award-badge .award-count {
    color: #fcd34d;
}

/* Saved page - override thread title link styling */
.saved-comment-thread h3.thread-title,
.saved-comment-thread h3.thread-title a,
.saved-comment-thread h3.thread-title a:link,
.saved-comment-thread h3.thread-title a:visited,
.saved-comment-thread h3.thread-title a:hover,
.saved-comment-thread h3.thread-title a:active {
    color: var(--text-primary);
    text-decoration: none;
}

.thread-text {
    color: var(--text-secondary);
    margin-bottom: 8px;
    line-height: 1.5;
    font-size: 14px;
}

.thread-media {
    margin-bottom: 8px;
    max-width: 100%;
}

.thread-media img {
    max-width: 100%;
    border-radius: 15px;
}

/* Video Player Styles */
.thread-video-container {
    position: relative;
    width: 100%;
    margin: 16px 0;
    border-radius: 15px;
    overflow: hidden;
    background: #000;
    line-height: 0;
}

.thread-video {
    width: 100%;
    max-width: 100%;
    max-height: 600px;
    display: block;
    border-radius: 8px;
    background: #000;
}

.thread-video::-webkit-media-controls-panel {
    background: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.7));
}

.video-thumbnail-gif {
    width: 100%;
    display: block;
    cursor: pointer;
}

.video-preview-container {
    position: relative;
    width: 100%;
    margin: 16px 0;
}

.video-preview-container .video-thumbnail {
    width: 100%;
    border-radius: 8px;
}

.video-play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    cursor: pointer;
    z-index: 10;
}

.play-button-circle {
    width: 80px;
    height: 80px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: white;
    transition: all 0.2s ease;
}

.play-button-circle:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

.video-preview-player {
    width: 100%;
    max-height: 600px;
    border-radius: 8px;
}

/* Responsive video sizing */
@media (max-width: 768px) {
    .thread-video, .video-preview-player {
        max-height: 600px;
    }
}

/* Thread Actions */
.thread-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Push menu button to far right */
.thread-dropdown-btn,
.action-more {
    margin-left: auto;
}

.action-btn {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 20px;
    transition: all 0.2s;
}

.action-btn img {
    width: 20px;
    height: 20px;
    opacity: 0.5;
}

.action-btn span {
    font-size: 12px;
    font-weight: 700;
}

.action-btn:hover {
    background: var(--hover-bg);
    border-color: var(--border-color);
}

.action-btn:hover img {
    opacity: 0.8;
}

.action-more {
    position: relative;
    padding: 4px 8px;
    border-radius: 20px;
}

.action-more img {
    width: 20px;
    height: 20px;
}

/* Action Dropdown Menu */
.action-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    z-index: 1000;
    overflow: hidden;
}

/* Thread Dropdown Menu (Reusable) */
.thread-dropdown-menu {
    position: absolute;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    min-width: 200px;
    z-index: 10000;
    overflow: hidden;
    animation: dropdownFadeIn 0.15s ease-out;
}

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

.dropdown-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.2s;
    border-bottom: 1px solid var(--border-color);
}

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

.dropdown-menu-item:hover {
    background-color: var(--hover-bg);
}

.dropdown-menu-item.danger {
    color: var(--error-color);
}

.dropdown-menu-item.danger:hover {
    background-color: rgba(239, 68, 68, 0.1);
}

.dropdown-menu-item img {
    width: 18px;
    height: 18px;
    opacity: 0.7;
}

.dropdown-menu-item:hover img {
    opacity: 1;
}

.dropdown-menu-item.danger img {
    opacity: 1;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    background: none;
    border: none;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.2s;
}

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

.dropdown-item:hover {
    background-color: var(--hover-bg);
}

.dropdown-item img {
    width: 18px;
    height: 18px;
    opacity: 0.7;
}

.dropdown-item:hover img {
    opacity: 1;
}

/* Thread Detail */
.thread-detail {
    background: var(--bg-primary);
    border-left: none;
    border-right: none;
    border-radius: 0;
    padding: 5px;
    margin-bottom: 5px;
    display: flex;
    gap: 16px;
}

.thread-full {
    flex: 1;
}

.thread-body {
    margin-top: 16px;
    line-height: 1.6;
}

/* Comments */
.comments-section {
    background: var(--bg-primary);
    border-left: none;
    border-right: none;
    border-radius: 0;
    padding: 5px;
}

.comments-section h2 {
    margin-bottom: 2px;
}

.comment-form {
    margin-bottom: 10px;
    border: 1px solid var(--border-color);
    border-radius: 50px;
    background: var(--bg-primary);
    padding: 8px 16px;
    transition: all 0.2s ease;
}

.comment-form.expanded {
    border-radius: 12px;
    padding: 3px 6px;
}

.comment-form textarea {
    width: 100%;
    padding: 8px 0;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 14px;
    resize: none;
    outline: none;
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.comment-form.expanded textarea {
    border-radius: 12px;
    min-height: 120px;
    padding: 8px;
}

textarea#comment-input {
    border-radius: 12px;
    padding: 8px 5px;
}

.comment-form textarea::placeholder {
    color: var(--text-secondary);
}

.comment-form-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.comment-form-actions .btn {
    padding: 8px 8px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
}

.comment {
    padding: 12px;
    border-left: 2px solid var(--border-color);
    margin-bottom: 12px;
}

.comment-author {
    font-weight: 600;
    margin-bottom: 4px;
}

.comment-content {
    margin-bottom: 8px;
}

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

.comment-action-btn {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.comment-action-btn:hover {
    opacity: 1;
}

.comment-action-btn img {
    width: 16px;
    height: 16px;
    filter: brightness(0) saturate(100%) invert(50%);
}

.comment-action-btn.active-upvote img {
    filter: invert(45%) sepia(96%) saturate(1952%) hue-rotate(14deg) brightness(99%) contrast(94%);
    opacity: 1;
}

.comment-action-btn.active-downvote img {
    filter: invert(45%) sepia(100%) saturate(1500%) hue-rotate(210deg) brightness(90%) contrast(100%);
    opacity: 1;
}

.comment-vote-count {
    font-weight: 600;
    font-size: 12px;
    color: var(--text-primary);
    min-width: 5px;
    text-align: center;
}

.comment-action-btn.active-upvote ~ .comment-vote-count {
    color: #ff4500;
}

.comment-action-btn.active-downvote ~ .comment-vote-count {
    color: #7193ff;
}

/* Circles */
.circle-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.circle-info h3 {
    margin-bottom: 8px;
}

.circle-info h3 a {
    color: var(--text-primary);
    text-decoration: none;
}

.circle-info h3 a:hover {
    color: var(--primary-color);
}

.circle-description {
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.circle-stats {
    display: flex;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.circle-header {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.circle-header h1 {
    margin-bottom: 8px;
}

.circle-header .circle-stats {
    display: flex;
    gap: 16px;
    align-items: center;
    margin-top: 16px;
}

/* Forms */
.auth-container {
    max-width: 400px;
    margin: 40px auto;
}

.auth-form {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 32px;
}

.auth-form h1 {
    margin-bottom: 24px;
    text-align: center;
}

.auth-subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 24px;
    font-size: 14px;
}

.auth-link {
    text-align: center;
    margin-top: 16px;
    font-size: 14px;
    color: var(--text-secondary);
}

.auth-link a {
    color: var(--primary-color);
    text-decoration: none;
}

.auth-link a:hover {
    text-decoration: underline;
}

.auth-link-small {
    text-align: center;
    margin-top: 12px;
    font-size: 13px;
    color: var(--text-secondary);
}

.auth-link-small a {
    color: var(--primary-color);
    text-decoration: none;
}

.auth-link-small a:hover {
    text-decoration: underline;
}

.terms-checkbox {
    margin-top: 16px;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    margin-top: 2px;
    cursor: pointer;
}

.checkbox-label a {
    color: var(--primary-color);
    text-decoration: none;
}

.checkbox-label a:hover {
    text-decoration: underline;
}

.form-message {
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 14px;
}

.form-message.success {
    background: var(--success-bg, #d1fae5);
    color: var(--success-color, #059669);
    border: 1px solid var(--success-color, #059669);
}

.form-message.error {
    background: var(--error-bg, #fee2e2);
    color: var(--error-color, #dc2626);
    border: 1px solid var(--error-color, #dc2626);
}

.forgot-password-link {
    display: block;
    text-align: right;
    margin-top: -10px;
    margin-bottom: 16px;
    font-size: 13px;
}

.forgot-password-link a {
    color: var(--primary-color);
    text-decoration: none;
}

.forgot-password-link a:hover {
    text-decoration: underline;
}

.verification-status {
    text-align: center;
    padding: 20px 0;
}

.status-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.status-icon.loading {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

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

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-hint {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-secondary);
}

/* Password Requirements */
.password-requirements {
    margin-top: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 13px;
}

.requirement-title {
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.requirement-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    color: var(--text-secondary);
    transition: color 0.2s ease;
}

.requirement-item.met {
    color: var(--success-color);
}

.req-icon {
    font-weight: bold;
    font-size: 16px;
    width: 16px;
    text-align: center;
}

.requirement-item.met .req-icon {
    color: var(--success-color);
}

.create-form {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 24px;
    max-width: 800px;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

/* Notifications */
.notification {
    position: fixed;
    top: 80px;
    right: 20px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 16px 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    transform: translateX(400px);
    transition: transform 0.3s;
    max-width: 350px;
}

.notification.show {
    transform: translateX(0);
}

.notification-success {
    border-left: 4px solid var(--success-color);
}

.notification-error {
    border-left: 4px solid var(--error-color);
}

.notification-info {
    border-left: 4px solid var(--primary-color);
}

.notification-warning {
    border-left: 4px solid var(--warning-color);
}

/* Read-Only Banner */
.read-only-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #fff;
    z-index: 10001;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
    }
    to {
        transform: translateY(0);
    }
}

.read-only-banner-content {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    gap: 10px;
    max-width: 1200px;
    margin: 0 auto;
}

.read-only-icon {
    font-size: 1.2em;
}

.read-only-message {
    font-size: 14px;
    font-weight: 500;
}

.read-only-dismiss {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    transition: background 0.2s;
}

.read-only-dismiss:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Adjust body padding when banner is present */
body:has(.read-only-banner) .header {
    top: 44px;
}

body:has(.read-only-banner) .sidebar {
    top: 104px;
}

body:has(.read-only-banner) .main-content {
    padding-top: 44px;
}

/* Loading & Empty States */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

/* Global Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color, #e0e0e0);
    border-top-color: var(--primary-color, #0079d3);
    border-radius: 50%;
    animation: spinner-rotate 0.8s linear infinite;
    margin: 60px auto;
}

.spinner-small {
    width: 20px;
    height: 20px;
    border-width: 2px;
    margin: 20px auto;
}

.spinner-inline {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-width: 2px;
    margin: 0 8px;
    vertical-align: middle;
}

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

.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

.error {
    background: #fee;
    border: 1px solid var(--error-color);
    border-radius: 6px;
    padding: 16px;
    color: var(--error-color);
    margin: 20px;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 2px;
    }
    
    .header-content {
        flex-direction: column;
        gap: 12px;
    }

    .nav {
        flex-wrap: wrap;
        justify-content: center;
    }

    .thread-card {
        flex-direction: column;
    }

    .thread-votes {
        flex-direction: row;
    }

    .page-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
}

/* Admin Dashboard Styles */
.admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    text-align: center;
}

.stat-card h3 {
    font-size: 14px;
    color: #64748b;
    margin-bottom: 10px;
    font-weight: 500;
}

.stat-card p {
    font-size: 32px;
    font-weight: bold;
    color: #1e293b;
    margin: 0;
}

.admin-sections {
    margin-top: 30px;
}

.admin-section {
    background: white;
    padding: 30px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    margin-bottom: 20px;
}

.admin-section h2 {
    margin-top: 0;
    margin-bottom: 15px;
}

/* Voting in actions row */
.action-btn.action-vote {
    position: relative;
    gap: 4px;
}

.action-btn.action-vote .vote-count {
    font-weight: 700;
    font-size: 12px;
    color: var(--text-primary);
}

.action-btn.action-vote .downvote-icon {
    width: 20px;
    height: 20px;
    opacity: 0.5;
}

.action-btn.action-vote .downvote-icon:hover {
    opacity: 0.8;
}

.action-btn.action-vote img.active-upvote {
    filter: invert(45%) sepia(96%) saturate(1952%) hue-rotate(14deg) brightness(99%) contrast(94%);
    opacity: 1;
}

.action-btn.action-vote img.active-downvote {
    filter: invert(45%) sepia(100%) saturate(1500%) hue-rotate(210deg) brightness(90%) contrast(100%);
    opacity: 1;
}

/* Create Community Form */
.create-community-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.create-community-layout {
    display: grid;
    gap: 2rem;
}

.community-form-section {
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    padding: 2rem;
}

.community-preview-section {
    position: sticky;
    top: calc(var(--header-height) + 1rem);
    height: fit-content;
}

.form-section-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.form-group-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.input-with-prefix {
    display: flex;
    align-items: center;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    background: var(--bg-primary);
}

.input-prefix {
    padding: 0.625rem 0.75rem;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-weight: 600;
    border-right: 1px solid var(--border-color);
}

.input-with-prefix input {
    flex: 1;
    border: none;
    padding: 0.625rem 0.75rem;
    outline: none;
    font-size: 1rem;
}

.input-with-prefix.error {
    border-color: #dc2626;
}

.input-with-prefix.success {
    border-color: #16a34a;
}

.form-group input[type="text"],
.form-group textarea {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input[type="text"]:focus,
.form-group textarea:focus {
    border-color: var(--primary-color);
}

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

.char-count {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: right;
    margin-top: 0.25rem;
}

.char-count.warning {
    color: #ea580c;
}

.validation-message {
    font-size: 0.875rem;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.validation-message.error {
    color: #dc2626;
}

.validation-message.success {
    color: #16a34a;
}

.validation-message.checking {
    color: var(--text-secondary);
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.radio-option {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.radio-option:hover {
    background: var(--hover-bg);
}

.radio-option input[type="radio"] {
    margin-top: 0.25rem;
}

.radio-option-content {
    flex: 1;
}

.radio-option-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.radio-option-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.tags-input-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    min-height: 20px;
}

.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    background: var(--primary-color);
    color: white;
    border-radius: 16px;
    font-size: 0.875rem;
}

.tag-chip button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0;
    font-size: 1.125rem;
    line-height: 1;
}

.tag-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.tag-suggestion {
    padding: 0.25rem 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.tag-suggestion:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.btn-cancel {
    padding: 0.625rem 1.5rem;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-primary);
    border-radius: 24px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

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

.btn-create {
    padding: 0.625rem 1.5rem;
    border: none;
    background: var(--primary-color);
    color: white;
    border-radius: 24px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-create:hover {
    background: #2563eb;
}

.btn-create:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
}

.community-preview-card {
    background: var(--bg-primary);
    border-radius: 8px;
    padding: 1rem;
}

.preview-header {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: 1rem;
}

.preview-community-name {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.preview-community-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.preview-community-type {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.preview-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .create-community-layout {
        grid-template-columns: 1fr;
    }
    
    .community-preview-section {
        position: static;
    }
}

/* Additional styles for create community */
.no-tags-placeholder {
    color: #7c8591;
    font-size: 0.875rem;
    font-style: italic;
    padding: 0.5rem;
}

.preview-tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: #e2e8f0;
    border-radius: 12px;
    font-size: 0.75rem;
    color: #4a5568;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
}

.char-count {
    text-align: right;
    font-size: 0.75rem;
    color: #7c8591;
    margin-top: 0.25rem;
}

.form-section-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text-primary)
}

.form-group-description {
    font-size: 0.875rem;
    color: #7c8591;
    margin-top: 0.25rem;
    margin-bottom: 0.5rem;
}

/* Recent Posts Sidebar Styles */
.recent-post-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    border-bottom: 1px solid #e2e8f0;
    transition: background-color 0.2s;
}

.recent-post-item:hover {
    background-color: #f7fafc;
}

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

.recent-post-thumbnail {
    position: relative;
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    background: #e2e8f0;
}

.recent-post-media {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.recent-video-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    pointer-events: none;
}

.recent-post-link {
    flex: 1;
    text-decoration: none;
    color: inherit;
    min-width: 0;
}

.recent-post-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: #1c1c1c;
    margin-bottom: 6px;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.recent-post-meta {
    font-size: 0.75rem;
    color: #7c8591;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.recent-post-circle {
    font-weight: 600;
    color: #4a5568;
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #0f172a;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    line-height: 1;
    color: #64748b;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.modal-body {
    padding: 24px;
}

.modal-body p {
    margin: 0 0 16px 0;
    color: #475569;
    font-size: 0.9375rem;
}

.modal-body textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.2s;
}

.modal-body textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover, #2563eb);
}

.btn-secondary {
    background: #64748b;
    color: white;
}

.btn-secondary:hover {
    background: #475569;
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

/* Feed Headers */
.feed-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.feed-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.feed-header p {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    margin-bottom: 1rem;
}

.feed-sort-tabs {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.feed-sort-tab {
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.feed-sort-tab:hover {
    background: var(--hover-bg);
    border-color: var(--primary-color);
}

.feed-sort-tab.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-state h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.empty-state p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-size: 0.9375rem;
}

.empty-state img {
    margin-bottom: 1rem;
    opacity: 0.3;
}

.empty-state .btn {
    margin-top: 1rem;
}



/* Popular Page Sections */
.popular-section,
.popular-threads-section {
    margin-bottom: 3rem;
}

.section-header {
    margin-bottom: 1.5rem;
}

.section-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.section-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0;
}

/* Popular Circles Carousel - Reddit Style */
.popular-carousel-wrapper {
    position: relative;
    margin-bottom: 1.5rem;
}

.popular-circles-carousel {
    margin-bottom: -20px;
    border-bottom: solid 1px var(--border-color);
    display: flex;
    gap: 0.3rem;
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
    cursor: grab;
    padding: 0.5rem 0;
}

.popular-circles-carousel::-webkit-scrollbar {
    display: none;
}

.popular-carousel-card {
    position: relative;
    flex: 0 0 320px;
    height: 220px;
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.popular-carousel-card:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.popular-carousel-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-color: var(--bg-tertiary);
}

.popular-carousel-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.4) 50%, rgba(0, 0, 0, 0.1) 100%);
}

.popular-carousel-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1rem 1.25rem;
    color: #fff;
    z-index: 1;
}

.popular-carousel-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0 0 0.35rem;
    line-height: 1.3;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.popular-carousel-desc {
    font-size: 0.85rem;
    margin: 0 0 0.75rem;
    opacity: 0.9;
    line-height: 1.4;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.popular-carousel-footer {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
}

.popular-carousel-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.popular-carousel-avatar-placeholder {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--primary-color);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.popular-carousel-circle-name {
    font-weight: 600;
    color: #fff;
}

.popular-carousel-members {
    opacity: 0.7;
    margin-left: auto;
}

.popular-carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.popular-carousel-arrow:hover {
    background: var(--bg-secondary);
    border-color: var(--primary-color);
}

.popular-carousel-arrow svg {
    color: var(--text-primary);
}

.popular-carousel-arrow-right {
    right: -10px;
}

.popular-carousel-arrow-left {
    left: -10px;
}

/* Legacy Popular Circles Grid (keep for backwards compatibility) */
.popular-circles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.popular-circle-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem 1rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.popular-circle-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.popular-circle-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.popular-circle-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.popular-circle-card h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.popular-circle-card .member-count {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Explore Communities */
.explore-header {
    margin-bottom: 2rem;
}

.explore-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.1rem;
    color: var(--text-primary);
}

.explore-tabs {
    margin-bottom: -30px;
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    white-space: nowrap;
    padding-bottom: 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

.explore-tabs::-webkit-scrollbar {
    height: 6px;
}

.explore-tabs::-webkit-scrollbar-track {
    background: transparent;
}

.explore-tabs::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.explore-tabs::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

.explore-tab {
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    white-space: nowrap;
}

.explore-tab:hover {
    background: var(--hover-bg);
    border-color: var(--primary-color);
}

.explore-tab.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.recommended-section h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.explore-communities-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.explore-community-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.2s;
}

.explore-community-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.explore-community-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.explore-community-header .community-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.explore-community-header .community-info h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.125rem;
}

.explore-community-header .community-info h4 a {
    color: var(--text-primary);
    text-decoration: none;
}

.explore-community-header .community-info h4 a:hover {
    color: var(--primary-color);
}

.explore-community-header .community-members {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.explore-community-card .community-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.explore-community-card .btn {
    width: 100%;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .popular-circles-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
    
    .popular-carousel-card {
        flex: 0 0 280px;
        height: 200px;
    }
    
    .popular-carousel-arrow {
        display: none;
    }
    
    .popular-carousel-title {
        font-size: 1.1rem;
    }
    
    .explore-communities-grid {
        grid-template-columns: 1fr;
    }
    
    .explore-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }
}

/* Explore Circles Grid (2 columns on desktop/tablet) */
.explore-circles-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

@media (max-width: 1024px) {
    .explore-circles-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .explore-circles-grid {
        grid-template-columns: 1fr;
    }
}

.explore-circle-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    transition: all 0.2s;
}

.explore-circle-card:hover {
    border-color: var(--border-hover, #ccc);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.explore-circle-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.explore-circle-avatar-link {
    flex-shrink: 0;
    text-decoration: none;
}

.explore-circle-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.explore-circle-avatar-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), #6366f1);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 600;
}

.explore-circle-info {
    flex: 1;
    min-width: 0;
}

.explore-circle-name {
    display: block;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.explore-circle-name:hover {
    color: var(--primary-color);
}

.explore-circle-members {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.125rem;
}

.btn-join {
    padding: 0.375rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 9999px;
    background: var(--primary-color);
    color: white;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
}

.btn-join:hover {
    background: var(--primary-hover, #4f46e5);
    transform: scale(1.02);
}

.btn-join.btn-joined {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-join.btn-joined:hover {
    background: var(--bg-tertiary);
}

.explore-circle-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Legacy styles for backwards compatibility */
.explore-circle-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.2s;
}

.explore-circle-left .circle-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.explore-circle-left .circle-avatar-placeholder {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 600;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .explore-circles-grid {
        grid-template-columns: 1fr;
    }
    
    .explore-circle-item {
        flex-direction: column;
        align-items: stretch;
    }
    
    .explore-circle-item .btn {
        width: 100%;
        margin-top: 1rem;
        margin-left: 0;
    }
}

/* Suggested Users Carousel */
.suggested-users-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.suggested-users-section h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.suggested-users-carousel {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.suggested-users-carousel::-webkit-scrollbar {
    height: 6px;
}

.suggested-users-carousel::-webkit-scrollbar-track {
    background: transparent;
}

.suggested-users-carousel::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.suggested-user-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 180px;
    padding: 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.2s;
}

.suggested-user-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.suggested-user-card .user-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 0.75rem;
}

.suggested-user-card .user-info {
    text-align: center;
    margin-bottom: 0.75rem;
    width: 100%;
}

.suggested-user-card .user-info h4 {
    font-size: 0.9375rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.suggested-user-card .user-info h4 a {
    color: var(--text-primary);
    text-decoration: none;
}

.suggested-user-card .user-info h4 a:hover {
    color: var(--primary-color);
}

.suggested-user-card .user-karma {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.suggested-user-card .btn {
    width: 100%;
}

/* ========== EXPLORE PAGE USERS CAROUSEL ========== */
.explore-suggested-users {
    margin-bottom: 0.5rem;
    padding: 0.25rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.explore-suggested-users .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.1rem;
    padding-left: 1px;
}

.explore-suggested-users .section-header h2 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.users-carousel-wrapper {
    overflow-x: auto;
    overflow-y: hidden;
    position: relative;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.users-carousel-wrapper::-webkit-scrollbar {
    display: none;
}

.users-carousel {
    display: flex;
    gap: 0.75rem;
    padding-bottom: 0.25rem;
}

.carousel-user-card {
    flex: 0 0 auto;
    width: 140px;
    padding: 1rem 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: all 0.2s;
}

.carousel-user-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.carousel-user-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 0.5rem;
}

.carousel-user-avatar-placeholder {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary-color);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.carousel-user-info {
    margin-bottom: 0.75rem;
    width: 100%;
}

.carousel-username {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.25rem;
}

.carousel-username:hover {
    color: var(--primary-color);
}

.carousel-user-karma {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.carousel-user-card .follow-btn {
    width: 100%;
    padding: 0.375rem 0.5rem;
    font-size: 0.75rem;
}

.carousel-user-card .follow-btn.following {
    background: var(--bg-tertiary, #e2e8f0);
    border-color: var(--border-color);
    color: var(--text-secondary);
}

@media (max-width: 768px) {
    .explore-suggested-users {
        padding: 0.3rem;
    }
    
    .carousel-user-card {
        width: 120px;
        padding: 0.75rem 0.5rem;
    }
    
    .carousel-user-avatar,
    .carousel-user-avatar-placeholder {
        width: 48px;
        height: 48px;
    }
    
    .carousel-username {
        font-size: 0.75rem;
    }
}

/* Moderation Queue */
.mod-queue-container, .mod-mail-container, .mod-log-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 1.5rem;
}

.mod-queue-tabs, .mod-mail-header {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1.5rem;
}

.mod-tab {
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.mod-tab.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.mod-queue-item, .mod-mail-item, .mod-log-item {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.report-header, .log-header, .mail-meta {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.report-type, .log-action {
    padding: 0.25rem 0.5rem;
    background: var(--hover-bg);
    border-radius: 4px;
    font-weight: 500;
    text-transform: capitalize;
}

.report-content {
    margin: 1rem 0;
    padding: 1rem;
    background: var(--hover-bg);
    border-radius: 6px;
}

.report-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.report-status, .mail-status {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-top: 0.5rem;
    font-size: 0.875rem;
}

.status-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-open { background: #e0f2fe; color: #0369a1; }
.status-in_progress { background: #fef3c7; color: #92400e; }
.status-closed { background: #f3f4f6; color: #374151; }

.mod-mail-item {
    cursor: pointer;
    transition: all 0.2s;
}

.mod-mail-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.mail-subject {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.unread-badge {
    padding: 0.25rem 0.75rem;
    background: var(--error-color);
    color: white;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 500;
}

.log-reason {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: var(--hover-bg);
    border-radius: 4px;
    font-size: 0.875rem;
}

@media (max-width: 768px) {
    .mod-queue-container, .mod-mail-container, .mod-log-container {
        padding: 1rem;
    }
    
    .report-actions {
        flex-direction: column;
    }
    
    .report-actions .btn {
        width: 100%;
    }
}

/* Mod Tools Navigation */
.mod-tools-nav {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.mod-nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--hover-bg);
    border-radius: 6px;
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 500;
    transition: all 0.2s;
}

.mod-nav-link:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.mod-nav-link img {
    filter: var(--icon-filter, none);
}

.mod-nav-link:hover img {
    filter: brightness(0) invert(1);
}

@media (max-width: 768px) {
    .mod-tools-nav {
        flex-wrap: wrap;
    }
    
    .mod-nav-link {
        flex: 1 1 calc(50% - 0.5rem);
        min-width: 140px;
    }
}

/* Circle Mod Tools Card */
.circle-mod-tools-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

.circle-mod-tools-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.circle-mod-tools-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mod-tool-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.mod-tool-link:hover {
    background-color: var(--hover-bg);
}

.mod-tool-link img {
    opacity: 0.7;
}

.mod-tool-link span {
    font-size: 14px;
    font-weight: 500;
}

/* Circle Settings Page */
.circle-settings-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.settings-header {
    margin-bottom: 24px;
}

.settings-header h1 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 8px;
}

.settings-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

.settings-tabs {
    display: flex;
    gap: 8px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 24px;
}

.settings-tab {
    padding: 12px 16px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.settings-tab:hover {
    color: var(--text-primary);
}

.settings-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.settings-panel {
    display: none;
}

.settings-panel.active {
    display: block;
}

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

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-control:disabled {
    background-color: var(--hover-bg);
    cursor: not-allowed;
}

.form-group small {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-secondary);
}

.char-count {
    text-align: right;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.appearance-section {
    margin-bottom: 32px;
}

.appearance-section h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
}

.image-upload-section {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

.current-image,
.current-banner {
    flex-shrink: 0;
}

.circle-avatar-preview {
    width: 128px;
    height: 128px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-color);
}

.circle-avatar-placeholder {
    width: 128px;
    height: 128px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    font-weight: 600;
    border: 2px solid var(--border-color);
}

.circle-banner-preview {
    width: 400px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
    border: 2px solid var(--border-color);
}

.circle-banner-placeholder {
    width: 400px;
    height: 80px;
    background: var(--hover-bg);
    border: 2px dashed var(--border-color);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 14px;
}

.upload-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* User Profile Image Uploads */
.profile-images-section {
    display: flex;
    flex-direction: column;
    gap: 32px;
    margin-bottom: 32px;
}

.image-upload-group h3 {
    margin: 0 0 16px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.user-avatar-preview {
    width: 128px;
    height: 128px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-color);
}

.user-avatar-placeholder {
    width: 128px;
    height: 128px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    font-weight: 600;
    border: 2px solid var(--border-color);
}

.user-banner-preview {
    width: 100%;
    max-width: 600px;
    height: 120px;
    object-fit: cover;
    border-radius: 4px;
    border: 2px solid var(--border-color);
}

.user-banner-placeholder {
    width: 100%;
    max-width: 600px;
    height: 120px;
    background: var(--hover-bg);
    border: 2px dashed var(--border-color);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 14px;
}

@media (max-width: 768px) {
    .circle-settings-container {
        padding: 16px;
    }
    
    .settings-tabs {
        overflow-x: auto;
    }
    
    .image-upload-section {
        flex-direction: column;
    }
    
    .circle-banner-preview,
    .circle-banner-placeholder {
        width: 100%;
    }
    
    .user-banner-preview,
    .user-banner-placeholder {
        max-width: 100%;
    }
}

/* ================================
   COMPACT MODE STYLES
   Thread lists only - horizontal layout with media on right
   ================================ */

/* Compact mode placeholder - hidden by default */
.compact-placeholder {
    display: none;
}

/* Compact mode - thread card horizontal layout */
body.compact-mode .thread-card {
    padding: 8px 12px;
    margin-bottom: 2px;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 12px;
    min-height: auto;
}

/* Compact mode - hide full vote section, show inline */
body.compact-mode .thread-votes {
    display: none;
}

/* Compact mode - show placeholder for threads without media */
body.compact-mode .thread-card[data-has-media="false"] .compact-placeholder {
    display: flex;
    position: absolute;
    right: 0;
    top: 0;
    width: 70px;
    height: 70px;
    border-radius: 8px;
    background: var(--bg-secondary);
    border: solid 1px var(--border-color);
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

body.compact-mode .thread-card[data-has-media="false"] .compact-placeholder svg {
    width: 28px;
    height: 28px;
    color: var(--text-secondary);
    opacity: 0.5;
}

/* Compact mode - main content needs flex layout to position media right */
body.compact-mode .thread-content {
    flex: 1;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    min-width: 0;
    position: relative;
}

/* Compact mode - text content area (left side) */
body.compact-mode .thread-meta,
body.compact-mode .thread-title,
body.compact-mode .thread-actions {
    flex-basis: calc(100% - 85px);
    flex-shrink: 0;
}

/* Compact mode - smaller title */
body.compact-mode .thread-title {
    padding-right: 80px;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
    margin-top: 0;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Compact mode - hide thread text preview */
body.compact-mode .thread-text {
    display: none;
}

/* Compact mode - smaller meta info */
body.compact-mode .thread-meta {
    font-size: 11px;
    margin-bottom: 4px;
    gap: 4px;
}

body.compact-mode .thread-icon,
body.compact-mode .thread-icon-placeholder {
    width: 18px;
    height: 18px;
    font-size: 10px;
}

body.compact-mode .circle-name {
    font-size: 11px;
}

body.compact-mode .thread-author {
    font-size: 11px;
}

body.compact-mode .thread-time {
    font-size: 11px;
}

/* Compact mode - inline actions with vote count */
body.compact-mode .thread-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 11px;
    margin-top: 3px;
}

body.compact-mode .thread-actions .action-btn {
    padding: 2px 6px;
    font-size: 11px;
}

body.compact-mode .thread-actions .action-btn img {
    width: 14px;
    height: 14px;
}

/* Compact mode - media thumbnail positioned absolutely on right */
body.compact-mode .thread-media,
body.compact-mode .thread-video-container {
    position: absolute;
    right: 0;
    top: 0;
    width: 70px;
    height: 70px;
    margin: 0;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    flex-shrink: 0;
}

body.compact-mode .thread-media img,
body.compact-mode .thread-video-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

/* Hide video controls in compact mode list view only */
body.compact-mode .feed-container .thread-video-container video,
body.compact-mode .threads-list .thread-video-container video {
    pointer-events: none;
}

body.compact-mode .feed-container .thread-video-container video::-webkit-media-controls,
body.compact-mode .threads-list .thread-video-container video::-webkit-media-controls {
    display: none !important;
}

/* Compact mode - hide link preview in compact */
body.compact-mode .link-preview {
    display: none;
}

/* Compact mode - show placeholder icon for link posts (since link preview is hidden) */
body.compact-mode .thread-card[data-type="link"] .compact-placeholder {
    display: flex;
    position: absolute;
    right: 0;
    top: 0;
    width: 70px;
    height: 70px;
    border-radius: 8px;
    background: var(--bg-secondary);
    border: solid 1px var(--border-color);
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

body.compact-mode .thread-card[data-type="link"] .compact-placeholder svg {
    width: 28px;
    height: 28px;
    color: var(--text-secondary);
    opacity: 0.5;
}

/* Compact mode - hide poll in compact view */
body.compact-mode .poll-container {
    display: none;
}

/* Compact mode - reduce spacing between cards */
body.compact-mode .feed-container {
    gap: 0;
}

body.compact-mode .threads-list {
    gap: 0;
}

/* Compact mode - don't apply to single thread view */
body.compact-mode .thread-detail .thread-card,
body.compact-mode .thread-detail-page .thread-card,
body.compact-mode .single-thread .thread-card {
    padding: 16px;
    flex-direction: column;
}

body.compact-mode .thread-detail .thread-content,
body.compact-mode .thread-detail-page .thread-content,
body.compact-mode .single-thread .thread-content {
    display: block;
    position: static;
}

body.compact-mode .thread-detail .thread-votes,
body.compact-mode .thread-detail-page .thread-votes,
body.compact-mode .single-thread .thread-votes {
    display: flex;
}

body.compact-mode .thread-detail .thread-title,
body.compact-mode .thread-detail-page .thread-title,
body.compact-mode .single-thread .thread-title {
    font-size: 18px;
    -webkit-line-clamp: unset;
    flex-basis: 100%;
}

body.compact-mode .thread-detail .thread-meta,
body.compact-mode .thread-detail-page .thread-meta,
body.compact-mode .single-thread .thread-meta,
body.compact-mode .thread-detail .thread-actions,
body.compact-mode .thread-detail-page .thread-actions,
body.compact-mode .single-thread .thread-actions {
    flex-basis: 100%;
}

body.compact-mode .thread-detail .thread-text,
body.compact-mode .thread-detail-page .thread-text,
body.compact-mode .single-thread .thread-text {
    display: block;
}

body.compact-mode .thread-detail .thread-media,
body.compact-mode .thread-detail-page .thread-media,
body.compact-mode .single-thread .thread-media,
body.compact-mode .thread-detail .thread-video-container,
body.compact-mode .thread-detail-page .thread-video-container,
body.compact-mode .single-thread .thread-video-container {
    position: static;
    width: 100%;
    height: auto;
    margin: 8px 0;
}

body.compact-mode .thread-detail .link-preview,
body.compact-mode .thread-detail-page .link-preview,
body.compact-mode .single-thread .link-preview {
    display: block;
}

body.compact-mode .thread-detail .poll-container,
body.compact-mode .thread-detail-page .poll-container,
body.compact-mode .single-thread .poll-container {
    display: block;
}

/* Hide placeholder in single thread view */
body.compact-mode .thread-detail .compact-placeholder,
body.compact-mode .thread-detail-page .compact-placeholder,
body.compact-mode .single-thread .compact-placeholder {
    display: none !important;
}

/* ================================
   FONT SIZE STYLES
   ================================ */

/* Small font size (14px base) */
body.font-small {
    font-size: 14px;
}

body.font-small .thread-title {
    font-size: 16px;
}

body.font-small .thread-text {
    font-size: 13px;
}

body.font-small .thread-meta,
body.font-small .thread-author,
body.font-small .thread-time,
body.font-small .circle-name {
    font-size: 11px;
}

body.font-small .comment-body {
    font-size: 13px;
}

body.font-small .action-btn {
    font-size: 11px;
}

/* Medium font size (16px base - default) */
body.font-medium {
    font-size: 16px;
}

body.font-medium .thread-title {
    font-size: 18px;
}

body.font-medium .thread-text {
    font-size: 14px;
}

body.font-medium .thread-meta,
body.font-medium .thread-author,
body.font-medium .thread-time,
body.font-medium .circle-name {
    font-size: 12px;
}

body.font-medium .comment-body {
    font-size: 14px;
}

body.font-medium .action-btn {
    font-size: 12px;
}

/* Large font size (18px base) */
body.font-large {
    font-size: 16px;
}

body.font-large .thread-title {
    font-size: 16px;
}

body.font-large .thread-text {
    font-size: 16px;
}

body.font-large .thread-meta,
body.font-large .thread-author,
body.font-large .thread-time,
body.font-large .circle-name {
    font-size: 16px;
}

body.font-large .comment-body {
    font-size: 16px;
}

body.font-large .action-btn {
    font-size: 13px;
}

/* Large font size - tablet/mobile for thread-meta */
@media (max-width: 768px) {
    body.font-large .thread-meta,
    body.font-large .thread-author,
    body.font-large .thread-time,
    body.font-large .circle-name {
        font-size: 16px;
    }
}

/* Compact mode + font size combinations */
body.compact-mode.font-small .thread-title {
    font-size: 13px;
}

body.compact-mode.font-small .thread-meta,
body.compact-mode.font-small .thread-author,
body.compact-mode.font-small .thread-time,
body.compact-mode.font-small .circle-name {
    font-size: 10px;
}

body.compact-mode.font-medium .thread-meta,
body.compact-mode.font-medium .thread-author,
body.compact-mode.font-medium .thread-time,
body.compact-mode.font-medium .circle-name {
    font-size: 11px;
}

body.compact-mode.font-large .thread-title {
    font-size: 16px;
}

body.compact-mode.font-large .thread-meta,
body.compact-mode.font-large .thread-author,
body.compact-mode.font-large .thread-time,
body.compact-mode.font-large .circle-name {
    font-size: 13px;
}

/* Mobile responsive for compact mode */
@media (max-width: 768px) {
    body.compact-mode .thread-card {
        padding: 6px 10px;
    }
    
    body.compact-mode .thread-media {
        width: 70px;
        height: 70px;
    }
    
    body.compact-mode .thread-title {
        font-size: 13px;
    }
}

/* ========== AD CONTAINER ISOLATION ========== */
/* Creates an isolated context for ad content without resetting ad's own styles */
.ad-isolation-container {
    display: block !important;
    position: relative !important;
    isolation: isolate !important;
    contain: layout !important;
    width: 100% !important;
    min-height: 50px;
}

/* Allow ad content to control its own styling */
.ad-isolation-container * {
    box-sizing: border-box;
}

/* Zeal Ad Manager / Adcaver specific - ensure proper display */
.ad-isolation-container .zeal-ad-unit {
    display: block !important;
    width: 100% !important;
}

/* Sidebar ad widget styling */
#sidebar-ad-widget {
    margin-bottom: 1rem;
    border-radius: 8px;
    overflow: hidden;
}

/* Comment ad widget styling */
#comment-ad-widget {
    margin: 1rem 0;
    border-radius: 8px;
    overflow: hidden;
}

/* Thread promoted ad styling */
.thread-promoted-ad-container {
    margin: 1rem 0;
    border-radius: 8px;
    overflow: hidden;
}

/* ========== 404 / Error Page Styles ========== */
.error-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 50vh;
    text-align: center;
    padding: 2rem;
}

.error-page-icon {
    color: var(--text-tertiary, #9ca3af);
    margin-bottom: 1.5rem;
    opacity: 0.6;
}

.error-page-title {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text-primary, #1f2937);
    margin: 0 0 0.75rem 0;
}

.error-page-message {
    font-size: 1rem;
    color: var(--text-secondary, #6b7280);
    margin: 0 0 2rem 0;
    max-width: 400px;
}

.error-page-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.error-page-actions .btn {
    min-width: 120px;
}

/* Dark mode support */
[data-theme="dark"] .error-page-title {
    color: var(--text-primary, #f3f4f6);
}

[data-theme="dark"] .error-page-message {
    color: var(--text-secondary, #9ca3af);
}

[data-theme="dark"] .error-page-icon {
    color: var(--text-tertiary, #6b7280);
}
