* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Segoe UI', Tahoma, sans-serif; }

body { background: #111b21; height: 100vh; overflow: hidden; direction: rtl; }

#login-screen {
  display: flex; align-items: center; justify-content: center;
  height: 100vh; background: linear-gradient(135deg, #0b141a, #1f2c33);
}

.login-box {
  background: #1f2c33; padding: 40px; border-radius: 16px;
  text-align: center; width: 340px; box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.login-logo { font-size: 42px; font-weight: 800; color: #00a884; letter-spacing: 4px; margin-bottom: 8px; }
.login-sub { color: #8696a0; font-size: 14px; margin-bottom: 30px; }

.login-box input {
  width: 100%; padding: 14px 18px; border: 2px solid #2a3942;
  border-radius: 10px; background: #2a3942; color: #e9edef;
  font-size: 16px; outline: none; transition: 0.3s;
}

.login-box input:focus { border-color: #00a884; }

.login-box button {
  width: 100%; padding: 14px; margin-top: 16px;
  background: #00a884; color: white; border: none;
  border-radius: 10px; font-size: 16px; font-weight: 600;
  cursor: pointer; transition: 0.3s;
}

.login-box button:hover { background: #06cf9e; }

#main-app { display: flex; height: 100vh; }

#sidebar {
  width: 340px; min-width: 340px; background: #111b21;
  border-left: 1px solid #2a3942; display: flex; flex-direction: column;
}

.sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; background: #1f2c33; border-bottom: 1px solid #2a3942;
}

.sidebar-header h2 { color: #00a884; font-size: 20px; font-weight: 800; letter-spacing: 2px; }

#coins-display {
  background: #2a3942; color: #f59e0b; padding: 4px 12px; border-radius: 16px;
  font-size: 14px; font-weight: 700;
}

.sidebar-tabs { display: flex; background: #1f2c33; border-bottom: 1px solid #2a3942; }

.stab {
  flex: 1; padding: 10px; border: none; background: none; color: #8696a0;
  font-size: 13px; cursor: pointer; transition: 0.2s; font-weight: 600;
}

.stab.active { color: #00a884; border-bottom: 2px solid #00a884; background: #111b21; }
.stab:hover { color: #e9edef; }

#tab-content-users, #tab-content-rooms { flex: 1; overflow-y: auto; }

.rooms-header { padding: 10px 16px; border-bottom: 1px solid #1f2c33; }

#create-room-btn {
  width: 100%; padding: 10px; border: 2px dashed #00a884;
  background: none; color: #00a884; border-radius: 10px;
  font-size: 14px; cursor: pointer; transition: 0.2s; font-weight: 600;
}

#create-room-btn:hover { background: #00a884; color: white; }

#users-list, #rooms-list { flex: 1; overflow-y: auto; padding: 8px 0; }
#users-list::-webkit-scrollbar, #rooms-list::-webkit-scrollbar { width: 6px; }
#users-list::-webkit-scrollbar-track, #rooms-list::-webkit-scrollbar-track { background: #111b21; }
#users-list::-webkit-scrollbar-thumb, #rooms-list::-webkit-scrollbar-thumb { background: #2a3942; border-radius: 3px; }

.user-item, .room-item {
  display: flex; align-items: center; padding: 12px 20px;
  cursor: pointer; transition: 0.2s; border-bottom: 1px solid #1f2c33;
}

.user-item:hover, .room-item:hover { background: #1f2c33; }
.user-item.active, .room-item.active { background: #2a3942; }

.user-avatar, .room-icon {
  width: 44px; height: 44px; border-radius: 50%;
  background: #00a884; color: white; display: flex;
  align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700; margin-left: 14px;
  flex-shrink: 0;
}

.room-icon { background: #7c3aed; font-size: 20px; }

.user-info { flex: 1; min-width: 0; }
.user-name, .room-name { color: #e9edef; font-size: 15px; font-weight: 500; }
.user-distance, .room-info { color: #8696a0; font-size: 12px; margin-top: 2px; }

.online-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: #00a884; flex-shrink: 0; margin-right: 4px;
  box-shadow: 0 0 6px rgba(0,168,132,0.5);
}

.unread-badge {
  background: #00a884; color: white; font-size: 11px; font-weight: 700;
  padding: 1px 7px; border-radius: 10px; display: inline-block; margin-top: 3px;
}

#main-content { flex: 1; display: flex; background: #222e35; }

#chat-area { flex: 1; display: flex; flex-direction: column; position: relative; }

#chat-header {
  padding: 14px 24px; background: #1f2c33; border-bottom: 1px solid #2a3942;
  color: #e9edef; font-size: 16px; font-weight: 600;
  display: flex; align-items: center; justify-content: space-between;
}

.chat-header-actions { display: flex; gap: 8px; }

#gift-btn, #video-call-btn {
  background: none; border: 2px solid #00a884; color: #00a884;
  font-size: 20px; border-radius: 50%; width: 40px; height: 40px;
  cursor: pointer; transition: 0.2s; display: flex;
  align-items: center; justify-content: center;
}

#gift-btn:hover, #video-call-btn:hover { background: #00a884; color: white; }

#video-call-btn.video-room {
  border-color: #7c3aed; color: #7c3aed; width: 52px; height: 52px; font-size: 22px;
}
#video-call-btn.video-room:hover { background: #7c3aed; color: white; }

#video-container { background: #0b141a; padding: 12px; border-bottom: 1px solid #2a3942; }

.video-wrapper { display: flex; gap: 8px; justify-content: center; }

.video-box {
  position: relative; width: 48%; max-width: 400px;
  background: #1f2c33; border-radius: 12px; overflow: hidden; aspect-ratio: 4/3;
}

.video-box video { width: 100%; height: 100%; object-fit: cover; }
#face-processed { width: 100%; height: 100%; object-fit: cover; border-radius: 12px; position: absolute; top: 0; left: 0; }

.video-label {
  position: absolute; bottom: 8px; right: 8px;
  background: rgba(0,0,0,0.7); color: #e9edef;
  padding: 4px 12px; border-radius: 6px; font-size: 12px;
}

.video-controls { display: flex; justify-content: center; gap: 16px; padding: 10px 0 4px; }

.vc-btn {
  width: 44px; height: 44px; border-radius: 50%; border: none;
  background: #2a3942; color: #e9edef; font-size: 18px;
  cursor: pointer; transition: 0.2s; display: flex;
  align-items: center; justify-content: center;
}

.vc-btn:hover { background: #3b4a54; }
.vc-btn.danger { background: #ef4444; }
.vc-btn.danger:hover { background: #dc2626; }

.video-filter-row {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; padding: 6px 0 4px; color: #8696a0; font-size: 13px;
}

.video-filter-row select {
  padding: 6px 10px; border-radius: 6px; border: 1px solid #2a3942;
  background: #2a3942; color: #e9edef; font-size: 13px; outline: none; cursor: pointer;
}

#messages { flex: 1; overflow-y: auto; padding: 20px 24px; background: #0b141a; }

#messages::-webkit-scrollbar { width: 6px; }
#messages::-webkit-scrollbar-track { background: #0b141a; }
#messages::-webkit-scrollbar-thumb { background: #2a3942; border-radius: 3px; }

.message { margin-bottom: 8px; display: flex; flex-direction: column; }
.message.sent { align-items: flex-end; }
.message.received { align-items: flex-start; }

.message-bubble {
  max-width: 70%; padding: 10px 16px; border-radius: 12px;
  font-size: 14px; line-height: 1.5; word-wrap: break-word;
}

.message.sent .message-bubble { background: #005c4b; color: #e9edef; border-bottom-left-radius: 4px; }
.message.received .message-bubble { background: #1f2c33; color: #e9edef; border-bottom-right-radius: 4px; }
.message.room .message-bubble { background: #312e81; color: #e9edef; }

.message-sender { font-size: 12px; color: #00a884; font-weight: 600; margin-bottom: 2px; }
.message-time { font-size: 11px; color: #8696a0; margin-top: 4px; text-align: left; }

.gift-message { font-size: 16px; text-align: center; padding: 8px 12px; }
.gift-message .message-bubble { background: linear-gradient(135deg, #7c3aed, #db2777) !important; }

.chat-image { max-width: 200px; border-radius: 8px; cursor: pointer; display: block; }
.sticker-msg { font-size: 64px; text-align: center; padding: 4px; }
.sticker-msg .message-bubble { background: none !important; padding: 4px; }
.emoji-msg { font-size: 28px; }

#chat-input-area {
  display: flex; align-items: center; padding: 8px 12px; background: #1f2c33;
  border-top: 1px solid #2a3942; gap: 6px;
}

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

.ia-btn {
  width: 36px; height: 36px; border-radius: 50%; border: none;
  background: #2a3942; color: #e9edef; font-size: 18px;
  cursor: pointer; transition: 0.2s; display: flex;
  align-items: center; justify-content: center;
}

.ia-btn:hover { background: #00a884; }

#msg-input {
  flex: 1; padding: 10px 14px; border: none; border-radius: 8px;
  background: #2a3942; color: #e9edef; font-size: 14px; outline: none;
}

#send-btn {
  padding: 10px 20px; background: #00a884; color: white;
  border: none; border-radius: 8px; font-size: 14px;
  font-weight: 600; cursor: pointer; transition: 0.3s;
}

#send-btn:hover { background: #06cf9e; }

/* Overlays */
#gift-overlay, #emoji-overlay, #sticker-overlay, #create-room-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6); display: flex; align-items: center;
  justify-content: center; z-index: 1000;
}

#gift-picker, #emoji-picker, #sticker-picker, #create-room-box {
  background: #1f2c33; border-radius: 16px; padding: 24px;
  width: 360px; max-width: 90vw; max-height: 80vh; overflow-y: auto;
}

.picker-header {
  color: #e9edef; font-size: 18px; font-weight: 700; margin-bottom: 16px; text-align: center;
}

#gift-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
#emoji-list, #sticker-list { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }

.gift-item, .emoji-item, .sticker-item {
  padding: 12px 8px; border-radius: 10px; background: #2a3942;
  text-align: center; cursor: pointer; transition: 0.2s;
  color: #e9edef; font-size: 14px;
}

.gift-item:hover, .emoji-item:hover, .sticker-item:hover {
  background: #00a884; transform: scale(1.1);
}

.gift-item .gift-emoji { font-size: 28px; display: block; margin-bottom: 4px; }
.gift-item .gift-cost { color: #f59e0b; font-size: 12px; font-weight: 700; }
.emoji-item { font-size: 28px; padding: 8px; }
.sticker-item { font-size: 40px; padding: 12px 8px; }

#create-room-box input {
  width: 100%; padding: 12px 16px; border: 2px solid #2a3942;
  border-radius: 10px; background: #2a3942; color: #e9edef;
  font-size: 14px; outline: none; margin-bottom: 10px;
}

#create-room-box input:focus { border-color: #00a884; }

#create-room-box button {
  width: 100%; padding: 12px; border: none; border-radius: 10px;
  background: #00a884; color: white; font-size: 14px; font-weight: 600; cursor: pointer;
}

#create-room-box button:hover { background: #06cf9e; }

.video-room-toggle {
  display: flex; align-items: center; gap: 8px; color: #e9edef;
  font-size: 14px; margin-bottom: 10px; cursor: pointer;
}

.video-room-toggle input { width: auto !important; margin: 0 !important; }

/* Gift animation */
#gift-animation {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  font-size: 80px; z-index: 9999; pointer-events: none;
  animation: giftPop 2s ease-out forwards;
}

@keyframes giftPop {
  0% { transform: translate(-50%, -50%) scale(0); opacity: 1; }
  50% { transform: translate(-50%, -50%) scale(1.3); opacity: 1; }
  100% { transform: translate(-50%, -150%) scale(1); opacity: 0; }
}

@media (max-width: 768px) {
  #sidebar { width: 100%; min-width: unset; }
  #main-content { display: none; }
  .video-wrapper { flex-direction: column; align-items: center; }
  .video-box { width: 100%; }
}
