/* Kilit Özelliği: İçeriklerin taşmasını kesin olarak engeller */
#msj-widget *, #msj-client-box *, #msj-admin-modal * { box-sizing: border-box; }

.msj-hidden { display: none !important; }

/* Sağ Alt Yüzer Buton */
#msj-widget { position: fixed; bottom: 20px; right: 20px; z-index: 99999; font-family: sans-serif; }
.msj-fab { height: 60px; padding: 0 20px; background: #25d366; border-radius: 30px; display: flex; align-items: center; justify-content: center; color: white; font-size: 24px; cursor: pointer; box-shadow: 0 4px 10px rgba(0,0,0,0.3); border: none; white-space: nowrap; transition: all 0.3s ease; }
.msj-fab:hover { transform: scale(1.05); }
.msj-fab-text { font-size: 15px; font-weight: bold; margin-left: 8px; font-family: sans-serif;}

/* Müşteri Kutusu ve Taşma Kilitleri */
#msj-client-box { position: fixed; bottom: 90px; right: 20px; width: 340px; height: 480px; max-width: calc(100vw - 30px); max-height: calc(100vh - 120px); background: #fff; border-radius: 10px; box-shadow: 0 5px 20px rgba(0,0,0,0.3); z-index: 99999; display: flex; flex-direction: column; overflow: hidden; }
#msj-chat-area { display: flex; flex-direction: column; flex: 1; height: 100%; overflow: hidden; }
.msj-header { background: #333; color: #fff; padding: 15px; display: flex; justify-content: space-between; font-weight: bold; flex-shrink: 0; align-items: center;}
.msj-header span.close { cursor: pointer; color: #ff5555; font-size: 20px;}
.msj-body { flex: 1; overflow-y: auto; padding: 15px; background: #e5ddd5; display: flex; flex-direction: column; gap: 10px; min-height: 0; }

/* MÜŞTERİ FOOTER (Mobilde taşmayı önleyen kilitli tasarım) */
.msj-footer { width: 100%; padding: 10px; background: #f0f0f0; display: flex; gap: 8px; flex-shrink: 0; align-items: center; }
.msj-footer input { flex: 1; min-width: 0; padding: 12px 15px; border: 1px solid #ccc; border-radius: 25px; outline:none; font-size: 14px; }
.msj-footer button { background: #25d366; color: white; border: none; width: 42px; height: 42px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; padding: 0; font-size: 16px; box-shadow: 0 2px 5px rgba(0,0,0,0.2);}

/* Balonlar ve Tik Tasarımı */
.msj-bubble { max-width: 85%; padding: 10px 12px; border-radius: 10px; font-size: 14px; line-height: 1.4; word-wrap: break-word;}
.msj-bubble.client { background: #dcf8c6; align-self: flex-end; border-bottom-right-radius: 0; box-shadow: 0 1px 1px rgba(0,0,0,0.1);}
.msj-bubble.admin { background: #fff; align-self: flex-start; border-bottom-left-radius: 0; box-shadow: 0 1px 1px rgba(0,0,0,0.1);}
.msj-time { font-size: 10px; color: #888; text-align: right; display: block; margin-top: 5px; }
.msj-tick { font-size: 11px; margin-left: 3px; color: #999; font-weight: bold; }
.msj-tick.read { color: #34b7f1; letter-spacing: -2px; }

/* Müşteri Giriş Formu */
#msj-login-form { padding: 20px; display: flex; flex-direction: column; gap: 10px; height: 100%; justify-content: center; background: white; flex: 1; overflow-y: auto;}
#msj-login-form input, #msj-login-form textarea { padding: 12px; border: 1px solid #ccc; border-radius: 5px; font-size: 14px; font-family: inherit; }
#msj-login-form textarea { resize: none; background: #f9f9f9; color:#333; border:2px solid #25d366;}
#msj-login-form button { padding: 12px; background: #e74c3c; color: white; border: none; border-radius: 5px; cursor: pointer; font-weight: bold; flex-shrink: 0; font-size: 15px;}

/* YÖNETİM MODALI (Genişletilmiş ve Ferah Tasarım) */
#msj-admin-modal { position: fixed; top:0; left:0; width:100%; height:100%; background: rgba(0,0,0,0.6); z-index: 99999; display: flex; justify-content: center; align-items: center; }
#msj-admin-container { display: flex; width: 1000px; height: 650px; max-width: 95%; max-height: 90%; background: #fff; border-radius: 10px; overflow: hidden; font-family: sans-serif; position: relative;}
.msj-admin-sidebar { width: 320px; border-right: 1px solid #ccc; background: #f8f9fa; overflow-y: auto; }
.msj-admin-chat-area { flex: 1; display: flex; flex-direction: column; background: #e5ddd5; overflow: hidden; }
#msj-admin-chat-body { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 10px; min-height: 0; }

/* YÖNETİM FOOTER (Genişletilmiş Yazı Kutusu) */
#msj-admin-footer { width: 100%; flex-shrink: 0; padding: 15px; background: #f0f0f0; display: flex; gap: 10px; align-items: center; border-top: 1px solid #ddd;}
#msj-admin-footer input { flex: 1; min-width: 0; padding: 15px 20px; font-size: 15px; border-radius: 30px; border: 1px solid #ccc; outline: none; }
#msj-admin-footer button { background: #25d366; color: white; border: none; width: 50px; height: 50px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; padding: 0; font-size: 20px; box-shadow: 0 2px 5px rgba(0,0,0,0.2);}

/* Yönetim Sol Taraf Kullanıcı Listesi */
.msj-user-item { padding: 15px; border-bottom: 1px solid #ddd; display: flex; justify-content: space-between; align-items: center; }
.msj-user-item:hover { background: #eee; }
.msj-user-info { flex:1; min-width: 0; }
.msj-user-info strong { display: block; font-size: 15px; color:#333; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 3px;}
.msj-user-info span { font-size: 13px; color: #666; }

.copy-area { padding: 2px 4px; border-radius: 3px; transition: background 0.2s; cursor: pointer;}
.copy-area:hover { background: #d1ecf1; color: #0c5460; }
.copy-success { background: #d4edda !important; color: #155724 !important; font-weight: bold;}

.msj-unread-dot { width: 12px; height: 12px; background: #e74c3c; border-radius: 50%; display: none; margin-right:5px;}
.msj-unread-dot.active { display: block; } 
.msj-btn-open { background: #007bff; color: white; border: none; padding: 8px 12px; border-radius: 5px; cursor: pointer; font-size: 13px; font-weight: bold;}
.msj-btn-open:hover { background: #0056b3; }
.msj-btn-delete { background: #ff4d4d; color: white; border: none; padding: 8px 12px; border-radius: 5px; cursor: pointer; font-size: 13px; font-weight: bold;}
#msj-admin-close { position: absolute; top: 15px; right: 15px; color: white; cursor: pointer; font-size: 20px; font-weight: bold; }

/* Dışarıdaki Asıl Tetikleyici Buton (Kırmızı/Yeşil) */
.msj-admin-trigger-btn { background: white; color: #d9534f; border: 2px solid #d9534f; padding: 10px; font-size: 18px; font-weight: bold; width: 100%; margin-top: 10px; border-radius: 5px; cursor: pointer; display: flex; justify-content: center; align-items: center; gap: 10px; transition: all 0.3s ease;}
.msj-admin-trigger-btn:hover { background: #d9534f; color: white; }
.msj-badge { background: #d9534f; color: white; padding: 2px 8px; border-radius: 10px; font-size: 12px; display: none;}
.msj-admin-trigger-btn:hover .msj-badge { background: white; color: #d9534f; }

.msj-admin-trigger-btn.has-unread { background: #28a745 !important; color: white !important; border-color: #28a745 !important;}
.msj-admin-trigger-btn.has-unread .msj-badge { background: white; color: #28a745; }