/* CC Community Styles - Matching Main Site Design */

:root {
    --primary-color: #0A84FF;
    --secondary-color: #5E5CE6;
    --accent-color: #FF453A;
    --success-color: #30D158;
    --doctor-badge-color: #34C759;
    --text-primary: #FFFFFF;
    --text-secondary: #98989D;
    --background-primary: #000000;
    --background-secondary: #1C1C1E;
    --background-tertiary: #2C2C2E;
    --border-color: #38383A;
    --shadow-light: 0 2px 10px rgba(0, 0, 0, 0.3);
    --shadow-medium: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-heavy: 0 8px 40px rgba(0, 0, 0, 0.6);
    --border-radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--background-primary);
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Navigation */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    transition: var(--transition);
}

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

.nav-logo h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary-color);
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
    align-items: center;
}

.nav-link {
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 400;
    font-size: 1rem;
    transition: var(--transition);
    position: relative;
}

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

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary-color);
    border-radius: 1px;
}

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

.notification-badge {
    position: relative;
}

.notification-badge::after {
    content: attr(data-count);
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--accent-color);
    color: white;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 0.7rem;
    font-weight: 600;
}

/* Main Content */
main {
    margin-top: 70px;
    min-height: calc(100vh - 70px);
}

/* Auth Pages */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 70px);
    padding: 40px 20px;
}

.auth-card {
    background: var(--background-secondary);
    border-radius: var(--border-radius);
    padding: 40px;
    width: 100%;
    max-width: 450px;
    box-shadow: var(--shadow-medium);
    border: 1px solid var(--border-color);
}

.auth-card h1 {
    font-size: 2rem;
    margin-bottom: 10px;
    text-align: center;
}

.auth-card p {
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 30px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 0.9rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--background-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.1);
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox-group input[type="checkbox"] {
    width: auto;
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary:hover {
    background: #0066CC;
    transform: translateY(-1px);
}

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

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

.btn-secondary:hover {
    background: rgba(10, 132, 255, 0.1);
}

.auth-switch {
    text-align: center;
    margin-top: 20px;
    color: var(--text-secondary);
}

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

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

/* Dashboard */
.dashboard-container {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 20px;
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.sidebar {
    background: var(--background-secondary);
    border-radius: var(--border-radius);
    padding: 20px;
    height: fit-content;
    position: sticky;
    top: 90px;
    border: 1px solid var(--border-color);
}

.sidebar-menu {
    list-style: none;
}

.sidebar-menu li {
    margin-bottom: 10px;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 8px;
    transition: var(--transition);
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background: var(--background-tertiary);
    color: var(--primary-color);
}

.sidebar-menu .icon {
    font-size: 1.2rem;
}

.main-content {
    background: var(--background-secondary);
    border-radius: var(--border-radius);
    padding: 30px;
    border: 1px solid var(--border-color);
}

/* Cards */
.card {
    background: var(--background-tertiary);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-light);
}

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

.card-title {
    font-size: 1.2rem;
    font-weight: 600;
}

.card-body {
    color: var(--text-secondary);
}

/* User Info */
.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

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

.user-details {
    flex: 1;
}

.user-name {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.doctor-badge {
    background: var(--doctor-badge-color);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
}

.user-meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Tags */
.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 10px 0;
}

.tag {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.tag-diagnosis { background: rgba(94, 92, 230, 0.2); color: #8B89F5; }
.tag-treatment { background: rgba(10, 132, 255, 0.2); color: #5AC8FA; }
.tag-research { background: rgba(48, 209, 88, 0.2); color: #32D74B; }
.tag-support { background: rgba(255, 159, 10, 0.2); color: #FF9F0A; }
.tag-fontan { background: rgba(255, 69, 58, 0.2); color: #FF453A; }

.tag:hover {
    transform: translateY(-1px);
    opacity: 0.8;
}

/* Thread List */
.thread-list {
    list-style: none;
}

.thread-item {
    background: var(--background-tertiary);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 15px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
}

.thread-item:hover {
    border-color: var(--primary-color);
    transform: translateX(4px);
}

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

.thread-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.thread-excerpt {
    color: var(--text-secondary);
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.thread-meta {
    display: flex;
    gap: 20px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Messages */
.message-container {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 20px;
    height: calc(100vh - 130px);
}

.conversation-list {
    background: var(--background-secondary);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    overflow-y: auto;
}

.conversation-item {
    display: flex;
    gap: 12px;
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
}

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

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

.conversation-info {
    flex: 1;
    overflow: hidden;
}

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

.conversation-preview {
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.chat-window {
    background: var(--background-secondary);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.chat-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.message-bubble {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.message-bubble.own {
    flex-direction: row-reverse;
}

.message-bubble img {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    object-fit: cover;
}

.message-content {
    max-width: 60%;
    background: var(--background-tertiary);
    padding: 12px 16px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
}

.message-bubble.own .message-content {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.message-text {
    margin-bottom: 5px;
}

.message-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.chat-input {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 12px;
}

.chat-input input {
    flex: 1;
    padding: 12px 16px;
    background: var(--background-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    color: var(--text-primary);
    font-size: 1rem;
}

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

.chat-input button {
    padding: 12px 24px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 24px;
    cursor: pointer;
    transition: var(--transition);
}

.chat-input button:hover {
    background: #0066CC;
}

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

.group-card {
    background: var(--background-tertiary);
    border-radius: var(--border-radius);
    padding: 20px;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.group-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-4px);
    box-shadow: var(--shadow-medium);
}

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

.group-name {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.group-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 15px;
}

.group-stats {
    display: flex;
    gap: 20px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Profile */
.profile-container {
    max-width: 800px;
    margin: 0 auto;
}

.profile-header {
    display: flex;
    gap: 30px;
    align-items: center;
    margin-bottom: 30px;
    padding: 30px;
    background: var(--background-tertiary);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.profile-avatar {
    position: relative;
}

.profile-avatar img {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary-color);
}

.profile-avatar input[type="file"] {
    display: none;
}

.profile-avatar label {
    position: absolute;
    bottom: 0;
    right: 0;
    background: var(--primary-color);
    color: white;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.profile-avatar label:hover {
    background: #0066CC;
}

.profile-info h1 {
    margin-bottom: 8px;
}

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

.profile-stats {
    display: flex;
    gap: 30px;
}

.stat {
    text-align: center;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary-color);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Search Bar */
.search-bar {
    position: relative;
    margin-bottom: 20px;
}

.search-bar input {
    width: 100%;
    padding: 12px 16px 12px 45px;
    background: var(--background-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: var(--transition);
}

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

.search-bar .icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    font-size: 0.95rem;
}

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

.btn-icon {
    width: 35px;
    height: 35px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

/* Loading Spinner */
.spinner {
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--background-secondary);
    border-radius: var(--border-radius);
    padding: 30px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-heavy);
}

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

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
}

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

/* User Search Results */
#userSearchResults {
    border-radius: 8px;
}

#userSearchResults::-webkit-scrollbar {
    width: 8px;
}

#userSearchResults::-webkit-scrollbar-track {
    background: var(--background-tertiary);
    border-radius: 4px;
}

#userSearchResults::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

#userSearchResults::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

.user-search-result {
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.user-search-result:hover {
    background: var(--background-secondary) !important;
    border-color: var(--primary-color) !important;
    transform: translateX(4px);
}

.user-search-result:active {
    transform: translateX(4px) scale(0.98);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 90px;
    right: 20px;
    z-index: 3000;
}

.toast {
    background: var(--background-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 16px 20px;
    margin-bottom: 10px;
    min-width: 300px;
    box-shadow: var(--shadow-medium);
    animation: slideIn 0.3s ease-out;
}

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

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

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

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Responsive Design */
@media (max-width: 1024px) {
    .dashboard-container {
        grid-template-columns: 200px 1fr;
    }

    .message-container {
        grid-template-columns: 250px 1fr;
    }
}

@media (max-width: 768px) {
    .dashboard-container {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: relative;
        top: 0;
    }

    .message-container {
        grid-template-columns: 1fr;
    }

    .conversation-list {
        display: none;
    }

    .conversation-list.mobile-show {
        display: block;
        position: fixed;
        top: 70px;
        left: 0;
        width: 100%;
        height: calc(100vh - 70px);
        z-index: 1500;
    }

    .groups-grid {
        grid-template-columns: 1fr;
    }

    .profile-header {
        flex-direction: column;
        text-align: center;
    }
}

/* Media Upload & Display */
.file-upload-area {
    position: relative;
}

.file-upload-area.drag-active {
    border: 2px dashed var(--primary-color);
    background: rgba(10, 132, 255, 0.05);
    border-radius: 8px;
    padding: 10px;
}

.media-preview-container {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.media-preview {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--background-tertiary);
    border: 2px solid var(--border-color);
    transition: var(--transition);
}

.media-preview:hover {
    border-color: var(--primary-color);
    transform: scale(1.02);
}

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

.media-preview-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9), transparent);
    padding: 8px;
    font-size: 0.7rem;
    display: flex;
    flex-direction: column;
}

.media-preview-name {
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

.media-preview-size {
    color: var(--text-secondary);
    font-size: 0.65rem;
}

.media-preview-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: bold;
    transition: var(--transition);
    z-index: 10;
}

.media-preview-remove:hover {
    background: #FF1F10;
    transform: scale(1.1);
}

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

/* Upload Progress */
.upload-progress-container {
    padding: 12px;
    background: var(--background-tertiary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.upload-progress-bar {
    width: 100%;
    height: 8px;
    background: var(--background-secondary);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.upload-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 4px;
    transition: width 0.3s ease;
}

.upload-progress-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-align: center;
}

/* Chat Input with Attachment */
.chat-input-container {
    border-top: 1px solid var(--border-color);
}

.chat-attachment-preview {
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--background-tertiary);
}

.chat-attachment-preview:empty {
    display: none;
}

.chat-input {
    padding: 20px;
    display: flex;
    gap: 12px;
    align-items: center;
}

.chat-input .btn-icon {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    transition: var(--transition);
}

.chat-input .btn-icon:hover {
    background: var(--background-tertiary);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* Message Media Display */
.message-media {
    margin-top: 8px;
    border-radius: 12px;
    overflow: hidden;
    max-width: 400px;
}

.message-media-image {
    width: 100%;
    height: auto;
    display: block;
    cursor: pointer;
    transition: var(--transition);
    border-radius: 12px;
}

.message-media-image:hover {
    opacity: 0.9;
    transform: scale(1.02);
}

.message-media-video {
    width: 100%;
    max-height: 400px;
    display: block;
    border-radius: 12px;
}

/* Media Gallery (for posts with multiple images) */
.media-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.media-gallery .message-media {
    margin: 0;
    max-width: 100%;
}

.media-gallery .message-media-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.media-gallery .message-media-video {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

/* Single item in gallery */
.media-gallery:has(.message-media:only-child) {
    grid-template-columns: 1fr;
}

.media-gallery:has(.message-media:only-child) .message-media-image {
    height: auto;
    max-height: 500px;
    object-fit: contain;
}

/* Two items in gallery */
.media-gallery:has(.message-media:nth-child(2):last-child) {
    grid-template-columns: repeat(2, 1fr);
}

/* Lightbox */
.media-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5000;
    display: none;
    align-items: center;
    justify-content: center;
}

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

.media-lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
}

.media-lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    z-index: 5001;
}

.media-lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    z-index: 5002;
}

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

.media-lightbox-media {
    display: flex;
    align-items: center;
    justify-content: center;
}

.media-lightbox-media img {
    max-width: 90vw;
    max-height: 90vh;
    width: auto;
    height: auto;
    border-radius: 8px;
    box-shadow: var(--shadow-heavy);
}

.media-lightbox-media video {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: var(--shadow-heavy);
}

/* Thread Media Gallery */
.thread-media-gallery,
.reply-media-gallery {
    margin-top: 20px;
}

/* Responsive Media */
@media (max-width: 768px) {
    .media-preview {
        width: 100px;
        height: 100px;
    }

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

    .media-gallery .message-media-image,
    .media-gallery .message-media-video {
        height: 150px;
    }

    .message-media {
        max-width: 100%;
    }

    .media-lightbox-media img,
    .media-lightbox-media video {
        max-width: 95vw;
        max-height: 95vh;
    }

    .chat-attachment-preview {
        padding: 8px 12px;
    }
}

/* Utility Classes */
.text-center { text-align: center; }
.text-secondary { color: var(--text-secondary); }
.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }
.mt-20 { margin-top: 20px; }
.hidden { display: none; }
.flex { display: flex; }
.flex-center { display: flex; justify-content: center; align-items: center; }
.gap-10 { gap: 10px; }
.gap-20 { gap: 20px; }
