* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Helvetica, Arial, sans-serif;
}

body {
    background-color: #d1d7db;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.hidden {
    display: none !important;
}

/* LOGIN */
#login-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #00a884;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.login-box {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    text-align: center;
    width: 90%;
    max-width: 400px;
}

.login-box input {
    padding: 12px;
    width: 100%;
    margin-bottom: 15px;
    font-size: 16px;
    border: 1px solid #ddd;
    border-radius: 5px;
    outline: none;
}

.login-box button {
    padding: 12px 25px;
    background: #00a884;
    color: white;
    border: none;
    cursor: pointer;
    font-size: 16px;
    border-radius: 5px;
    width: 100%;
}

/* APP LAYOUT */
/* APP LAYOUT */
#chat-app {
    display: flex;
    width: 100%;
    height: 100%;
    background: #fff;
    overflow: hidden;
    position: relative;
}

/* LEFT SIDEBAR */
.sidebar-left {
    width: 30%;
    min-width: 320px;
    max-width: 450px;
    border-right: 1px solid #e9edef;
    background: #fff;
    display: flex;
    flex-direction: column;
}

/* RIGHT SIDEBAR (User List) */
/* RIGHT SIDEBAR (User List) */
.sidebar-right {
    width: 300px;
    background: #fff;
    border-left: 1px solid #e9edef;
    display: flex;
    /* Always visible on desktop */
    flex-direction: column;
    height: 100%;
    z-index: 100;
    /* Removed absolute positioning for desktop to prevent overlap */
}

/* Mobile/Tablet: Sidebar is absolute and hidden by default */
@media (max-width: 900px) {
    .sidebar-right {
        position: absolute;
        right: 0;
        top: 0;
        display: none;
        box-shadow: -2px 0 5px rgba(0, 0, 0, 0.1);
    }

    .sidebar-right.active {
        display: flex;
        animation: slideInRight 0.2s;
    }
}

/* .sidebar-right.active is now handled inside the media query or globally if needed for animation, 
   but for desktop it's always flex, so 'active' class doesn't matter unless we want to toggle it there too. 
   For now, assuming desktop always shows it. */

@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }

    to {
        transform: translateX(0);
    }
}

.main-chat {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #efeae2;
    position: relative;
}

.main-chat::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('https://user-images.githubusercontent.com/15075759/28719144-86dc0f70-73b1-11e7-911d-60d70fcded21.png');
    opacity: 0.4;
    pointer-events: none;
}

/* HEADERS */
.header {
    background: #f0f2f5;
    height: 60px;
    display: flex;
    align-items: center;
    padding: 0 16px;
    border-bottom: 1px solid #d1d7db;
    justify-content: space-between;
}

.header-icons button {
    background: none;
    border: none;
    font-size: 20px;
    color: #54656f;
    cursor: pointer;
    margin-left: 15px;
}

.avatar,
.chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #dfe5e7;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-right: 15px;
    font-weight: bold;
    color: #555;
    flex-shrink: 0;
}

.chat-avatar {
    background: #00a884;
    color: white;
}

/* CHAT LIST */
.search-bar {
    padding: 10px;
    background: #fff;
    border-bottom: 1px solid #f0f2f5;
}

.search-bar input {
    width: 100%;
    padding: 8px 12px;
    background: #f0f2f5;
    border: none;
    border-radius: 8px;
    outline: none;
    font-size: 14px;
}

.chats-list {
    flex: 1;
    overflow-y: auto;
}

.chat-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f5f6f6;
    transition: background 0.2s;
}

.chat-item:hover {
    background: #f5f6f6;
}

.chat-item.active {
    background: #f0f2f5;
}

.chat-item-info {
    flex: 1;
    overflow: hidden;
}

.chat-item-top {
    display: flex;
    justify-content: space-between;
    margin-bottom: 3px;
}

.chat-name {
    font-size: 16px;
    color: #111;
    font-weight: 500;
}

.chat-time {
    font-size: 12px;
    color: #667781;
}

.chat-last-msg {
    font-size: 13px;
    color: #667781;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.unread-badge {
    background: #25d366;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 5px;
}

/* RADIO PLAYER INLINE */
.radio-player-inline {
    background: #202c33;
    border-bottom: 1px solid #374045;
    overflow: hidden;
}

.radio-artwork-bg {
    width: 100%;
    height: 200px;
    background-size: cover;
    background-position: center;
    position: relative;
}

.radio-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.8));
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 15px;
}

.radio-info-text {
    color: white;
    margin-bottom: 10px;
}

.radio-info-text h4 {
    margin: 0 0 5px 0;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.radio-info-text p {
    margin: 0 0 8px 0;
    font-size: 14px;
    color: #e0e0e0;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.radio-badges {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}

.badge.dj {
    background: #00a884;
    color: white;
}

.badge.request {
    background: #1976d2;
    color: white;
}

.radio-play-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #00a884;
    color: white;
    border: none;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.2s;
}

.radio-play-btn:hover {
    background: #008f6f;
    transform: scale(1.05);
}

.radio-play-btn:active {
    transform: scale(0.95);
}

/* MAIN CHAT HEADER */

.close-btn {
    background: none;
    border: none;
    color: #aebac1;
    font-size: 20px;
    cursor: pointer;
}

/* MAIN CHAT HEADER */
#chat-header-clickable {
    cursor: pointer;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

#chat-header-clickable:hover {
    background: rgba(0, 0, 0, 0.03);
    border-radius: 5px;
    padding-left: 5px;
    margin-left: -5px;
}

/* MESSAGES */
.messages-area {
    flex: 1;
    padding: 20px 5%;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 5;
}

.message {
    max-width: 65%;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 14.2px;
    box-shadow: 0 1px 0.5px rgba(0, 0, 0, 0.13);
    position: relative;
    line-height: 19px;
}

.message.received {
    align-self: flex-start;
    background: #fff;
    border-top-left-radius: 0;
}

.message.sent {
    align-self: flex-end;
    background: #d9fdd3;
    border-top-right-radius: 0;
}

.message.system {
    align-self: center;
    background: #e8f5fa;
    font-size: 12.5px;
    color: #555;
    padding: 5px 12px;
    box-shadow: none;
    border-radius: 8px;
}

.message.action {
    align-self: center;
    background: transparent;
    font-style: italic;
    font-size: 13px;
    box-shadow: none;
    color: #444;
}

.msg-nick {
    font-size: 12.5px;
    font-weight: bold;
    color: #e542a3;
    margin-bottom: 4px;
    cursor: pointer;
}

.msg-time {
    font-size: 11px;
    color: #999;
    float: right;
    margin-top: 2px;
    margin-left: 10px;
    position: relative;
    top: 4px;
}

/* INPUT */
.input-area {
    background: #f0f2f5;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    z-index: 10;
}

.input-area input {
    flex: 1;
    padding: 12px 15px;
    border: none;
    border-radius: 8px;
    margin-right: 12px;
    outline: none;
    font-size: 15px;
    background: #fff;
}

.input-area button {
    background: none;
    color: #54656f;
    border: none;
    width: 40px;
    height: 40px;
    font-size: 24px;
    cursor: pointer;
}

/* MODAL */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 5000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    padding: 25px;
    border-radius: 5px;
    width: 90%;
    max-width: 350px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.modal h3 {
    margin-bottom: 15px;
    color: #333;
}

.modal input {
    width: 100%;
    padding: 10px;
    margin-bottom: 20px;
    border: 1px solid #ddd;
    border-radius: 3px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.modal-actions button {
    padding: 8px 15px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-weight: 500;
}

#btnCancelJoin {
    background: #f0f2f5;
    color: #333;
}

#btnConfirmJoin {
    background: #00a884;
    color: white;
}

/* User List Colors (Nicknames) */
.user-item.owner .user-name {
    color: #d32f2f;
    font-weight: bold;
}

/* Rojo */
.user-item.admin .user-name {
    color: #f57c00;
    font-weight: bold;
}

/* Naranjo */
.user-item.op .user-name {
    color: #1976d2;
    font-weight: bold;
}

/* Azul */
.user-item.voice .user-name {
    color: #388e3c;
    font-weight: bold;
}

/* Verde Oscuro */
.user-item.normal .user-name {
    color: #000;
}

/* Common style for all user names */
.user-name {
    font-size: 16px !important;
    /* Increased from default and forced */
    font-weight: 500;
}

/* Negro */

/* Mantener avatar con color suave o distintivo si se desea, o dejarlo default */
.user-item.owner .user-avatar {
    background: #ffebee;
    color: #d32f2f;
}

.user-item.admin .user-avatar {
    background: #fff3e0;
    color: #f57c00;
}

.user-item.op .user-avatar {
    background: #e3f2fd;
    color: #1976d2;
}

.user-item.voice .user-avatar {
    background: #e8f5e9;
    color: #388e3c;
}

/* RESPONSIVE */
@media (max-width: 900px) {
    .sidebar-left {
        width: 40%;
    }
}

@media (max-width: 700px) {
    .sidebar-left {
        width: 100%;
        display: flex;
    }

    .main-chat {
        display: none;
    }

    .main-chat.active {
        display: flex;
        width: 100%;
        position: absolute;
        top: 0;
        left: 0;
        height: 100%;
        z-index: 200;
    }

    .sidebar-left.hidden-mobile {
        display: none;
    }
}