/* Chat System Styles */
.chat-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, serif;
}

.chat-toggle {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #444 0%, #666 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    transition: all 0.3s ease;
    font-size: 20px;
    color: white;
    user-select: none;
}

.chat-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

/* Chat Panel - Mirroring Boss Modal */
.chat-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(700px, 95vw);
    height: 70vh;
    max-height: 500px;
    background: #111111;
    border: 1px solid #333;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0,0,0,0.8);
    display: none;
    flex-direction: column;
    z-index: 100000;
    color: #e0e0e0;
    overflow: hidden;
}

.chat-panel.active {
    display: flex;
}

/* Chat Header - styled like boss-header */
.chat-header {
    background: linear-gradient(180deg, #222 0%, #111 100%);
    border-bottom: 1px solid #444;
    padding: 15px;
    text-align: center;
    font-size: 18px;
    font-weight: bold;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h3 {
    margin: 0;
    color: #fff;
    font-size: 16px;
    font-weight: bold;
}

/* Chat Body - styled like boss-body for vertical side-by-side tabs and content */
.chat-body {
    display: flex;
    flex-direction: row;
    padding: 15px;
    gap: 15px;
    flex: 1;
    overflow: hidden;
    width: 100%;
}

/* Chat Tabs - styled like boss-tabs */
.chat-tabs {
    display: flex;
    flex-direction: column;
    width: 150px;
    min-width: 150px;
    gap: 5px;
    border-right: 1px solid #333;
    padding-right: 15px;
    overflow-y: auto;
}

.chat-tab-btn {
    flex-shrink: 0;
    background: #222;
    border: 1px solid #444;
    color: #ccc;
    padding: 10px;
    text-align: left;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
    font-weight: bold;
    font-size: 13px;
    font-family: inherit;
}

.chat-tab-btn:hover {
    background: #333;
    color: #fff;
}

.chat-tab-btn.active {
    background: #555;
    color: #ff9900;
    border-color: #777;
}

.chat-tab-btn.has-dot {
    position: relative;
}

.chat-tab-btn.has-dot::after {
    content: '';
    position: absolute;
    top: 5px;
    right: 5px;
    width: 6px;
    height: 6px;
    background-color: #ff4444;
    border-radius: 50%;
    box-shadow: 0 0 4px #ff4444;
}

.chat-message.hidden {
    display: none !important;
}

.system-message.hidden {
    display: none !important;
}

/* Chat Close Button */
.chat-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-close img {
    width: 20px;
    height: 20px;
}

/* Chat Content Container - holds messages and input */
.chat-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.chat-message {
    display: flex;
    flex-direction: column;
    margin-bottom: 8px;
    animation: fadeIn 0.3s ease;
}

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

.chat-message.own-message {
    align-items: flex-end;
}

.chat-message.other-message {
    align-items: flex-start;
}

.message-content {
    max-width: 80%;
    padding: 10px 15px;
    border-radius: 18px;
    word-wrap: break-word;
    line-height: 1.4;
    font-size: 14px;
}

.own-message .message-content {
    background: rgba(52, 152, 219, 0.3);
    border: 1px solid rgba(52, 152, 219, 0.5);
    color: #fff;
    border-bottom-right-radius: 5px;
}

.other-message .message-content {
    background: rgba(40, 40, 40, 0.8);
    border: 1px solid rgba(100, 100, 100, 0.3);
    color: #ffffff;
    border-bottom-left-radius: 5px;
}

.message-sender {
    font-size: 12px;
    color: #cccccc;
    margin-bottom: 4px;
    font-weight: 600;
}

.own-message .message-sender {
    color: #888;
}

.other-message .message-sender {
    color: #cccccc;
}

.message-time {
    font-size: 11px;
    color: #888;
    margin-top: 4px;
    text-align: right;
}

.other-message .message-time {
    text-align: left;
}

.chat-input-container {
    padding: 10px;
    border-top: 1px solid rgba(100, 100, 100, 0.3);
    display: flex;
    gap: 8px;
    position: relative;
    align-items: center;
}

/* World chat checkbox */
.world-chat-checkbox {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
    flex-shrink: 0;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
}

.world-chat-checkbox:hover {
    background: rgba(40, 40, 40, 0.5);
}

.world-chat-checkbox input[type="checkbox"] {
    display: none;
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 28px;
    background: rgba(40, 40, 40, 0.8);
    border: 1px solid rgba(100, 100, 100, 0.3);
    border-radius: 4px;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    transition: all 0.2s;
    cursor: pointer;
}

.world-chat-checkbox:hover .checkbox-label {
    background: rgba(50, 50, 50, 0.9);
    border-color: rgba(100, 100, 100, 0.5);
}

.world-chat-checkbox input[type="checkbox"]:checked + .checkbox-label {
    background: rgba(52, 152, 219, 0.3);
    border-color: rgba(52, 152, 219, 0.6);
    color: #3498db;
    font-weight: 700;
}

.world-chat-checkbox input[type="checkbox"]:checked + .checkbox-label:hover {
    background: rgba(52, 152, 219, 0.4);
    border-color: rgba(52, 152, 219, 0.8);
}

.chat-input-container input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid rgba(100, 100, 100, 0.3);
    border-radius: 4px;
    outline: none;
    font-size: 13px;
    transition: all 0.2s;
    background: rgba(40, 40, 40, 0.8);
    color: #ffffff;
    min-width: 0;
}

.chat-input-container input:focus {
    border-color: rgba(52, 152, 219, 0.5);
    background: rgba(50, 50, 50, 0.9);
}

.chat-send {
    padding: 5px 10px;
    background: rgba(40, 40, 40, 0.8);
    border: 1px solid rgba(100, 100, 100, 0.3);
    border-radius: 4px;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 55px;
    flex-shrink: 0;
}

.chat-send:hover:not(:disabled) {
    background: rgba(50, 50, 50, 0.9);
    border-color: rgba(52, 152, 219, 0.5);
    color: #3498db;
}

.chat-send:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Quick menu button */
.chat-quick-menu {
    padding: 5px 10px;
    background: rgba(40, 40, 40, 0.8);
    border: 1px solid rgba(100, 100, 100, 0.3);
    border-radius: 4px;
    color: #fff;
    cursor: pointer;
    font-size: 18px;
    font-weight: 600;
    transition: all 0.2s;
    min-width: 40px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.chat-quick-menu:hover {
    background: rgba(50, 50, 50, 0.9);
    border-color: rgba(52, 152, 219, 0.5);
    color: #3498db;
}

/* Quick menu dropdown */
.chat-quick-menu-dropdown {
    position: absolute;
    bottom: 100%;
    right: 0;
    margin-bottom: 8px;
    background: rgba(30, 30, 30, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(100, 100, 100, 0.3);
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    display: none;
    flex-direction: column;
    min-width: 150px;
    z-index: 1001;
    overflow: hidden;
}

.chat-quick-menu-dropdown.active {
    display: flex;
}

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

.quick-menu-item {
    background: none;
    border: none;
    color: #fff;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
    text-align: left;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid rgba(100, 100, 100, 0.3);
}

.quick-menu-item:last-child {
    border-bottom: none;
}

.quick-menu-item:hover {
    background: rgba(40, 40, 40, 0.8);
}

.quick-menu-item.active {
    background: rgba(52, 152, 219, 0.3);
    color: #3498db;
    font-weight: 600;
}

.quick-menu-item.active:hover {
    background: rgba(52, 152, 219, 0.4);
}

.quick-menu-item span {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* System messages */
.system-message {
    text-align: center;
    color: #cccccc;
    font-size: 12px;
    font-style: italic;
    padding: 5px 0;
    border-bottom: 1px solid #555;
    margin-bottom: 8px;
}

.system-message.join {
    color: #4caf50;
}

.system-message.leave {
    color: #f44336;
}

.system-message.error {
    color: #f44336;
    font-weight: 600;
}

/* Mobile responsive */
/* Tablet and medium screens */
@media (max-width: 768px) and (min-width: 481px) {
    .chat-container {
        top: 10px;
        right: 10px;
    }
    
    .chat-panel {
        width: 90vw;
        height: 80vh;
        max-width: 500px;
        max-height: 600px;
    }
    
    .chat-toggle {
        width: 45px;
        height: 45px;
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    .chat-panel {
        width: 95vw;
        height: 80vh;
        max-width: none;
        max-height: none;
    }
    
    .chat-messages {
        padding: 8px;
        gap: 5px;
    }
    
    .chat-input-container {
        padding: 8px;
        gap: 6px;
    }
    
    .chat-input-container input {
        font-size: 12px;
        padding: 7px 10px;
    }
    
    .chat-send {
        padding: 7px 12px;
        font-size: 12px;
        min-width: 42px;
    }
    
    .chat-header {
        padding: 10px 12px;
    }
    
    .chat-tab-btn {
        font-size: 13px;
        padding: 4px 8px;
    }
}

/* Mobile landscape orientation */
@media (max-width: 900px) and (max-height: 480px) and (orientation: landscape) {
    .chat-panel {
        width: 95vw;
        height: 95vh;
        max-width: none;
        max-height: none;
    }
    
    .chat-header {
        padding: 5px 12px;
    }
    
    .chat-messages {
        padding: 5px;
    }
    
    .chat-input-container {
        padding: 5px;
    }
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 10px 15px;
    color: #cccccc;
    font-size: 12px;
    font-style: italic;
}

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

.typing-dots span {
    width: 4px;
    height: 4px;
    background: #cccccc;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Online users indicator */
.online-users {
    position: absolute;
    bottom: -35px;
    left: 0;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 12px;
    display: none;
    border: 1px solid #555;
}

.chat-panel.active .online-users {
    display: block;
}

/* Notification animations */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideOutRight {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}
