/**
 * Community System Styles
 * Responsive design with Dark/Light mode support
 */

/* ========================================================================
   CSS VARIABLES - DARK MODE (Default)
   ======================================================================== */
:root,
.theme-dark {
    --color-primary: #ff6b35;
    --color-primary-hover: #e55a2b;
    --color-secondary: #b8a99a;
    --color-success: #00e676;
    --color-danger: #ff3d00;
    --color-warning: #ffc107;

    --bg-body: #000000;
    --bg-surface: rgba(44, 24, 16, 0.3);
    --bg-elevated: rgba(44, 24, 16, 0.45);
    --bg-hover: rgba(255, 107, 53, 0.08);
    --bg-input: rgba(44, 24, 16, 0.5);
    
    --text-primary: #f0ece8;
    --text-secondary: #d4ccc4;
    --text-muted: #b8a99a;
    
    --border-color: rgba(255, 107, 53, 0.1);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* ========================================================================
   CSS VARIABLES - LIGHT MODE
   ======================================================================== */
.theme-light {
    --color-primary: #ff6b35;
    --color-primary-hover: #e55a2b;
    --color-secondary: #8a7060;
    --color-success: #00c853;
    --color-danger: #ff3d00;
    --color-warning: #ff9800;

    --bg-body: #faf5f0;
    --bg-surface: rgba(255, 248, 240, 0.8);
    --bg-elevated: rgba(255, 245, 235, 0.9);
    --bg-hover: rgba(255, 107, 53, 0.06);
    --bg-input: rgba(255, 248, 240, 0.9);
    
    --text-primary: #2c1810;
    --text-secondary: #5a4030;
    --text-muted: #8a7060;
    
    --border-color: rgba(255, 107, 53, 0.12);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.12);
}

/* ========================================================================
   RESET & BASE STYLES
   ======================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--color-primary-hover);
}

img {
    max-width: 100%;
    height: auto;
}

/* ========================================================================
   BANNED USER NOTICE
   ======================================================================== */
.banned-notice {
    background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
    color: white;
    padding: 14px 20px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(220, 38, 38, 0.4);
    position: fixed;
    top: 100px;
    right: 24px;
    z-index: 999;
    max-width: 360px;
    width: auto;
    margin: 0;
}

.banned-notice-content {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.banned-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.banned-text strong {
    display: block;
    font-size: 15px;
    margin-bottom: 4px;
}

.banned-text p {
    margin: 0;
    font-size: 13px;
    opacity: 0.95;
    line-height: 1.4;
}

@media (max-width: 768px) {
    .banned-notice {
        top: 80px;
        right: 12px;
        left: 12px;
        max-width: none;
        padding: 12px 16px;
    }
    
    .banned-icon {
        font-size: 20px;
    }
    
    .banned-text strong {
        font-size: 14px;
    }
    
    .banned-text p {
        font-size: 12px;
    }
}

/* ========================================================================
   CONTAINER & LAYOUT
   ======================================================================== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

.site-main {
    min-height: calc(100vh - 140px);
    padding: 20px 0;
}

/* ========================================================================
   HEADER
   ======================================================================== */
.site-header {
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-sm);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    gap: 20px;
}

.site-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.site-logo:hover {
    opacity: 0.8;
}

.logo-image {
    height: 40px;
    width: auto;
    object-fit: contain;
}

.logo-text {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, var(--color-primary), #e55a2b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-icon {
    font-size: 28px;
}

.header-nav {
    display: flex;
    gap: 10px;
}

.nav-link {
    padding: 8px 16px;
    border-radius: 6px;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

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

.nav-link.main-site-link {
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.1), rgba(255, 107, 53, 0.05));
    border: 1px solid rgba(255, 107, 53, 0.2);
    color: #ff6b35;
    font-weight: 600;
    font-size: 13px;
}

.nav-link.main-site-link:hover {
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.2), rgba(255, 107, 53, 0.1));
    border-color: rgba(255, 107, 53, 0.4);
    color: #ff8c5a;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Theme Toggle */
.theme-toggle {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: background-color 0.2s ease;
}

.theme-toggle:hover {
    background-color: var(--bg-hover);
}

.theme-dark .theme-icon-light {
    display: inline;
}

.theme-dark .theme-icon-dark {
    display: none;
}

.theme-light .theme-icon-light {
    display: none;
}

.theme-light .theme-icon-dark {
    display: inline;
}

/* Notifications */
.notification-btn {
    position: relative;
    padding: 8px;
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 20px;
    transition: background-color 0.2s ease;
}

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

.notification-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background-color: var(--color-danger);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* User Menu */
.user-menu {
    position: relative;
}

.user-menu-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 8px;
    color: var(--text-primary);
    transition: background-color 0.2s ease;
}

.user-menu-toggle:hover {
    background-color: var(--bg-hover);
}

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

.user-name {
    font-weight: 500;
}

.dropdown-arrow {
    font-size: 10px;
    color: var(--text-muted);
}

.user-menu-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background-color: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
}

.user-menu-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-menu-dropdown a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    color: var(--text-primary);
    transition: background-color 0.2s ease;
}

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

.user-menu-dropdown hr {
    margin: 4px 0;
    border: none;
    border-top: 1px solid var(--border-color);
}

/* ========================================================================
   CARDS & BOXES
   ======================================================================== */
.card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s ease;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

/* ========================================================================
   BUTTONS
   ======================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

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

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

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

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

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-block {
    width: 100%;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-link {
    background: none;
    border: none;
    color: var(--color-primary);
    padding: 0;
    font-size: 14px;
    cursor: pointer;
}

/* ========================================================================
   FORMS
   ======================================================================== */
.form-group {
    margin-bottom: 20px;
}

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

.form-control,
.form-select,
textarea {
    width: 100%;
    padding: 10px 14px;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.2s ease;
}

.form-control:focus,
.form-select:focus,
textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

textarea {
    resize: vertical;
    font-family: inherit;
}

/* ========================================================================
   FEED LAYOUT
   ======================================================================== */
.feed-layout {
    display: grid;
    grid-template-columns: 250px 1fr 300px;
    gap: 20px;
    margin-top: 20px;
}

.feed-layout:has(.feed-main:only-child) {
    /* When only main content exists (non-logged-in) */
    grid-template-columns: 1fr;
    place-items: center;
}

/* Sidebar */
.sidebar {
    position: sticky;
    top: 84px;
    height: fit-content;
}

.sidebar-section {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.sidebar-section h3 {
    font-size: 16px;
    margin-bottom: 15px;
    color: var(--text-primary);
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--text-secondary);
    margin-bottom: 4px;
    transition: all 0.2s ease;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.sidebar-nav a.active {
    font-weight: 500;
}

.admin-section {
    background-color: rgba(239, 68, 68, 0.1);
    border-color: var(--color-danger);
}

/* Main Feed */
.feed-main {
    max-width: 800px;
}

.sidebar-right {
    position: sticky;
    top: 84px;
    height: fit-content;
}

/* ========================================================================
   LOGIN PROMPT (Non-Logged-In Users)
   ======================================================================== */
.login-prompt {
    max-width: 500px;
    margin: 40px auto;
    text-align: center;
    padding: 40px;
}

.login-prompt-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.8;
}

.login-prompt h2 {
    font-size: 28px;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.login-prompt p {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 30px;
    line-height: 1.6;
}

.login-prompt-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.login-prompt .btn {
    min-width: 140px;
    padding: 12px 24px;
    font-size: 16px;
}

/* ========================================================================
   CREATE POST BOX
   ======================================================================== */
.create-post-box {
    margin-bottom: 20px;
}

.create-post-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.post-composer {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.post-composer .user-avatar {
    flex-shrink: 0;
}

.post-composer .user-avatar img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.post-input-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.post-textarea {
    width: 100%;
    min-height: 80px;
    padding: 12px 16px;
    border: none;
    background-color: var(--bg-elevated);
    color: var(--text-primary);
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    resize: vertical;
}

.post-textarea:focus {
    outline: none;
    background-color: var(--bg-hover);
}

.post-textarea::placeholder {
    color: var(--text-muted);
}

.post-actions-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.post-options {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.post-option-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    transition: all 0.2s;
}

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

.post-option-btn svg {
    color: var(--color-primary);
}

.group-select {
    padding: 10px 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
}

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

.post-submit-btn {
    min-width: 100px;
}

/* Media Preview Grid */
.media-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
    padding: 12px;
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.media-preview-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-elevated);
}

.media-preview-item img,
.media-preview-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media-preview-item button {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.media-preview-item button:hover {
    background: rgba(239, 68, 68, 0.9);
    transform: scale(1.1);
}

.media-preview-item .file-icon {
    font-size: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

/* ========================================================================
   POST CARD
   ======================================================================== */
.posts-feed {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.post-card {
    transition: all 0.3s ease;
}

.post-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 16px;
}

.post-author {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

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

.avatar-large {
    width: 64px;
    height: 64px;
}

.author-info {
    display: flex;
    flex-direction: column;
}

.author-name {
    font-weight: 600;
    color: var(--text-primary);
}

.post-time {
    font-size: 13px;
    color: var(--text-muted);
}

.post-edited {
    font-size: 12px;
    color: var(--text-muted);
    font-style: italic;
}

.post-group {
    font-size: 13px;
    color: var(--color-primary);
    margin-left: 8px;
}

.post-pinned {
    background-color: rgba(245, 158, 11, 0.1);
    color: var(--color-warning);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
}

.post-menu {
    position: relative;
}

.menu-toggle {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background-color 0.2s ease;
}

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

.menu-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
    min-width: 180px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 100;
    overflow: hidden;
    backdrop-filter: blur(12px);
}

.menu-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.menu-dropdown a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 11px 16px;
    color: var(--text-primary);
    font-size: 14px;
    transition: background-color 0.2s ease;
    text-decoration: none;
}

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

.post-content {
    margin-bottom: 16px;
}

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

.post-title a {
    color: var(--text-primary);
}

.post-text {
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Post Media Styles */
.post-media {
    margin-top: 16px;
    border-radius: 12px;
    overflow: hidden;
}

.media-single {
    width: 100%;
    text-align: center;
}

.media-single img,
.media-single video {
    max-width: 100%;
    max-height: 600px;
    object-fit: contain;
    display: inline-block;
    background: var(--bg-body);
    image-rendering: auto;
    image-rendering: high-quality;
    -webkit-image-rendering: auto;
}

.media-single audio {
    width: 100%;
}

.media-file {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.2s;
}

.media-file:hover {
    background: var(--bg-hover);
}

.media-file .file-icon {
    font-size: 32px;
}

.media-grid {
    display: grid;
    gap: 4px;
}

.media-grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.media-grid-3 {
    grid-template-columns: repeat(2, 1fr);
}

.media-grid-3 .media-item:first-child {
    grid-column: span 2;
}

.media-grid-4,
.media-grid-5 {
    grid-template-columns: repeat(2, 1fr);
    max-height: 500px;
}

.media-item {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    background: var(--bg-body);
}

.media-item img,
.media-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    image-rendering: auto;
    image-rendering: high-quality;
    -webkit-image-rendering: auto;
}

/* Mobile responsive media grid */
@media (max-width: 768px) {
    .media-grid-4,
    .media-grid-5 {
        max-height: 400px;
    }
    
    .media-item {
        min-height: 150px;
    }
}

@media (max-width: 480px) {
    .media-grid {
        gap: 2px;
    }
    
    .media-grid-3,
    .media-grid-4,
    .media-grid-5 {
        grid-template-columns: repeat(2, 1fr);
        max-height: 350px;
    }
    
    .media-grid-3 .media-item:first-child {
        grid-column: span 2;
        max-height: 200px;
    }
    
    .media-item {
        min-height: 120px;
        aspect-ratio: 1;
    }
    
    .media-single img,
    .media-single video {
        max-height: 400px;
        border-radius: 8px;
    }
}

.file-preview {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-elevated);
}

.file-preview .file-icon {
    font-size: 48px;
}

.post-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    gap: 12px;
    flex-wrap: wrap;
}

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

.stat-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.post-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Image Lightbox */
.lightbox-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    animation: fadeIn 0.3s ease;
}

.lightbox-overlay.active {
    display: flex;
}

.lightbox-content {
    max-width: 95vw;
    max-height: 95vh;
    position: relative;
    animation: zoomIn 0.3s ease;
}

.lightbox-content img,
.lightbox-content video {
    max-width: 100%;
    max-height: 95vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(10px);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10000;
}

.lightbox-close:hover {
    background: rgba(255,255,255,0.3);
    transform: rotate(90deg);
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(10px);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10000;
}

.lightbox-nav:hover {
    background: rgba(255,255,255,0.3);
    transform: translateY(-50%) scale(1.1);
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

.lightbox-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(10px);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

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

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

.action-btn.liked {
    color: var(--color-danger);
    border-color: var(--color-danger);
}

/* ========================================================================
   COMMENTS
   ======================================================================== */
.comments-section {
    margin-top: 30px;
}

.section-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.add-comment-form {
    margin-bottom: 24px;
}

.comment-form {
    display: flex;
    gap: 12px;
}

.comment-input {
    flex: 1;
}

.comment-input textarea {
    margin-bottom: 10px;
}

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

.comment-item {
    display: flex;
    gap: 12px;
    transition: all 0.3s ease;
}

/* Nested comment indentation with max depth */
.comment-item.comment-depth-1,
.comment-item.comment-depth-2,
.comment-item.comment-depth-3,
.comment-item.comment-depth-4,
.comment-item.comment-depth-5,
.comment-item.comment-depth-6 {
    position: relative;
}

.comment-item.comment-depth-1::before,
.comment-item.comment-depth-2::before,
.comment-item.comment-depth-3::before,
.comment-item.comment-depth-4::before,
.comment-item.comment-depth-5::before,
.comment-item.comment-depth-6::before {
    content: '';
    position: absolute;
    left: -15px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, var(--border-color) 0%, transparent 100%);
}

/* Smaller avatars for deeply nested comments */
.comment-depth-3 .comment-avatar img,
.comment-depth-4 .comment-avatar img,
.comment-depth-5 .comment-avatar img,
.comment-depth-6 .comment-avatar img {
    width: 32px;
    height: 32px;
}

.comment-avatar {
    flex-shrink: 0;
}

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

.comment-body {
    flex: 1;
}

.comment-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

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

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

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

.comment-actions {
    display: flex;
    gap: 12px;
    font-size: 12px;
}

.comment-action {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    transition: color 0.2s ease;
}

.comment-action:hover {
    color: var(--color-primary);
}

.comment-action.liked {
    color: var(--color-danger);
}

.comment-replies {
    margin-top: 16px;
    margin-left: 52px;
    padding-left: 16px;
    border-left: 2px solid var(--border-color);
}

.comment-reply .comment-avatar img {
    width: 32px;
    height: 32px;
}

.reply-form-container {
    margin-top: 12px;
    padding: 12px;
    background: var(--bg-elevated);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.reply-form-content {
    display: flex;
    gap: 10px;
    align-items: start;
    margin-bottom: 10px;
}

.reply-form-content .reply-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
}

.reply-form-content textarea {
    flex: 1;
    width: 100%;
    min-height: 60px;
    padding: 10px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
    resize: vertical;
    font-family: inherit;
}

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

.reply-form textarea {
    margin-bottom: 8px;
}

.reply-form-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* ========================================================================
   PAGINATION
   ======================================================================== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 30px 0;
}

.pagination-btn,
.pagination-page {
    padding: 8px 16px;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.2s ease;
}

.pagination-page:hover {
    background-color: var(--bg-hover);
    color: var(--color-primary);
}

.pagination-page.active {
    background-color: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

.pagination-dots {
    color: var(--text-muted);
}

/* ========================================================================
   GROUPS
   ======================================================================== */
.groups-page {
    margin-top: 20px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 20px;
}

.page-header-content h1 {
    font-size: 32px;
    color: var(--text-primary);
    margin: 0 0 8px 0;
}

.page-header-content p {
    color: var(--text-secondary);
    margin: 0;
}

/* Groups Filters & Search */
.groups-filters {
    margin-bottom: 24px;
}

.filters-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.filter-tabs {
    display: flex;
    gap: 8px;
    border-bottom: 2px solid var(--border-color);
}

.filter-tab {
    padding: 12px 20px;
    color: var(--text-secondary);
    font-weight: 500;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}

.filter-tab:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

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

.search-box {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.search-input {
    flex: 1;
    min-width: 250px;
    padding: 10px 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
}

.search-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.search-input::placeholder {
    color: var(--text-muted);
}

.groups-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.group-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
}

.group-cover {
    height: 120px;
    background: linear-gradient(135deg, var(--color-primary), #e55a2b);
    background-size: cover;
    background-position: center;
}

.group-cover-default {
    background: linear-gradient(135deg, #ff6b35, #e55a2b);
}

.group-card-content {
    padding: 20px;
}

.group-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-top: -40px;
    margin-bottom: 12px;
}

.group-avatar {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    border: 3px solid var(--bg-surface);
    object-fit: cover;
}

.group-avatar-default {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--color-primary);
    color: white;
    font-weight: 700;
    font-size: 20px;
}

.group-privacy-badge {
    font-size: 11px;
    padding: 4px 8px;
    background-color: var(--bg-elevated);
    border-radius: 6px;
    color: var(--text-muted);
}

.group-card-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.group-card-description {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    line-height: 1.5;
}

.group-card-stats {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.group-card-footer {
    margin-top: auto;
}

/* ========================================================================
   ADMIN PANEL
   ======================================================================== */
.admin-layout {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 20px;
    margin-top: 20px;
}

.admin-sidebar {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    position: sticky;
    top: 84px;
    height: fit-content;
}

.admin-sidebar-header h3 {
    margin-bottom: 20px;
    color: var(--text-primary);
}

.admin-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.admin-nav-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.admin-nav-link:hover,
.admin-nav-link.active {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.admin-nav-link .badge {
    background-color: var(--color-danger);
    color: white;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    display: flex;
    flex-direction: column;
    padding: 20px;
}

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

.stat-icon {
    font-size: 32px;
    margin-bottom: 12px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.stat-link {
    font-size: 13px;
    color: var(--color-primary);
    margin-top: auto;
}

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

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table thead {
    background-color: var(--bg-elevated);
}

.admin-table th,
.admin-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.admin-table th {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.admin-table td {
    color: var(--text-secondary);
    font-size: 14px;
}

.table-responsive {
    overflow-x: auto;
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
}

.badge-post { background-color: rgba(255, 107, 53, 0.1); color: var(--color-primary); }
.badge-comment { background-color: rgba(16, 185, 129, 0.1); color: var(--color-success); }
.badge-pending { background-color: rgba(245, 158, 11, 0.1); color: var(--color-warning); }
.badge-reviewing { background-color: rgba(255, 107, 53, 0.1); color: var(--color-primary); }
.badge-resolved { background-color: rgba(16, 185, 129, 0.1); color: var(--color-success); }

/* ========================================================================
   MESSAGING SYSTEM
   ======================================================================== */
.messages-page-wrapper {
    height: calc(100vh - 84px);
    display: flex;
    flex-direction: column;
    padding: 20px 0;
}

.messages-layout {
    display: grid;
    grid-template-columns: 360px 1fr;
    height: 100%;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

/* ── Conversations Sidebar ─────────────────────────────────────────────── */
.conversations-sidebar {
    display: flex;
    flex-direction: column;
    background-color: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    height: 100%;
    overflow: hidden;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.sidebar-header h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-header h2 .msg-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--color-primary), #e55a2b);
    border-radius: 8px;
    font-size: 14px;
}

.new-message-btn {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--color-primary), #e55a2b);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.3);
}

.new-message-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.4);
}

.new-message-btn:active {
    transform: translateY(0);
}

.conversations-search {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.conversations-search input {
    width: 100%;
    padding: 10px 14px 10px 38px;
    background-color: var(--bg-elevated);
    border: 1px solid transparent;
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.2s ease;
}

.conversations-search input:focus {
    outline: none;
    border-color: var(--color-primary);
    background-color: var(--bg-input);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.conversations-search input::placeholder {
    color: var(--text-muted);
}

.search-input-wrapper {
    position: relative;
}

.search-input-wrapper .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 14px;
    pointer-events: none;
}

.conversations-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    scrollbar-width: thin;
    scrollbar-color: var(--bg-hover) transparent;
}

.conversations-list::-webkit-scrollbar {
    width: 4px;
}

.conversations-list::-webkit-scrollbar-track {
    background: transparent;
}

.conversations-list::-webkit-scrollbar-thumb {
    background-color: var(--bg-hover);
    border-radius: 4px;
}

.conversation-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    color: inherit;
    position: relative;
    margin-bottom: 2px;
}

.conversation-item:hover {
    background-color: var(--bg-elevated);
    color: inherit;
}

.conversation-item.active {
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.12), rgba(255, 107, 53, 0.08));
    border: 1px solid rgba(255, 107, 53, 0.2);
}

.conversation-item .conv-avatar {
    position: relative;
    flex-shrink: 0;
}

.conversation-item .conv-avatar img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-color);
    transition: border-color 0.2s ease;
}

.conversation-item.active .conv-avatar img {
    border-color: var(--color-primary);
}

.conversation-item .conv-avatar .online-dot {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background: var(--color-success);
    border-radius: 50%;
    border: 2px solid var(--bg-surface);
}

.conversation-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.conversation-info .conv-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.conversation-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-time {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

.conversation-item.has-unread .conversation-time {
    color: var(--color-primary);
    font-weight: 600;
}

.conversation-info .conv-bottom-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.conversation-preview {
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.conversation-item.has-unread .conversation-preview {
    color: var(--text-secondary);
    font-weight: 500;
}

.unread-badge {
    flex-shrink: 0;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--color-primary), #e55a2b);
    color: white;
    font-size: 11px;
    font-weight: 700;
    border-radius: 10px;
    line-height: 1;
}

.conversations-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
    gap: 12px;
    height: 100%;
}

.conversations-empty .empty-icon {
    font-size: 48px;
    opacity: 0.4;
}

.conversations-empty p {
    font-size: 14px;
    max-width: 200px;
    line-height: 1.5;
}

/* ── Messages Main Area ────────────────────────────────────────────────── */
.messages-main {
    display: flex;
    flex-direction: column;
    height: 100%;
    background-color: var(--bg-body);
    overflow: hidden;
}

/* Empty State (No conversation selected) */
.empty-conversation {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
    gap: 16px;
}

.empty-conversation .empty-icon-wrapper {
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.1), rgba(255, 107, 53, 0.1));
    border-radius: 50%;
    margin-bottom: 8px;
}

.empty-conversation .empty-icon-wrapper .icon {
    font-size: 44px;
    opacity: 0.7;
}

.empty-conversation h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.empty-conversation p {
    font-size: 15px;
    color: var(--text-muted);
    max-width: 300px;
    line-height: 1.5;
    margin: 0;
}

.empty-conversation .btn {
    margin-top: 8px;
}

/* Chat Header */
.chat-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 24px;
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    min-height: 72px;
}

.chat-header .back-btn-mobile {
    display: none;
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    margin-right: 4px;
}

.chat-header .chat-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-color);
    flex-shrink: 0;
}

.chat-user-info {
    flex: 1;
    min-width: 0;
}

.chat-user-info h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-user-info .user-status {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
}

.chat-user-info .user-status .status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--color-success);
    flex-shrink: 0;
}

.chat-user-info .user-status .status-dot.online {
    background: var(--color-success);
}

.chat-user-info .user-status .status-dot.offline {
    background: #6b7280;
}

/* Conversation sidebar online dot */
.conv-avatar {
    position: relative;
    flex-shrink: 0;
}

.conv-online-dot {
    position: absolute;
    bottom: 1px;
    right: 1px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--color-success);
    border: 2px solid var(--bg-surface);
}

.chat-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}

.chat-action-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.chat-action-btn:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.chat-action-btn.danger:hover {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--color-danger);
}

/* Messages Container */
.messages-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    scrollbar-width: thin;
    scrollbar-color: var(--bg-hover) transparent;
}

.messages-container::-webkit-scrollbar {
    width: 5px;
}

.messages-container::-webkit-scrollbar-track {
    background: transparent;
}

.messages-container::-webkit-scrollbar-thumb {
    background-color: var(--bg-hover);
    border-radius: 5px;
}

/* Date Separator */
.message-date-separator {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 20px 0;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 500;
}

.message-date-separator::before,
.message-date-separator::after {
    content: '';
    flex: 1;
    height: 1px;
    background-color: var(--border-color);
}

/* Message Bubbles */
.message {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    max-width: 70%;
    animation: messageSlideIn 0.2s ease-out;
}

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

@keyframes slideUp {
    from { opacity: 0; transform: translate(-50%, 20px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

.message-sent {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-received {
    align-self: flex-start;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    margin-bottom: 4px;
}

.message-bubble {
    padding: 10px 16px;
    border-radius: 18px;
    position: relative;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    line-height: 1.5;
    max-width: 100%;
}

.message-sent .message-bubble {
    background: linear-gradient(135deg, var(--color-primary), #ff6b35);
    color: white;
    border-bottom-right-radius: 6px;
}

.message-received .message-bubble {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-bottom-left-radius: 6px;
}

.message-bubble p {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
}

.message-time {
    display: block;
    font-size: 10px;
    margin-top: 4px;
    opacity: 0.65;
}

.message-sent .message-time {
    text-align: right;
    color: rgba(255, 255, 255, 0.7);
}

.message-received .message-time {
    color: var(--text-muted);
}

/* Message Media */
.message-media {
    max-width: 280px;
    border-radius: 12px !important;
    margin-top: 6px;
    cursor: pointer;
    transition: opacity 0.2s ease;
    display: block;
}

.message-media:hover {
    opacity: 0.9;
}

/* ── Message Actions (Edit/Delete) ─────────────────────────────────────── */
.message-actions {
    display: none;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.message:hover .message-actions {
    display: flex;
}

.msg-action-btn {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s;
    padding: 0;
}

.msg-action-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.msg-action-btn.msg-delete-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--color-danger);
    border-color: rgba(239, 68, 68, 0.3);
}

/* ── Message Edit Mode ─────────────────────────────────────────────────── */
.message-edit-area {
    width: 100%;
    min-width: 200px;
}

.message-edit-area textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 8px;
    background: rgba(255,255,255,0.1);
    color: white;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    min-height: 36px;
    line-height: 1.5;
}

.message-received .message-edit-area textarea {
    background: var(--bg-input);
    border-color: var(--color-primary);
    color: var(--text-primary);
}

.message-edit-area textarea:focus {
    outline: none;
    border-color: rgba(255,255,255,0.5);
}

.message-received .message-edit-area textarea:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

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

.message-edit-actions button {
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

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

.edit-save-btn:hover {
    background: rgba(255,255,255,0.9);
}

.edit-cancel-btn {
    background: rgba(255,255,255,0.15);
    color: white;
}

.message-received .edit-save-btn {
    background: var(--color-primary);
    color: white;
}

.message-received .edit-cancel-btn {
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

/* ── Message Meta (time + edited badge) ────────────────────────────────── */
.message-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
}

.message-meta .message-time {
    margin-top: 0;
}

.message-edited-badge {
    font-size: 10px;
    opacity: 0.6;
    font-style: italic;
}

.message-file-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    margin-top: 6px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    text-decoration: none;
}

.message-sent .message-file-link {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

.message-sent .message-file-link:hover {
    background: rgba(255, 255, 255, 0.25);
    color: white;
}

.message-received .message-file-link {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.message-received .message-file-link:hover {
    background: var(--bg-hover);
}

/* Consecutive messages (same sender) — tighter spacing */
.message + .message-sent.message-sent,
.message-received + .message-received {
    margin-top: 2px;
}

/* ── Message Input Area ────────────────────────────────────────────────── */
.message-input-area {
    padding: 16px 24px 20px;
    background-color: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

.message-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    background-color: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 6px 6px 6px 16px;
    transition: all 0.2s ease;
}

.message-input-wrapper:focus-within {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
    background-color: var(--bg-input);
}

.file-attach-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    font-size: 18px;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
    margin-bottom: 2px;
}

.file-attach-btn:hover {
    color: var(--color-primary);
    background-color: rgba(255, 107, 53, 0.1);
}

.message-input-wrapper textarea {
    flex: 1;
    border: none;
    background: none;
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
    padding: 8px 0;
    resize: none;
    min-height: 20px;
    max-height: 120px;
    font-family: inherit;
}

.message-input-wrapper textarea:focus {
    outline: none;
    box-shadow: none;
}

.message-input-wrapper textarea::placeholder {
    color: var(--text-muted);
}

.send-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--color-primary), #ff6b35);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.4);
}

.send-btn:active {
    transform: scale(0.95);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* File Preview Bar */
.file-preview-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(255, 107, 53, 0.1);
    border-radius: 8px;
    font-size: 13px;
    color: var(--color-primary);
    font-weight: 500;
    margin-bottom: 2px;
}

.file-preview-bar span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 200px;
}

.file-preview-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    padding: 2px 4px;
    border-radius: 4px;
    line-height: 1;
    transition: all 0.2s ease;
}

.file-preview-remove:hover {
    color: var(--color-danger);
    background-color: rgba(239, 68, 68, 0.1);
}

/* ── New Message Modal Enhancements ────────────────────────────────────── */
.new-msg-modal .modal-content {
    max-width: 480px;
}

.user-search-results {
    max-height: 300px;
    overflow-y: auto;
    margin-top: 8px;
}

.user-search-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.user-search-item:hover {
    background-color: var(--bg-elevated);
    border-color: var(--border-color);
}

.user-search-item img {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-color);
}

.user-search-item .user-info {
    flex: 1;
    min-width: 0;
}

.user-search-item .user-info .name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}

.user-search-item .user-info .username {
    font-size: 12px;
    color: var(--text-muted);
}

/* ── Typing Indicator ──────────────────────────────────────────────────── */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 0;
    font-size: 12px;
    color: var(--text-muted);
}

.typing-dots {
    display: flex;
    gap: 3px;
}

.typing-dots span {
    width: 5px;
    height: 5px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* ── Responsive Messages ───────────────────────────────────────────────── */
@media (max-width: 900px) {
    .messages-page-wrapper {
        height: calc(100vh - 70px);
        padding: 0;
    }

    .messages-layout {
        grid-template-columns: 1fr;
        border-radius: 0;
        border: none;
    }

    .conversations-sidebar {
        border-right: none;
    }

    .conversations-sidebar.hidden-mobile {
        display: none;
    }

    .messages-main.hidden-mobile {
        display: none;
    }

    .chat-header .back-btn-mobile {
        display: flex;
    }

    .message {
        max-width: 85%;
    }

    .chat-header {
        padding: 12px 16px;
    }

    .messages-container {
        padding: 16px;
    }

    .message-input-area {
        padding: 12px 16px 16px;
    }

    .conversation-item {
        padding: 10px 12px;
    }
}

@media (max-width: 480px) {
    .message-bubble {
        padding: 8px 12px;
        border-radius: 14px;
    }

    .message-sent .message-bubble {
        border-bottom-right-radius: 4px;
    }

    .message-received .message-bubble {
        border-bottom-left-radius: 4px;
    }

    .message-bubble p {
        font-size: 13px;
        word-break: break-word;
    }

    .message-input-wrapper {
        border-radius: 12px;
        padding: 4px 4px 4px 12px;
    }

    .send-btn {
        width: 36px;
        height: 36px;
        border-radius: 10px;
    }
}

/* ========================================================================
   MODAL
   ======================================================================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: none;
}

.modal.show {
    display: block;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    position: relative;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    padding: 0;
}

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

.modal-content .form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.modal-content .form-control,
.modal-content select,
.modal-content textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background-color: var(--bg-input);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.modal-content .form-control:focus,
.modal-content select:focus,
.modal-content textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.15);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2,
.modal-header h3 {
    font-size: 20px;
    color: var(--text-primary);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.modal-content form {
    padding: 20px;
}

/* Report Modal - Select and Option Dark Styling */
#reportModal select,
#reportModal .form-control,
.modal-content select.form-control,
.modal-content select {
    background-color: var(--bg-elevated) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color);
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
    cursor: pointer;
}

#reportModal select option,
.modal-content select option {
    background-color: var(--bg-elevated) !important;
    color: var(--text-primary) !important;
    padding: 8px 12px;
}

#reportModal select:focus,
.modal-content select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.15);
    outline: none;
}

#reportModal textarea,
#reportModal .form-control[type="text"] {
    background-color: var(--bg-elevated) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color);
}

#reportModal textarea::placeholder {
    color: var(--text-muted);
}

.modal-body {
    padding: 20px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

/* ========================================================================
   UTILITIES
   ======================================================================== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state p {
    margin-bottom: 20px;
}

/* ========================================================================
   RESPONSIVE
   ======================================================================== */
@media (max-width: 1200px) {
    .feed-layout {
        grid-template-columns: 200px 1fr;
    }
    
    .sidebar-right {
        display: none;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    .feed-layout,
    .admin-layout {
        grid-template-columns: 1fr;
    }
    
    .sidebar,
    .admin-sidebar {
        position: static;
    }
    
    .header-nav {
        display: none;
    }
    
    .user-name {
        display: none;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .filter-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .filter-tab {
        white-space: nowrap;
    }
    
    .search-box {
        width: 100%;
    }
    
    .search-input {
        min-width: 100%;
    }
    
    /* Create post responsive */
    .post-composer {
        flex-direction: column;
    }
    
    .post-composer .user-avatar {
        align-self: flex-start;
    }
    
    .post-actions-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .post-options {
        flex-direction: column;
        width: 100%;
    }
    
    .post-option-btn,
    .group-select {
        width: 100%;
        justify-content: center;
    }
    
    .post-submit-btn {
        width: 100%;
    }
    
    /* Media grid responsive */
    .media-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .groups-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* ========================================================================
   FOOTER
   ======================================================================== */
.site-footer {
    background-color: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    padding: 20px 0;
    margin-top: 40px;
}

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

.footer-right {
    display: flex;
    gap: 12px;
    align-items: center;
}

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

@media (max-width: 768px) {
    .footer-content {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }
}

/* ========================================
   PROFESSIONAL PROFILE PAGE STYLES
   ======================================== */

.profile-layout {
    max-width: 1100px;
    margin: 0 auto;
}

.profile-header.card {
    padding: 0;
    overflow: hidden;
    border-radius: 16px;
    margin-bottom: 24px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

.profile-cover {
    height: 220px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: relative;
    overflow: hidden;
}

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

.profile-info-container {
    display: flex;
    align-items: flex-start;
    gap: 24px;
    padding: 0 32px 24px;
    position: relative;
    flex-wrap: wrap;
}

.profile-avatar-wrapper {
    position: relative;
    margin-top: -50px;
    flex-shrink: 0;
}

.profile-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 4px solid var(--bg-primary, #fff);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    object-fit: cover;
    background: var(--bg-primary, #fff);
}

.verified-badge {
    position: absolute;
    bottom: 8px;
    right: 4px;
    width: 28px;
    height: 28px;
    background: #ff6b35;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    border: 3px solid var(--bg-primary, #fff);
    box-shadow: 0 2px 6px rgba(255, 107, 53, 0.4);
}

.profile-details {
    flex: 1;
    min-width: 0;
    padding-top: 12px;
}

.profile-name-row {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.profile-name {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.2;
}

.profile-username {
    font-size: 15px;
    color: var(--text-muted);
    font-weight: 400;
}

.profile-bio {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 8px 0 12px;
    max-width: 600px;
}

.profile-meta-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 8px;
}

.profile-meta-grid .meta-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: var(--text-muted);
}

.profile-meta-grid .meta-item a {
    color: var(--accent-primary, #ff6b35);
    text-decoration: none;
}

.profile-meta-grid .meta-item a:hover {
    text-decoration: underline;
}

.profile-actions {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding-top: 16px;
    flex-shrink: 0;
}

.profile-actions .btn {
    border-radius: 10px;
    padding: 10px 22px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.profile-actions .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Stats Bar */
.profile-stats-bar {
    display: flex;
    border-top: 1px solid var(--border-light, #e5e7eb);
    padding: 0;
}

.profile-stats-bar .stat-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px 8px;
    gap: 2px;
    transition: background 0.2s ease;
    border-right: 1px solid var(--border-light, #e5e7eb);
}

.profile-stats-bar .stat-item:last-child {
    border-right: none;
}

.profile-stats-bar .stat-item:hover {
    background: var(--bg-hover, rgba(0, 0, 0, 0.02));
}

.profile-stats-bar .stat-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.profile-stats-bar .stat-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

/* Profile Content Layout */
.profile-content-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 24px;
    align-items: start;
}

/* Sidebar */
.profile-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: sticky;
    top: 20px;
}

.sidebar-card {
    border-radius: 14px;
    padding: 20px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.sidebar-card h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-light, #e5e7eb);
}

.about-info p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0 0 12px;
}

.about-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    font-size: 14px;
    color: var(--text-secondary);
}

.about-icon {
    flex-shrink: 0;
    width: 20px;
    text-align: center;
}

.empty-text {
    font-size: 14px;
    color: var(--text-muted);
    font-style: italic;
}

/* Profile Groups List */
.profile-groups-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.profile-groups-list .group-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.profile-groups-list .group-item:hover {
    background: var(--bg-hover, rgba(0, 0, 0, 0.03));
    transform: translateX(2px);
}

.group-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #e0e7ff, #c7d2fe);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.group-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.group-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.group-meta {
    font-size: 12px;
    color: var(--text-muted);
}

.see-all-link {
    display: block;
    text-align: center;
    padding: 10px;
    font-size: 13px;
    color: var(--accent-primary, #ff6b35);
    text-decoration: none;
    font-weight: 500;
    border-radius: 8px;
    transition: background 0.2s ease;
}

.see-all-link:hover {
    background: var(--bg-hover, rgba(255, 107, 53, 0.05));
}

/* Social Links */
.social-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.social-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 10px;
    text-decoration: none;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    border: 1px solid var(--border-color);
}

.social-link:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.social-link svg {
    flex-shrink: 0;
}

.social-link.facebook:hover {
    background: #1877f2;
    color: white;
    border-color: #1877f2;
}

.social-link.twitter:hover {
    background: #1da1f2;
    color: white;
    border-color: #1da1f2;
}

.social-link.instagram:hover {
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    color: white;
    border-color: #dc2743;
}

.social-link.linkedin:hover {
    background: #0077b5;
    color: white;
    border-color: #0077b5;
}

.social-link.github:hover {
    background: #333;
    color: white;
    border-color: #333;
}

/* Profile Posts Header */
.profile-posts-header {
    border-radius: 14px;
    padding: 16px 20px;
    margin-bottom: 16px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.profile-posts-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    border-radius: 14px;
}

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

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

.empty-state p {
    font-size: 14px;
    color: var(--text-muted);
    margin: 0 0 20px;
}

/* Profile Page Post Cards */
.profile-main .post-card {
    border-radius: 14px;
    margin-bottom: 16px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    transition: box-shadow 0.2s ease;
}

.profile-main .post-card:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* Responsive Profile */
@media (max-width: 900px) {
    .profile-content-layout {
        grid-template-columns: 1fr;
    }

    .profile-sidebar {
        position: static;
        order: 2;
    }

    .profile-main {
        order: 1;
    }
}

@media (max-width: 640px) {
    .profile-info-container {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 0 16px 20px;
    }

    .profile-avatar-wrapper {
        margin-top: -50px;
    }

    .profile-name-row {
        justify-content: center;
        flex-direction: column;
        align-items: center;
        gap: 4px;
    }

    .profile-name {
        font-size: 22px;
    }

    .profile-meta-grid {
        justify-content: center;
    }

    .profile-actions {
        justify-content: center;
        padding-top: 12px;
    }

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

    .profile-cover {
        height: 160px;
    }

    .profile-avatar {
        width: 100px;
        height: 100px;
    }
}
/* ========================================================================
   COMPREHENSIVE MOBILE RESPONSIVE DESIGN
   ======================================================================== */
@media (max-width: 768px) {
    /* Container */
    .container {
        padding: 0 12px;
    }

    /* Header */
    .header-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--bg-surface);
        border-top: 1px solid var(--border-color);
        flex-direction: column;
        padding: 10px;
        box-shadow: var(--shadow-md);
    }

    .header-nav.show {
        display: flex;
    }

    .nav-link {
        width: 100%;
        text-align: left;
        padding: 12px 16px;
    }

    /* Mobile Menu Toggle */
    .mobile-menu-toggle {
        display: block;
        background: none;
        border: none;
        font-size: 24px;
        cursor: pointer;
        color: var(--text-primary);
        padding: 8px;
    }

    /* Posts and Cards */
    .post-card, .card {
        border-radius: 0;
        margin-left: -12px;
        margin-right: -12px;
    }

    .post-header {
        flex-wrap: wrap;
    }

    .post-footer {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .post-stats {
        justify-content: space-around;
        gap: 12px;
        padding-bottom: 8px;
        border-bottom: 1px solid var(--border-color);
    }
    
    .post-actions {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
        width: 100%;
    }

    .action-btn {
        font-size: 12px;
        padding: 8px 10px;
        justify-content: center;
        white-space: nowrap;
    }
    
    .action-btn .icon {
        font-size: 16px;
    }

    /* Forms */
    .form-row {
        flex-direction: column;
    }

    .form-group {
        width: 100%;
    }

    /* Buttons */
    .btn {
        width: 100%;
        justify-content: center;
    }

    .btn-group {
        flex-direction: column;
        gap: 8px;
    }

    /* Groups Grid */
    .groups-grid {
        grid-template-columns: 1fr;
    }

    /* Stats Grid */
    .stats-grid {
        grid-template-columns: 1fr !important;
    }

    /* Tables */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        font-size: 13px;
    }

    /* Modal */
    .modal-content {
        width: 95%;
        max-height: 80vh;
    }

    /* Profile */
    .profile-layout {
        padding: 0;
    }

    .profile-header {
        margin: 0 -12px;
        border-radius: 0;
    }

    .profile-meta-grid {
        flex-wrap: wrap;
    }

    /* Edit Profile */
    .edit-profile-page {
        padding: 15px 0;
    }

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

    .cover-photo {
        height: 200px;
    }

    .avatar-section {
        flex-direction: column;
        text-align: center;
        padding: 20px;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn {
        width: 100%;
    }

    /* Admin Tables */
    .admin-table-container {
        overflow-x: auto;
    }

    .admin-table {
        min-width: 600px;
    }

    /* Filters Bar */
    .filters-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 480px) {
    /* Typography */
    h1 {
        font-size: 24px;
    }

    h2 {
        font-size: 20px;
    }

    h3 {
        font-size: 18px;
    }

    /* Header */
    .site-logo {
        font-size: 20px;
    }

    .logo-image {
        height: 32px;
    }

    .logo-text {
        font-size: 20px;
    }

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

    /* Profile */
    .profile-name {
        font-size: 20px !important;
    }

    .profile-stats-bar {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .stat-value {
        font-size: 16px;
    }

    .stat-label {
        font-size: 11px;
    }

    /* Post Media */
    .post-media img,
    .post-media video {
        border-radius: 8px;
    }
    
    /* Lightbox Mobile */
    .lightbox-content {
        max-width: 100vw;
        max-height: 100vh;
        padding: 10px;
    }
    
    .lightbox-close {
        top: 10px;
        right: 10px;
        width: 35px;
        height: 35px;
        font-size: 20px;
    }
    
    .lightbox-nav {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
    
    .lightbox-prev {
        left: 10px;
    }
    
    .lightbox-next {
        right: 10px;
    }
    
    .lightbox-counter {
        bottom: 10px;
        font-size: 12px;
        padding: 6px 12px;
    }
}
/* ========================================================================
   MENTION SYSTEM
   ======================================================================== */

/* Mention Dropdown */
.mention-dropdown {
    position: fixed;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    max-height: 300px;
    overflow-y: auto;
    z-index: 10000;
    min-width: 250px;
    display: none;
}

.mention-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.mention-item:hover,
.mention-item.selected {
    background: var(--bg-hover);
}

.mention-item img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.mention-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 4px;
}

.mention-name .verified-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    background: var(--color-primary);
    color: white;
    border-radius: 50%;
    font-size: 10px;
    font-weight: bold;
}

/* Highlighted Mentions in Content */
.mention {
    color: var(--color-primary);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mention:hover {
    text-decoration: underline;
    color: var(--color-primary-hover);
}

/* Scrollbar for mention dropdown */
.mention-dropdown::-webkit-scrollbar {
    width: 6px;
}

.mention-dropdown::-webkit-scrollbar-track {
    background: transparent;
}

.mention-dropdown::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.mention-dropdown::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* ========================================================================
   FOOTER STYLES (Bootstrap-like utilities)
   ======================================================================== */
.container-fluid {
    width: 100%;
    padding-right: 15px;
    padding-left: 15px;
    margin-right: auto;
    margin-left: auto;
}

.bg-dark {
    background-color: #1a1a1a !important;
}

.text-white {
    color: #ffffff !important;
}

.text-primary {
    color: var(--color-primary) !important;
}

.text-uppercase {
    text-transform: uppercase !important;
}

.py-5 {
    padding-top: 3rem !important;
    padding-bottom: 3rem !important;
}

.py-4 {
    padding-top: 1.5rem !important;
    padding-bottom: 1.5rem !important;
}

.pt-5 {
    padding-top: 3rem !important;
}

.px-sm-3 {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
}

.px-lg-5 {
    padding-left: 3rem !important;
    padding-right: 3rem !important;
}

.px-md-5 {
    padding-left: 3rem !important;
    padding-right: 3rem !important;
}

.mb-2 {
    margin-bottom: 0.5rem !important;
}

.mb-3 {
    margin-bottom: 1rem !important;
}

.mb-4 {
    margin-bottom: 1.5rem !important;
}

.mb-5 {
    margin-bottom: 3rem !important;
}

.mb-md-0 {
    margin-bottom: 0 !important;
}

.mt-4 {
    margin-top: 1.5rem !important;
}

.mr-2 {
    margin-right: 0.5rem !important;
}

.m-0 {
    margin: 0 !important;
}

.row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -15px;
    margin-left: -15px;
}

.col-lg-6,
.col-lg-5,
.col-lg-7,
.col-md-6,
.col-md-12 {
    position: relative;
    width: 100%;
    padding-right: 15px;
    padding-left: 15px;
}

@media (min-width: 768px) {
    .col-md-6 {
        flex: 0 0 50%;
        max-width: 50%;
    }
    .col-md-12 {
        flex: 0 0 100%;
        max-width: 100%;
    }
    .text-md-left {
        text-align: left !important;
    }
    .text-md-right {
        text-align: right !important;
    }
}

@media (min-width: 992px) {
    .col-lg-5 {
        flex: 0 0 41.666667%;
        max-width: 41.666667%;
    }
    .col-lg-6 {
        flex: 0 0 50%;
        max-width: 50%;
    }
    .col-lg-7 {
        flex: 0 0 58.333333%;
        max-width: 58.333333%;
    }
}

.d-flex {
    display: flex !important;
}

.flex-column {
    flex-direction: column !important;
}

.justify-content-start {
    justify-content: flex-start !important;
}

.d-inline-flex {
    display: inline-flex !important;
}

.text-center {
    text-align: center !important;
}

.border-top {
    border-top: 1px solid #dee2e6 !important;
}

.btn {
    display: inline-block;
    font-weight: 400;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    user-select: none;
    border: 1px solid transparent;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    border-radius: 0.25rem;
    transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    cursor: pointer;
    text-decoration: none;
}

.btn-outline-light {
    color: #f8f9fa;
    border-color: #f8f9fa;
    background-color: transparent;
}

.btn-outline-light:hover {
    color: #212529;
    background-color: #f8f9fa;
    border-color: #f8f9fa;
}

.btn-square {
    width: 38px;
    height: 38px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.nav {
    display: flex;
    flex-wrap: wrap;
    padding-left: 0;
    margin-bottom: 0;
    list-style: none;
}

.nav-item {
    display: list-item;
}

.nav-link {
    display: block;
    padding: 0.5rem 1rem;
    text-decoration: none;
    transition: color 0.15s ease-in-out;
}

.nav-link:hover {
    text-decoration: none;
}

.py-0 {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

/* Footer specific styles */
.container-fluid a.text-white:hover {
    color: var(--color-primary) !important;
    text-decoration: none;
}

.container-fluid h5 {
    font-weight: 600;
}

.container-fluid p {
    margin-bottom: 0.5rem;
}

.container-fluid .fa,
.container-fluid .fab {
    margin-right: 0.5rem;
}

/* ========================================================================
   ALERT MESSAGES
   ======================================================================== */
.alert {
    padding: 16px 0;
    margin-bottom: 0;
    font-size: 15px;
    font-weight: 500;
    animation: slideDown 0.3s ease-out;
    position: relative;
    z-index: 1000;
}

.alert .container {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
}

.alert-success {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    color: white;
    border-bottom: 3px solid #065f46;
}

.alert-error {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    color: white;
    border-bottom: 3px solid #991b1b;
}

.alert-icon {
    font-size: 20px;
    line-height: 1;
}

.alert-message {
    flex: 1;
}

.alert-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    padding: 0 8px;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.alert-close:hover {
    opacity: 1;
}

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

/* ========================================================================
   MARKDOWN EDITOR & RENDERED CONTENT
   ======================================================================== */

/* Markdown Toolbar */
.md-toolbar {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 6px 8px;
    background: var(--bg-elevated, #1a1a2e);
    border: 1px solid var(--border-color, #2a2a4a);
    border-bottom: none;
    border-radius: 10px 10px 0 0;
    flex-wrap: wrap;
}
.md-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted, #8b8da3);
    cursor: pointer;
    padding: 5px 8px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;
    line-height: 1;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 30px;
}
.md-btn:hover {
    background: rgba(255, 107, 53, 0.15);
    color: var(--color-primary, #ff6b35);
    border-color: rgba(255, 107, 53, 0.3);
}
.md-btn code {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 11px;
    background: none;
    padding: 0;
    color: inherit;
}
.md-separator {
    width: 1px;
    height: 20px;
    background: var(--border-color, #2a2a4a);
    margin: 0 4px;
}
.md-preview-toggle {
    margin-left: auto;
    padding: 5px 12px;
    font-size: 12px;
    min-width: auto;
    background: rgba(255, 107, 53, 0.1);
    border: 1px solid rgba(255, 107, 53, 0.2);
    color: var(--color-primary, #ff6b35);
}
.md-preview-toggle:hover {
    background: rgba(255, 107, 53, 0.2);
}
.md-toolbar + .post-textarea {
    border-radius: 0 0 10px 10px;
}
.md-preview-box {
    padding: 16px;
    background: var(--bg-input, #0d0d1a);
    border: 1px solid var(--border-color, #2a2a4a);
    border-radius: 0 0 10px 10px;
    min-height: 80px;
    max-height: 400px;
    overflow-y: auto;
    color: var(--text-primary, #e8e8f0);
    font-size: 14px;
    line-height: 1.7;
}

/* Rendered Markdown Content */
.post-text h1, .post-text h2, .post-text h3, .post-text h4, .post-text h5, .post-text h6,
.md-preview-box h1, .md-preview-box h2, .md-preview-box h3, .md-preview-box h4 {
    color: var(--text-primary, #e8e8f0);
    margin: 16px 0 8px 0;
    font-weight: 700;
    line-height: 1.3;
}
.post-text h1, .md-preview-box h1 { font-size: 1.6em; border-bottom: 1px solid var(--border-color); padding-bottom: 8px; }
.post-text h2, .md-preview-box h2 { font-size: 1.35em; border-bottom: 1px solid var(--border-color); padding-bottom: 6px; }
.post-text h3, .md-preview-box h3 { font-size: 1.15em; }
.post-text h4, .md-preview-box h4 { font-size: 1em; }

.post-text p, .md-preview-box p {
    margin: 0 0 12px 0;
    line-height: 1.7;
}
.post-text p:last-child, .md-preview-box p:last-child { margin-bottom: 0; }

.post-text strong, .md-preview-box strong { color: var(--text-primary, #e8e8f0); font-weight: 700; }
.post-text em, .md-preview-box em { font-style: italic; }
.post-text del, .md-preview-box del { text-decoration: line-through; opacity: 0.7; }

.post-text a, .md-preview-box a {
    color: var(--color-primary, #ff6b35);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}
.post-text a:hover, .md-preview-box a:hover { border-bottom-color: var(--color-primary, #ff6b35); }

/* Inline code */
.post-text code, .md-preview-box code {
    background: rgba(255, 107, 53, 0.1);
    color: #f472b6;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
    font-size: 0.88em;
    border: 1px solid rgba(255, 107, 53, 0.15);
}

/* Code blocks */
.post-text pre, .md-preview-box pre {
    background: #0d1117;
    border: 1px solid rgba(255, 107, 53, 0.2);
    border-radius: 10px;
    padding: 16px;
    overflow-x: auto;
    margin: 12px 0;
    position: relative;
}
.post-text pre code, .md-preview-box pre code {
    background: none !important;
    border: none !important;
    padding: 0 !important;
    color: #e6edf3;
    font-size: 13px;
    line-height: 1.6;
    display: block;
    white-space: pre;
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
}

/* highlight.js language label */
.post-text pre code[class*="language-"]::before,
.md-preview-box pre code[class*="language-"]::before {
    content: attr(data-lang);
    position: absolute;
    top: 6px;
    right: 80px;
    font-size: 11px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Ensure hljs doesn't override our background */
.post-text pre code.hljs, .md-preview-box pre code.hljs {
    background: transparent !important;
    padding: 0 !important;
}

/* Code copy button */
.code-copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    color: #8b949e;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 2;
}
.code-copy-btn:hover {
    background: rgba(255,255,255,0.15);
    color: #e6edf3;
}

/* Blockquotes */
.post-text blockquote, .md-preview-box blockquote {
    border-left: 3px solid var(--color-primary, #ff6b35);
    margin: 12px 0;
    padding: 8px 16px;
    background: rgba(255, 107, 53, 0.05);
    border-radius: 0 8px 8px 0;
    color: var(--text-secondary, #a0a3bd);
}
.post-text blockquote p, .md-preview-box blockquote p { margin-bottom: 4px; }

/* Lists */
.post-text ul, .post-text ol, .md-preview-box ul, .md-preview-box ol {
    margin: 8px 0;
    padding-left: 24px;
}
.post-text li, .md-preview-box li {
    margin: 4px 0;
    line-height: 1.6;
}

/* Tables */
.post-text table, .md-preview-box table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
    font-size: 14px;
}
.post-text th, .post-text td, .md-preview-box th, .md-preview-box td {
    border: 1px solid var(--border-color, #2a2a4a);
    padding: 8px 12px;
    text-align: left;
}
.post-text th, .md-preview-box th {
    background: var(--bg-elevated, #1a1a2e);
    font-weight: 600;
}

/* Horizontal rule */
.post-text hr, .md-preview-box hr {
    border: none;
    border-top: 1px solid var(--border-color, #2a2a4a);
    margin: 16px 0;
}

/* Images in markdown */
.post-text img, .md-preview-box img {
    max-width: 100%;
    border-radius: 8px;
    margin: 8px 0;
}
