:root {
    --primary-color: #405DE6;
    --secondary-color: #5851DB;
    --accent-color: #833AB4;
    --background: #fafafa;
    --card-bg: #ffffff;
    --text-primary: #262626;
    --text-secondary: #8e8e8e;
    --border-color: #dbdbdb;
    --error-color: #ed4956;
    --success-color: #00c853;
    --like-color: #ed4956;
}

/* Dark mode colors */
body[data-theme="dark"] {
    --background: #000000;
    --card-bg: #121212;
    --text-primary: #ffffff;
    --text-secondary: #a8a8a8;
    --border-color: #262626;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.5;
    padding-bottom: 60px;
}

/* Navigation */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    z-index: 100;
}

.nav-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 20px;
    font-weight: 600;
}

.nav-logo i {
    color: var(--primary-color);
}

.nav-actions {
    display: flex;
    gap: 12px;
}

.nav-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-primary);
    padding: 4px;
}

/* Main Content */
.main-content {
    max-width: 600px;
    margin: 60px auto 0;
    padding: 16px;
    min-height: calc(100vh - 120px);
}

/* Post Card */
.post-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 16px;
}

.post-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    gap: 12px;
}

.post-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(45deg, var(--primary-color), var(--accent-color));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
}

.post-avatar.clickable {
    cursor: pointer;
    transition: transform 0.2s;
}

.post-avatar.clickable:hover {
    transform: scale(1.05);
}

.post-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.post-user-info {
    flex: 1;
}

.post-username {
    font-weight: 600;
    font-size: 14px;
}

.post-username.clickable {
    cursor: pointer;
    transition: color 0.2s;
}

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

.clickable-username {
    cursor: pointer;
    transition: color 0.2s;
}

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

.username.clickable {
    cursor: pointer;
    transition: color 0.2s;
}

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

.comment-username.clickable-username:hover,
.post-detail-caption-content .clickable-username:hover {
    text-decoration: underline;
}

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

.post-media {
    width: 100%;
    max-height: 600px;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.post-media img,
.post-media video {
    width: 100%;
    height: auto;
    display: block;
}

.post-media img.media-crop,
.post-media video.media-crop {
    object-fit: cover;
    aspect-ratio: 4 / 3;
    width: 100%;
    height: auto;
    max-height: 500px;
}

.post-media img.media-fit,
.post-media video.media-fit {
    object-fit: contain;
    height: auto;
    width: 100%;
    max-height: 600px;
}

.post-media .aspect-ratio-toggle {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: background 0.2s;
}

.post-media .aspect-ratio-toggle:hover {
    background: rgba(0, 0, 0, 0.8);
}

.post-actions {
    padding: 8px 16px;
    display: flex;
    gap: 16px;
    position: relative;
}

.post-mentions-btn {
    position: absolute;
    left: 16px;
    bottom: 8px;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s;
    z-index: 10;
}

.post-mentions-btn:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
}

.post-mentions-btn.hidden {
    display: none;
}

.action-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-primary);
    padding: 4px;
    transition: transform 0.1s;
}

.action-btn:active {
    transform: scale(0.9);
}

.action-btn.liked {
    color: var(--like-color);
    animation: likeAnimation 0.3s ease;
}

@keyframes likeAnimation {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

.post-likes {
    padding: 0 16px;
    font-size: 14px;
    font-weight: 600;
}

.post-caption {
    padding: 8px 16px;
    font-size: 14px;
}

.post-caption .username {
    font-weight: 600;
    margin-right: 4px;
}

.view-comments {
    padding: 0 16px 12px;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    padding: 8px 0;
    z-index: 100;
}

.bottom-nav-btn {
    background: none;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 12px;
    padding: 4px 12px;
}

.bottom-nav-btn i {
    font-size: 24px;
}

.bottom-nav-btn.active {
    color: var(--text-primary);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--card-bg);
    border-radius: 12px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-header h2 {
    font-size: 18px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--text-primary);
    padding: 0;
    line-height: 1;
}

.modal-body {
    padding: 16px;
}

/* Settings Modal */
.settings-modal-content {
    max-width: 600px;
}

.settings-section {
    margin-bottom: 28px;
}

.settings-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border-color);
}

.settings-section-header i {
    font-size: 20px;
    color: var(--primary-color);
}

.settings-section-header h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
}

.settings-divider {
    height: 1px;
    background: var(--border-color);
    margin: 32px 0;
}

.profile-picture-upload {
    display: flex;
    align-items: center;
    gap: 24px;
}

.current-profile-picture {
    flex-shrink: 0;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--border-color);
    background: var(--card-bg);
}

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

.profile-picture-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color), #e91e63);
    color: white;
    font-size: 40px;
}

.profile-picture-actions {
    flex: 1;
}

.settings-hint {
    font-size: 12px;
    color: var(--text-secondary);
    margin: 8px 0 0 0;
}

.theme-selector {
    display: grid;
    gap: 12px;
    grid-template-columns: 1fr 1fr;
}

.theme-option {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 16px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--card-bg);
}

.theme-option:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(88, 81, 219, 0.15);
}

.theme-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.theme-option-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.theme-icon-wrapper {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    font-size: 24px;
    transition: all 0.2s;
}

.light-theme-icon {
    background: #fff4e6;
    color: #f59e0b;
}

.dark-theme-icon {
    background: #1e293b;
    color: #60a5fa;
}

.theme-option-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

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

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

.theme-check {
    position: absolute;
    top: 12px;
    right: 12px;
    font-size: 20px;
    color: var(--primary-color);
    opacity: 0;
    transition: opacity 0.2s;
}

.theme-option input[type="radio"]:checked ~ .theme-check {
    opacity: 1;
}

.theme-option input[type="radio"]:checked ~ .theme-option-content .theme-icon-wrapper {
    background: var(--primary-color);
    color: white;
}

.settings-section .form-group {
    margin-bottom: 20px;
    position: relative;
}

.settings-section .form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.settings-section .form-group label i {
    font-size: 14px;
    color: var(--primary-color);
}

.settings-section .form-group input,
.settings-section .form-group textarea {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    background: var(--card-bg);
    color: var(--text-primary);
    transition: all 0.2s;
}

.settings-section .form-group input:focus,
.settings-section .form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(88, 81, 219, 0.1);
}

.settings-section .form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.char-count {
    position: absolute;
    right: 12px;
    bottom: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    pointer-events: none;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

.btn-small {
    padding: 8px 16px;
    font-size: 13px;
}

/* Permission Warnings */
.permission-warnings {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.permission-warning {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 10px;
    color: #856404;
    font-size: 14px;
}

body[data-theme="dark"] .permission-warning {
    background: rgba(255, 193, 7, 0.15);
    border-color: rgba(255, 193, 7, 0.3);
    color: #ffc107;
}

.permission-warning i {
    font-size: 18px;
    flex-shrink: 0;
}

.permission-warning span {
    flex: 1;
    line-height: 1.4;
}

/* Post Detail Modal */
.post-modal-content {
    max-width: 1200px;
    width: 95vw;
    max-height: 85vh;
    padding: 0;
    display: flex;
    flex-direction: column;
    background-color: black;
}

.post-modal-content .modal-close {
    position: absolute;
    top: 60px;
    right: 25px;
    z-index: 10;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.post-detail-container {
    display: flex;
    height: 100%;
    overflow: hidden;
    position: relative;
}

.post-detail-media {
    flex: 1;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 65%;
    position: relative;
}

.post-detail-media img,
.post-detail-media video {
    max-width: 100%;
    max-height: 95vh;
    object-fit: contain;
}

.aspect-ratio-toggle {
    display: none;
}

.post-detail-caption-overlay {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    /* background: linear-gradient(to top, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0.4), transparent); */
    padding: 48px 16px 16px;
    z-index: 10;
}

.post-detail-caption-content {
    color: white;
    font-size: 14px;
    line-height: 1.5;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.post-detail-caption-content strong {
    font-weight: 600;
    margin-right: 4px;
}

.post-detail-sidebar {
    width: 35%;
    min-width: 335px;
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
}

.post-detail-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
}

.post-options-btn {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    color: var(--text-primary);
}

.post-options-menu {
    position: absolute;
    top: 50px;
    right: 16px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 100;
    min-width: 200px;
}

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

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

.post-option-item.delete {
    color: var(--error-color);
}

.post-option-item i {
    width: 20px;
}

.post-detail-comments {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.post-detail-actions {
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    background: var(--card-bg);
}

.post-detail-actions .action-buttons {
    display: flex;
    gap: 16px;
    margin-bottom: 8px;
}

.post-detail-actions .post-likes {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
}

.post-detail-actions .post-time {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.post-detail-add-comment {
    padding: 16px;
    display: flex;
    gap: 8px;
    align-items: center;
}

.post-detail-add-comment input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 14px;
}

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

.btn-link:disabled {
    opacity: 0.3;
}

/* Mobile Post Detail */
@media (max-width: 768px) {
    .post-modal-content {
        max-width: 100vw;
        width: 100vw;
        height: 95vh;
        border-radius: 20px;
        padding: 0;
    }
    
    /* Improve video controls on mobile */
    .post-detail-media video {
        width: 100%;
        height: 100%;
        object-fit: contain
    }
    
    .post-detail-media video::-webkit-media-controls-panel {
        background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
    }
    
    .modal-close {
        position: fixed;
        top: 12px;
        right: 12px;
        z-index: 100;
        color: white;
        font-size: 28px;
        width: 44px;
        height: 44px;
        background: rgba(0, 0, 0, 0.6);
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
    }
    
    .post-detail-container {
        flex-direction: column;
        position: relative;
        height: auto;
        min-height: 70vh;
    }
    
    .post-detail-media {
        max-width: 100%;
        width: 100%;
        height: auto;
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .post-detail-media img,
    .post-detail-media video {
        width: 100%;
        height: auto;
    }
    
    .post-detail-media img.media-crop,
    .post-detail-media video.media-crop {
        object-fit: cover;
        aspect-ratio: 3 / 6;
        width: 100%;
        height: auto;
    }
    
    .post-detail-media img.media-fit,
    .post-detail-media video.media-fit {
        object-fit: contain !important;
        height: auto;
        width: 100%;
        max-height: 80vh;
    }
    
    .aspect-ratio-toggle {
        position: absolute;
        top: 60px;
        left: 12px;
        width: 44px;
        height: 44px;
        border-radius: 50%;
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        border: none;
        color: white;
        font-size: 18px;
        cursor: pointer;
        z-index: 20;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: background 0.2s, transform 0.2s;
    }
    
    .aspect-ratio-toggle:active {
        transform: scale(1.1);
        background: rgba(0, 0, 0, 0.7);
    }
    
    /* .post-detail-caption-overlay {
        position: absolute;
        bottom: 70px;
        left: 1px;
        padding: 40px 16px 12px;
        max-height: 35vh;
        overflow-y: auto;
        background: linear-gradient(to top, rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0.5), transparent);
    } */
    
    /* .post-detail-caption-content {
        font-size: 13px;
        line-height: 1.4;
    } */
    
    /* Floating action buttons for mobile */
    .post-detail-actions {
        position: fixed;
        bottom: 70px;
        right: 25px;
        background: transparent;
        border: none;
        padding: 0;
        z-index: 15;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 20px;
    }
    
    .post-detail-actions .action-buttons {
        flex-direction: column;
        gap: 8px;
        margin: 0;
        align-items: center;
    }
    
    .post-detail-actions .action-btn {
        color: white;
        font-size: 26px;
        background: rgba(0, 0, 0, 0.3);
        border: none;
        cursor: pointer;
        padding: 0;
        width: 48px;
        height: 48px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.6));
        transition: transform 0.2s, background 0.2s;
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
    }
    
    .post-detail-actions .action-btn:active {
        transform: scale(1.15);
        background: rgba(0, 0, 0, 0.5);
    }
    
    .post-detail-actions .action-btn.liked {
        color: #ed4956;
    }
    
    .post-detail-actions .post-likes {
        color: white;
        font-size: 13px;
        font-weight: 600;
        text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
        margin: 0;
        text-align: center;
        order: 2;
    }
    
    .post-detail-actions .post-detail-like-btn {
        order: 1;
    }
    
    .post-detail-actions #toggleCommentsBtn {
        order: 3;
    }
    
    .post-detail-actions .post-time {
        display: none;
    }
    
    .post-detail-sidebar {
        position: fixed;
        bottom: 0px;
        left: 0;
        right: 0;
        width: 100%;
        min-width: unset;
        max-height: 80vh;
        transform: translateY(calc(100% + 60px));
        transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 25;
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.3);
        background: white;
        display: flex;
        flex-direction: column;
    }
    
    .post-detail-sidebar.show-mobile {
        transform: translateY(0);
    }
    
    /* Handle bar for mobile sheet */
    .post-detail-sidebar::before {
        content: '';
        position: absolute;
        top: 12px;
        left: 50%;
        transform: translateX(-50%);
        width: 36px;
        height: 4px;
        background: #ddd;
        border-radius: 2px;
    }
    
    .post-detail-header {
        display: flex;
        padding: 24px 16px 12px;
        border-bottom: 1px solid var(--border-color);
    }
    
    .post-detail-header .post-username {
        font-weight: 600;
        font-size: 14px;
    }
    
    .post-options-btn {
        padding: 12px;
        font-size: 20px;
    }
    
    .post-options-menu {
        top: auto;
        bottom: 60px;
        right: 8px;
        min-width: 180px;
        max-width: 90vw;
    }
    
    .post-option-item {
        padding: 16px;
        font-size: 15px;
    }
    
    .post-detail-comments {
        flex: 1;
        overflow-y: auto;
        max-height: calc(80vh - 180px);
        padding: 16px;
        min-height: 250px;
        -webkit-overflow-scrolling: touch;
    }
    
    .post-detail-add-comment {
        border-top: 1px solid var(--border-color);
        padding: 12px 16px;
        background: white;
    }
    
    .post-detail-add-comment input {
        background: #f0f0f0;
        border-radius: 20px;
        padding: 8px 16px;
    }
    
    /* Feed post media on mobile */
    .post-media {
        max-height: 600px;
    }
    
    .post-media img.media-crop,
    .post-media video.media-crop {
        aspect-ratio: 3 / 6;
        max-height: 500px;
    }
    
    .post-media img.media-fit,
    .post-media video.media-fit {
        max-height: 500px;
    }
}

/* Smaller phones */
@media (max-width: 480px) {
    .post-detail-caption-overlay {
        bottom: 50px;
        left: 12px;
        max-height: 30vh;
    }
    
    .post-detail-caption-content {
        font-size: 15px;
    }
    
    .aspect-ratio-toggle {
        width: 40px;
        height: 40px;
        font-size: 16px;
        top: 10px;
    }
    
    .post-detail-actions {
        bottom: 70px;
        gap: 16px;
        right: 25px;
    }
    
    .post-detail-actions .action-btn {
        width: 44px;
        height: 44px;
        font-size: 24px;
    }
    
    .post-detail-actions .post-likes {
        font-size: 15px;
    }
    
    .post-options-menu {
        right: 4px;
        min-width: 160px;
    }
}

/* Tablet landscape */
@media (min-width: 769px) and (max-width: 1024px) {
    .post-modal-content {
        max-width: 90vw;
        max-height: 90vh;
    }
    
    .post-detail-media {
        max-width: 60%;
    }
    
    .post-detail-sidebar {
        width: 40%;
        min-width: 300px;
    }
}

/* Upload Modal */
.upload-modal-content {
    max-width: 600px;
    width: 90vw;
}

.upload-step {
    min-height: 300px;
}

.upload-source-options {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 20px 0;
}

.upload-source-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 32px 24px;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
}

.upload-source-btn:hover {
    border-color: var(--primary-color);
    background: rgba(88, 81, 219, 0.05);
    transform: translateY(-2px);
}

.upload-source-btn i {
    font-size: 48px;
    color: var(--primary-color);
}

/* Camera/Recording UI */
.camera-container {
    position: relative;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 3/5;
}

#cameraPreview {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.camera-controls {
    position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    padding: 0 20px;
}

.btn-capture {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: white;
    border: 4px solid #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.btn-capture:hover {
    transform: scale(1.1);
}

.btn-capture.recording {
    background: #ff0000;
    border-color: #ff0000;
}

.btn-capture i {
    font-size: 24px;
    color: #ff0000;
}

.btn-capture.recording i {
    color: white;
}

.recording-indicator {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(255, 0, 0, 0.9);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    animation: pulse 1.5s infinite;
}

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

/* Preview Step */
.upload-preview-container {
    position: relative;
    margin-bottom: 20px;
}

.upload-preview-media {
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    max-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-preview-media img,
.upload-preview-media video {
    max-width: 100%;
    max-height: 400px;
    display: block;
}

.btn-change-file {
    margin-top: 12px;
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    margin-right: auto;
}

.btn-change-file:hover {
    background: var(--background);
}

/* Progress Bar */
.upload-progress {
    margin: 20px 0;
}

.progress-bar {
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    text-align: center;
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

.upload-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.upload-actions .btn-primary,
.upload-actions .btn-secondary {
    flex: 1;
}

/* Mention Tags in Upload */
.mention-tags-container {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px;
    background: var(--card-bg);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.mention-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.mention-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--primary-color);
    color: white;
    border-radius: 16px;
    font-size: 14px;
}

.mention-tag-remove {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.mention-tag-remove:hover {
    background: rgba(255, 255, 255, 0.2);
}

.mention-search-input {
    flex: 1;
    min-width: 150px;
    border: none;
    background: none;
    outline: none;
    padding: 4px;
    font-size: 14px;
    color: var(--text-primary);
}

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

.mention-search-results {
    position: relative;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
    /* width: calc(100% - 32px); */
    margin-bottom: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.mention-search-result-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.mention-search-result-item:hover {
    background: var(--background);
}

.mention-search-result-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    margin-right: 10px;
}

.mention-search-result-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.mention-search-result-avatar-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color), #e91e63);
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
    border-radius: 50%;
}

.mention-search-result-username {
    font-weight: 500;
    color: var(--text-primary);
}

body[data-theme="dark"] .mention-search-result-item:hover {
    background: #1a1a1a;
}

/* Upload */
.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.3s;
}

.upload-area:hover {
    border-color: var(--primary-color);
}

.upload-area i {
    font-size: 48px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.upload-preview {
    text-align: center;
    margin-bottom: 16px;
}

.upload-preview img,
.upload-preview video {
    max-width: 100%;
    max-height: 400px;
    border-radius: 8px;
    margin-bottom: 12px;
}

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

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

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

/* Buttons */
.btn-primary {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    font-size: 14px;
}

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

.btn-secondary {
    background: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-size: 14px;
}

.btn-block {
    width: 100%;
}

/* Comments */
.comments-list {
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 16px;
}

.comment-item {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.comment-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(45deg, var(--primary-color), var(--accent-color));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.comment-content {
    flex: 1;
}

.comment-username {
    font-weight: 600;
    font-size: 14px;
}

.comment-text {
    font-size: 14px;
    margin-top: 4px;
}

.comment-time {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.comment-form {
    display: flex;
    gap: 8px;
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
}

.comment-form input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 14px;
}

.comment-form button {
    padding: 8px 16px;
}

/* Profile */
.profile-header {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 16px;
    text-align: center;
    position: relative;
}

.btn-back {
    position: absolute;
    top: 16px;
    left: 16px;
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-primary);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

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

.btn-back {
    position: absolute;
    top: 16px;
    left: 16px;
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-primary);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

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

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(45deg, var(--primary-color), var(--accent-color));
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 32px;
    font-weight: 600;
}

.profile-username {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 4px;
}

.profile-bio {
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.profile-stats {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 16px;
}

.profile-stat {
    text-align: center;
}

.profile-stat-clickable {
    cursor: pointer;
    transition: transform 0.2s ease;
}

.profile-stat-clickable:hover {
    transform: scale(1.05);
}

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

.profile-stat-label {
    font-size: 14px;
    color: var(--text-secondary);
}

.profile-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 8px;
}

.profile-actions .btn-primary,
.profile-actions .btn-secondary {
    flex: 1;
    max-width: 150px;
}

.profile-header .btn-primary,
.profile-header .btn-secondary {
    margin-top: 8px;
}

.profile-header .btn-primary i,
.profile-header .btn-secondary i {
    margin-right: 4px;
}

.profile-posts {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2px;
}

.profile-post-item {
    aspect-ratio: 1;
    overflow: hidden;
    cursor: pointer;
    position: relative;
}

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

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

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

/* Followers/Following List */
.followers-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    padding-top: 80px;
}

@media (min-width: 769px) {
    .followers-container {
        padding-top: 20px;
    }
}

.followers-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.followers-header h2 {
    margin: 0;
    flex: 1;
    font-size: 1.5rem;
}

.users-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.user-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--card-bg);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.user-list-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.user-list-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    cursor: pointer;
}

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

.user-list-avatar .avatar-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color), #e91e63);
    color: white;
    font-weight: 600;
    font-size: 1.2rem;
}

.user-list-info {
    flex: 1;
    cursor: pointer;
    min-width: 0;
}

.user-list-username {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-list-name {
    font-size: 0.875rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-small {
    padding: 6px 16px;
    font-size: 0.875rem;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
}

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

.empty-state i {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 1.1rem;
    margin: 0;
}

/* Loading */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Toast */
.toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-primary);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 3000;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
}

.toast.error {
    background: var(--error-color);
}

.toast.success {
    background: var(--success-color);
}

/* Auth Pages */
.auth-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 16px;
}

.auth-container {
    max-width: 350px;
    width: 100%;
}

.auth-box {
    background: rgba(245, 245, 245, 0.95);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 32px;
    padding-top: 16px;
    box-shadow: 0 0 10px 10px rgba(0, 0, 0, 0.1);
}

.auth-logo {
    text-align: center;
    margin-bottom: 10px;
}

.auth-logo i {
    font-size: 48px;
    color: var(--primary-color);
}

.auth-logo h1 {
    font-size: 32px;
    margin-top: 8px;
}

.auth-form h2 {
    text-align: center;
    margin-bottom: 24px;
    font-size: 20px;
}

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

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

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

/* Responsive */
@media (max-width: 600px) {
    .post-card {
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
    
    .main-content {
        padding: 0;
    }
}

/* Explore Grid */
.explore-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2px;
}

.explore-item {
    aspect-ratio: 1;
    overflow: hidden;
    cursor: pointer;
    position: relative;
}

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

.video-indicator {
    position: absolute;
    top: 8px;
    right: 8px;
    color: white;
    font-size: 20px;
    text-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
}

/* Dark mode specific enhancements */
body[data-theme="dark"] .post-modal-content {
    background-color: #000000;
}

body[data-theme="dark"] .modal-content {
    background: #1a1a1a;
    color: var(--text-primary);
}

body[data-theme="dark"] .upload-area {
    background: #262626;
    border-color: #3a3a3a;
}

body[data-theme="dark"] input,
body[data-theme="dark"] textarea {
    background: #262626;
    color: var(--text-primary);
    border-color: var(--border-color);
}

body[data-theme="dark"] input::placeholder,
body[data-theme="dark"] textarea::placeholder {
    color: #666;
}

body[data-theme="dark"] .empty-state {
    color: var(--text-secondary);
}

body[data-theme="dark"] .post-detail-sidebar {
    background: #1a1a1a;
}

body[data-theme="dark"] .post-detail-add-comment {
    background: #1a1a1a;
    border-top-color: var(--border-color);
}

body[data-theme="dark"] .post-detail-add-comment input {
    background: #262626;
}

body[data-theme="dark"] .comment {
    border-bottom-color: var(--border-color);
}

body[data-theme="dark"] .theme-option:hover {
    background: rgba(88, 81, 219, 0.1);
}

/* Messages/Chat UI */
.badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--error-color);
    color: white;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 11px;
    font-weight: 600;
    min-width: 18px;
    text-align: center;
}

.conversations-container {
    max-width: 600px;
    margin: 0 auto;
}

.conversations-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    background: var(--card-bg);
    position: sticky;
    top: 60px;
    z-index: 10;
}

.conversations-header h2 {
    font-size: 1.5rem;
    margin: 0;
}

.conversation-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s;
}

.conversation-item:hover {
    background: var(--background);
}

.conversation-avatar {
    position: relative;
    width: 56px;
    height: 56px;
    flex-shrink: 0;
    margin-right: 12px;
}

.conversation-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.avatar-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color), #e91e63);
    color: white;
    font-weight: 600;
    font-size: 1.2rem;
    border-radius: 50%;
}

.online-indicator {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    background: var(--success-color);
    border: 2px solid var(--card-bg);
    border-radius: 50%;
}

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

.conversation-username {
    font-weight: 600;
    margin-bottom: 4px;
}

.conversation-last-message {
    color: var(--text-secondary);
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

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

.unread-badge {
    background: var(--primary-color);
    color: white;
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
}

/* Chat Thread */
.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(90vh - 60px);
    max-width: 600px;
    margin: 0 auto;
    background: var(--card-bg);
}

.chat-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    background: var(--card-bg);
    position: sticky;
    top: 60px;
    z-index: 10;
}

.chat-header .btn-back {
    margin-right: 12px;
}

.chat-header-avatar {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    margin-right: 12px;
}

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

.chat-header-info {
    flex: 1;
}

.chat-header-username {
    font-weight: 600;
    font-size: 16px;
}

.chat-header-status {
    font-size: 12px;
    color: var(--text-secondary);
}

.chat-header-status.online {
    color: var(--success-color);
}

.typing-indicator-text {
    color: var(--primary-color);
    font-style: italic;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.message-wrapper.sent {
    flex-direction: row-reverse;
}

.message-bubble {
    position: relative;
    max-width: 70%;
    padding: 10px 14px;
    border-radius: 18px;
    word-wrap: break-word;
}

.message-react-btn {
    position: absolute;
    bottom: -8px;
    right: -8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.message-reply-btn {
    position: absolute;
    bottom: -8px;
    right: 24px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.message-bubble:hover .message-react-btn,
.message-bubble:hover .message-reply-btn {
    display: flex;
}

.message-reply-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: scale(1.1);
}

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

.message-react-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: scale(1.1);
}

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

/* Always show on mobile (touch devices) */
@media (hover: none) {
    .message-react-btn,
    .message-reply-btn {
        display: flex;
    }
}

.message-wrapper.received .message-bubble {
    background: var(--border-color);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

.message-wrapper.sent .message-bubble {
    background: var(--primary-color);
    color: white;
    border-bottom-right-radius: 4px;
}

.message-time {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.message-wrapper.sent .message-time {
    text-align: right;
}

.message-status {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.message-status.read {
    color: whitesmoke;
}

.chat-input-container {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0;
    border-top: 1px solid var(--border-color);
    background: var(--card-bg);
}

.reply-preview {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    background: var(--background);
    border-bottom: 1px solid var(--border-color);
}

.reply-preview-content {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    color: var(--text-secondary);
    font-size: 14px;
    overflow: hidden;
}

.reply-preview-content i {
    color: var(--primary-color);
}

.reply-preview-content span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.reply-preview-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
    font-size: 14px;
    transition: color 0.2s;
}

.reply-preview-close:hover {
    color: var(--text-primary);
}

.chat-input-container > div:last-child {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
}

.message-reply-preview {
    background: rgba(0, 0, 0, 0.1);
    padding: 6px 10px;
    margin-bottom: 6px;
    border-left: 3px solid var(--primary-color);
    border-radius: 4px;
    font-size: 13px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: flex;
    align-items: center;
}

.message-wrapper.sent .message-reply-preview {
    color: rgba(255, 255, 255, 0.8);
}

.chat-input {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid var(--border-color);
    border-radius: 24px;
    background: var(--background);
    color: var(--text-primary);
    font-size: 14px;
    resize: none;
    min-height: 40px;
    max-height: 120px;
    font-family: inherit;
}

.chat-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.chat-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.chat-send-btn:hover {
    background: var(--secondary-color);
    transform: scale(1.05);
}

.chat-send-btn:disabled {
    background: var(--border-color);
    cursor: not-allowed;
    transform: none;
}

.typing-dots {
    display: inline-flex;
    gap: 4px;
    padding: 10px 14px;
    background: var(--border-color);
    border-radius: 18px;
    border-bottom-left-radius: 4px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: var(--text-secondary);
    border-radius: 50%;
    animation: typingDot 1.4s infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingDot {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-10px);
    }
}

/* Message Reactions */
.message-wrapper {
    position: relative;
}

.message-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
    font-size: 14px;
}

.message-reaction {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px 6px;
    background: var(--background);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.message-reaction:hover {
    background: var(--border-color);
    transform: scale(1.05);
}

.message-reaction.user-reacted {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.message-reaction-emoji {
    font-size: 16px;
}

.message-reaction-count {
    font-size: 12px;
    font-weight: 500;
}

.reaction-picker {
    position: absolute;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 8px 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    gap: 4px;
    z-index: 1000;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.2s, transform 0.2s;
    pointer-events: none;
    /* Ensure it's above everything */
    will-change: opacity, transform;
    -webkit-tap-highlight-color: transparent;
}

.reaction-picker.show {
    opacity: 1;
    transform: scale(1);
    pointer-events: all;
}

.reaction-picker.above {
    bottom: 100%;
    margin-bottom: 8px;
    left: 50%;
    transform: translateX(-50%) scale(0.8);
}

.reaction-picker.above.show {
    transform: translateX(-50%) scale(1);
}

.reaction-picker.below {
    top: 100%;
    margin-top: 8px;
    left: 50%;
    transform: translateX(-50%) scale(0.8);
}

.reaction-picker.below.show {
    transform: translateX(-50%) scale(1);
}

.reaction-picker-emoji {
    font-size: 28px;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: transform 0.2s, background 0.2s;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    /* Ensure touch targets are large enough */
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.reaction-picker-emoji:active {
    transform: scale(1.3);
    background: var(--background);
}

/* Dark mode for messages */
body[data-theme="dark"] .conversation-item:hover {
    background: #1a1a1a;
}

body[data-theme="dark"] .message-wrapper.received .message-bubble {
    background: #262626;
}

body[data-theme="dark"] .typing-dots {
    background: #262626;
}

body[data-theme="dark"] .chat-input {
    background: #1a1a1a;
}

/* Search Styles */
.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--card-bg);
    z-index: 1000;
    display: none;
    flex-direction: column;
}

.search-overlay.show {
    display: flex;
}

.search-header {
    position: sticky;
    top: 0;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 10;
}

.search-back-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px;
}

.search-input-container {
    flex: 1;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--background);
    color: var(--text-primary);
    font-size: 14px;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.search-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.search-section {
    margin-bottom: 24px;
}

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

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

.search-user-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.search-user-item:hover {
    background: var(--background);
}

.search-user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: hidden;
    margin-right: 12px;
    flex-shrink: 0;
}

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

.search-user-avatar .avatar-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color), #e91e63);
    color: white;
    font-weight: 600;
    font-size: 1.2rem;
}

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

.search-user-username {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.search-user-fullname {
    font-size: 14px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-posts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2px;
}

.search-post-item {
    aspect-ratio: 1;
    position: relative;
    cursor: pointer;
    overflow: hidden;
    background: var(--border-color);
}

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

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

.search-post-item:hover .search-post-overlay {
    opacity: 1;
}

.search-post-stat {
    display: flex;
    align-items: center;
    gap: 6px;
}

body[data-theme="dark"] .search-user-item:hover {
    background: #1a1a1a;
}

/* Mentions Modal */
.mentions-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: flex-end;
}

.mentions-modal.show {
    display: flex;
}

.mentions-modal-content {
    width: 100%;
    max-height: 60vh;
    background: var(--card-bg);
    border-radius: 16px 16px 0 0;
    animation: slideUp 0.3s ease-out;
    overflow-y: auto;
}

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

.mentions-modal-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: var(--card-bg);
    z-index: 10;
}

.mentions-modal-title {
    font-size: 16px;
    font-weight: 600;
}

.mentions-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
}

.mentions-list {
    padding: 8px 0;
}

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

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

.mention-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 12px;
    flex-shrink: 0;
}

.mention-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

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

.mention-username {
    font-weight: 600;
    color: var(--text-primary);
}

body[data-theme="dark"] .mention-item:hover {
    background: #1a1a1a;
}

/* Confirmation Modal */
.confirm-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease;
}

.confirm-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.confirm-modal-content {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 32px;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
    text-align: center;
}

.confirm-modal-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(239, 68, 68, 0.2));
    display: flex;
    align-items: center;
    justify-content: center;
}

.confirm-modal-icon i {
    font-size: 28px;
    color: var(--error-color);
}

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

.confirm-modal-message {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 24px;
}

.confirm-modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.confirm-modal-actions button {
    flex: 1;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.confirm-modal-actions .btn-secondary {
    background: var(--background);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.confirm-modal-actions .btn-secondary:hover {
    background: var(--border-color);
    transform: translateY(-1px);
}

.confirm-modal-actions .btn-danger {
    background: var(--error-color);
    color: white;
}

.confirm-modal-actions .btn-danger:hover {
    background: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

body[data-theme="dark"] .confirm-modal-content {
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

body[data-theme="dark"] .confirm-modal-actions .btn-secondary {
    background: #1a1a1a;
    border-color: #262626;
}

body[data-theme="dark"] .confirm-modal-actions .btn-secondary:hover {
    background: #262626;
}


