/* -*- coding: utf-8 -*- */
/* Game Page (Native) Styles - aligned with legacy SPA look */

:root {
  --bg-start: #1a1a2e;
  --bg-end: #16213e;
  --primary: #4a9eff;
  --text: #ffffff;
  --muted: rgba(255, 255, 255, 0.7);
  --divider: rgba(255, 255, 255, 0.2);
}

html, body {
  height: 100%;
}
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
    Ubuntu, Cantarell, 'Fira Sans', 'Droid Sans', 'Helvetica Neue', Arial, sans-serif;
  background: linear-gradient(135deg, var(--bg-start) 0%, var(--bg-end) 100%);
  color: var(--text);
}

.chat-view {
  display: flex;
  height: 100vh;
}

/* Left: Chat Window */
.chat-window {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--divider);
  box-sizing: border-box;
}
.chat-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}
.chat-subtitle {
  font-size: 13px;
  color: var(--muted);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  box-sizing: border-box;
}

.messages-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.message-item {
  display: flex;
  gap: 10px;
}
.message-item.is-own { flex-direction: row-reverse; }

.message-bubble {
  max-width: 72%;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  white-space: pre-wrap;
  word-wrap: break-word;
}
.message-item.is-own .message-bubble {
  background: var(--primary);
}

.message-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

/* Input */
.chat-input {
  border-top: 1px solid var(--divider);
  padding: 10px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  box-sizing: border-box;
}
#chat-input {
  flex: 1;
  min-height: 42px;
  max-height: 140px;
  border-radius: 10px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.18);
  color: var(--text);
  padding: 10px 12px;
  resize: vertical;
  outline: none;
}
#send-btn {
  background: var(--primary);
  border: none;
  color: #fff;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
}
#send-btn:hover { filter: brightness(1.05); }

.typing {
  font-size: 12px;
  color: var(--muted);
  padding: 0 12px 8px;
}

/* Right: Contacts */
.contacts-panel {
  width: 320px;
  background: rgba(255, 255, 255, 0.08);
  border-left: 1px solid var(--divider);
  display: flex;
  flex-direction: column;
}
.contacts-header {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-bottom: 1px solid var(--divider);
}
.contacts-title { margin: 0; font-size: 16px; font-weight: 600; }

.function-tabs { display: flex; gap: 6px; padding: 10px 10px 0; }
.tab-button {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 10px 6px;
  border-radius: 8px 8px 0 0;
  cursor: pointer;
}
.tab-button.active { background: rgba(74, 158, 255, 0.2); color: #fff; }

.list { flex: 1; overflow: auto; }
.list-item { padding: 12px 16px; border-bottom: 1px solid rgba(255,255,255,0.1); cursor: pointer; }
.list-item:hover { background: rgba(255,255,255,0.06); }

/* Responsive */
@media (max-width: 900px) {
  .chat-view { flex-direction: column; }
  .contacts-panel { width: 100%; height: 220px; }
}

/* Header action button */
.new-chat-btn{background:#4a9eff;border:none;color:#fff;padding:8px 10px;border-radius:6px;cursor:pointer}
.new-chat-btn:hover{filter:brightness(1.05)}

/* Search */
.contacts-search{padding:10px 20px;border-bottom:1px solid var(--divider)}
.search-input{width:100%;border:1px solid rgba(255,255,255,0.3);border-radius:20px;padding:10px 14px;background:rgba(255,255,255,0.08);color:#fff;outline:none}
.search-input::placeholder{color:rgba(255,255,255,0.6)}
.search-input:focus{border-color:var(--primary)}

/* Contact item */
.contact-item{display:flex;align-items:center;gap:12px;padding:14px 20px;border-bottom:1px solid rgba(255,255,255,0.1);cursor:pointer}
.contact-item:hover{background:rgba(255,255,255,0.06)}
.contact-avatar{position:relative;width:40px;height:40px;border-radius:50%;overflow:visible;flex-shrink:0}
.contact-avatar .avatar-placeholder{width:100%;height:100%;background:linear-gradient(135deg,#4a9eff,#6c5ce7);color:#fff;display:flex;align-items:center;justify-content:center;font-weight:700;border-radius:50%}
.online-indicator{position:absolute;bottom:0;right:0;width:10px;height:10px;background:#44ff44;border:2px solid #fff;border-radius:50%}
.contact-info{flex:1;min-width:0}
.contact-name{font-weight:600;color:#fff;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.contact-status{font-size:12px;color:var(--muted)}

/* Conversation item */
.conversation-item{display:flex;align-items:center;gap:12px;padding:14px 20px;border-bottom:1px solid rgba(255,255,255,0.1);cursor:pointer}
.conversation-item:hover{background:rgba(255,255,255,0.06)}
.conversation-item.is-active{background:rgba(74,158,255,0.2);border-left:3px solid var(--primary)}
.conversation-avatar{width:40px;height:40px;border-radius:50%;overflow:hidden;flex-shrink:0}
.conversation-avatar .avatar-placeholder{width:100%;height:100%;background:linear-gradient(135deg,#4a9eff,#6c5ce7);color:#fff;display:flex;align-items:center;justify-content:center;font-weight:700;border-radius:50%}
.conversation-info{flex:1;min-width:0}
.conversation-name{font-weight:600;color:#fff;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.conversation-last-message{font-size:13px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.conversation-meta{display:flex;flex-direction:column;align-items:flex-end;gap:4px}
.last-time{font-size:12px;color:var(--muted)}
.unread-count{background:#ff4444;color:#fff;font-size:11px;padding:2px 6px;border-radius:10px;min-width:16px;text-align:center}




.game-container{display:flex;height:100vh;width:100%;background:linear-gradient(135deg,#1a1a2e 0%,#16213e 100%);color:#fff;overflow:hidden}
.chat-section{flex:2;display:flex;flex-direction:column;border-right:1px solid rgba(255,255,255,0.1)}
.chat-header{display:flex;align-items:center;padding:20px;border-bottom:1px solid rgba(255,255,255,0.1);background:rgba(255,255,255,0.05)}
.ai-avatar{width:50px;height:50px;border-radius:50%;background:linear-gradient(135deg,#4a9eff,#0066cc);display:flex;align-items:center;justify-content:center;margin-right:15px}
.avatar-icon{font-size:24px}
.ai-info{flex:1}
.ai-name{margin:0 0 5px 0;font-size:18px;font-weight:600}
.ai-status{margin:0;font-size:14px;color:#4a9eff}
.chat-controls{display:flex;gap:10px}
.control-btn{background:rgba(255,255,255,0.1);border:none;color:#fff;padding:8px 12px;border-radius:6px;cursor:pointer}
.control-btn:hover{background:rgba(255,255,255,0.2)}
.auto-scroll-control{display:flex;align-items:center;margin-right:12px}
.auto-scroll-checkbox{display:flex;align-items:center;gap:6px;padding:6px 10px;border-radius:6px;background:rgba(255,255,255,0.05);border:1px solid rgba(255,255,255,0.1);font-size:12px;color:rgba(255,255,255,0.8)}
.checkbox-icon{font-size:14px}
.checkbox-text{font-size:11px;font-weight:500;white-space:nowrap}

.chat-messages{flex:1;overflow-y:auto;padding:20px;display:flex;flex-direction:column;gap:20px}
.message{display:flex;gap:12px;max-width:80%}
.message-avatar{width:40px;height:40px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:18px;flex-shrink:0}
.user-message{align-self:flex-end;flex-direction:row-reverse}
.ai-message{align-self:flex-start}
.message-text{background:rgba(255,255,255,0.1);padding:12px 16px;border-radius:12px;margin-bottom:5px;word-wrap:break-word;white-space:pre-wrap;line-height:1.5}
.user-message .message-text{background:linear-gradient(135deg,#ff6b6b,#ee5a24)}
.ai-message .message-text{background:rgba(74,158,255,0.2)}
.message-time{font-size:12px;color:rgba(255,255,255,0.6);text-align:right}

.typing-indicator{display:flex;gap:4px;padding:12px 16px}
.typing-indicator span{width:8px;height:8px;border-radius:50%;background:#4a9eff;animation:typing 1.4s infinite ease-in-out}
.typing-indicator span:nth-child(1){animation-delay:-0.32s}
.typing-indicator span:nth-child(2){animation-delay:-0.16s}
@keyframes typing{0%,80%,100%{transform:scale(0.8);opacity:.5}40%{transform:scale(1);opacity:1}}

.chat-input-area{padding:20px;border-top:1px solid rgba(255,255,255,0.1);background:rgba(255,255,255,0.05)}
.input-container{display:flex;gap:12px;align-items:flex-end}
.message-input{flex:1;background:rgba(255,255,255,0.1);border:1px solid rgba(255,255,255,0.2);border-radius:12px;padding:12px 16px;color:#fff;font-size:16px;resize:none;min-height:44px;max-height:120px}
.message-input:focus{outline:none;border-color:#4a9eff}
.send-button{background:linear-gradient(135deg,#4a9eff,#0066cc);border:none;color:#fff;padding:12px 16px;border-radius:12px;min-width:50px;height:44px;display:flex;align-items:center;justify-content:center;cursor:pointer}
.send-button:hover{transform:translateY(-2px);box-shadow:0 4px 12px rgba(74,158,255,0.3)}
.input-hint{margin-top:8px;font-size:12px;color:rgba(255,255,255,0.5);text-align:center}

.assistant-section{flex:1;display:flex;flex-direction:column;gap:20px;padding:20px;overflow-y:auto;background:rgba(255,255,255,0.02)}
.feature-panel{background:rgba(255,255,255,0.05);border-radius:12px;padding:20px;border:1px solid rgba(255,255,255,0.1)}
.panel-title{display:flex;align-items:center;gap:10px;margin:0 0 15px 0;font-size:16px;font-weight:600;color:#4a9eff}
.panel-icon{font-size:18px}
.character-stats{display:flex;flex-direction:column;gap:12px}
.stat-item{display:flex;flex-direction:column;gap:5px}
.stat-label{font-size:14px;color:rgba(255,255,255,0.8)}
.stat-bar{position:relative;height:20px;background:rgba(255,255,255,0.1);border-radius:10px;overflow:hidden}
.stat-fill{height:100%;border-radius:10px;transition:width .3s ease}
.stat-fill.health{background:linear-gradient(90deg,#ff6b6b,#ee5a24)}
.stat-fill.mana{background:linear-gradient(90deg,#4a9eff,#0066cc)}
.stat-fill.stamina{background:linear-gradient(90deg,#26de81,#20bf6b)}
.stat-value{position:absolute;top:50%;right:8px;transform:translateY(-50%);font-size:12px;font-weight:600;color:#fff;text-shadow:0 1px 2px rgba(0,0,0,0.5)}
.game-info{display:flex;flex-direction:column;gap:10px}
.info-item{display:flex;justify-content:space-between;align-items:center;padding:8px 0;border-bottom:1px solid rgba(255,255,255,0.1)}
.info-item:last-child{border-bottom:none}
.info-label{font-size:14px;color:rgba(255,255,255,0.8)}
.info-value{font-size:14px;font-weight:600;color:#4a9eff}
.inventory-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:8px}
.inventory-item{position:relative;aspect-ratio:1;background:rgba(255,255,255,0.1);border:1px solid rgba(255,255,255,0.2);border-radius:8px;display:flex;align-items:center;justify-content:center;cursor:pointer}
.inventory-item:hover{background:rgba(255,255,255,0.15);border-color:#4a9eff}
.inventory-item.empty{opacity:.5;cursor:default}
.item-icon{font-size:20px}
.item-quantity{position:absolute;bottom:2px;right:2px;background:#ff6b6b;color:#fff;font-size:10px;font-weight:600;padding:2px 4px;border-radius:4px;min-width:16px;text-align:center}
.control-buttons{display:flex;flex-direction:column;gap:10px}
.control-button{display:flex;align-items:center;gap:10px;padding:12px 16px;border:none;border-radius:8px;cursor:pointer;font-size:14px;font-weight:600}
.control-button.primary{background:linear-gradient(135deg,#4a9eff,#0066cc);color:#fff}
.control-button.secondary{background:rgba(255,255,255,0.1);color:#fff;border:1px solid rgba(255,255,255,0.2)}
.button-icon{font-size:16px}

@media (max-width: 768px){
  .game-container{flex-direction:column}
  .chat-section{flex:1;border-right:none;border-bottom:1px solid rgba(255,255,255,0.1)}
  .assistant-section{flex:none;height:300px;padding:15px}
  .inventory-grid{grid-template-columns:repeat(6,1fr)}
  .control-buttons{flex-direction:row}
}
