/* ===== GENEL ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-primary: #36393f;
  --bg-secondary: #2f3136;
  --bg-tertiary: #202225;
  --bg-accent: #5865F2;
  --bg-accent-hover: #4752c4;
  --bg-modifier-hover: #4f545c29;
  --bg-modifier-active: #4f545c52;
  --text-normal: #dcddde;
  --text-muted: #72767d;
  --text-link: #00b0f4;
  --header-primary: #fff;
  --header-secondary: #b9bbbe;
  --channel-icon: #8e9297;
  --interactive-hover: #dcddde;
  --interactive-active: #fff;
  --background-floating: #18191c;
  --success: #57F287;
  --danger: #ED4245;
  --warning: #FEE75C;
  --scrollbar-thin-track: transparent;
  --scrollbar-thin-thumb: #202225;
}

body {
  font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg-tertiary);
  color: var(--text-normal);
  overflow: hidden;
  height: 100vh;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: var(--scrollbar-thin-track);
}
::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thin-thumb);
  border-radius: 4px;
}

/* ===== AUTH SAYFASI ===== */
.auth-page {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  min-height: 100vh;
  padding: 60px 80px;
  background: url('/img/bg.jpg') 30% top / cover no-repeat fixed;
}

.auth-container {
  width: 100%;
  max-width: 480px;
  padding: 20px;
}

.auth-box {
  background: var(--bg-primary);
  border-radius: 8px;
  padding: 32px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.auth-logo {
  text-align: center;
  margin-bottom: 24px;
}

.auth-logo h1 {
  color: var(--header-primary);
  font-size: 24px;
  margin-top: 8px;
  letter-spacing: 2px;
}

.auth-subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 4px;
}

.auth-form {
  display: none;
}
.auth-form.active {
  display: block;
}

.auth-form h2 {
  text-align: center;
  color: var(--header-primary);
  font-size: 20px;
  margin-bottom: 4px;
}

.auth-desc {
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 20px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--header-secondary);
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}

.form-group input {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-tertiary);
  border: 1px solid #040405;
  border-radius: 4px;
  color: var(--text-normal);
  font-size: 16px;
  outline: none;
  transition: border-color 0.2s;
}

.form-group input:focus {
  border-color: var(--bg-accent);
}

.btn-primary {
  width: 100%;
  padding: 12px;
  background: var(--bg-accent);
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  margin-top: 8px;
}

.btn-primary:hover {
  background: var(--bg-accent-hover);
}

.auth-switch {
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 12px;
}

.auth-switch a {
  color: var(--text-link);
  text-decoration: none;
}

.auth-switch a:hover {
  text-decoration: underline;
}

.auth-error {
  background: var(--danger);
  color: white;
  padding: 10px;
  border-radius: 4px;
  text-align: center;
  margin-top: 12px;
  font-size: 14px;
}

/* ===== ANA UYGULAMA ===== */
.app-layout {
  display: flex;
  height: 100vh;
  width: 100vw;
}

/* --- Sunucu Listesi --- */
.server-list {
  width: 72px;
  min-width: 72px;
  background: var(--bg-tertiary);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
  overflow-y: auto;
  gap: 8px;
}

.server-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-normal);
  font-size: 18px;
  font-weight: 700;
  position: relative;
  overflow: hidden;
}

.server-icon:hover,
.server-icon.active {
  border-radius: 16px;
  background: var(--bg-accent);
  color: white;
}

.server-icon.active::before {
  content: '';
  position: absolute;
  left: -16px;
  width: 8px;
  height: 40px;
  background: white;
  border-radius: 0 4px 4px 0;
}

.home-icon {
  background: var(--bg-accent);
  color: white;
}

.server-separator {
  width: 32px;
  height: 2px;
  background: var(--bg-modifier-active);
  border-radius: 1px;
}

.add-server {
  background: var(--bg-primary);
  color: var(--success);
  font-size: 24px;
}

.add-server:hover {
  background: var(--success);
  color: white;
}

/* --- Kanal Sidebar --- */
.channel-sidebar {
  width: 240px;
  min-width: 240px;
  background: var(--bg-secondary);
  display: flex;
  flex-direction: column;
}

.channel-header {
  height: 48px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  font-size: 16px;
  font-weight: 700;
  color: var(--header-primary);
  border-bottom: 1px solid var(--bg-tertiary);
  cursor: pointer;
  position: relative;
}

.channel-header:hover {
  background: var(--bg-modifier-hover);
}

.welcome-panel,
.channel-list-panel {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.welcome-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  text-align: center;
  padding: 20px;
}

.channel-category {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 8px 4px 16px;
}

.category-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--channel-icon);
  letter-spacing: 0.5px;
}

.add-channel-btn {
  background: none;
  border: none;
  color: var(--channel-icon);
  font-size: 18px;
  cursor: pointer;
  padding: 0 8px;
  line-height: 1;
}

.add-channel-btn:hover {
  color: var(--interactive-hover);
}

.channel-item {
  display: flex;
  align-items: center;
  padding: 6px 8px 6px 16px;
  margin: 1px 8px;
  border-radius: 4px;
  cursor: pointer;
  color: var(--channel-icon);
  font-size: 15px;
  transition: all 0.1s;
}

.channel-item:hover {
  background: var(--bg-modifier-hover);
  color: var(--interactive-hover);
}

.channel-item.active {
  background: var(--bg-modifier-active);
  color: var(--interactive-active);
}

.channel-item .channel-icon {
  margin-right: 6px;
  font-size: 18px;
  opacity: 0.7;
}

.channel-item .channel-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Ses kanalindaki kullanicilar */
.voice-channel-users {
  padding-left: 32px;
}

.voice-user-item {
  display: flex;
  align-items: center;
  padding: 4px 8px;
  margin: 1px 0;
  border-radius: 4px;
  font-size: 13px;
  color: var(--text-muted);
}

.voice-user-item .voice-user-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  margin-right: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: white;
  font-weight: 700;
}

/* --- Kullanici Panel (Alt) --- */
.user-panel {
  height: 52px;
  background: #292b2f;
  display: flex;
  align-items: center;
  padding: 0 8px;
  gap: 4px;
}

.user-info {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: white;
  margin-right: 8px;
  flex-shrink: 0;
}

.user-details {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--header-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-status {
  font-size: 11px;
  color: var(--success);
}

.user-controls {
  display: flex;
  gap: 2px;
}

.control-btn {
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  color: var(--channel-icon);
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.control-btn:hover {
  background: var(--bg-modifier-hover);
  color: var(--interactive-hover);
}

.control-btn.muted {
  color: var(--danger);
}

/* --- Chat Alani --- */
.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
  min-width: 0;
  position: relative;
}

.chat-header {
  height: 48px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--bg-tertiary);
  flex-shrink: 0;
}

.chat-channel-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--header-primary);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
}

.welcome-message {
  text-align: center;
  margin: auto;
  color: var(--text-muted);
}

.welcome-message h2 {
  color: var(--header-primary);
  font-size: 28px;
  margin-bottom: 8px;
}

/* Mesaj Stili */
.message {
  display: flex;
  padding: 4px 0;
  margin: 2px 0;
}

.message:hover {
  background: var(--bg-modifier-hover);
  border-radius: 4px;
}

.message-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: white;
  margin-right: 12px;
  flex-shrink: 0;
  margin-top: 2px;
}

.message-content {
  flex: 1;
  min-width: 0;
}

.message-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.message-author {
  font-size: 15px;
  font-weight: 600;
  color: var(--header-primary);
}

.message-time {
  font-size: 12px;
  color: var(--text-muted);
}

.message-text {
  font-size: 15px;
  color: var(--text-normal);
  line-height: 1.4;
  word-wrap: break-word;
  white-space: pre-wrap;
}

/* Chat Input */
.chat-input-area {
  padding: 0 16px 16px;
  flex-shrink: 0;
}

.message-form {
  display: flex;
  background: #40444b;
  border-radius: 8px;
  padding: 4px 4px 4px 16px;
}

.message-form input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-normal);
  font-size: 15px;
  outline: none;
  padding: 8px 0;
}

.message-form input::placeholder {
  color: var(--text-muted);
}

.send-btn {
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  color: var(--channel-icon);
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.send-btn:hover {
  color: var(--text-normal);
}

.typing-indicator {
  font-size: 12px;
  color: var(--text-muted);
  padding: 4px 0;
  height: 20px;
}

/* --- Uye Sidebar --- */
.member-sidebar {
  width: 240px;
  min-width: 240px;
  background: var(--bg-secondary);
  overflow-y: auto;
}

.member-header {
  padding: 16px 16px 8px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--channel-icon);
  letter-spacing: 0.5px;
}

.member-item {
  display: flex;
  align-items: center;
  padding: 6px 16px;
  cursor: pointer;
  border-radius: 4px;
  margin: 1px 8px;
}

.member-item:hover {
  background: var(--bg-modifier-hover);
}

.member-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: white;
  margin-right: 12px;
  position: relative;
}

.member-avatar .status-dot {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--bg-secondary);
}

.status-dot.online {
  background: var(--success);
}

.status-dot.offline {
  background: var(--text-muted);
}

.member-name {
  font-size: 15px;
  color: var(--channel-icon);
}

.member-item.online .member-name {
  color: var(--text-normal);
}

/* --- Ses Bari --- */
.voice-bar {
  background: #1a1e23;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--bg-tertiary);
}

.voice-bar-info {
  display: flex;
  flex-direction: column;
}

.voice-bar-status {
  font-size: 13px;
  font-weight: 600;
  color: var(--success);
}

.voice-bar-channel {
  font-size: 12px;
  color: var(--text-muted);
}

.voice-bar-controls {
  display: flex;
  gap: 4px;
}

.voice-control-btn {
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  color: var(--channel-icon);
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.voice-control-btn:hover {
  background: var(--bg-modifier-hover);
  color: var(--interactive-hover);
}

.voice-control-btn.active {
  color: var(--success);
  background: rgba(87, 242, 135, 0.1);
}

.disconnect-btn:hover {
  background: var(--danger);
  color: white;
}

/* --- Media Container (Video/Ekran) --- */
.media-container {
  position: absolute;
  top: 49px;
  left: 0;
  right: 0;
  bottom: 60px;
  background: #000;
  z-index: 10;
  display: flex;
  flex-direction: column;
}

.remote-videos {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px;
}

.remote-videos video {
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
  background: #1a1a1a;
}

.local-video-wrapper {
  position: absolute;
  bottom: 16px;
  right: 16px;
  width: 200px;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid var(--bg-accent);
}

.local-video-wrapper video {
  width: 100%;
  display: block;
}

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

.modal-content {
  background: var(--bg-primary);
  border-radius: 8px;
  padding: 24px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.modal-header h3 {
  color: var(--header-primary);
  font-size: 20px;
}

.modal-close {
  background: none;
  border: none;
  color: var(--channel-icon);
  font-size: 24px;
  cursor: pointer;
}

.modal-close:hover {
  color: var(--text-normal);
}

.modal-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.modal-tab {
  flex: 1;
  padding: 8px;
  background: var(--bg-tertiary);
  border: none;
  color: var(--text-muted);
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}

.modal-tab.active {
  background: var(--bg-accent);
  color: white;
}

.modal-form {
  display: block;
}

/* Davet kodu gosterimi */
.invite-display {
  text-align: center;
}

.invite-display p {
  color: var(--text-muted);
  margin-bottom: 16px;
}

.invite-code-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-tertiary);
  padding: 12px 16px;
  border-radius: 4px;
}

.invite-code-box span {
  flex: 1;
  font-size: 18px;
  font-weight: 700;
  color: var(--header-primary);
  font-family: monospace;
  letter-spacing: 2px;
}

.btn-copy {
  background: var(--bg-accent);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
}

.btn-copy:hover {
  background: var(--bg-accent-hover);
}

/* --- Responsive --- */
@media (max-width: 1000px) {
  .member-sidebar {
    display: none;
  }
}

@media (max-width: 768px) {
  .channel-sidebar {
    display: none;
  }
  .server-list {
    width: 56px;
    min-width: 56px;
  }
  .server-icon {
    width: 40px;
    height: 40px;
  }
}
