@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@500&display=swap');

/* ============================================
   MODERN CHAT REDESIGN 2025
   ============================================ */

/* ============================================
   BASE CONTAINER
   ============================================ */
.container {
    position: fixed !important;
    padding: 2px !important;
}

/* Chat Room Container */
.chat-container {
    z-index: 5;
    position: relative;
    width: var(--msger-width);
    height: var(--msger-height);
    min-width: var(--msger-width);
    min-height: var(--msger-height);
    padding: 0;
    background: var(--msger-bg);
    border: var(--border);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    overflow: hidden;
    transition: all var(--transition-slow);
}

/* Chat Container Maximized State */
.chat-container.maximized {
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    border-radius: 0;
    border: none;
}

/* ============================================
   CHAT APP CONTAINER
   ============================================ */
.chat-app {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: var(--border-radius);
    overflow: hidden;
}

/* ============================================
   MOBILE PARTICIPANTS - HORIZONTAL SCROLL
   ============================================ */
.mobile-participants-horizontal {
    display: none;
    position: relative;
    width: 100%;
    height: 70px;
    background: var(--chat-panel-bg);
    border-bottom: var(--border);
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    z-index: 5;
    padding: 8px 12px;
    gap: 10px;
    flex-shrink: 0;
}

.mobile-participants-horizontal::-webkit-scrollbar {
    display: none;
}

.mobile-participant-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 65px;
    scroll-snap-align: start;
    cursor: pointer;
    transition: transform var(--transition-fast);
    background: transparent;
}

.mobile-participant-item > div {
    background: transparent;
}

.mobile-participant-item:active {
    transform: scale(0.95);
}

/* No active styles on mobile participants */
.mobile-participant-item.active {
    position: relative;
    background: transparent;
}

.mobile-participant-item.active > div {
    background: transparent;
}

.mobile-participant-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--border);
    margin-bottom: 4px;
    object-fit: cover;
    background: transparent;
}

/* Icon style for "All" chat */
.mobile-participant-avatar-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.15);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #2a2a2a !important;
    background-color: #2a2a2a !important;
    position: relative;
}

.mobile-participant-item > div > .mobile-participant-avatar-icon {
    background: #2a2a2a !important;
    background-color: #2a2a2a !important;
}

.mobile-participant-avatar-icon i {
    font-size: 18px;
    color: var(--text-primary) !important;
    background: transparent !important;
}

.mobile-participant-name {
    font-size: 11px;
    color: var(--text-primary);
    text-align: center;
    max-width: 65px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mobile-participant-status {
    position: absolute;
    top: 30px;
    right: 5px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--chat-panel-bg);
}

.mobile-participant-status.online {
    background-color: #25d366;
}

.mobile-participant-status.offline {
    background-color: #e47297;
}

/* ============================================
   PEOPLE LIST (DESKTOP SIDEBAR)
   ============================================ */
.chat-app .people-list {
    z-index: 6;
    position: absolute;
    padding: 20px;
    top: 0;
    left: 0;
    width: 280px;
    height: 100%;
    background: var(--chat-panel-bg);
    border-right: var(--border);
    overflow-y: auto;
    overflow-x: hidden;
    transition: transform var(--transition-slow);
}

.people-list {
    transition: transform var(--transition-slow);
}

/* Search Input in Sidebar */
.people-list .input-group {
    margin-bottom: 15px;
}

.people-list .input-group-text {
    background: var(--chat-panel-secondary);
    border: var(--border);
    border-right: none;
    color: var(--text-secondary);
    padding: 10px 12px;
    border-radius: 8px 0 0 8px;
}

.people-list .form-control {
    background: var(--chat-panel-secondary) !important;
    border: var(--border) !important;
    border-left: none !important;
    color: var(--text-primary) !important;
    padding: 10px 12px;
    border-radius: 0 8px 8px 0 !important;
    font-size: 14px;
}

.people-list .form-control:focus {
    background: var(--chat-panel-secondary) !important;
    border-color: var(--accent-blue) !important;
    box-shadow: none !important;
}

/* Participant List Items */
.people-list .chat-list {
    height: auto;
}

.people-list .chat-list li {
    padding: 12px;
    list-style: none;
    border-radius: 10px;
    margin-bottom: 8px;
    transition: all var(--transition-fast);
    cursor: pointer;
    position: relative;
}

.people-list .chat-list li:hover {
    background: var(--hover-bg);
    transform: translateX(2px);
}

.people-list .chat-list li.active {
    background: var(--active-bg);
}

.people-list .chat-list li .name {
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 2px;
}

.people-list .chat-list img {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.1);
    object-fit: cover;
}

.people-list img {
    float: left;
    border-radius: 50%;
}

.people-list .about {
    float: left;
    padding-left: 12px;
    padding-top: 2px;
}

.people-list .about-buttons {
    margin-top: 35px;
    width: auto;
}

.people-list .status {
    color: var(--text-secondary);
    font-size: 12px;
    margin-top: 2px;
}

/* Sidebar Action Buttons */
#chatShareRoomBtn {
    width: 100%;
    padding: 10px 16px;
    background: var(--chat-panel-secondary);
    border-radius: 8px;
    border: var(--border);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition-fast);
    margin-bottom: 10px;
}

#chatShareRoomBtn:hover {
    background: var(--hover-bg);
    transform: translateY(-2px);
    box-shadow: var(--message-shadow);
}

#chatShareRoomBtn i {
    margin-right: 8px;
}

/* Mobile Sidebar Toggle Button */
#chatShowParticipantsList {
    cursor: pointer;
    transition: all var(--transition-fast);
}

#chatShowParticipantsList:hover {
    transform: scale(1.05);
}

#chatHideParticipantsList {
    position: sticky;
    top: 10px;
    z-index: 10;
}

/* Sidebar Top Buttons */
.people-list > div:first-child {
    margin-bottom: 15px;
}

.people-list > div:first-child button {
    background: var(--chat-panel-secondary);
    border: var(--border);
    border-radius: 8px;
    padding: 8px 12px;
    color: var(--text-primary);
    transition: all var(--transition-fast);
    margin-left: 5px;
}

.people-list > div:first-child button:hover {
    background: var(--hover-bg);
    transform: scale(1.05);
}

/* ============================================
   MAIN CHAT AREA
   ============================================ */
.chat-app .chat {
    position: relative;
    margin-left: 280px;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--chat-bg-secondary);
}

/* ============================================
   CHAT HEADER
   ============================================ */
.chat .chat-header {
    padding: 15px 20px;
    border-bottom: var(--border);
    height: 60px;
    min-height: 60px;
    cursor: move;
    background: var(--chat-panel-bg);
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.chat .chat-header .w-100 {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Close Button (Left Side) */
.chat-close-btn {
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.chat-close-btn:hover {
    background: var(--hover-bg);
    transform: scale(1.1);
}

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

.chat-close-btn i {
    font-size: 20px;
}

/* Chat Header - Center (Info) */
#chatAbout {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.all-participants-img {
    border: var(--border);
    border-radius: 8px;
    width: 36px;
    height: 36px;
    padding: 6px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.all-participants-img:hover {
    background-color: var(--hover-bg);
}

.chat .chat-header img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.chat .chat-header .chat-about {
    display: flex;
    flex-direction: column;
    justify-content: center;
    color: var(--text-primary);
}

.chat .chat-header .chat-about h6 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
}

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

/* Chat Header - Right Side (Action Buttons) */
.chat .chat-header .chat-option-buttons {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat .chat-header .chat-option-buttons button {
    background: transparent;
    border: var(--border);
    border-radius: 8px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
    padding: 0;
}

.chat .chat-header .chat-option-buttons button:hover {
    background: var(--hover-bg);
    transform: scale(1.05);
}

.chat .chat-header .chat-option-buttons button i {
    font-size: 16px;
}

/* Dropdown Menu */
.chat .chat-header .dropdown-menu {
    background: var(--chat-panel-bg);
    border: var(--border);
    border-radius: 10px;
    padding: 8px;
    box-shadow: var(--box-shadow-hover);
    margin-top: 8px;
    backdrop-filter: blur(10px);
    animation: fadeIn 0.2s ease-out;
}

.chat .chat-header .dropdown-menu li {
    list-style: none;
}

.chat .chat-header .dropdown-menu button {
    width: 100%;
    text-align: left;
    padding: 10px 14px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat .chat-header .dropdown-menu button:hover {
    background: var(--hover-bg);
}

.chat .chat-header .dropdown-menu button i {
    width: 18px;
    text-align: center;
}

.chat .chat-header .dropdown-menu hr {
    border-color: rgba(255, 255, 255, 0.1);
    margin: 8px 0;
}

.chat .chat-header .dropdown-menu .title {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 10px;
}

.chat .chat-header .dropdown-menu .form-check-input {
    margin: 0;
}

/* ============================================
   CHAT HISTORY (MESSAGES AREA)
   ============================================ */
.chat .chat-history {
    flex: 1;
    padding: 15px 20px;
    padding-bottom: 10px;
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--chat-bg-secondary);
    scroll-behavior: smooth;
    min-height: 0; /* Important for flex children */
}

/* Custom Scrollbar for Chat History */
.chat .chat-history::-webkit-scrollbar {
    width: 8px;
}

.chat .chat-history::-webkit-scrollbar-track {
    background: transparent;
}

.chat .chat-history::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.chat .chat-history::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Firefox Scrollbar */
.chat .chat-history {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

/* Custom Scrollbar for Participants List */
.people-list::-webkit-scrollbar {
    width: 6px;
}

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

.people-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

.people-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

.people-list {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.chat .chat-history ul {
    padding: 0;
    margin: 0;
}

.chat .chat-history ul li {
    list-style: none;
    margin-bottom: 20px;
    animation: messageSlideIn 0.3s ease-out;
}

.chat .chat-history ul li:last-child {
    margin-bottom: 0;
}

/* ============================================
   MESSAGE BUBBLES
   ============================================ */
.chat .chat-history .message-data {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    gap: 8px;
}

.chat .chat-history .message-data img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.chat .chat-history .message-data-name {
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
}

.chat .chat-history .message-data-time {
    color: var(--text-timestamp);
    font-size: 11px;
    padding-left: 6px;
}

.chat .chat-history .message-data.text-end {
    justify-content: flex-end;
}

.chat .chat-history .message-data.text-start {
    justify-content: flex-start;
}

/* Message Bubble Base */
.chat .chat-history .message {
    position: relative;
    display: inline-block;
    overflow-wrap: break-word;
    word-wrap: break-word;
    color: var(--text-primary);
    padding: 12px 16px;
    line-height: 1.5;
    font-size: 15px;
    max-width: var(--msger-bubble-width);
    border-radius: var(--border-radius-message);
    box-shadow: var(--message-shadow);
    transition: all var(--transition-fast);
}

/* Remove old message tails */
.chat .chat-history .message:after {
    display: none;
}

/* My Messages (Right Side) */
.chat .chat-history .my-message {
    background: var(--right-msg-bg);
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.chat .chat-history .my-message:after {
    display: none;
}

/* Other Messages (Left Side) */
.chat .chat-history .other-message {
    background: var(--left-msg-bg);
    text-align: left;
    border-bottom-left-radius: 4px;
}

.chat .chat-history .other-message:after {
    display: none;
}

/* Private Messages */
.chat .chat-history .private-message {
    background: var(--private-msg-bg);
    border-left: 3px solid rgba(255, 255, 255, 0.3);
}

/* Message Actions (Delete, Copy, etc) */
.message-actions {
    display: inline-flex;
    gap: 8px;
    margin-left: 10px;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.chat .chat-history ul li:hover .message-actions {
    opacity: 1;
}

.message-actions button {
    background: rgba(0, 0, 0, 0.3);
    border: none;
    border-radius: 6px;
    padding: 4px 8px;
    color: var(--text-primary);
    font-size: 12px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.message-actions button:hover {
    background: rgba(0, 0, 0, 0.5);
    transform: scale(1.05);
}

/* ============================================
   MESSAGE INPUT AREA - MODERN INLINE DESIGN
   ============================================ */
.chat .chat-message {
    padding: 8px 16px;
    background: var(--chat-panel-bg);
    border-top: var(--border);
    flex-shrink: 0;
}

/* Input Wrapper - All in One Line */
.chat-message-input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--chat-panel-secondary);
    border: var(--border);
    border-radius: 24px;
    padding: 8px 12px;
    transition: all var(--transition-fast);
}

.chat-message-input-wrapper:focus-within {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px rgba(0, 136, 204, 0.1);
}

/* Text Input */
.chat-message-textarea {
    flex: 1;
    background: transparent !important;
    border: none !important;
    color: var(--text-primary) !important;
    padding: 8px 12px !important;
    font-size: 15px !important;
    resize: none !important;
    line-height: 1.5 !important;
    max-height: 120px;
    overflow-y: auto;
    font-family: 'Montserrat', sans-serif;
}

.chat-message-textarea:focus {
    outline: none !important;
    box-shadow: none !important;
}

.chat-message-textarea::placeholder {
    color: var(--text-secondary);
}

/* Custom scrollbar for textarea */
.chat-message-textarea::-webkit-scrollbar {
    width: 6px;
}

.chat-message-textarea::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

/* Input Buttons */
.chat-input-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.chat-input-btn:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
    transform: scale(1.1);
}

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

.chat-input-btn i {
    font-size: 18px;
}

/* Send Button - Special Styling */
.chat-send-btn {
    background: var(--accent-blue);
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.chat-send-btn:hover {
    background: #0077b3;
    transform: scale(1.1);
}

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

.chat-send-btn i {
    font-size: 16px;
}

/* Button disabled state */
.chat-input-btn:disabled,
.chat-send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.chat-input-btn:disabled:hover,
.chat-send-btn:disabled:hover {
    transform: none;
    background: transparent;
}

.chat-send-btn:disabled:hover {
    background: var(--accent-blue);
}

/* ============================================
   EMOJI PICKER
   ============================================ */
.chatEmojiPicker {
    z-index: 10;
    position: absolute;
    left: 20px;
    bottom: 140px;
    background: var(--chat-panel-bg);
    border: var(--border);
    border-radius: 12px;
    box-shadow: var(--box-shadow-hover);
    --rgb-background: var(--chat-panel-bg);
    --color-border-over: var(--chat-panel-bg);
    --font-family: 'Montserrat';
    animation: fadeIn 0.2s ease-out;
}

/* Emoji Button Active State */
#chatEmojiButton.active {
    background: var(--active-bg);
    color: var(--accent-blue);
}

/* ============================================
   STATUS INDICATORS
   ============================================ */
.online,
.offline,
.me {
    margin-right: 3px;
    font-size: 10px;
    vertical-align: middle;
}

.online {
    color: #25d366;
}

.offline {
    color: #e47297;
}

.me {
    color: #0088cc;
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* ============================================
   FOCUS STATES (Accessibility)
   ============================================ */
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
}

/* ============================================
   LOADING & SKELETON STATES
   ============================================ */
.skeleton-loading {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.05) 25%,
        rgba(255, 255, 255, 0.1) 50%,
        rgba(255, 255, 255, 0.05) 75%
    );
    background-size: 200% 100%;
    animation: skeletonLoading 1.5s ease-in-out infinite;
}

@keyframes skeletonLoading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* ============================================
   TYPING INDICATOR
   ============================================ */
.typing-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: var(--left-msg-bg);
    border-radius: var(--border-radius-message);
    margin-bottom: 20px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.6);
    animation: typingDot 1.4s infinite;
}

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

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

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

/* ============================================
   UNREAD MESSAGE BADGE
   ============================================ */
.unread-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: var(--accent-blue);
    color: white;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: badgePulse 2s infinite;
}

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

/* ============================================
   UTILITY CLASSES
   ============================================ */
.float-right {
    float: right;
}

.float-left {
    float: left;
}

.inline {
    display: inline-flex;
}

.absolute {
    position: absolute;
}

.clearfix:after {
    visibility: hidden;
    display: block;
    font-size: 0;
    content: ' ';
    clear: both;
    height: 0;
}

.mt5 {
    margin-top: 5px;
}

.mt10 {
    margin-top: 10px;
}

.mr5 {
    margin-right: 5px;
}

.ml5 {
    margin-left: 5px;
}

.ml10 {
    margin-left: 10px;
}

.form-check-input {
    cursor: pointer;
}

/* ============================================
   DESKTOP OPTIMIZATION (for screens > 768px)
   ============================================ */
@media screen and (min-width: 769px) {
    /* Force proper flex layout for chat */
    .chat-app .chat {
        display: flex !important;
        flex-direction: column !important;
        height: 100% !important;
    }
    
    /* Chat header should not shrink */
    .chat .chat-header {
        flex-shrink: 0 !important;
    }
    
    /* Chat history should take all available space */
    .chat .chat-history {
        flex: 1 1 auto !important;
        min-height: 0 !important;
        overflow-y: auto !important;
    }
    
    /* Chat message area should be at bottom and not shrink */
    .chat .chat-message {
        flex-shrink: 0 !important;
        margin-top: 0 !important;
        margin-bottom: 0 !important;
        position: relative !important;
        bottom: auto !important;
        left: auto !important;
        right: auto !important;
        width: auto !important;
    }
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */
@media screen and (max-width: 768px) {
    /* Override container positioning on mobile */
    .container {
        position: relative !important;
    }

    /* Show mobile horizontal participant list */
    .mobile-participants-horizontal {
        display: flex;
    }

    /* Hide desktop sidebar */
    .chat-app .people-list {
        transform: translateX(-100%);
        position: fixed;
        z-index: 100;
    }

    .chat-app .people-list.show {
        transform: translateX(0);
        box-shadow: 4px 0 12px rgba(0, 0, 0, 0.5);
    }

    /* Full width chat */
    .chat-app .chat {
        margin-left: 0;
        margin-top: 0;
        padding-top: 0;
        height: 100vh;
        height: 100dvh;
        max-height: 100vh;
        max-height: 100dvh;
        box-sizing: border-box;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }

    /* Adjust chat container */
    .chat-container {
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        min-width: 100vw;
        min-height: 100vh;
        min-height: 100dvh;
        max-width: 100vw;
        max-height: 100vh;
        max-height: 100dvh;
        border-radius: 0;
        position: static;
        top: auto;
        left: auto;
    }

    .chat-app {
        border-radius: 0;
        height: 100vh;
        height: 100dvh;
    }

    /* Smaller message bubbles on mobile */
    .chat .chat-history .message {
        max-width: 80%;
        font-size: 14px;
        padding: 10px 14px;
    }

    /* Compact header */
    .chat .chat-header {
        padding: 12px 15px;
        padding-top: calc(12px + env(safe-area-inset-top));
        height: calc(55px + env(safe-area-inset-top));
        min-height: calc(55px + env(safe-area-inset-top));
    }

    .chat .chat-header .w-100 {
        gap: 8px;
    }

    /* Close button on mobile */
    .chat-close-btn {
        width: 36px;
        height: 36px;
    }

    .chat-close-btn i {
        font-size: 18px;
    }

    /* Hide participants list toggle icon on mobile */
    .all-participants-img,
    #chatShowParticipantsList {
        display: none !important;
    }

    .chat .chat-header img {
        width: 32px;
        height: 32px;
    }

    .chat .chat-header .chat-about h6 {
        font-size: 14px;
    }

    /* Compact input area - Fixed positioning to avoid system bar */
    .chat .chat-message {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        padding: 10px 12px;
        margin-bottom: 10px;
        z-index: 10;
        box-sizing: border-box;
    }

    .chat-message-input-wrapper {
        border-radius: 20px;
        padding: 6px 10px;
        gap: 6px;
    }

    .chat-message-textarea {
        font-size: 14px !important;
        padding: 6px 10px !important;
    }

    .chat-input-btn {
        width: 28px;
        height: 28px;
        padding: 4px;
    }

    .chat-input-btn i {
        font-size: 16px;
    }

    .chat-send-btn {
        width: 32px;
        height: 32px;
        padding: 6px;
    }

    .chat-send-btn i {
        font-size: 14px;
    }

    /* Hide less important buttons on mobile to save space */
    #chatMarkdownButton,
    #chatPasteButton,
    #chatCleanTextButton {
        display: none !important;
    }

    /* Reduce chat history padding and ensure proper height */
    .chat .chat-history {
        padding: 15px;
        padding-bottom: 80px;
        flex: 1 1 0;
        min-height: 0;
        overflow-y: auto;
    }

    .chat .chat-history ul li {
        margin-bottom: 15px;
    }
}

@media screen and (max-width: 600px) {
    .people-list {
        width: 100% !important;
    }

    .mobile-participants-horizontal {
        height: 65px;
        padding: 6px 10px;
    }

    .mobile-participant-avatar {
        width: 36px;
        height: 36px;
    }
    
    .mobile-participant-avatar-icon {
        width: 36px;
        height: 36px;
    }

    .mobile-participant-avatar-icon i {
        font-size: 16px;
    }

    .mobile-participant-name {
        font-size: 10px;
        max-width: 50px;
    }

    .mobile-participant-status {
        top: 28px;
        right: 3px;
        width: 10px;
        height: 10px;
    }

    .chat-app .chat {
        margin-top: 0;
        padding-top: 0;
        height: 100vh;
        height: 100dvh;
        max-height: 100vh;
        max-height: 100dvh;
        box-sizing: border-box;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }
    
    .chat .chat-history {
        flex: 1 1 0;
        min-height: 0;
        overflow-y: auto;
        padding-bottom: 80px;
    }
}
