/* ============================================
   Server_MC Chat - Discord Style
   Japanese Luxury Gold & Black Theme
   ============================================ */

/* ============ VARIABLES ============ */
:root {
  --bg-primary: #050505;
  --bg-secondary: #0A0A0A;
  --bg-panel: #0F0F0F;
  --bg-card: #141414;
  --bg-input: #0B0B0B;
  --bg-hover: rgba(212, 175, 55, 0.08);
  --bg-active: rgba(212, 175, 55, 0.12);
  
  --gold-primary: #D4AF37;
  --gold-soft: #C9A227;
  --gold-hover: #FFD700;
  --gold-dark: #8B7500;
  --gold-border: rgba(212, 175, 55, 0.15);
  --gold-glow: rgba(212, 175, 55, 0.2);
  
  --text-primary: #F2F2F2;
  --text-secondary: #A8A8A8;
  --text-muted: #6B6B6B;
  
  --status-online: #43B581;
  --status-idle: #FAA61A;
  --status-dnd: #F04747;
  --status-offline: #747F8D;
  
  --danger: #F04747;
  --success: #43B581;
  
  --font-display: 'Inter', 'Noto Sans JP', sans-serif;
  --font-body: 'Inter', 'Noto Sans JP', sans-serif;
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 50%;
  
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
  --shadow-gold: 0 4px 20px rgba(212, 175, 55, 0.3);
}

/* Light Theme */
[data-theme="light"] {
  --bg-primary: #F5F5F5;
  --bg-secondary: #EEEEEE;
  --bg-panel: #E8E8E8;
  --bg-card: #FFFFFF;
  --bg-input: #F0F0F0;
  --bg-hover: rgba(212, 175, 55, 0.1);
  --bg-active: rgba(212, 175, 55, 0.15);
  --text-primary: #1A1A1A;
  --text-secondary: #666666;
  --text-muted: #999999;
  --gold-border: rgba(212, 175, 55, 0.3);
}

/* ============ RESET & BASE ============ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

input, button, textarea, select {
  font-family: inherit;
  outline: none;
}

a {
  color: var(--gold-primary);
  text-decoration: none;
}

a:hover {
  color: var(--gold-hover);
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.08);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.15);
}

/* ============ TOAST ============ */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  padding: 10px 20px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--gold-primary), var(--gold-soft));
  color: #000;
  font-size: 14px;
  font-weight: 600;
  z-index: 99999;
  opacity: 0;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-gold);
  pointer-events: none;
}

.toast.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ============ LOGIN OVERLAY ============ */
.login-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99998;
  backdrop-filter: blur(8px);
}

.login-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  width: 90%;
  max-width: 400px;
  border: 1px solid var(--gold-border);
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.login-logo {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--gold-primary), var(--gold-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 800;
  color: #000;
  margin: 0 auto 16px;
}

.login-card h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
}

.login-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.login-field {
  margin-bottom: 12px;
}

.login-field input {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,0.08);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 14px;
  transition: border-color 0.2s;
}

.login-field input:focus {
  border-color: var(--gold-primary);
}

.login-btn {
  width: 100%;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: none;
  background: linear-gradient(135deg, var(--gold-primary), var(--gold-soft));
  color: #000;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 8px;
}

.login-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(212,175,55,0.4);
}

.login-footer {
  margin-top: 16px;
  font-size: 13px;
  color: var(--text-muted);
}

/* ============ APP LAYOUT ============ */
.app {
  display: flex;
  height: 100vh;
  background: var(--bg-primary);
  position: relative;
}

/* ============ SERVER SIDEBAR ============ */
.server-sidebar {
  width: 72px;
  background: var(--bg-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
  gap: 4px;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}

.server-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  background: var(--bg-panel);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 22px;
  position: relative;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.server-icon:hover {
  border-radius: 14px;
  background: var(--gold-primary);
  color: #000;
  border-color: var(--gold-primary);
}

.server-icon.active {
  border-radius: 14px;
  background: rgba(212, 175, 55, 0.2);
  border-color: var(--gold-primary);
}

.server-logo {
  background: linear-gradient(135deg, var(--gold-primary), var(--gold-dark));
  color: #000;
  font-weight: 800;
  font-size: 20px;
}

.server-divider {
  width: 32px;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(212,175,55,0.3), transparent);
  margin: 4px 0;
}

.server-spacer {
  flex: 1;
}

.server-tooltip {
  position: absolute;
  left: 56px;
  top: 50%;
  transform: translateY(-50%);
  background: #000;
  color: #fff;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: all 0.15s ease;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.server-icon:hover .server-tooltip {
  opacity: 1;
}

/* ============ CHANNEL SIDEBAR ============ */
.channel-sidebar {
  width: 280px;
  background: var(--bg-panel);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: relative;
  z-index: 5;
  border-right: 1px solid rgba(255,255,255,0.03);
}

.channel-header {
  padding: 16px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.channel-server-name {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.channel-server-name h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.channel-arrow {
  font-size: 10px;
  color: var(--text-muted);
}

.channel-user-mini {
  display: flex;
  align-items: center;
  gap: 10px;
}

.channel-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  border: 1px solid var(--gold-dark);
}

.channel-user-info {
  display: flex;
  flex-direction: column;
}

.channel-user-info span:first-child {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.channel-user-info .status-offline,
.channel-user-info .status-online {
  font-size: 11px;
  color: var(--text-muted);
}

.channel-search {
  padding: 8px 12px;
}

.channel-search input {
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,0.06);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 13px;
  transition: border-color 0.2s;
}

.channel-search input:focus {
  border-color: var(--gold-primary);
}

.channel-search input::placeholder {
  color: var(--text-muted);
}

.channel-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.channel-category {
  margin-bottom: 4px;
}

.category-header {
  display: flex;
  align-items: center;
  padding: 6px 16px 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  gap: 4px;
}

.category-arrow {
  font-size: 10px;
}

.category-add {
  margin-left: auto;
  width: 20px;
  height: 20px;
  border-radius: var(--radius-full);
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all 0.2s;
  transform: rotate(45deg);
}

.category-header:hover .category-add {
  opacity: 1;
}

.category-add:hover {
  background: var(--gold-primary);
  color: #000;
}

.channel-list {
  padding: 0 8px;
}

.channel-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 14px;
  transition: all 0.15s;
  margin-bottom: 1px;
  position: relative;
}

.channel-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.channel-item.active {
  background: var(--bg-active);
  color: var(--gold-primary);
}

.channel-item.active::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--gold-primary);
  border-radius: 0 3px 3px 0;
}

.channel-hash {
  font-size: 16px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
  opacity: 0.7;
}

.channel-item.voice {
  color: var(--text-muted);
}

.channel-voice-users {
  margin-left: auto;
  font-size: 11px;
  background: rgba(255,255,255,0.05);
  padding: 1px 6px;
  border-radius: 10px;
}

/* ============ USER PANEL ============ */
.user-panel {
  padding: 10px 12px;
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid rgba(255,255,255,0.04);
  flex-shrink: 0;
}

.user-panel-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-panel-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  border: 2px solid var(--gold-dark);
}

.user-panel-details {
  display: flex;
  flex-direction: column;
}

.user-panel-details span:first-child {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.user-panel-details span:last-child {
  font-size: 11px;
  color: var(--text-muted);
}

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

.user-panel-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.user-panel-btn:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text-primary);
}

/* ============ CHAT MAIN ============ */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg-primary);
  position: relative;
}

/* Chat Header */
.chat-header {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  background: var(--bg-primary);
  flex-shrink: 0;
  z-index: 2;
  backdrop-filter: blur(10px);
}

.chat-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-hashtag {
  font-size: 22px;
  color: var(--text-muted);
  font-weight: 700;
}

.chat-header-info h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.chat-header-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.chat-status-online {
  font-size: 10px;
}

.chat-header-right {
  display: flex;
  gap: 2px;
}

.chat-header-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.chat-header-btn:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text-primary);
}

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

.chat-welcome {
  text-align: center;
  padding: 48px 20px;
  margin: auto;
}

.chat-welcome-icon {
  font-size: 56px;
  margin-bottom: 16px;
}

.chat-welcome h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.chat-welcome p {
  font-size: 14px;
  color: var(--text-muted);
}

/* Chat Message */
.chat-msg {
  display: flex;
  gap: 12px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
  margin: 1px 0;
}

.chat-msg:hover {
  background: rgba(255,255,255,0.02);
}

.chat-msg-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  border: 1px solid var(--gold-dark);
  cursor: pointer;
  margin-top: 2px;
}

.chat-msg-body {
  flex: 1;
  min-width: 0;
}

.chat-msg-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.chat-msg-author {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
}

.chat-msg-author:hover {
  color: var(--gold-primary);
  text-decoration: underline;
}

.chat-msg-role {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.chat-msg-role.admin {
  background: linear-gradient(135deg, #ff4444, #cc0000);
  color: #fff;
}

.chat-msg-role.member {
  background: rgba(255,255,255,0.05);
  color: var(--text-muted);
}

.chat-msg-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: auto;
}

.chat-msg-text {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
  word-wrap: break-word;
  white-space: pre-wrap;
}

.chat-msg.own {
  background: rgba(212, 175, 55, 0.04);
  border-left: 2px solid rgba(212, 175, 55, 0.2);
}

.chat-date-divider {
  display: flex;
  align-items: center;
  margin: 16px 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.chat-date-divider::before,
.chat-date-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255,255,255,0.06);
}

.chat-date-divider span {
  padding: 0 16px;
}

/* ============ CHAT INPUT ============ */
.chat-input-area {
  padding: 12px 16px;
  background: var(--bg-primary);
  flex-shrink: 0;
  border-top: 1px solid rgba(255,255,255,0.03);
}

.chat-input-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 0 8px;
  border: 1px solid rgba(255,255,255,0.08);
  transition: all 0.2s;
}

.chat-input-wrap:focus-within {
  border-color: var(--gold-primary);
  box-shadow: 0 0 10px var(--gold-glow);
}

.chat-input-plus {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.chat-input-plus:hover {
  color: var(--gold-primary);
}

.chat-input-wrap input {
  flex: 1;
  background: transparent;
  border: none;
  padding: 10px 4px;
  color: var(--text-primary);
  font-size: 14px;
}

.chat-input-wrap input::placeholder {
  color: var(--text-muted);
}

.chat-input-actions {
  display: flex;
  gap: 2px;
}

.chat-input-action {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.chat-input-action:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.05);
}

/* ============ MEMBER SIDEBAR ============ */
.member-sidebar {
  width: 240px;
  background: var(--bg-panel);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  border-left: 1px solid rgba(255,255,255,0.03);
}

.member-header {
  padding: 16px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.member-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.member-role-section {
  margin-bottom: 12px;
}

.member-role-header {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: 4px 8px;
  margin-bottom: 4px;
}

.member-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.member-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}

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

.member-status {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.member-status.online {
  background: var(--status-online);
  box-shadow: 0 0 6px rgba(67, 181, 129, 0.5);
}

.member-status.offline {
  background: var(--status-offline);
}

.member-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.member-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-left: auto;
  flex-shrink: 0;
}

.member-badge.owner {
  background: linear-gradient(135deg, #FFD700, #FF8C00);
  color: #000;
}

.member-badge.admin {
  background: linear-gradient(135deg, #F04747, #CC0000);
  color: #fff;
}

/* ============ NANO PLAYER ============ */
.nano-player {
  position: fixed !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
  height: 44px !important;
  background: var(--bg-card);
  border-top: 1px solid var(--gold-border);
  z-index: 99999 !important;
  backdrop-filter: blur(10px);
  transition: opacity 0.3s ease, height 0.3s ease;
  transform: none !important;
}

.nano-player.hidden {
  display: none;
}

.nano-progress-track {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: rgba(255,255,255,0.06);
  cursor: pointer;
}

.nano-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-primary), var(--gold-hover));
  transition: width 0.15s linear;
}

.nano-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: 44px;
}

.nano-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.nano-icon {
  font-size: 18px;
  flex-shrink: 0;
}

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

.nano-time {
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.nano-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 12px;
}

.nano-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.nano-btn:hover {
  color: var(--gold-primary);
}

.nano-play {
  width: 36px;
  height: 36px;
  background: var(--gold-primary);
  color: #000;
  font-size: 16px;
}

.nano-play:hover {
  background: var(--gold-hover);
  transform: scale(1.05);
}

/* ============ BUBBLE PLAYER ============ */
.bubble-player {
  position: fixed !important;
  bottom: 56px !important;
  right: 20px !important;
  z-index: 99998 !important;
}

.bubble-toggle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-primary), var(--gold-dark));
  border: none;
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(212,175,55,0.4);
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bubble-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 28px rgba(212,175,55,0.5);
}

.bubble-toggle.hidden {
  display: none;
}

.bubble-panel {
  position: absolute;
  bottom: 56px;
  right: 0;
  width: 300px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--gold-border);
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
  overflow: hidden;
  animation: bubbleSlideUp 0.25s ease;
}

.bubble-panel.hidden {
  display: none;
}

@keyframes bubbleSlideUp {
  from { opacity: 0; transform: translateY(12px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.bubble-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.bubble-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.bubble-close:hover {
  background: var(--gold-primary);
  color: #000;
}

.bubble-now {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
}

.bubble-cover {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--gold-dark), var(--gold-primary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

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

.bubble-track-artist {
  font-size: 11px;
  color: var(--text-muted);
}

.bubble-progress {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 16px 8px;
}

.bubble-progress-track {
  flex: 1;
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  cursor: pointer;
}

.bubble-progress-track:hover {
  height: 6px;
}

.bubble-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-primary), var(--gold-hover));
  border-radius: 2px;
  transition: width 0.15s linear;
}

.bubble-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 4px 16px 10px;
}

.bctrl {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.bctrl:hover {
  color: var(--gold-primary);
}

.bubble-play-btn {
  width: 40px;
  height: 40px;
  background: var(--gold-primary);
  color: #000;
  font-size: 18px;
}

.bubble-play-btn:hover {
  background: var(--gold-hover);
  transform: scale(1.05);
}

.bubble-volume {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px 10px;
}

.bubble-vol-slider {
  flex: 1;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  outline: none;
}

.bubble-vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--gold-primary);
  cursor: pointer;
}

.bubble-playlist-label {
  padding: 6px 16px 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border-top: 1px solid rgba(255,255,255,0.05);
}

.bubble-playlist {
  max-height: 160px;
  overflow-y: auto;
  padding: 4px 8px;
}

.bubble-playlist::-webkit-scrollbar {
  width: 4px;
}

.bubble-playlist::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
}

.bubble-upload-btn {
  display: block;
  text-align: center;
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--gold-primary);
  cursor: pointer;
  border-top: 1px solid rgba(255,255,255,0.05);
  transition: background 0.2s;
}

.bubble-upload-btn:hover {
  background: rgba(212,175,55,0.08);
}

/* ============ MODALS ============ */
.modal-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(4px);
}

.modal-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 440px;
  max-height: 80vh;
  overflow: hidden;
  border: 1px solid var(--gold-border);
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 700;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,0.04);
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.modal-close:hover {
  background: var(--gold-primary);
  color: #000;
}

.modal-body {
  padding: 20px;
}

.modal-body input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,0.08);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 14px;
  margin-bottom: 12px;
}

.modal-body input[type="text"]:focus {
  border-color: var(--gold-primary);
}

.modal-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.modal-footer {
  border-top: 1px solid rgba(255,255,255,0.05);
}

/* Profile Modal */
.profile-card {
  max-width: 480px;
}

.profile-banner {
  height: 100px;
  background: linear-gradient(135deg, var(--gold-dark), var(--gold-primary), var(--gold-dark));
  opacity: 0.3;
}

.profile-avatar-section {
  padding: 0 20px;
  margin-top: -40px;
}

.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-full);
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  border: 4px solid var(--gold-primary);
  box-shadow: 0 4px 20px rgba(212,175,55,0.3);
}

.profile-body {
  padding: 12px 20px 20px;
}

.profile-display-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.profile-display-username {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 2px;
}

.profile-role-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  margin-top: 8px;
  background: rgba(212,175,55,0.15);
  color: var(--gold-primary);
  border: 1px solid rgba(212,175,55,0.3);
}

.profile-bio {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 12px;
  line-height: 1.5;
}

.profile-stats {
  display: flex;
  gap: 12px;
  margin: 16px 0;
}

.profile-stat {
  flex: 1;
  text-align: center;
  padding: 10px;
  background: rgba(255,255,255,0.03);
  border-radius: var(--radius-sm);
}

.profile-stat-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--gold-primary);
  display: block;
}

.profile-stat-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  display: block;
}

.profile-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.profile-actions .btn {
  flex: 1;
}

/* Settings Modal */
.settings-card {
  max-width: 600px;
  max-height: 85vh;
}

.settings-body {
  display: flex;
  min-height: 300px;
}

.settings-nav {
  width: 140px;
  padding: 12px 0;
  border-right: 1px solid rgba(255,255,255,0.05);
  flex-shrink: 0;
}

.settings-nav-item {
  display: block;
  width: 100%;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s;
}

.settings-nav-item:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.03);
}

.settings-nav-item.active {
  color: var(--gold-primary);
  background: rgba(212,175,55,0.08);
  border-right: 2px solid var(--gold-primary);
}

.settings-content {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
}

.settings-pane {
  display: none;
}

.settings-pane.active {
  display: block;
}

.settings-pane h4 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 16px;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}

.settings-row label {
  font-size: 13px;
  color: var(--text-primary);
}

.settings-select {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,0.1);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
}

.settings-select:focus {
  border-color: var(--gold-primary);
}

.settings-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--gold-primary);
}

.settings-btn {
  width: 100%;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s;
  margin-bottom: 6px;
}

.settings-btn:hover {
  background: var(--bg-hover);
  border-color: var(--gold-border);
}

/* Member Picker */
.member-picker {
  max-height: 200px;
  overflow-y: auto;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 6px;
}

.dm-list {
  max-height: 300px;
  overflow-y: auto;
}

.member-picker-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}

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

.clickable-dm {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-primary);
  text-align: left;
  font-size: 13px;
}

/* Friend Item */
.friend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
  transition: all 0.15s;
}

.friend-item:hover {
  background: rgba(255,255,255,0.03);
}

.friend-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  border: 1px solid var(--gold-dark);
  flex-shrink: 0;
}

.friend-info {
  flex: 1;
  min-width: 0;
}

.friend-name {
  font-size: 13px;
  font-weight: 600;
}

.friend-status {
  font-size: 11px;
  color: var(--text-muted);
}

.friend-status.online {
  color: var(--status-online);
}

.friend-actions {
  display: flex;
  gap: 4px;
}

/* Notification Item */
.notif-item {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  cursor: pointer;
  transition: all 0.15s;
}

.notif-item:hover {
  background: rgba(255,255,255,0.02);
}

.notif-item.unread {
  background: var(--bg-hover);
  border-left: 3px solid var(--gold-primary);
}

.notif-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.notif-content {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.notif-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Playlist Track */
.playlist-track {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}

.playlist-track:hover {
  background: rgba(255,255,255,0.04);
}

.playlist-track.active {
  background: var(--gold-primary);
  color: #000;
}

.playlist-track.active .track-artist {
  color: #000;
  opacity: 0.7;
}

.track-info {
  flex: 1;
  min-width: 0;
}

.track-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-artist {
  font-size: 11px;
  color: var(--text-muted);
}

/* ============ NOTIFICATION BADGE ============ */
.notif-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 16px;
  height: 16px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  box-shadow: 0 0 8px rgba(240,71,71,0.6);
  animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
  0%, 100% { box-shadow: 0 0 8px rgba(240,71,71,0.6); }
  50% { box-shadow: 0 0 16px rgba(240,71,71,0.9); }
}

/* ============ BUTTONS ============ */
.btn {
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}

.btn-primary {
  background: linear-gradient(135deg, var(--gold-primary), var(--gold-soft));
  color: #000;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(212,175,55,0.4);
}

.btn-secondary {
  background: rgba(255,255,255,0.06);
  color: var(--text-primary);
  border: 1px solid rgba(255,255,255,0.1);
}

.btn-secondary:hover {
  background: rgba(255,255,255,0.1);
}

/* ============ UTILITY ============ */
.hidden {
  display: none !important;
}

.error-message {
  background: rgba(240,71,71,0.1);
  border: 1px solid rgba(240,71,71,0.3);
  color: var(--danger);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  font-size: 13px;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 1024px) {
  .member-sidebar {
    display: none;
  }
  
  .channel-sidebar {
    width: 240px;
  }
}

@media (max-width: 768px) {
  .server-sidebar {
    width: 56px;
  }
  
  .server-icon {
    width: 36px;
    height: 36px;
    font-size: 18px;
  }
  
  .channel-sidebar {
    width: 200px;
  }
  
  .member-sidebar {
    display: none;
  }
  
  .nano-player {
    left: 0 !important;
    width: 100% !important;
  }
  
  .bubble-player {
    bottom: 50px !important;
    right: 12px !important;
  }
  
  .bubble-panel {
    width: 260px;
  }
  
  .settings-body {
    flex-direction: column;
  }
  
  .settings-nav {
    width: 100%;
    display: flex;
    overflow-x: auto;
    border-right: none;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    padding: 0;
  }
  
  .settings-nav-item {
    white-space: nowrap;
    padding: 8px 12px;
    border-right: none !important;
    border-bottom: 2px solid transparent;
  }
  
  .settings-nav-item.active {
    border-bottom-color: var(--gold-primary);
  }
}

@media (max-width: 480px) {
  .channel-sidebar {
    display: none;
  }
  
  .server-sidebar {
    width: 48px;
  }
  
  .server-icon {
    width: 32px;
    height: 32px;
    font-size: 16px;
  }
  
  .nano-player {
    left: 0 !important;
    width: 100% !important;
  }
}

/* ============ iOS / Safari OPTIMIZATIONS ============ */
@supports (-webkit-touch-callout: none) {
  .chat-input-area {
    padding-bottom: env(safe-area-inset-bottom, 8px);
  }
  .nano-player {
    bottom: env(safe-area-inset-bottom, 0px) !important;
  }
  .user-panel {
    padding-bottom: env(safe-area-inset-bottom, 4px);
  }
  input, textarea, select, button {
    font-size: 16px !important;
  }
  .modal-overlay {
    -webkit-overflow-scrolling: touch;
  }
  .chat-messages {
    -webkit-overflow-scrolling: touch;
  }
  .channel-scroll {
    -webkit-overflow-scrolling: touch;
  }
  * {
    -webkit-tap-highlight-color: transparent;
  }
}

/* ============ SETTINGS EXTRAS ============ */
.settings-textarea {
  width: 100%;
  min-height: 80px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--gold-border);
  background: var(--bg-input);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  resize: vertical;
}

.settings-info {
  margin-top: 12px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  font-size: 13px;
}

.settings-info p {
  margin: 4px 0;
  color: var(--text-secondary);
}

.settings-info span {
  color: var(--text-primary);
}

/* ============ ACCESSIBILITY ============ */
[data-high-contrast="true"] {
  --text-primary: #FFFFFF;
  --text-secondary: #CCCCCC;
  --text-muted: #999999;
  --gold-border: rgba(212, 175, 55, 0.4);
}

[data-reduced-anim="true"] * {
  animation: none !important;
  transition: none !important;
}

[data-cursor="large"] * {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='10' fill='none' stroke='%23D4AF37' stroke-width='2'/%3E%3C/svg%3E") 12 12, auto;
}
