.chat-container {
  position: fixed;
  bottom: 12px;
  right: 12px;
  width: 300px;
  height: 40px;
  background: #1a1a2e;
  color: #ecf0f1;
  border: 1px solid var(--accent);
  border-radius: 12px 12px 0 0;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  transition: all 0.3s ease;
  box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.5);
}

.chat-container.expanded {
  height: 450px;
  border-radius: 12px;
}

.chat-header {
  padding: 10px 15px;
  background: rgba(0, 255, 200, 0.1);
  border-bottom: 1px solid var(--accent);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: bold;
  color: var(--accent);
  flex-shrink: 0;
}

.chat-tabs {
  display: flex;
  background: #0a0a12;
  border-bottom: 1px solid var(--accent);
  flex-shrink: 0;
}

.chat-tab {
  flex: 1;
  background: none;
  border: none;
  color: #888;
  padding: 8px;
  cursor: pointer;
  font-size: 12px;
  font-weight: bold;
  border-bottom: 2px solid transparent;
}

.chat-tab:hover { color: #fff; }
.chat-tab.active { color: var(--accent); border-bottom: 2px solid var(--accent); background: rgba(255, 255, 255, 0.05); }

.tab-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-height: 0; }
.chat-body, .news-list { flex: 1; overflow-y: auto; padding: 10px; background: #0a0a12; display: flex; flex-direction: column; gap: 8px; }

.chat-message { font-size: 12px; padding: 6px 10px; border-radius: 8px; background: rgba(255, 255, 255, 0.08); word-wrap: break-word; }
.chat-message.admin { border-left: 2px solid #9b59b6; }
.chat-message.user { border-left: 2px solid var(--accent); }

.news-item { background: rgba(0, 255, 200, 0.05); border: 1px solid rgba(0, 255, 200, 0.2); padding: 10px; border-radius: 6px; font-size: 12px; }
.news-date { color: #888; font-size: 10px; margin-bottom: 4px; display: flex; justify-content: space-between; }
.news-content { color: #ecf0f1; white-space: pre-wrap; }

.chat-input-area { padding: 10px; border-top: 1px solid rgba(255, 255, 255, 0.1); display: flex; gap: 5px; background: #1a1a2e; flex-shrink: 0; }
.chat-input-area input { flex: 1; padding: 8px; border-radius: 4px; border: 1px solid var(--accent); background: #0a0a12; color: #fff; font-size: 12px; }
.chat-input-area button { background: var(--accent); border: none; border-radius: 4px; cursor: pointer; padding: 0 10px; }
.chat-online-count { font-size: 11px; background: #2ecc71; color: #000; padding: 2px 6px; border-radius: 10px; margin-left: 10px; }
.chat-img { max-width: 100%; max-height: 200px; border-radius: 8px; margin-top: 5px; border: 1px solid rgba(255, 255, 255, 0.1); cursor: pointer; }

.chat-preview-area { padding: 5px 10px; background: #0a0a12; border-top: 1px solid var(--accent); display: none; position: relative; }
.chat-preview-thumb { height: 60px; border-radius: 4px; border: 1px solid var(--accent); }
.chat-preview-close { position: absolute; left: 70px; top: 5px; background: none; border: none; color: #e74c3c; font-weight: bold; cursor: pointer; }

.chat-attach-btn { background: none; border: 1px solid var(--accent); color: var(--accent); border-radius: 4px; cursor: pointer; padding: 0 8px; font-size: 16px; display: flex; align-items: center; justify-content: center; }
.chat-attach-btn:hover { background: rgba(0, 255, 200, 0.1); }

.news-gallery { display: flex; flex-direction: column; gap: 15px; margin-top: 15px; }
.news-gallery img { width: 100%; height: auto; max-height: 500px; object-fit: contain; background: rgba(0, 0, 0, 0.2); border-radius: 8px; border: 1px solid var(--accent); cursor: pointer; transition: transform 0.2s, box-shadow 0.2s; }
.news-gallery img:hover { transform: scale(1.02); box-shadow: 0 0 15px var(--accent-glow); }

/* USER CURSORS */
.user-cursor {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    pointer-events: none;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    transition: transform 0.1s linear;
    will-change: transform;
    min-width: 10px; 
    min-height: 10px;
}
.user-cursor.readonly { opacity: 0.6; filter: grayscale(100%); }
.user-cursor.readonly::after { content: '🚫'; position: absolute; top: -8px; left: -8px; font-size: 14px; animation: none; }
.user-cursor.readonly .cursor-label { border-color: #7f8c8d; color: #bdc3c7; }
.user-cursor.readonly .cursor-icon { border-bottom-color: #7f8c8d; }
.cursor-icon { width: 0; height: 0; border-left: 6px solid transparent; border-right: 6px solid transparent; border-bottom: 16px solid var(--accent); transform: rotate(-25deg); filter: drop-shadow(0 0 2px var(--accent-glow)); transform-origin: center; }
.cursor-label { background: var(--node); color: var(--accent); padding: 2px 6px; border-radius: 4px; font-size: 10px; margin-left: 8px; margin-top: 2px; white-space: nowrap; border: 1px solid var(--accent); opacity: 0.8; }
.user-cursor.admin .cursor-icon { border-bottom-color: #9b59b6 !important; }
.user-cursor.admin .cursor-label { color: #9b59b6 !important; border-color: #9b59b6 !important; }

/* MOBILE CHAT OVERRIDES */
@media (max-width: 768px) {
    .chat-container:not(.expanded) { width: 50px !important; height: 50px !important; border-radius: 50% !important; right: 10px !important; left: auto !important; background: #000 !important; border: 2px solid var(--accent) !important; padding: 0 !important; display: flex !important; align-items: center !important; justify-content: center !important; z-index: 2005 !important; bottom: 90px !important; }
    body.editing .chat-container:not(.expanded) { bottom: 240px !important; }
    .chat-container:not(.expanded) .chat-header span, .chat-container:not(.expanded) #chatToggleIcon { display: none !important; }
    .chat-container:not(.expanded) .chat-header::after { content: '💬'; font-size: 24px; line-height: 1; }
    .chat-container:not(.expanded) .chat-header { width: 100% !important; height: 100% !important; padding: 0 !important; background: transparent !important; border: none !important; display: flex !important; justify-content: center !important; align-items: center !important;}
    .chat-container.expanded { width: auto !important; left: 10px !important; right: 10px !important; bottom: 90px !important; height: 50vh !important; border-radius: 12px !important; background: #1a1a2e !important; display: flex !important; flex-direction: column !important; z-index: 2010 !important; }
    .chat-container.expanded .chat-body, .chat-container.expanded .chat-input-area, .chat-container.expanded .chat-tabs, .chat-container.expanded #onlineList { display: flex !important; }
    .chat-container.expanded .chat-header { justify-content: space-between !important; padding: 10px 15px !important; height: auto !important; }
    .chat-container.expanded .chat-header span { display: inline !important; }
    .chat-container.expanded .chat-header::after { content: '' !important; }
}

/* Styl dla linków do plików na czacie */
.chat-file-download {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--accent);
    border-radius: 6px;
    padding: 8px 12px;
    margin-top: 5px;
    text-decoration: none;
    color: var(--text);
    transition: all 0.2s ease;
    max-width: fit-content;
}

.chat-file-download:hover {
    background: rgba(0, 255, 200, 0.1);
    box-shadow: 0 0 10px rgba(0, 255, 200, 0.2);
    transform: translateX(2px);
}

.file-icon {
    font-size: 20px;
    margin-right: 10px;
}

.file-name {
    font-weight: bold;
    font-size: 12px;
    margin-right: 15px;
    max-width: 150px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--accent);
}

.file-action {
    font-size: 10px;
    color: #aaa;
    text-transform: uppercase;
}

/* Przycisk usuwania wiadomości */
.chat-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.msg-delete-btn {
    background: transparent;
    border: none;
    color: #666;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    padding: 0 5px;
    line-height: 1;
    opacity: 0; /* Ukryty domyślnie */
    transition: all 0.2s;
}

.chat-message:hover .msg-delete-btn {
    opacity: 1; /* Pokaż po najechaniu na wiadomość */
}

.msg-delete-btn:hover {
    color: #e74c3c; /* Czerwony po najechaniu na krzyżyk */
    transform: scale(1.2);
}

/* Mobilne: zawsze pokazuj przycisk, bo nie ma hover */
@media (max-width: 768px) {
    .msg-delete-btn {
        opacity: 0.5;
    }
}/* Przycisk usuwania wiadomości */
.chat-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.msg-delete-btn {
    background: transparent;
    border: none;
    color: #666;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    padding: 0 5px;
    line-height: 1;
    opacity: 0; /* Ukryty domyślnie */
    transition: all 0.2s;
}

.chat-message:hover .msg-delete-btn {
    opacity: 1; /* Pokaż po najechaniu na wiadomość */
}

.msg-delete-btn:hover {
    color: #e74c3c; /* Czerwony po najechaniu na krzyżyk */
    transform: scale(1.2);
}

/* Mobilne: zawsze pokazuj przycisk, bo nie ma hover */
@media (max-width: 768px) {
    .msg-delete-btn {
        opacity: 0.5;
    }
}