/* Reset and Base Styles */
* {
    box-sizing: border-box;
}

body {
    background-color: rgb(12, 12, 12);
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    overflow-x: hidden;
    height: 100vh;
}

/* Header */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

#roomInfo {
    font-size: 14px;
    font-family: monospace;
    color: #ffc107 !important;
}

/* Welcome Section */
#welcomeSection {
    color: white;
    text-align: center;
    padding: 40px 20px;
    min-height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

#welcomeSection h2 {
    margin-bottom: 30px;
    font-size: 2rem;
}

/* Name Entry Modal */
#popupBox {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    height: 100vh;
    width: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 1000;
}

.my-modal {
    width: 90%;
    max-width: 400px;
    border: 2px solid rgb(53, 53, 53);
    border-radius: 20px;
    background-color: rgb(20, 20, 20);
    color: white;
    padding: 30px;
    text-align: center;
}

.my-modal input[type="text"] {
    width: 100%;
    padding: 12px;
    margin: 15px 0;
    background-color: rgb(40, 40, 40);
    border: 2px solid rgb(53, 53, 53);
    border-radius: 10px;
    color: white;
    font-size: 16px;
}

.my-modal .button {
    width: 100%;
    padding: 12px;
    margin-top: 10px;
}

/* Chat Container */
.chat-container {
    display: flex;
    height: calc(100vh - 56px);
    overflow: hidden;
}

/* Users Panel */
.users-panel {
    width: 300px;
    background-color: rgb(20, 20, 20);
    border-right: 2px solid rgb(53, 53, 53);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.users-header {
    padding: 20px;
    border-bottom: 2px solid rgb(53, 53, 53);
    background-color: rgb(15, 15, 15);
}

.users-header h6 {
    color: white;
    margin: 0 0 10px 0;
    font-weight: bold;
    font-size: 16px;
}

#nameTag,
#nameTagSidebar {
    color: white;
    font-size: 14px;
    display: flex;
    align-items: center;
}

#nameTag::before,
#nameTagSidebar::before {
    content: "• ";
    color: #28a745;
    font-size: 1.2em;
    margin-right: 5px;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.users-list {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

.user-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    margin: 8px 0;
    background-color: rgba(87, 86, 86, 0.3);
    border-radius: 10px;
    color: white;
    transition: all 0.2s ease;
}

.user-item:hover {
    background-color: rgba(87, 86, 86, 0.5);
    transform: translateX(5px);
}

.user-item.host {
    background-color: rgba(0, 123, 255, 0.3);
    border: 1px solid rgba(0, 123, 255, 0.6);
}

.user-name {
    font-size: 14px;
    font-weight: 500;
}

.user-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-badge {
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 12px;
    background-color: #ffc107;
    color: black;
    font-weight: bold;
}

.kick-btn {
    background-color: #dc3545;
    color: white;
    border: none;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 11px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.kick-btn:hover {
    background-color: #c82333;
}

/* Chat Panel */
.chat-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: rgb(12, 12, 12);
    min-width: 0;
}

.msgBox {
    flex: 1;
    background: url('wall.jpg');
    background-repeat: no-repeat;
    background-position: center;
    background-size: cover;
    padding: 20px;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Messages */
.message {
    width: fit-content;
    max-width: 70%;
    margin: 8px 0;
    word-wrap: break-word;
    clear: both;
}

.message.left {
    float: left;
}

.message.right {
    float: right;
}

.message.center {
    float: none;
    margin: 10px auto;
    text-align: center;
    background-color: rgba(87, 86, 86, 0.7);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    max-width: 80%;
}

.message.system-message {
    background-color: rgba(255, 165, 0, 0.8);
    color: white;
}

.textbox {
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.4;
    word-wrap: break-word;
}

.left .textbox {
    background-color: rgba(87, 86, 86, 0.9);
    color: white;
    border-radius: 18px 18px 18px 4px;
}

.right .textbox {
    background-color: rgba(0, 123, 255, 0.9);
    color: white;
    border-radius: 18px 18px 4px 18px;
}

.username {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 4px;
    padding: 0 5px;
}

.right .username {
    text-align: right;
}

/* Host indicator */
.message.host .username::after {
    content: " ~Host";
    color: #ffc107;
    font-weight: bold;
}

/* Media Messages */
.media-message {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.chat-image,
.chat-video {
    max-width: 250px;
    max-height: 200px;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.2s;
    object-fit: cover;
}

.chat-video {
    background-color: rgba(0, 0, 0, 0.8);
}

.chat-image:hover,
.chat-video:hover {
    transform: scale(1.02);
}

.media-filename {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 6px;
    word-break: break-all;
    max-width: 250px;
}

/* Send Message Area */
.sendMsg {
    padding: 20px;
    background-color: rgb(12, 12, 12);
    border-top: 2px solid rgb(53, 53, 53);
    display: flex;
    gap: 10px;
    align-items: center;
}

input[type='text'] {
    flex: 1;
    padding: 12px 16px;
    background-color: rgb(40, 40, 40);
    border: 2px solid rgb(53, 53, 53);
    border-radius: 25px;
    color: white;
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s;
}

input[type='text']:focus {
    border-color: #007bff;
}

.button {
    padding: 12px 20px;
    border: none;
    border-radius: 25px;
    background-color: #007bff;
    color: white;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
}

.button:hover {
    background-color: #0056b3;
    transform: translateY(-1px);
}

.attach-btn {
    padding: 12px;
    border: 2px solid rgb(53, 53, 53);
    border-radius: 50%;
    background-color: rgb(40, 40, 40);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    width: 48px;
    height: 48px;
}

.attach-btn:hover {
    background-color: rgb(60, 60, 60);
    border-color: #007bff;
}

/* Loading Animation */
.loading-textbox {
    display: flex;
    align-items: center;
    gap: 10px;
}

.loading-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Media Modal */
.media-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.media-modal-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.media-modal-close {
    position: absolute;
    top: -50px;
    right: 0;
    color: white;
    font-size: 30px;
    font-weight: bold;
    cursor: pointer;
    background-color: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.media-modal-close:hover {
    background-color: rgba(255, 0, 0, 0.7);
}

.modal-media {
    max-width: 100%;
    max-height: 80vh;
    border-radius: 10px;
    object-fit: contain;
}

.modal-filename {
    color: white;
    margin-top: 15px;
    text-align: center;
    font-size: 14px;
    word-break: break-all;
    background-color: rgba(0, 0, 0, 0.7);
    padding: 10px 20px;
    border-radius: 20px;
}

/* Scrollbar Styling */
.msgBox::-webkit-scrollbar,
.users-list::-webkit-scrollbar {
    width: 8px;
}

.msgBox::-webkit-scrollbar-track,
.users-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
}

.msgBox::-webkit-scrollbar-thumb,
.users-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
}

.msgBox::-webkit-scrollbar-thumb:hover,
.users-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Footer */
footer {
    background-color: rgb(20, 20, 20);
    color: rgba(255, 255, 255, 0.6);
    text-align: center;
    padding: 15px;
    font-size: 12px;
    border-top: 1px solid rgb(53, 53, 53);
}

/* Mobile Responsive */
@media screen and (max-width: 768px) {
    .chat-container {
        flex-direction: column-reverse;
        height: calc(100vh - 56px);
    }

    .users-panel {
        width: 100%;
        height: 140px;
        border-right: none;
        border-top: 2px solid rgb(53, 53, 53);
        flex-shrink: 0;
    }

    .users-header {
        padding: 12px 15px;
    }

    .users-header h6 {
        font-size: 14px;
        margin-bottom: 5px;
    }

    .users-list {
        padding: 8px 15px;
        display: flex;
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        gap: 10px;
    }

    .user-item {
        min-width: 140px;
        margin: 0;
        padding: 10px;
        flex-shrink: 0;
    }

    .user-name {
        font-size: 12px;
    }

    .user-badge {
        font-size: 10px;
        padding: 2px 6px;
    }

    .kick-btn {
        font-size: 10px;
        padding: 4px 6px;
    }

    .chat-panel {
        flex: 1;
        min-height: 0;
    }

    .msgBox {
        padding: 15px;
    }

    .sendMsg {
        padding: 15px;
    }

    .message {
        max-width: 85%;
    }

    .chat-image,
    .chat-video {
        max-width: 200px;
        max-height: 150px;
    }

    .navbar-actions {
        flex-direction: column;
        align-items: flex-end;
        gap: 8px;
    }

    #createPrivateBtn {
        font-size: 12px;
        padding: 6px 12px;
    }

    #roomInfo {
        font-size: 12px;
    }

    #nameTag,
    #nameTagSidebar {
        font-size: 12px;
    }

    /* Hide users panel when typing */
    .chat-container.typing .users-panel {
        display: none;
    }

    .chat-container.typing .chat-panel {
        height: calc(100vh - 56px);
    }
}

@media screen and (max-width: 480px) {
    .users-panel {
        height: 120px;
    }

    .users-header {
        padding: 10px;
    }

    .users-list {
        padding: 5px 10px;
    }

    .user-item {
        min-width: 120px;
        padding: 8px;
    }

    .user-name {
        font-size: 11px;
    }

    .sendMsg {
        padding: 12px;
        gap: 8px;
    }

    input[type='text'] {
        font-size: 14px;
        padding: 10px 14px;
    }

    .button {
        font-size: 14px;
        padding: 10px 16px;
    }

    .attach-btn {
        width: 40px;
        height: 40px;
        padding: 8px;
    }

    .chat-image,
    .chat-video {
        max-width: 150px;
        max-height: 120px;
    }

    .media-filename {
        font-size: 10px;
        max-width: 150px;
    }

    .modal-filename {
        font-size: 12px;
        padding: 8px 16px;
    }

    .media-modal-close {
        top: -40px;
        font-size: 24px;
        width: 35px;
        height: 35px;
    }
}

/* Utility Classes */
.clearfix::after {
    content: "";
    display: table;
    clear: both;
}

.msgBox::after {
    content: "";
    display: table;
    clear: both;
}
/* Mobile Footer Members Section */
.desktop-footer {
    display: block;
}

.mobile-footer {
    display: none;
}

.mobile-members {
    padding: 12px 15px;
    background-color: rgb(25, 25, 25);
    border-radius: 8px;
    margin: 5px;
}

.mobile-members-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 12px;
    color: white;
    font-weight: bold;
}

.mobile-users-list {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 5px 0;
    scrollbar-width: thin;
}

.mobile-user-item {
    display: flex;
    align-items: center;
    gap: 4px;
    background-color: rgba(87, 86, 86, 0.6);
    padding: 4px 8px;
    border-radius: 12px;
    color: white;
    font-size: 10px;
    white-space: nowrap;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.mobile-user-item.host {
    background-color: rgba(0, 123, 255, 0.6);
    border: 1px solid rgba(0, 123, 255, 0.8);
}

.mobile-user-badge {
    background-color: #ffc107;
    color: black;
    padding: 1px 4px;
    border-radius: 6px;
    font-size: 8px;
    font-weight: bold;
}

.mobile-kick-btn {
    background-color: #dc3545;
    color: white;
    border: none;
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 8px;
    cursor: pointer;
    margin-left: 2px;
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-kick-btn:hover {
    background-color: #c82333;
}

#mobileNameTag {
    font-size: 10px;
    color: #28a745;
}

#mobileNameTag::before {
    content: "• ";
    animation: pulse 2s infinite;
}

/* Mobile Layout Updates */
@media screen and (max-width: 768px) {
    .desktop-footer {
        display: none !important;
    }
    
    .mobile-footer {
        display: block !important;
        background-color: rgb(20, 20, 20);
        border-top: 1px solid rgb(53, 53, 53);
    }
    
    /* Adjust chat container height to account for mobile footer */
    .chat-container {
        height: calc(100vh - 56px - 80px); /* navbar + mobile footer */
    }
    
    .chat-container.typing {
        height: calc(100vh - 56px); /* Hide footer when typing */
    }
    
    .chat-container.typing .mobile-footer {
        display: none !important;
    }
}

/* Mobile users list scrollbar */
.mobile-users-list::-webkit-scrollbar {
    height: 4px;
}

.mobile-users-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
}

.mobile-users-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
}
/* Hide old member class */
.member-class {
    display: none !important;
}

#oldLayoutContainer {
    display: none !important;
}

#allmembers {
    display: none !important;
}
/* Desktop Layout - Keep Users Panel */
.chat-container {
    display: flex;
    height: calc(100vh - 56px);
    overflow: hidden;
}

.users-panel {
    width: 300px;
    background-color: rgb(20, 20, 20);
    border-right: 2px solid rgb(53, 53, 53);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.users-header {
    padding: 20px;
    border-bottom: 2px solid rgb(53, 53, 53);
    background-color: rgb(15, 15, 15);
}

.users-header h6 {
    color: white;
    margin: 0 0 10px 0;
    font-weight: bold;
    font-size: 16px;
}

#nameTag, #nameTagSidebar {
    color: white;
    font-size: 14px;
    display: flex;
    align-items: center;
}

#nameTag::before, #nameTagSidebar::before {
    content: "• ";
    color: #28a745;
    font-size: 1.2em;
    margin-right: 5px;
    animation: pulse 2s infinite;
}

.users-list {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

.user-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    margin: 8px 0;
    background-color: rgba(87, 86, 86, 0.3);
    border-radius: 10px;
    color: white;
    transition: all 0.2s ease;
}

.user-item:hover {
    background-color: rgba(87, 86, 86, 0.5);
    transform: translateX(5px);
}

.user-item.host {
    background-color: rgba(0, 123, 255, 0.3);
    border: 1px solid rgba(0, 123, 255, 0.6);
}

.user-name {
    font-size: 14px;
    font-weight: 500;
}

.user-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-badge {
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 12px;
    background-color: #ffc107;
    color: black;
    font-weight: bold;
}

.kick-btn {
    background-color: #dc3545;
    color: white;
    border: none;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 11px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.kick-btn:hover {
    background-color: #c82333;
}

.chat-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: rgb(12, 12, 12);
    min-width: 0;
}

/* Mobile Layout - Hide Users Panel, Show Footer */
@media screen and (max-width: 768px) {
    .users-panel {
        display: none !important;
    }
    
    .chat-container {
        height: calc(100vh - 56px - 80px) !important; /* navbar + mobile footer */
    }
    
    .chat-container.typing {
        height: calc(100vh - 56px) !important; /* Hide footer when typing */
    }
    
    .msgBox {
        padding: 15px !important;
    }
    
    .sendMsg {
        padding: 15px !important;
    }
}