/* Reset & Base - Thêm viewport meta */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #0f0f0f;
    color: #ffffff;
    overflow: hidden;
    height: 100vh;
    width: 100%;
    position: fixed;
}

/* App Container - Responsive Base */
.app-container {
    display: flex;
    height: 100vh;
    width: 100%;
    background: #1a1a1a;
    position: relative;
}

/* Sidebar Left */
.sidebar-left {
    width: 300px;
    min-width: 300px;
    background: #1f1f1f;
    border-right: 1px solid #2a2a2a;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #2a2a2a;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.channel-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px;
}

.sidebar-footer {
    padding: 15px;
    border-top: 1px solid #2a2a2a;
    flex-shrink: 0;
}

/* Main Chat */
.main-chat {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: #1a1a1a;
    height: 100vh;
    overflow: hidden;
}

.chat-header {
    padding: 20px;
    border-bottom: 1px solid #2a2a2a;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #1f1f1f;
    flex-shrink: 0;
    flex-wrap: wrap;
    gap: 10px;
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
    scroll-behavior: smooth;
}

.chat-input-area {
    padding: 20px;
    border-top: 1px solid #2a2a2a;
    background: #1f1f1f;
    flex-shrink: 0;
}

/* Sidebar Right */
.sidebar-right {
    width: 300px;
    min-width: 300px;
    background: #1f1f1f;
    border-left: 1px solid #2a2a2a;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.info-header {
    padding: 20px;
    border-bottom: 1px solid #2a2a2a;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.info-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
}

/* Messages Responsive */
.message {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    animation: fadeIn 0.3s ease;
}

.message-own {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.message-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.message-content {
    max-width: 70%;
    min-width: 0;
}

.message-own .message-content {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.message-text {
    background: #2a2a2a;
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
    line-height: 1.5;
    word-break: break-word;
}

.message-own .message-text {
    background: #0084ff;
    color: #fff;
}

.message-media {
    max-width: 400px;
    border-radius: 12px;
    overflow: hidden;
}

.message-media img,
.message-media video {
    width: 100%;
    height: auto;
    display: block;
    cursor: pointer;
}

/* Input Group */
.input-group {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    background: #2a2a2a;
    border-radius: 25px;
    padding: 5px 10px;
}

#messageInput {
    background: transparent;
    border: none;
    color: #fff;
    resize: none;
    padding: 10px 0;
    font-size: 15px;
    line-height: 1.5;
    min-height: 40px;
    max-height: 150px;
    width: 100%;
    outline: none;
}

#messageInput:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Upload Area */
.upload-area {
    padding: 10px 20px;
    background: #1a1a1a;
    border-bottom: 1px solid #2a2a2a;
    max-height: 200px;
    overflow-y: auto;
}

.upload-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    background: #2a2a2a;
    border-radius: 8px;
    margin-bottom: 8px;
}

/* Guest Message */
.guest-message {
    text-align: center;
    padding: 15px;
    background: #2a2a2a;
    border-radius: 10px;
    color: #a0a0a0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    padding: 5px 10px;
}

/* Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 5;
}

.sidebar-overlay.active {
    display: block;
}

/* Responsive Media Queries trong chat.css */
@media (max-width: 1024px) and (min-width: 768px) {
    .sidebar-left {
        width: 80px;
        min-width: 80px;
    }
    
    .sidebar-left .channel-name,
    .sidebar-left .channel-preview,
    .sidebar-left .sidebar-header h3,
    .sidebar-left .user-name,
    .sidebar-left .btn-block {
        display: none;
    }
    
    .sidebar-left .channel-item {
        justify-content: center;
        padding: 12px;
    }
    
    .sidebar-left .channel-avatar {
        margin-right: 0;
    }
    
    .sidebar-left .channel-info {
        display: none;
    }
    
    .sidebar-right {
        width: 250px;
        min-width: 250px;
    }
}

@media (max-width: 991px) {
    .mobile-menu-toggle {
        display: block;
    }
    
    .sidebar-left {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 280px;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 100;
        box-shadow: 2px 0 10px rgba(0,0,0,0.3);
    }
    
    .sidebar-left.active {
        transform: translateX(0);
    }
    
    .sidebar-right {
        position: fixed;
        right: 0;
        top: 0;
        bottom: 0;
        width: 300px;
        transform: translateX(100%);
        transition: transform 0.3s ease;
        z-index: 100;
        box-shadow: -2px 0 10px rgba(0,0,0,0.3);
    }
    
    .sidebar-right.active {
        transform: translateX(0);
    }
}

@media (max-width: 767px) {
    .chat-header {
        padding: 12px 15px;
    }
    
    .chat-header h2 {
        font-size: 16px;
    }
    
    .channel-title h2 {
        font-size: 16px;
    }
    
    .channel-description {
        font-size: 12px;
    }
    
    .messages-container {
        padding: 12px 10px;
    }
    
    .message-avatar {
        width: 32px;
        height: 32px;
    }
    
    .message-content {
        max-width: 85%;
    }
    
    .message-text {
        padding: 8px 12px;
        font-size: 14px;
    }
    
    .message-media {
        max-width: 220px;
    }
    
    .chat-input-area {
        padding: 10px;
    }
    
    .input-group {
        padding: 4px 8px;
    }
    
    #messageInput {
        font-size: 14px;
    }
    
    .btn-icon {
        width: 36px;
        height: 36px;
    }
}

@media (max-width: 575px) {
    .message:not(.message-own) .message-avatar {
        display: none;
    }
    
    .message-own .message-avatar {
        display: none;
    }
    
    .message-content {
        max-width: 100%;
    }
    
    .attachment-buttons {
        display: none;
    }
    
    .chat-header {
        padding: 10px;
    }
    
    .sidebar-left {
        width: 260px;
    }
    
    .sidebar-right {
        width: 280px;
    }
}