/* --- Sentiments Description Styling --- */
.sent-desc {
  color: #555;
  font-size: 12px;
  margin-left: 8px;
  font-style: italic;
  opacity: 0.85;
}
/* --- Stat Adjustment Buttons in Sentiments Tab --- */
.stat-btn {
  margin-left: 6px;
  margin-right: 2px;
  padding: 0 8px;
  font-size: 13px;
  border: 1px solid #b3d1f7;
  background: #eaf3ff;
  color: #2186eb;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s;
  vertical-align: middle;
}
.stat-btn:hover {
  background: #d0e7ff;
  color: #1761b0;
}

/* =========================
   style.css: Main UI Styles
   =========================

   This file contains all the visual styling for the desktop, windows, chat, icons, journal, calendar, and more.
   Each section is commented for clarity and maintainability.
*/

/* --- Global Scrollbar Styles --- */
* {
  scrollbar-width: auto; /* Firefox */
  scrollbar-color: #b3d1f7 #f0f0f0;
}
*::-webkit-scrollbar {
  width: 10px;
}
*::-webkit-scrollbar-thumb {
  background: #b3d1f7;
  border-radius: 6px;
}
*::-webkit-scrollbar-track {
  background: #f0f0f0;
}

/* --- Chat Input Focus Styles --- */
.chat-window .chat-input input[type="text"]:focus, .chat-window .chat-input textarea:focus {
  outline: 2px solid #2186eb;
  background: #fff;
}

/* --- Chat Send Button Styles --- */
.chat-window .send-btn,
.enhanced-group-chat-window .send-btn {
  background: #2186eb;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  transition: background 0.2s;
  cursor: pointer;
}
.chat-window .send-btn:disabled,
.enhanced-group-chat-window .send-btn:disabled {
  background: #b3d1f7;
  color: #fff;
  cursor: not-allowed;
}
.chat-window .send-btn:hover:not(:disabled),
.enhanced-group-chat-window .send-btn:hover:not(:disabled) {
  background: #1761b0;
}

/* --- CSS Variables for Gradients, Borders, Shadows --- */
:root {
  --gradient-light: linear-gradient(to bottom, #fff, #eee);
  --gradient-menu: linear-gradient(to bottom, #f0f0f0, #d0d0d0);
  --border-light: #aaa;
  --shadow-color: rgba(0, 0, 0, 0.2);
}

/* --- Base Layout: html, body --- */
html, body { 
  margin: 0;
  padding: 0;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}
body { 
  font-family: system-ui, -apple-system, sans-serif; 
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transition: background 2s ease-in-out;
}

/* --- Time-based Background Classes --- */
body.time-morning {
  background-image: url('../assets/morning.png');
}

body.time-afternoon {
  background-image: url('../assets/afternoon.png');
}

body.time-evening {
  background-image: url('../assets/evening.png');
}

body.time-night {
  background-image: url('../assets/night.png');
}

/* =====================
   Splash Screen
   ===================== */

/* --- Splash Screen Overlay --- */
.splash-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  font-family: system-ui, -apple-system, sans-serif;
  transition: background 2s ease-in-out;
}

/* --- Time-based Splash Screen Backgrounds --- */
.splash-screen.time-morning {
  background-image: url('../assets/morning.png');
}

.splash-screen.time-afternoon {
  background-image: url('../assets/afternoon.png');
}

.splash-screen.time-evening {
  background-image: url('../assets/evening.png');
}

.splash-screen.time-night {
  background-image: url('../assets/night.png');
}

/* --- Splash Screen Content Container --- */
.splash-content {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  padding: 60px 50px;
  max-width: 600px;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
}

/* --- Splash Screen Title --- */
.splash-title {
  font-size: 2.5em;
  font-weight: 700;
  color: #333;
  margin: 0 0 30px 0;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* --- Splash Screen Description --- */
.splash-description {
  color: #555;
  font-size: 1.1em;
  line-height: 1.6;
  margin-bottom: 40px;
}

.splash-description p {
  margin: 0 0 20px 0;
}

.splash-description p:last-child {
  margin-bottom: 0;
}

/* --- Username Input on Splash Screen --- */
.splash-username {
  margin: 30px 0;
  text-align: center;
}

.splash-username label {
  display: block;
  color: #555;
  font-size: 1.1em;
  margin-bottom: 10px;
  font-weight: 500;
}

.splash-username input {
  padding: 12px 20px;
  font-size: 1.1em;
  border: 2px solid #ddd;
  border-radius: 8px;
  width: 200px;
  text-align: center;
  background: rgba(255, 255, 255, 0.9);
  transition: border-color 0.3s ease;
}

.splash-username input:focus {
  outline: none;
  border-color: #667eea;
  background: rgba(255, 255, 255, 1);
}

/* --- Start Button --- */
.start-button {
  background: linear-gradient(145deg, #667eea, #764ba2);
  color: white;
  border: none;
  border-radius: 50px;
  padding: 15px 40px;
  font-size: 1.2em;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.start-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 25px rgba(102, 126, 234, 0.6);
  background: linear-gradient(145deg, #5a6fd8, #6a42a0);
}

.start-button:active {
  transform: translateY(0);
  box-shadow: 0 6px 15px rgba(102, 126, 234, 0.4);
}

/* =====================
   Menu Bar & Desktop
   ===================== */

/* --- Menu Bar (top bar with Apple logo, File, Edit, etc.) --- */
.menu-bar {
  position: relative;
  top: 0;
  left: 0;
  width: 100%;
  min-width: 0;
  max-width: none;
  height: 32px;
  margin: 0;
  background: var(--gradient-menu);
  color: #000;
  font-size: 15px;
  display: flex;
  align-items: center;
  padding: 0 18px;
  z-index: 200;
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
  border-bottom: 1.5px solid #b0b0b0;
  pointer-events: auto;
  border-top-left-radius: 14px;
  border-top-right-radius: 14px;
}
.menu-item { margin-right: 20px; cursor: default; pointer-events: auto; position: relative; }
.menu-click { cursor: pointer; user-select: none; pointer-events: auto; }
.apple-logo { font-weight: bold; font-size: 16px; margin-right: 15px; }

/* --- Dropdown Menu Styles --- */
.menu-item:hover {
  background-color: rgba(0, 0, 0, 0.1);
  border-radius: 4px;
}

.dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  background: white;
  border: 1px solid #ccc;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  min-width: 160px;
  z-index: 1000;
  display: none;
  padding: 4px 0;
  font-size: 13px;
}

.dropdown-item {
  padding: 6px 16px;
  cursor: pointer;
  border-bottom: none;
  color: #333;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dropdown-item:hover {
  background-color: #007AFF;
  color: white;
}

.dropdown-item.disabled {
  color: #999;
  cursor: default;
}

.dropdown-item.disabled:hover {
  background-color: transparent;
  color: #999;
}

.dropdown-separator {
  height: 1px;
  background-color: #e0e0e0;
  margin: 4px 0;
}

.keyboard-shortcut {
  font-size: 11px;
  color: #666;
  margin-left: 20px;
}

/* --- Time Display Styles --- */
#dayLabel {
  display: flex;
  align-items: center;
  min-width: 180px; /* Reserve enough space to prevent layout shifts */
}

.time-emoji {
  font-size: 18px;
  margin-right: 8px;
  display: inline-block;
  width: 24px; /* Fixed width to prevent movement */
  text-align: center;
  flex-shrink: 0; /* Prevent emoji from shrinking */
}

.time-text {
  font-weight: bold;
  text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8);
  color: #000;
  white-space: nowrap; /* Prevent text wrapping */
}

.time-change-animation .time-emoji {
  animation: timeChangeGlow 1s ease-out;
}

.time-change-animation .time-text {
  animation: timeChangeSlide 1s ease-out;
}

@keyframes timeChangeGlow {
  0% { 
    transform: scale(1); 
    filter: brightness(1);
  }
  50% { 
    transform: scale(1.05); 
    filter: brightness(1.3);
  }
  100% { 
    transform: scale(1); 
    filter: brightness(1);
  }
}

@keyframes timeChangeSlide {
  0% { 
    opacity: 1;
  }
  25% { 
    opacity: 0.8;
  }
  75% { 
    opacity: 0.9;
  }
  100% { 
    opacity: 1;
  }
}

/* --- Desktop Container (outer border, background) --- */
.desktop-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  margin: 0;
  border: 4px solid #888;
  border-radius: 18px;
  box-sizing: border-box;
  overflow: hidden;
  box-shadow: 0 0 24px rgba(0,0,0,0.18);
  background: rgba(128, 128, 128, 0.15);
  z-index: 1;
}
.desktop {
  position: absolute;
  top: 32px;
  left: 0;
  width: 100%;
  height: calc(100% - 32px);
  background: rgba(128, 128, 128, 0.15);
  box-sizing: border-box;
  overflow: hidden;
  border-bottom-left-radius: 14px;
  border-bottom-right-radius: 14px;
}

/* =====================
   Sentiments Table
   ===================== */
.sent-table { 
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.sent-table th,
.sent-table td { 
  border-top: 1px solid #ddd;
  padding: 6px 8px;
  text-align: left;
}
.sent-table th { 
  background: var(--gradient-light);
  position: sticky;
  top: 0;
  z-index: 1;
}
.sent-sub { 
  font-size: 11px;
  opacity: 0.75;
}

/* =====================
   Window Shell & Title Bar
   ===================== */
.window {
  position: absolute; width: 300px; min-height: 200px; overflow: hidden;
  background: #fff; border-radius: 10px; border: 2px solid #aaa;
  box-shadow: 4px 4px 10px rgba(0,0,0,0.4); z-index: 100;
  display: flex; flex-direction: column;
}
.title-bar {
  background: linear-gradient(to bottom, #f0f0f0, #c0c0c0);
  padding: 6px 10px; font-weight: bold; display: flex; align-items: center;
  position: relative; cursor: move; height: 28px; user-select: none;
}
.mac-buttons { position: absolute; left: 10px; display: flex; gap: 5px; z-index: 2; }
.mac-button {
  width: 12px; height: 12px; border-radius: 50%;
  background-color: #ff5f57; box-shadow: inset 0 -1px 2px rgba(0,0,0,0.3); cursor: pointer;
}
.mac-button:nth-child(2) { background-color: #ffbd2e; }
.mac-button:nth-child(3) { background-color: #28c840; }
.title-text {
  position: absolute; left: 0; right: 0; text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* =====================
   Chat Window & Internals
   ===================== */
.chat-body {
  padding: 8px 4px; height: 260px; overflow-y: auto;
  border-top: 1px solid #aaa; border-bottom: 1px solid #aaa; 
  background: #ffffff; 
  flex: 1;
}
.chat-input { 
  padding: 10px; 
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%); 
  border-top: 1px solid #dee2e6; 
}

/* Group Chat Layout */
.chat-container {
  display: flex; flex: 1; height: 100%;
}
.group-sidebar {
  width: auto;
  min-width: max-content;
  background: #f8f8f8; border-right: 1px solid #ccc;
  display: flex; flex-direction: column; overflow: hidden;
}
.sidebar-header {
  padding: 8px; background: #e0e0e0; font-weight: bold; font-size: 12px;
  border-bottom: 1px solid #ccc; text-align: center;
}
.sidebar-members {
  flex: 1; overflow-y: auto; padding: 4px;
}
.member-item {
  padding: 4px 6px; margin: 2px 0; border-radius: 4px;
  background: #fff; border: 1px solid #ddd; font-size: 11px;
}
.member-name {
  display: block;
  font-weight: 500;
  white-space: nowrap;
  overflow: visible;
  text-overflow: unset;
}
.member-status {
  display: block; font-size: 10px; color: #888; font-style: italic;
}
.member-status.typing {
  color: #4CAF50; animation: pulse 1.5s ease-in-out infinite alternate;
}
.chat-main {
  flex: 1; display: flex; flex-direction: column;
}

@keyframes pulse {
  from { opacity: 0.6; }
  to { opacity: 1.0; }
}

/* =====================
   Enhanced Group Chat Window (Modular)
   ===================== */
.enhanced-group-chat-window {
  min-width: 450px;
  min-height: 380px;
  max-width: 800px;
  max-height: 650px;
  resize: both;
  overflow: hidden;
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  border-radius: 15px;
  border: 1px solid #e0e0e0;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.08);
}

.enhanced-group-chat-container {
  display: flex;
  flex: 1;
  height: calc(100% - 40px);
}

.enhanced-group-members-panel {
  width: auto;
  min-width: max-content;
  background: linear-gradient(to bottom, #f8f9fa, #e9ecef);
  border-right: 1px solid #dee2e6;
  display: flex;
  flex-direction: column;
  transition: width 0.3s ease;
}

.enhanced-group-members-panel.collapsed {
  width: 30px;
}

.enhanced-group-members-panel.collapsed .members-list,
.enhanced-group-members-panel.collapsed .member-actions,
.enhanced-group-members-panel.collapsed h4 {
  display: none;
}

.enhanced-member-item {
  display: flex;
  align-items: center;
  padding: 6px 8px;
  margin: 2px 0;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid #e9ecef;
  transition: background-color 0.2s ease;
  min-width: max-content;
}

.enhanced-member-item:hover {
  background: rgba(255, 255, 255, 0.9);
}

.enhanced-group-chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.enhanced-group-chat-header {
  padding: 8px 12px;
  background: #f8f9fa;
  border-bottom: 1px solid #dee2e6;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.enhanced-chat-body {
  flex: 1;
  padding: 8px 4px;
  overflow-y: auto;
  background: #ffffff;
}

.enhanced-group-typing-area {
  min-height: 20px;
  padding: 0 12px;
  background: #f8f9fa;
  border-top: 1px solid #e9ecef;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.enhanced-typing-message {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #6c757d;
  font-style: italic;
  padding: 2px 0;
}

/* Individual Chat Typing Indicators */
.individual-chat-typing-area {
  min-height: 20px;
  padding: 4px 10px;
  background: #f8f9fa;
  border-top: 1px solid #dee2e6;
  border-bottom: 1px solid #dee2e6;
  display: flex;
  align-items: center;
}

.individual-typing-message {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #6c757d;
  font-style: italic;
}

.typing-name {
  font-weight: 500;
  color: #495057;
}

.enhanced-group-chat-input-area {
  background: #f8f9fa;
  border-top: 1px solid #dee2e6;
}

.enhanced-chat-input {
  padding: 10px;
  background: #f0f0f0;
  border-top: 1px solid #aaa;
}

/* Shared elements for enhanced group chat */
.members-header {
  padding: 8px 10px;
  background: #e9ecef;
  border-bottom: 1px solid #dee2e6;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.members-header h4 {
  margin: 0;
  font-size: 12px;
  color: #495057;
  font-weight: 600;
}

.collapse-btn {
  background: none;
  border: none;
  font-size: 14px;
  color: #6c757d;
  cursor: pointer;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.members-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px;
}

.member-avatar {
  position: relative;
  margin-right: 8px;
  flex-shrink: 0;
}

.avatar-circle {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: bold;
  color: white;
  text-shadow: 0 1px 1px rgba(0,0,0,0.3);
}

.online-indicator {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 8px;
  height: 8px;
  background: #28a745;
  border: 2px solid white;
  border-radius: 50%;
}

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

.member-name {
  font-size: 11px;
  font-weight: 500;
  color: #212529;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.member-status {
  font-size: 9px;
  color: #6c757d;
  font-style: italic;
}

.member-typing {
  display: none;
  margin-left: 4px;
}

.typing-dots {
  display: flex;
  gap: 2px;
}

.typing-dots span {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #28a745;
  animation: typing-bounce 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.typing-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing-bounce {
  0%, 80%, 100% {
    transform: scale(0);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

.member-actions {
  padding: 8px;
  border-top: 1px solid #dee2e6;
}

.action-btn {
  width: 100%;
  padding: 6px 8px;
  font-size: 10px;
  background: #007bff;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.action-btn:hover {
  background: #0056b3;
}

.chat-topic {
  font-size: 12px;
  font-weight: 500;
  color: #495057;
}

.control-btn {
  background: none;
  border: none;
  font-size: 14px;
  color: #6c757d;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
}

.control-btn:hover {
  background: #e9ecef;
}

.typing-name {
  font-weight: 500;
  color: #495057;
}

.input-toolbar {
  padding: 6px 12px;
  display: flex;
  gap: 6px;
  border-bottom: 1px solid #e9ecef;
}

.emoji-btn, .attachment-btn {
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.emoji-btn:hover, .attachment-btn:hover {
  background: #e9ecef;
}
.choice {
  display: block; width: 100%; background: #ddd; border: none; margin: 5px 0; padding: 6px;
  cursor: pointer; font-size: 14px; border-radius: 6px;
}
.sys-line { color:#666; font-style: italic; margin: 6px 0; }
/* Modern Chat Bubble Styling */
.msg-you, .msg-npc { 
  margin: 4px 0; 
  display: flex;
  align-items: flex-end;
  max-width: 85%;
  position: relative;
  animation: messageSlideIn 0.3s ease-out;
}

@keyframes messageSlideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.msg-you {
  flex-direction: row-reverse;
  margin-left: auto;
  justify-content: flex-start;
}

.msg-npc {
  flex-direction: row;
  margin-right: auto;
  justify-content: flex-start;
}

.msg-bubble {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 12px;
  padding: 6px 10px;
  max-width: 220px;
  word-wrap: break-word;
  position: relative;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  font-size: 13px;
  line-height: 1.3;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.msg-bubble:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.msg-you .msg-bubble {
  background: #f8f9fa;
  border-color: #e9ecef;
  color: #495057;
}

.msg-npc .msg-bubble {
  background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
  border-color: #007bff;
  color: #ffffff;
}

.msg-sender {
  text-shadow: 0 1px 2px rgba(0,0,0,0.25);
  font-weight: 600;
  font-size: 11px;
  color: rgba(0,0,0,0.7);
  margin-bottom: 2px;
  display: block;
}

.msg-you .msg-sender {
  color: #495057;
}

.msg-npc .msg-sender {
  color: rgba(255,255,255,0.9);
}

.msg-text {
  display: block;
  word-break: break-word;
}

/* Enhanced Group Chat Message Styling */
.enhanced-chat-body .msg-you,
.enhanced-chat-body .msg-npc {
  margin: 5px 8px;
}

.enhanced-chat-body .msg-bubble {
  max-width: 240px;
  font-size: 13px;
}

/* Responsive adjustments for smaller windows */
@media (max-width: 500px) {
  .msg-bubble {
    max-width: 180px;
    padding: 5px 8px;
    font-size: 12px;
  }
  
  .enhanced-chat-body .msg-bubble {
    max-width: 200px;
  }
}
.typing { opacity:.7; font-style: italic; }

/* =====================
   Desktop Icons (Draggable)
   ===================== */
.desktop-icon {
  width: 64px; text-align: center; position: absolute; cursor: pointer; user-select: none;
  touch-action: none;
}
.desktop-icon img { width: 64px; height: 64px; -webkit-user-drag: none; pointer-events: none; }
.desktop-icon span { 
  display: block; 
  font-size: 12px; 
  font-weight: bold; 
  margin-top: 4px; 
  color: black; 
  text-shadow: 0.5px 0.5px 0 white, -0.5px -0.5px 0 white, 0.5px -0.5px 0 white, -0.5px 0.5px 0 white, 0 0.5px 0 white, 0.5px 0 0 white, 0 -0.5px 0 white, -0.5px 0 0 white;
}
#buddyIcon  { top: 40px; left: 40px; }
#trashIcon  { top: 140px; left: 40px; }
#journalIcon{ top: 240px; left: 40px; }
#calendarIcon{ top: 40px; left: 140px; }

#chatHistoryIcon { top: 140px; left: 140px; }
#settingsIcon { top: 240px; left: 140px; }

/* =====================
   Chat History Window Styles
   ===================== */
.chat-history-window {
  width: 520px !important;
  min-width: 320px;
  height: 420px;
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  border-radius: 15px;
  border: 1px solid #e0e0e0;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
  font-size: 15px;
  overflow: hidden;
  margin: 0;
  z-index: 120;
}
.chat-history-tabs {
  display: flex;
  gap: 6px;
  padding: 8px 10px 4px 10px;
  border-bottom: 1px solid #cfcfcf;
  background: linear-gradient(to bottom,#fff,#eee);
}
.chtab {
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
  background: linear-gradient(to bottom,#fff,#e6e6e6);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.15);
}
.chtab.active {
  background: linear-gradient(to bottom,#e9f0ff,#d7e5ff);
  box-shadow: inset 0 0 0 1px #8aa9ff;
}
.chat-history-body {
  flex: 1;
  overflow-y: auto;
  background: #fff;
  border-top: 1px solid #d0d0d0;
  border-bottom: 1px solid #d0d0d0;
  padding: 12px 16px;
}
.chmsg {
  margin-bottom: 10px;
  font-size: 14px;
  line-height: 1.4;
}
.chmsg.you .sender {
  color: #2186eb;
  font-weight: 600;
}
.chmsg.npc .sender {
  color: #222;
  font-weight: 600;
}
.chmsg .text {
  margin-left: 6px;
  word-break: break-word;
}

/* =====================
   Buddy List Window
   ===================== */
.buddy-window { 
  width: 280px !important; 
  height: 480px; 
  resize: vertical; 
  overflow: hidden; 
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  border-radius: 15px;
  border: 1px solid #e0e0e0;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.08);
}
.buddy-header{
  display:flex; align-items:center; gap:8px; padding:8px 10px 6px;
  background: linear-gradient(to bottom, #ffffff, #eaeaea);
  border-top:1px solid #fff; border-bottom:1px solid #c8c8c8;
  font-size:12px; user-select:none;
}
.account-row{ display:flex; align-items:center; gap:8px; flex:1; min-width:0; }
.status-dot{ width:8px; height:8px; border-radius:50%; background:#28c840; box-shadow:0 0 0 1px rgba(0,0,0,0.2); }
.account-name{ font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.availability{ color:#2a7d2a; margin-left:auto; opacity:.85; white-space:nowrap; }
.header-actions{ display:flex; align-items:center; gap:6px; margin-left:8px; }
.avatar{ width:22px; height:22px; border-radius:4px; background:linear-gradient(135deg,#bbb,#eee); box-shadow:inset 0 0 0 1px rgba(0,0,0,0.15); }
.icon-video{ width:18px; height:18px; border-radius:4px; background:#28c840; position:relative; box-shadow:inset 0 0 0 1px rgba(0,0,0,0.25); }
.icon-video:after{ content:""; position:absolute; left:5px; top:6px; width:8px; height:6px; background:#fff; border-radius:1px; box-shadow:6px -2px 0 0 #fff; transform:translateX(-2px); }

.buddy-list{ flex:1; overflow-y:auto; background:#fff; border-top:1px solid #d0d0d0; border-bottom:1px solid #d0d0d0; }
.buddy-list::-webkit-scrollbar{ width:12px; }
.buddy-list::-webkit-scrollbar-track{ background:#e8eefc; border-left:1px solid #c0c0c0; }
.buddy-list::-webkit-scrollbar-thumb{ background:linear-gradient(to bottom,#a5c6ff,#6aa0ff); border:1px solid #5c8fe6; border-radius:8px; }

.buddy-row{
  display:grid; grid-template-columns:14px 1fr auto; align-items:center; gap:8px;
  padding:6px 10px; font-size:13px; cursor:pointer;
}
.buddy-row:hover{ background: linear-gradient(to bottom, #eaf3ff, #d9e8ff); }
.presence{ width:10px; height:10px; border-radius:50%; box-shadow:0 0 0 1px rgba(0,0,0,0.2); }
.presence.green{ background:#2ecc40; }
.presence.yellow{ background:#ffbd2e; }
.presence.red{ background:#ff5f57; }
.buddy-name{
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.buddy-actions{ display:flex; align-items:center; gap:6px; opacity:.85; }
.ico{
  width:16px; height:16px; border-radius:3px;
  background:linear-gradient(to bottom,#fff,#e2e2e2);
  box-shadow:inset 0 0 0 1px rgba(0,0,0,0.15);
  display:flex; align-items:center; justify-content:center; font-size:12px;
}
.ico-call{ background:#32c85c; color:#000; }
.ico-call::before{ content:"\1f4de"; }
.ico-aim::before{ content:"\1f3c3"; }

/* Group chat styling in buddy list */
.buddy-separator {
  padding: 8px 10px 4px; 
  font-size: 11px; 
  font-weight: bold; 
  color: #666; 
  background: #f5f5f5; 
  border-top: 1px solid #e0e0e0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.group-chat-row {
  background: linear-gradient(to bottom, #f8f9ff, #f2f4ff);
  border-left: 3px solid #4a90ff;
}

.group-chat-row:hover {
  background: linear-gradient(to bottom, #e8f0ff, #dde7ff);
}

.group-chat-name {
  font-weight: 500;
  color: #2c5aa0;
}

.group-actions {
  opacity: 0.9;
}

.group-member-count {
  background: #4a90ff;
  color: white;
  font-size: 10px;
  font-weight: bold;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 16px;
  text-align: center;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.buddy-footer{
  display:flex; align-items:center; gap:6px; padding:6px 8px;
  background: linear-gradient(to bottom, #f6f6f6, #dcdcdc); border-top:1px solid #bfbfbf;
}
.tool{
  width:22px; height:22px; border-radius:5px;
  background:linear-gradient(to bottom,#fff,#d6d6d6);
  box-shadow:inset 0 0 0 1px rgba(0,0,0,0.25);
  display:flex; align-items:center; justify-content:center; cursor:pointer; user-select:none;
}
.tool:active{ filter:brightness(.95); }
.tool.plus::before{ content:"+"; font-weight:700; }
.tool.font::before{ content:"A"; font-weight:700; }
.tool.cam::before{ content:"\1f4f7"; }
.tool.call::before{ content:"\1f4de"; }
.ml-auto{ margin-left:auto; }

/* =====================
   Login Form Styles
   ===================== */
.login-form { display: flex; flex-direction: column; padding: 10px; }
.login-row { display: flex; align-items: center; margin-bottom: 8px; }
.login-row label { width: 90px; font-weight: bold; text-align: right; margin-right: 8px; }
.login-row input { flex: 1; padding: 6px; border: 1px solid #aaa; border-radius: 6px; }
.login-actions { display: flex; justify-content: flex-end; gap: 8px; }
.btn { padding: 4px 10px; background: #ddd; border: 1px solid #aaa; border-radius: 6px; cursor: pointer; }

/* =====================
   Trash Window Styles
   ===================== */
.trash-window { 
  width: 360px !important; 
  height: 300px; 
  resize: vertical; 
  overflow: hidden; 
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  border-radius: 15px;
  border: 1px solid #e0e0e0;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.08);
}
.file-list { flex: 1; overflow-y: auto; background: #fff; border-top: 1px solid #aaa; border-bottom: 1px solid #aaa; }
.file-row { display: grid; grid-template-columns: 20px 1fr auto; gap: 8px; align-items: center; padding: 6px 10px; font-size: 13px; }
.file-row:hover { background: #f3f6ff; }
.file-icon { width: 16px; height: 16px; border-radius: 3px; background: linear-gradient(to bottom, #fff, #d7e1ff); box-shadow: inset 0 0 0 1px rgba(0,0,0,0.2); }
.file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta { font-size: 12px; opacity: .7; }
.trash-footer { display: flex; gap: 8px; align-items: center; justify-content: flex-end; padding: 6px 8px; background: linear-gradient(to bottom, #f6f6f6, #dcdcdc); border-top: 1px solid #bfbfbf; }

/* =====================
   Journal Window Styles
   ===================== */
.journal-window { 
  width: 700px !important; 
  min-width: 700px !important; 
  max-width: 700px !important; 
  height: 600px; 
  overflow: auto; 
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  border-radius: 15px;
  border: 1px solid #e0e0e0;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.08);
  resize: none !important; 
}
.journal-tabs { display:flex; gap:6px; padding:6px 8px; border-bottom:1px solid #cfcfcf; background:linear-gradient(to bottom,#fff,#eee); }
.jtab {
  padding:4px 8px; border-radius:8px; font-size:12px; cursor:pointer; user-select:none;
  background:linear-gradient(to bottom,#fff,#e6e6e6); box-shadow:inset 0 0 0 1px rgba(0,0,0,.15);
}
.jtab.active { background:linear-gradient(to bottom,#e9f0ff,#d7e5ff); box-shadow:inset 0 0 0 1px #8aa9ff; }
.journal-body { flex:1; overflow-y:auto; background:#fff; border-top:1px solid #d0d0d0; border-bottom:1px solid #d0d0d0; }
.entry { padding:10px 12px; border-bottom:1px dashed #e0e0e0; line-height:1.35; font-size:13px; }
.entry .time { float:right; opacity:.6; font-size:12px; }
.entry .who { font-weight:700; }
.entry .text { margin-top:4px; word-break: break-word; white-space: pre-line; }

/* =====================
   Unread Badges
   ===================== */
.unread-badge{
  min-width: 16px; height: 16px; padding: 0 4px; font-size: 11px;
  border-radius: 8px; background: #ff5f57; color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
}
.buddy-name.unread { font-weight: 700; }

/* =====================
   Calendar Window Styles
   ===================== */
.calendar-window { 
  width: 1040px !important; /* 7*140 + 6*6 + 2*12 = 1040 */
  height: 670px; /* 5*110 + 4*6 + 2*12 + 80 = 670 */
  min-width: 0;
  min-height: 600px;
  resize: both;
  overflow: hidden;
  background: #fff;
  border-radius: 10px;
  border: 2px solid #aaa;
  box-shadow: 4px 4px 10px rgba(0,0,0,0.4);
}
.calendar-body { flex:1; overflow:auto; background:#fff; border-top:1px solid #d0d0d0; border-bottom:1px solid #d0d0d0; }
.calendar-toolbar { display:flex; gap:8px; padding:6px 8px; background:linear-gradient(to bottom,#fff,#eee); border-bottom:1px solid #cfcfcf; }
.event-row { display:grid; grid-template-columns: 1fr auto; gap:10px; padding:8px 10px; border-bottom:1px dashed #eee; }
.event-row .meta { font-size:12px; opacity:.7; }

/* =====================
   CRT (Optional Retro Effect)
   ===================== */
.desktop.crt{
  position:relative;
  filter: saturate(0.9) contrast(1.05) brightness(0.98) hue-rotate(-5deg);
  animation: crtFlicker 3.5s infinite steps(2,end);
  border-radius: 12px;
  box-shadow: inset 0 0 40px rgba(0,0,0,.35);
}
@keyframes crtFlicker{ 0%,100%{opacity:1} 50%{opacity:.995} }
.desktop.crt::before{
  content:""; position:absolute; inset:0; pointer-events:none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0,0,0,0.05) 0px,
    rgba(0,0,0,0.05) 1px,
    transparent 2px,
    transparent 3px
  );
  mix-blend-mode:multiply; border-radius: 12px;
}
.desktop.crt::after{
  content:""; position:absolute; inset:-2%; pointer-events:none; border-radius:14px;
  background:
    radial-gradient(120% 85% at 50% 50%, rgba(0,0,0,0) 60%, rgba(0,0,0,0.25) 100%),
    radial-gradient(60% 20% at 50% 0%, rgba(255,255,255,0.15), transparent 70%);
}

/* =====================
   Chat Window Sizing
   ===================== */
.chat-window {
  min-width: 360px !important;
  min-height: 440px !important;
  width: 400px;
  height: 480px;
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  border-radius: 15px;
  border: 1px solid #e0e0e0;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
  font-size: 15px;
  margin: 0;
  overflow: hidden;
}
.chat-window .chat-input {
  flex: 0 0 auto;
  position: sticky;
  bottom: 0;
  z-index: 2;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  min-height: 190px;
  max-height: 300px;
  padding: 8px 8px 4px 8px;
  box-sizing: border-box;
  gap: 0;
  border-top: 1px solid #dee2e6;
}
.chat-window .response-send-row {
  margin-bottom: 8px;
}
.chat-window .response-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-start;
  min-height: 80px;
  max-height: 160px;
  overflow-y: scroll;
  scrollbar-width: auto;
  scrollbar-color: #b3d1f7 #f0f0f0;
}
.chat-window .response-btns::-webkit-scrollbar {
  width: 10px;
}
.chat-window .response-btns::-webkit-scrollbar-thumb {
  background: #b3d1f7;
  border-radius: 6px;
}
.chat-window .response-btns::-webkit-scrollbar-track {
  background: #f0f0f0;
}

/* =====================
   Settings Window
   ===================== */

.settings-content {
  display: flex;
  height: calc(100% - 32px);
  overflow: hidden;
}

.settings-tabs {
  width: 120px;
  background: #f0f0f0;
  border-right: 1px solid #d0d0d0;
  display: flex;
  flex-direction: column;
}

.settings-tab {
  padding: 12px 8px;
  border-bottom: 1px solid #d0d0d0;
  cursor: pointer;
  font-size: 12px;
  text-align: center;
  background: #f0f0f0;
  transition: background 0.2s;
}

.settings-tab:hover {
  background: #e0e0e0;
}

.settings-tab.active {
  background: #fff;
  border-right: 1px solid #fff;
  margin-right: -1px;
  font-weight: bold;
}

.settings-panel {
  flex: 1;
  padding: 20px;
  background: #fff;
  display: none;
  overflow-y: auto;
}

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

.settings-panel h3 {
  margin: 0 0 20px 0;
  color: #333;
  font-size: 16px;
  border-bottom: 1px solid #e0e0e0;
  padding-bottom: 8px;
}

.setting-item {
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.setting-item label {
  min-width: 150px;
  font-size: 13px;
  color: #555;
}

.setting-item input[type="text"],
.setting-item select {
  padding: 4px 8px;
  border: 1px solid #ccc;
  border-radius: 3px;
  font-size: 13px;
}

.setting-item input[type="checkbox"] {
  transform: scale(1.2);
}

.setting-item input[type="range"] {
  flex: 1;
  max-width: 150px;
}

.setting-item button {
  padding: 4px 12px;
  border: 1px solid #b3d1f7;
  background: #eaf3ff;
  color: #2186eb;
  border-radius: 3px;
  cursor: pointer;
  font-size: 12px;
  transition: background 0.2s;
}

.setting-item button:hover {
  background: #d0e7ff;
}

/* Font size classes */
.font-small { font-size: 12px; }
.font-medium { font-size: 14px; }
.font-large { font-size: 16px; }
