:root {
  --bg-main: #0b0f19;
  --bg-card: rgba(18, 26, 43, 0.95);
  --border-card: rgba(255, 255, 255, 0.08);
  --accent: #6366f1;
  --bubble-me: #4f46e5;
  --bubble-other: #1e293b;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }

html, body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: var(--bg-main);
  color: #f8fafc;
}

#app-layout {
  display: flex;
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  position: relative;
}

/* MODALLAR */
#auth-modal, #ban-screen {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.88); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center; z-index: 2000; padding: 15px;
}
.modal {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.88); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center; z-index: 3000; padding: 15px;
}
.auth-card, .modal-card, .ban-card {
  background: var(--bg-card); border: 1px solid var(--border-card); padding: 22px;
  border-radius: 16px; width: 100%; max-width: 340px; text-align: center; box-shadow: 0 10px 40px rgba(0,0,0,0.7);
}
.support-badge {
  background: rgba(99, 102, 241, 0.15); border: 1px solid rgba(99, 102, 241, 0.4);
  color: #a5b4fc; font-size: 11px; padding: 5px 8px; border-radius: 8px; cursor: pointer; font-weight: bold;
}
.tabs { display: flex; background: rgba(0,0,0,0.3); border-radius: 8px; margin-bottom: 12px; padding: 3px; }
.tab-btn { flex: 1; padding: 8px; border: none; background: none; color: #94a3b8; font-weight: bold; font-size: 13px; cursor: pointer; border-radius: 6px; }
.tab-btn.active { background: var(--accent); color: #fff; }

input, textarea { width: 100%; padding: 10px 12px; margin-bottom: 8px; background: #0f172a; border: 1px solid var(--border-card); border-radius: 8px; color: #fff; font-size: 13px; outline: none; }
.btn-primary { width: 100%; padding: 10px; background: var(--accent); border: none; border-radius: 8px; color: #fff; font-weight: bold; cursor: pointer; }
.btn-sec { background: #334155; border: none; border-radius: 8px; color: #fff; font-weight: bold; cursor: pointer; }
.btn-logout { background: #ef4444; border: none; border-radius: 8px; color: #fff; font-weight: bold; cursor: pointer; }
.btn-logout:hover { background: #dc2626; }
.error-text { color: #f87171; font-size: 12px; min-height: 16px; margin-bottom: 6px; }

/* SIDEBAR (KAYDIRMA ÖZELLİĞİ EKLENDİ) */
#sidebar {
  width: 250px;
  flex-shrink: 0;
  background: #0d1322;
  border-right: 1px solid var(--border-card);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.profile-bar { padding: 12px 14px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--border-card); flex-shrink: 0; }
.avatar { width: 34px; height: 34px; border-radius: 8px; background: var(--accent); display: flex; align-items: center; justify-content: center; font-weight: bold; }
.section-label { padding: 10px 14px 4px; font-size: 10px; text-transform: uppercase; color: #64748b; font-weight: bold; flex-shrink: 0; }
.add-room-btn { background: rgba(99, 102, 241, 0.15); border: 1px solid var(--accent); color: #a5b4fc; font-size: 10px; padding: 2px 6px; border-radius: 6px; cursor: pointer; font-weight: bold; }
.room-list { display: flex; flex-direction: column; gap: 2px; padding: 0 8px; flex-shrink: 0; }
.room-btn { padding: 8px 10px; border-radius: 6px; background: none; border: none; color: #94a3b8; text-align: left; cursor: pointer; font-size: 13px; width: 100%; display: flex; justify-content: space-between; align-items: center; }
.room-btn.active, .room-btn:hover { background: rgba(99, 102, 241, 0.15); color: #fff; }

#online-list { list-style: none; padding: 4px 8px; flex-shrink: 0; }
#online-list li { padding: 6px 10px; font-size: 13px; color: #94a3b8; cursor: pointer; border-radius: 6px; display: flex; justify-content: space-between; align-items: center; }

/* CHAT MAIN */
#chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  min-width: 0;
  position: relative;
  overflow: hidden;
  background: var(--bg-main);
}

#chat-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-card);
  background: #0f172a;
  font-weight: bold;
  font-size: 14px;
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#mobile-topbar { display: none; flex-shrink: 0; }

#messages {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 16px;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.msg { background: var(--bubble-other); padding: 8px 12px; border-radius: 12px; border-top-left-radius: 2px; max-width: 80%; width: fit-content; word-break: break-word; font-size: 13px; }
.msg.me { align-self: flex-end; background: var(--bubble-me); border-top-left-radius: 12px; border-top-right-radius: 2px; }
.msg-user { font-size: 11px; font-weight: bold; color: #38bdf8; margin-bottom: 2px; }
.msg.me .msg-user { color: #c7d2fe; }
.msg-time { font-size: 9px; color: rgba(255,255,255,0.5); margin-left: 5px; }

#chat-form {
  flex-shrink: 0;
  min-height: 54px;
  padding: 8px 12px;
  background: #0d1322;
  border-top: 1px solid var(--border-card);
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 100;
}

#msg-input {
  flex: 1;
  height: 38px;
  margin: 0;
  padding: 0 12px;
  background: #0f172a;
  border: 1px solid var(--border-card);
  border-radius: 8px;
  color: #fff;
  font-size: 13px;
  outline: none;
}

#chat-form button {
  height: 38px;
  padding: 0 18px;
  background: var(--accent);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-weight: bold;
  cursor: pointer;
  flex-shrink: 0;
}

/* MOBİL TASARIM */
@media (max-width: 768px) {
  #chat-header { display: none; }
  #mobile-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: #0f172a;
    border-bottom: 1px solid var(--border-card);
  }
  #menu-toggle, .notif-btn { background: var(--accent); color: #fff; border: none; padding: 6px 10px; border-radius: 6px; font-size: 12px; font-weight: bold; cursor: pointer; }

  #sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 260px;
    z-index: 1500;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 4px 0 25px rgba(0,0,0,0.8);
  }
  #sidebar.open { transform: translateX(0); }
  #sidebar-backdrop {
    position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 1400; display: none;
  }
  #sidebar.open ~ #sidebar-backdrop { display: block; }
}
