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

:root {
  --chat-font-size: 11px;
}

body {
  font-family: 'Tahoma', 'MS Sans Serif', 'Arial', sans-serif;
  font-size: 11px;
  background: #3a6ea5;
  color: #000;
  height: 100vh;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* ==================== SCREENS ==================== */
.screen {
  display: none;
  width: 100%;
  height: 100%;
  justify-content: center;
  align-items: center;
}

.screen.active {
  display: flex;
}

/* ==================== WIN2K WINDOW STYLE ==================== */
.win-window {
  background: #d4d0c8;
  border: 2px solid;
  border-color: #ffffff #808080 #808080 #ffffff;
  box-shadow: 1px 1px 0 #000, inset 1px 1px 0 #dfdfdf;
}

.win-titlebar {
  background: linear-gradient(to right, #0a246a, #3a6ea5);
  color: white;
  font-weight: bold;
  font-size: 11px;
  padding: 3px 4px;
  display: flex;
  align-items: center;
  gap: 4px;
  user-select: none;
}

.win-titlebar-icon {
  font-size: 14px;
}

.win-titlebar-logo {
  width: 16px;
  height: 16px;
  object-fit: contain;
}

.win-titlebar-buttons {
  margin-left: auto;
  display: flex;
  gap: 2px;
}

.win-titlebar-buttons button {
  width: 16px;
  height: 14px;
  font-size: 9px;
  font-weight: bold;
  background: #d4d0c8;
  border: 1px solid;
  border-color: #ffffff #808080 #808080 #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
}

.win-titlebar-buttons button:active {
  border-color: #808080 #ffffff #ffffff #808080;
}

.win-body {
  padding: 10px;
}

.win-button {
  background: #d4d0c8;
  border: 2px solid;
  border-color: #ffffff #808080 #808080 #ffffff;
  padding: 3px 16px;
  font-family: 'Tahoma', sans-serif;
  font-size: 11px;
  cursor: pointer;
  min-width: 75px;
}

.win-button:active {
  border-color: #808080 #ffffff #ffffff #808080;
}

.win-button.primary {
  font-weight: bold;
}

/* ==================== LOGIN SCREEN ==================== */
.login-window {
  width: 320px;
}

.login-body {
  padding: 16px;
}

.login-logo {
  text-align: center;
  margin-bottom: 16px;
}

/* LYNQ Logo Image */
.lynq-logo-img {
  width: 80px;
  height: 80px;
  margin: 0 auto 8px;
  display: block;
  object-fit: contain;
}

/* Titlebar Logo */
.win-titlebar-logo {
  width: 16px;
  height: 16px;
  object-fit: contain;
}

.login-logo h1 {
  font-size: 28px;
  color: #4DB24D;
  text-shadow: 1px 1px 0 #2a8a2a;
  letter-spacing: 2px;
}

.login-subtitle {
  color: #666;
  font-style: italic;
  font-size: 10px;
}

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

.form-group label {
  display: block;
  margin-bottom: 2px;
  font-weight: bold;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 3px 4px;
  font-family: 'Tahoma', sans-serif;
  font-size: 11px;
  border: 2px solid;
  border-color: #808080 #ffffff #ffffff #808080;
  background: white;
}

.login-buttons {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 12px;
}

.error-msg {
  color: #c00;
  text-align: center;
  margin-top: 8px;
  font-size: 10px;
}

.info-msg {
  color: #060;
  text-align: center;
  margin-top: 8px;
  font-size: 10px;
  font-weight: bold;
}

/* ==================== CONTACT LIST ==================== */
.contact-window {
  width: 220px;
  height: 500px;
  display: flex;
  flex-direction: column;
}

.user-info-bar {
  background: #ece9d8;
  border-bottom: 1px solid #808080;
  padding: 6px 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.user-flower {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #4DB24D;
  position: relative;
  flex-shrink: 0;
}

.user-flower::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 6px;
  height: 6px;
  background: #e63946;
  border-radius: 50%;
}

.user-flower.away { background: #e6b800; }
.user-flower.dnd { background: #c00; }
.user-flower.na { background: #e68a00; }
.user-flower.occupied { background: #c00; }
.user-flower.invisible { background: #999; }
.user-flower.offline { background: #666; }
.user-flower.freechat { background: #00b300; }

.user-details {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex: 1;
}

.my-nickname {
  font-weight: bold;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.my-uin {
  font-size: 9px;
  color: #666;
}

.status-dropdown-wrapper select {
  font-size: 9px;
  font-family: 'Tahoma', sans-serif;
  padding: 1px;
  border: 1px solid #808080;
  background: #fff;
}

/* Toolbar */
.toolbar {
  background: #d4d0c8;
  border-bottom: 1px solid #808080;
  padding: 2px 4px;
  display: flex;
  gap: 2px;
}

.toolbar-btn {
  background: #d4d0c8;
  border: 1px solid transparent;
  padding: 2px 6px;
  cursor: pointer;
  font-size: 12px;
}

.toolbar-btn:hover {
  border: 1px solid;
  border-color: #ffffff #808080 #808080 #ffffff;
}

.toolbar-btn:active {
  border-color: #808080 #ffffff #ffffff #808080;
}

.toolbar-icon {
  font-size: 13px;
}

/* Contact list */
.contact-list {
  flex: 1;
  overflow-y: auto;
  background: white;
  border: 2px solid;
  border-color: #808080 #ffffff #ffffff #808080;
  margin: 4px;
}

.group-header {
  background: #ece9d8;
  border-bottom: 1px solid #d4d0c8;
  padding: 3px 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  user-select: none;
  font-weight: bold;
  font-size: 11px;
}

.group-header:hover {
  background: #e4e0d4;
}

.group-arrow {
  font-size: 8px;
  transition: transform 0.15s;
}

.group-arrow.collapsed {
  transform: rotate(-90deg);
}

.group-count {
  color: #666;
  font-weight: normal;
  font-size: 10px;
}

.group-add-btn {
  margin-left: auto;
  width: 16px;
  height: 14px;
  font-size: 12px;
  font-weight: bold;
  background: #d4d0c8;
  border: 1px solid #808080;
  cursor: pointer;
  line-height: 1;
  padding: 0;
}

.group-add-btn:hover { background: #e4e0d4; }

.group-icon {
  font-size: 14px;
  flex-shrink: 0;
}

.group-contacts.collapsed {
  display: none;
}

.contact-item {
  padding: 3px 8px 3px 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}

.contact-item:hover {
  background: #316ac5;
  color: white;
}

.contact-status-icon {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.contact-status-icon.online { background: #4DB24D; }
.contact-status-icon.freechat { background: #00b300; }
.contact-status-icon.away { background: #e6b800; }
.contact-status-icon.na { background: #e68a00; }
.contact-status-icon.occupied { background: #c00; }
.contact-status-icon.dnd { background: #c00; }
.contact-status-icon.invisible { background: #999; }
.contact-status-icon.offline { background: #999; }

.contact-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid #808080;
}

.avatar-preview-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
}

.avatar-preview {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #808080;
}

.contact-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex: 1;
}

.contact-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 11px;
}

.contact-status-msg {
  font-size: 9px;
  color: #888;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-style: italic;
}

.contact-last-seen {
  font-size: 9px;
  color: #aaa;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contact-item.has-message {
  font-weight: bold;
}

.contact-item.has-message .contact-name {
  color: #c00;
}

.contact-item:hover .contact-name {
  color: white;
}

/* Bottom bar */
.bottom-bar {
  background: #d4d0c8;
  border-top: 1px solid #808080;
  padding: 3px 8px;
  font-size: 9px;
}

.server-status {
  color: #4DB24D;
}

.server-status.disconnected {
  color: #c00;
}

.app-version {
  float: right;
  font-size: 9px;
  color: #888;
}

/* Update Banner */
.update-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: #c00;
  color: white;
  padding: 8px 12px;
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 9999;
}

.update-banner a {
  color: white;
  font-size: 10px;
  padding: 2px 10px;
}

.update-banner.force {
  background: #8b0000;
}

.update-close {
  margin-left: auto;
  background: none;
  border: none;
  color: white;
  font-size: 16px;
  cursor: pointer;
}

/* ==================== CHANGELOG DIALOG ==================== */
.changelog-dialog {
  width: 340px;
  max-height: 440px;
}

.changelog-body {
  padding: 0 !important;
}

.changelog-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(to bottom, #e8f5e8, #d4d0c8);
  border-bottom: 1px solid #808080;
}

.changelog-logo {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.changelog-title h2 {
  font-size: 16px;
  color: #4DB24D;
  margin: 0;
}

.changelog-ver {
  display: block;
  font-size: 11px;
  font-weight: bold;
  color: #333;
}

.changelog-date {
  display: block;
  font-size: 9px;
  color: #888;
}

.changelog-content {
  padding: 12px 16px;
  max-height: 220px;
  overflow-y: auto;
}

.changelog-subtitle {
  font-weight: bold;
  font-size: 11px;
  margin-bottom: 8px;
  color: #333;
}

.changelog-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.changelog-list li {
  padding: 4px 0 4px 16px;
  font-size: 11px;
  position: relative;
  border-bottom: 1px solid #ece9d8;
}

.changelog-list li:last-child {
  border-bottom: none;
}

.changelog-list li::before {
  content: '★';
  position: absolute;
  left: 0;
  color: #4DB24D;
  font-size: 10px;
}

.changelog-footer {
  padding: 10px 16px;
  text-align: center;
  border-top: 1px solid #808080;
  background: #d4d0c8;
}

/* ==================== CHAT WINDOW ==================== */
.chat-window {
  width: 420px;
  height: 460px;
  display: flex;
  flex-direction: column;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-40%, -50%);
}

.chat-toolbar {
  background: #d4d0c8;
  border-bottom: 1px solid #808080;
  padding: 2px 4px;
  display: flex;
  gap: 2px;
}

.chat-toolbar-btn {
  background: #d4d0c8;
  border: 1px solid transparent;
  padding: 2px 8px;
  cursor: pointer;
  font-size: 12px;
}

.chat-toolbar-btn:hover {
  border: 1px solid;
  border-color: #ffffff #808080 #808080 #ffffff;
}

.chat-search-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  padding: 0 4px;
}

.chat-search-bar input {
  width: 120px;
  padding: 2px 4px;
  font-family: 'Tahoma', sans-serif;
  font-size: 10px;
  border: 2px solid;
  border-color: #808080 #ffffff #ffffff #808080;
}

.chat-search-bar .win-button {
  min-width: auto;
  padding: 2px 8px;
  font-size: 10px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  background: white;
  border: 2px solid;
  border-color: #808080 #ffffff #ffffff #808080;
  margin: 4px;
  padding: 6px;
  font-size: var(--chat-font-size);
}

.chat-msg {
  margin-bottom: 8px;
  line-height: 1.4;
}

.chat-msg-header {
  font-weight: bold;
  font-size: 10px;
}

.chat-msg-header.mine {
  color: #0000c0;
}

.chat-msg-header.theirs {
  color: #c00000;
}

.chat-msg-time {
  font-size: 9px;
  color: #888;
  font-weight: normal;
}

.chat-msg-text {
  margin-left: 4px;
  word-wrap: break-word;
  font-size: var(--chat-font-size);
}

.chat-image {
  max-width: 200px;
  max-height: 150px;
  border-radius: 4px;
  cursor: pointer;
  border: 1px solid #ccc;
  margin-top: 4px;
  display: block;
}

.chat-image:hover { opacity: 0.9; }

.file-link {
  display: inline-block;
  padding: 4px 8px;
  background: #ece9d8;
  border: 1px solid #ccc;
  border-radius: 3px;
  color: #333;
  text-decoration: none;
  font-size: 10px;
  margin-top: 4px;
}

.file-link:hover { background: #d4d0c8; }

.file-name {
  font-size: 9px;
  color: #888;
  margin-top: 2px;
}

.chat-messages.drag-over {
  background: #e8f5e8 !important;
  border-color: #4DB24D !important;
}

.msg-status {
  font-size: 9px;
  margin-left: 4px;
}

.msg-status.sent { color: #999; }
.msg-status.read { color: #4DB24D; }

.chat-typing {
  font-size: 9px;
  color: #888;
  padding: 0 8px;
  height: 14px;
  font-style: italic;
}

.chat-input-area {
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chat-input-area textarea {
  width: 100%;
  height: 60px;
  resize: none;
  font-family: 'Tahoma', sans-serif;
  font-size: 11px;
  border: 2px solid;
  border-color: #808080 #ffffff #ffffff #808080;
  padding: 4px;
}

.chat-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
}

.emoji-btn {
  min-width: auto !important;
  padding: 3px 8px !important;
  font-size: 14px !important;
}

.emoji-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 6px;
  background: #d4d0c8;
  border: 2px solid;
  border-color: #ffffff #808080 #808080 #ffffff;
  max-height: 120px;
  overflow-y: auto;
}

.emoji-item {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  border-radius: 3px;
}

.emoji-item:hover {
  background: #316ac5;
}

/* ==================== DIALOGS ==================== */
.dialog-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.3);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
}

.dialog {
  width: 300px;
  max-height: 400px;
}

.dialog-body {
  padding: 12px;
}

.dialog-buttons {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 12px;
}

.search-results {
  margin-top: 10px;
  max-height: 200px;
  overflow-y: auto;
}

.search-result-item {
  padding: 6px 8px;
  border-bottom: 1px solid #d4d0c8;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.search-result-item:hover {
  background: #ece9d8;
}

.search-result-info {
  display: flex;
  flex-direction: column;
}

.search-result-name {
  font-weight: bold;
}

.search-result-uin {
  font-size: 9px;
  color: #666;
}

/* System message in chat */
.chat-system-msg {
  color: #888;
  font-style: italic;
  font-size: 10px;
  text-align: center;
  margin: 4px 0;
}

/* ==================== SETTINGS ==================== */
.settings-dialog {
  width: 340px;
  max-height: 480px;
}

.settings-body {
  padding: 0 !important;
}

.settings-tabs {
  display: flex;
  border-bottom: 1px solid #808080;
  background: #d4d0c8;
}

.settings-tab {
  flex: 1;
  padding: 5px 8px;
  font-family: 'Tahoma', sans-serif;
  font-size: 10px;
  font-weight: bold;
  background: #d4d0c8;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  color: #444;
}

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

.settings-tab.active {
  border-bottom: 2px solid #4DB24D;
  color: #000;
}

.settings-content {
  padding: 12px;
  max-height: 340px;
  overflow-y: auto;
}

.settings-hint {
  font-size: 9px;
  color: #888;
  margin-top: 4px;
}

.settings-divider {
  border: none;
  border-top: 1px solid #ccc;
  margin: 10px 0;
}

.lynq-number-display {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: bold;
  padding: 6px 0;
}

.lynq-number-display .win-button {
  font-size: 9px;
  min-width: auto;
  padding: 2px 10px;
}

/* Offline messages dialog */
#offline-messages-list .offline-msg-item {
  margin-bottom: 10px;
  padding: 6px;
  background: #fffff0;
  border: 1px solid #e0e0c0;
}

.offline-msg-from {
  font-weight: bold;
  color: #c00;
}

.offline-msg-time {
  font-size: 9px;
  color: #888;
}

.offline-msg-text {
  margin-top: 4px;
}

/* ==================== SKIN SWITCHER ==================== */
.skin-switcher {
  background: #d4d0c8;
  border-top: 1px solid #808080;
  padding: 3px 8px;
  display: flex;
  gap: 4px;
  justify-content: center;
}

.skin-btn {
  background: #d4d0c8;
  border: 1px solid #808080;
  padding: 2px 10px;
  font-family: 'Tahoma', sans-serif;
  font-size: 9px;
  font-weight: bold;
  cursor: pointer;
  color: #666;
}

.skin-btn:hover {
  color: #333;
}

.skin-btn.active {
  color: #4DB24D;
  border-color: #4DB24D;
  background: #e8f5e8;
}

/* Ad Banner – hidden by default (LYNQ has no ads) */
.ad-banner {
  display: none;
}

/* ==================== BLINK ANIMATION ==================== */
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.blinking {
  animation: blink 0.8s infinite;
}

/* ==================== SCROLLBAR WIN2K ==================== */
::-webkit-scrollbar {
  width: 16px;
}

::-webkit-scrollbar-track {
  background: #d4d0c8;
  border: 1px solid #808080;
}

::-webkit-scrollbar-thumb {
  background: #d4d0c8;
  border: 2px solid;
  border-color: #ffffff #808080 #808080 #ffffff;
}

::-webkit-scrollbar-button {
  display: block;
  height: 16px;
  background: #d4d0c8;
  border: 2px solid;
  border-color: #ffffff #808080 #808080 #ffffff;
}

/* ==================== CONTEXT MENU ==================== */
.context-menu {
  position: fixed;
  background: #d4d0c8;
  border: 2px solid;
  border-color: #ffffff #808080 #808080 #ffffff;
  box-shadow: 2px 2px 4px rgba(0,0,0,0.3);
  z-index: 10001;
  min-width: 120px;
}

.context-menu-item {
  padding: 4px 12px;
  font-size: 11px;
  font-family: 'Tahoma', sans-serif;
  cursor: pointer;
}

.context-menu-item:hover {
  background: #316ac5;
  color: white;
}

/* ==================== TOAST SYSTEM ==================== */
#toast-container {
  position: fixed;
  bottom: 12px;
  right: 12px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 280px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  background: #d4d0c8;
  border: 2px solid;
  border-color: #ffffff #808080 #808080 #ffffff;
  font-size: 11px;
  font-family: 'Tahoma', sans-serif;
  opacity: 0;
  transform: translateX(100%);
  transition: all 0.3s ease;
  box-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.toast.show {
  opacity: 1;
  transform: translateX(0);
}

.toast-icon { font-size: 14px; flex-shrink: 0; }
.toast-text { flex: 1; word-break: break-word; }

.toast-close {
  background: none;
  border: none;
  font-size: 14px;
  cursor: pointer;
  color: #666;
  padding: 0 2px;
  flex-shrink: 0;
}

.toast-success { border-left: 3px solid #4DB24D; }
.toast-error { border-left: 3px solid #c00; }
.toast-warning { border-left: 3px solid #e6b800; }
.toast-info { border-left: 3px solid #316ac5; }

/* ==================== RESPONSIVE FOR MOBILE ==================== */
@media (max-width: 600px) {
  .contact-window {
    width: 100%;
    height: 100%;
  }

  .chat-window {
    width: 100%;
    height: 100%;
    position: static;
    transform: none;
  }

  .login-window {
    width: 100%;
    max-width: 320px;
  }
}
