html, body { margin: 0; padding: 0; width: 100%; height: 100%; overflow: hidden; font-family: Tahoma, Arial, sans-serif; background: linear-gradient(135deg, #f7b7c8 0%, #fbd5d7 40%, #c4ebd0 70%, #f7b7c8 100%); color: #000; }
#chat-wrapper { display: flex; flex-direction: row; width: 100%; max-width: 1000px; margin: 2vh auto 5vh auto; gap: 10px; padding: 10px 10px 15px 10px; height: 93vh; box-sizing: border-box; }
#left-panel { flex: 3; display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; }

/* === LINEAR GRADIENT ARKAPLAN TEKNİĞİ === */
.custom-bg-chat {
    background: linear-gradient(var(--bg-chat-overlay), var(--bg-chat-overlay)), var(--bg-chat-img) center/cover no-repeat !important;
}
.custom-bg-users {
    background: linear-gradient(var(--bg-users-overlay), var(--bg-users-overlay)), var(--bg-users-img) center/cover no-repeat !important;
    overflow: hidden;
}
.custom-bg-input {
    background: linear-gradient(var(--bg-input-overlay), var(--bg-input-overlay)), var(--bg-input-img) center/cover no-repeat !important;
    border-radius: 5px;
}
.users-inner-overlay { display: flex; flex-direction: column; height: 100%; width: 100%; }
.input-box-inner { background: transparent !important; }
/* ========================================================= */

#messages-box { flex: 1; border-radius: 5px; padding: 10px; border: 1px solid rgba(0,0,0,0.1); word-wrap: break-word; display: flex; flex-direction: column; overflow: hidden; min-height: 0; }
.scroll-area { flex: 1; overflow-y: auto; overflow-x: hidden; width: 100%; -webkit-overflow-scrolling: touch; touch-action: pan-y; padding-right: 5px; }

#messages, #pm-messages { height: 100%; }
#pm-messages { display: none; }
img.emoji { height: 1.2em; width: 1.2em; margin: 0 .05em 0 .1em; vertical-align: -0.1em; }

/* --- OVERFLOW VISIBLE KORUNDU --- */
#chat-tabs-bar { display: flex; gap: 3px; margin-top: 5px; overflow: visible; width: 100%; padding: 0; box-sizing: border-box; flex: none; flex-wrap: nowrap; position: relative; }
/* --------------------------------------------------------------- */

.chat-tab-main { padding: 5px 15px; background: rgba(255, 255, 255, 0.5); border-radius: 10px 10px 0 0; cursor: pointer; font-size: 13px; font-weight: bold; border: 1px solid rgba(0,0,0,0.1); border-bottom: none; display: flex; align-items: center; color: #333; transition: 0.2s; flex: 0 0 auto; position: relative; user-select: none; }
.chat-tab-main.active { background: rgba(255, 255, 255, 0.9); color: #000; box-shadow: 0 -2px 5px rgba(0,0,0,0.05); }
.chat-tab { padding: 5px 8px; background: rgba(255, 255, 255, 0.5); border-radius: 10px 10px 0 0; cursor: pointer; font-size: 13px; font-weight: bold; border: 1px solid rgba(0,0,0,0.1); border-bottom: none; display: flex; align-items: center; justify-content: space-between; color: #333; transition: 0.2s; flex: 0 1 auto; max-width: 160px; min-width: 55px; overflow: hidden; }
.chat-tab.active { background: rgba(255, 255, 255, 0.9); color: #000; box-shadow: 0 -2px 5px rgba(0,0,0,0.05); }
.chat-tab.unread { background: rgba(255, 255, 255, 0.8); color: #000; }
.pm-badge { background: #5cb85c; color: #fff; border-radius: 10px; padding: 2px 6px; font-size: 11px; margin-right: 5px; display: inline-flex; align-items: center; justify-content: center; font-weight: bold; line-height: 1; flex-shrink: 0; box-shadow: 0 1px 3px rgba(0,0,0,0.2); }
.tab-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; width: 100%; text-align: left; }
.close-tab { margin-left: 5px; color: #d9534f; cursor: pointer; font-size: 11px; flex-shrink: 0; padding-left: 2px; }
.close-tab:hover { color: #c9302c; }

#bottom-input-container { display: flex; flex-direction: column; margin-top: 5px; flex: none; gap: 8px; } 
#smiley-bar { display: flex; align-items: center; justify-content: flex-start; background: rgba(255, 255, 255, 0.45); border: 1px solid rgba(0,0,0,0.1); border-radius: 5px; padding: 8px 12px; margin: 0; }
.xat-icon { width: 24px; height: 24px; cursor: pointer; transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.xat-icon:hover { transform: scale(1.3); z-index: 10; } 
.plus-btn { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; background: #c685a5; color: #fff; border-radius: 50%; font-size: 18px; font-weight: bold; border: 1px solid #9e6481; cursor: pointer; user-select: none; flex-shrink: 0; transition: transform 0.2s;}
.plus-btn:hover { background: #b0708f; transform: scale(1.1); }

#custom-emoji-popup { display: none; position: absolute; bottom: 130px; left: 10px; background: rgba(255, 255, 255, 0.95); border: 1px solid rgba(0,0,0,0.15); border-radius: 8px; box-shadow: 0 5px 15px rgba(0,0,0,0.3); padding: 12px; z-index: 1000; width: max-content; max-width: 280px; max-height: 200px; overflow-y: auto; gap: 8px; flex-wrap: wrap; backdrop-filter: blur(5px); }
.popup-emoji-item { width: 32px; height: 32px; cursor: pointer; transition: transform 0.2s; object-fit: contain; }
.popup-emoji-item:hover { transform: scale(1.3); }

.input-area-wrapper { display: flex; align-items: stretch; gap: 0; height: 76px; min-height: 76px; flex: none; }
#input-box { flex: 1; border: 1px solid rgba(0,0,0,0.1); border-radius: 5px 0 0 5px; position: relative; display: flex; align-items: center; justify-content: center; }
#message-input { width: 100%; height: 100%; background: transparent; border: none; text-align: left; font-size: 17px; font-style: italic; color: #000; font-weight: bold; outline: none; padding: 0 15px; box-sizing: border-box; } 
#message-input::placeholder { color: #333; font-weight: normal; }
#message-input:focus { font-style: normal; }
#send-btn { width: 55px; background: #000033; color: #fff; border: 1px solid rgba(0,0,0,0.1); border-left: none; border-radius: 0 5px 5px 0; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 20px; transition: 0.2s; }
#send-btn:hover { background: #000066; }
#send-btn:disabled { background: #ccc; border: 1px solid #999; cursor: not-allowed; }

#right-panel { width: 220px; flex: none; display: flex; flex-direction: column; min-height: 0; border-radius: 5px; border: 1px solid rgba(0,0,0,0.1); padding: 5px; box-sizing: border-box; gap: 5px; }
.xat-tab-top { background: #c685a5; color: #fff; text-align: center; font-weight: bold; padding: 5px; border-radius: 5px 5px 0 0; flex: none; }
.users-wrapper { flex: 1; overflow-y: auto; overflow-x: hidden; display: flex; flex-direction: column; min-height: 0; border-radius: 0; background: transparent !important; }
#users { flex: 1; padding: 5px; min-height: min-content; overflow-x: hidden; }
.user-item { padding: 4px 5px !important; overflow: hidden; }
.user-item:hover { background-color: rgba(255,255,255,0.7) !important; }

.action-buttons { flex: none; padding: 8px 0 0 0; border-top: 1px solid rgba(0,0,0,0.1); display: flex; flex-direction: column; gap: 5px; }
.action-btn { background: #000033; color: #fff; border: 1px solid #000066; border-radius: 5px; padding: 8px; font-weight: bold; cursor: pointer; text-align: center; text-decoration: none; font-size: 13px; transition: 0.2s; display: block; width: 100%; box-sizing: border-box; }
.action-btn:hover { background: #000066; }

/* MODAL YENİLEMESİ */
#nick-modal { display: none; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); background-color: #f1f1f1; padding: 20px; border: 1px solid #ccc; border-radius: 8px; box-shadow: 0 0 15px rgba(0,0,0,0.3); z-index: 1000; width: 90%; max-width: 400px; box-sizing: border-box; color: #000; }
#nick-modal h3 { margin-top: 0; text-align: center; }
#nick-modal input[type="text"] { width: 100%; padding: 12px; margin-bottom: 15px; box-sizing: border-box; border: 1px solid #ccc; border-radius: 4px; outline: none; font-size: 16px; text-align: center; font-weight: bold; }
.avatar-list { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 15px; max-height: 220px; overflow-y: auto; padding: 10px; justify-content: center; background: #fff; border: 1px inset #ccc; border-radius: 4px; }
.avatar-option { width: 40px; height: 40px; cursor: pointer; border: 2px solid transparent; }
.avatar-option.selected { border: 2px solid #5cb85c; }

#user-menu-modal { display: none; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); background: #ffffff; padding: 25px; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,0.3); z-index: 2000; width: 90%; max-width: 400px; box-sizing: border-box; border: 1px solid #eee; text-align: center; }
#user-menu-modal h4 { margin-top: 0; margin-bottom: 20px; color: #333; font-size: 18px; border-bottom: 2px solid #c685a5; padding-bottom: 10px; }
.modal-buttons { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap;}
.modal-buttons button { padding: 10px; flex: 1; cursor: pointer; border: none; border-radius: 6px; font-weight: bold; font-size: 14px; width: 100%; transition: background-color 0.2s; }
.btn-save { background-color: #5cb85c; color: white; }
.btn-cancel { background-color: #d9534f; color: white; }
.mod-buttons-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin-top: 15px; padding-top: 15px; border-top: 1px solid #ccc; width: 100%; }
.mod-btn { padding: 8px; border: none; border-radius: 4px; font-size: 12px; font-weight: bold; color: #fff; cursor: pointer; }
.mod-btn.bg-admin { background: #d49a00; }
.mod-btn.bg-mod { background: #888; }
.mod-btn.bg-member { background: #004aad; }
.mod-btn.bg-guest { background: #008b00; }
.mod-btn.bg-kick { background: #f0ad4e; }
.mod-btn.bg-ban { background: #d9534f; }
.mod-btn.bg-unban { background: #5cb85c; grid-column: span 2; }

#ban-form-container { display: none; margin-top: 15px; padding-top: 15px; border-top: 1px solid #ccc; width: 100%; text-align: left; }
#ban-form-container select, #ban-form-container input { width: 100%; padding: 8px; margin-bottom: 5px; border: 1px solid #ccc; border-radius: 4px; outline: none; box-sizing: border-box; }
.btn-pm { background-color: #007bff; color: white; margin-bottom: 10px; }
.btn-ignore { background-color: #f0ad4e; color: white; margin-bottom: 10px; }
.btn-close { background-color: #eee; color: #555; width: 100%; margin-top: 5px; }
#menu-avatar { width: 64px; height: 64px; border-radius: 8px; margin-bottom: 10px; display: none; object-fit: cover; margin-left: auto; margin-right: auto; }

#mobile-users-trigger { display: none; }

/* === MOBİL GÖRÜNÜM === */
@media (max-width: 768px) {
    html, body { overflow-y: auto; overflow-x: hidden; height: 100%; margin: 0; padding: 0; }
    
    #chat-wrapper { flex-direction: column; padding: 15px 5px 5px 5px; gap: 5px; height: auto; min-height: 100svh; margin: 0; box-sizing: border-box; }
    
    #left-panel { flex: none; flex-shrink: 0; height: calc(100svh - 165px); min-height: 350px; position: relative; z-index: 10; display: flex; flex-direction: column; }
    #messages-box { margin-top: 0; flex: 1; }
    
    #right-panel { flex: none; flex-shrink: 0; display: flex; flex-direction: column; width: 100%; border-radius: 5px; padding: 10px; box-sizing: border-box; height: auto; margin: 0; overflow-x: hidden; }
    
    #mobile-users-trigger { display: flex; align-items: center; justify-content: space-between; background: #c685a5; color: #fff; font-weight: bold; padding: 10px; border-radius: 5px; cursor: pointer; width: 100%; box-sizing: border-box; font-size: 14px; text-align: center; margin-bottom: 5px; }
    #users-title-desktop { display: none; }
    
    .users-wrapper { display: none; border-radius: 5px; padding: 5px; max-height: 250px; overflow-y: auto; margin-bottom: 5px; border: 1px solid rgba(0,0,0,0.1); overflow-x: hidden; }
    #right-panel.dropdown-open .users-wrapper { display: block; background: rgba(255,255,255,0.8) !important; }

    .input-area-wrapper { height: 60px; min-height: 60px; } 
    #message-input { padding: 0 10px; font-size: 14px; }
    
    #custom-emoji-popup { bottom: 120px; left: 5px; max-width: calc(100% - 10px); }
    
    #nick-modal, #user-menu-modal {
        width: 95vw !important;
        max-width: 95vw !important;
        max-height: 90vh !important;
        overflow-y: auto !important;
    }
}

/* --- GÜNCELLENDİ: TEK SATIR VE GENİŞLEYEN AÇILIR ODA MENÜSÜ --- */
.room-dropdown-menu {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px 8px 8px 0;
    box-shadow: 0 -4px 15px rgba(0,0,0,0.15);
    min-width: 250px; /* Minimum genişliği artırdık */
    width: max-content; /* İçeriğe göre yanlara doğru genişlemesini sağlar */
    max-width: 85vw; /* Mobilde ekrandan taşmasını engeller */
    max-height: 300px; /* MÜKEMMEL DETAY: Çok oda varsa aşağıya uzamasını engeller */
    overflow-y: auto; /* MÜKEMMEL DETAY: Taştığında dikey scroll çıkarır */
    overflow-x: hidden; /* MÜKEMMEL DETAY: Yatay scroll çıkmasını engeller */
    z-index: 1000;
    padding: 5px 0;
    display: none; 
    /* YENİ: Mobilde daha yumuşak kaydırma deneyimi için eklendi */
    -webkit-overflow-scrolling: touch;
}

/* YENİ: Oda menüsüne özel şık, ince scrollbar tasarımı */
.room-dropdown-menu::-webkit-scrollbar {
    width: 6px;
}
.room-dropdown-menu::-webkit-scrollbar-track {
    background: #f1f1f1; 
    border-radius: 0 8px 8px 0;
}
.room-dropdown-menu::-webkit-scrollbar-thumb {
    background: #c685a5; 
    border-radius: 4px;
}
.room-dropdown-menu::-webkit-scrollbar-thumb:hover {
    background: #a36b87; 
}

.room-dropdown-menu.show {
    display: block !important;
    animation: slideUpFade 0.2s ease-out forwards;
}
@keyframes slideUpFade {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}
.room-item {
    padding: 12px 15px;
    font-size: 13px;
    color: #444;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #f4f4f4;
    transition: all 0.2s;
    cursor: pointer;
    white-space: nowrap; /* Yazıların alt satıra geçmesini engeller */
    gap: 15px; /* İsim ile sayı rozeti arasına mesafe koyar */
}
.room-item:last-child { border-bottom: none; }
.room-item:hover { background: #f8f9fa; color: #3498db; padding-left: 20px; }
.room-item.active-room { 
    background: #e0f7fa; 
    font-weight: bold; 
    color: #00838f;
    border-left: 4px solid #00acc1; 
}
.room-item span:first-child {
    overflow: hidden;
    text-overflow: ellipsis; /* Ekran çok daralırsa yazının sonuna ... koyar */
}
.room-user-count {
    background: #e74c3c;
    color: #fff;
    font-size: 11px;
    padding: 2px 7px;
    border-radius: 12px;
    font-weight: bold;
    min-width: 15px;
    text-align: center;
}
/* --- DJ YANARLI DÖNERLİ NİCK ANİMASYONU --- */
@keyframes djRainbow {
    0% { color: #ff0000; text-shadow: 0 0 5px rgba(255, 0, 0, 0.6); }
    15% { color: #ff8000; text-shadow: 0 0 5px rgba(255, 128, 0, 0.6); }
    30% { color: #ffff00; text-shadow: 0 0 5px rgba(255, 255, 0, 0.6); }
    45% { color: #00ff00; text-shadow: 0 0 5px rgba(0, 255, 0, 0.6); }
    60% { color: #00ffff; text-shadow: 0 0 5px rgba(0, 255, 255, 0.6); }
    75% { color: #0000ff; text-shadow: 0 0 5px rgba(0, 0, 255, 0.6); }
    90% { color: #8000ff; text-shadow: 0 0 5px rgba(128, 0, 255, 0.6); }
    100% { color: #ff0000; text-shadow: 0 0 5px rgba(255, 0, 0, 0.6); }
}

.dj-rainbow-nick {
    animation: djRainbow 3s infinite linear !important;
    font-weight: 900 !important;
    letter-spacing: 0.5px;
}
/* ----------------------------------------- */