/**
 * Chat Component Styles
 * Paper Pulltabs Digital
 */

/* Chat Container */
.game-chat {
    position: fixed;
    bottom: 80px;
    left: 20px;
    width: 320px;
    max-height: 400px;
    background: rgba(0, 0, 0, 0.9);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.game-chat.minimized {
    max-height: 44px;
    overflow: hidden;
}

/* Chat Header */
.chat-header {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px 12px 0 0;
    cursor: pointer;
    user-select: none;
}

.game-chat.minimized .chat-header {
    border-radius: 12px;
    border-bottom: none;
}

.chat-title {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    flex: 1;
}

.chat-unread {
    display: none;
    background: #e63946;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    margin-right: 8px;
}

.chat-unread.show {
    display: inline-block;
}

.chat-toggle {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.chat-toggle:hover {
    color: #fff;
}

/* Chat Body */
.chat-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.game-chat.minimized .chat-body {
    display: none;
}

/* Messages Container */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    max-height: 280px;
    min-height: 120px;
}

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

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

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

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

/* Welcome Message */
.chat-welcome {
    text-align: center;
    padding: 20px 10px;
    color: rgba(255, 255, 255, 0.5);
}

.chat-welcome p {
    margin: 0;
    font-size: 13px;
}

.chat-welcome .chat-hint {
    font-size: 11px;
    margin-top: 8px;
    font-style: italic;
}

/* Individual Message */
.chat-message {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    animation: chatFadeIn 0.2s ease;
}

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

.chat-message .chat-name {
    flex-shrink: 0;
    font-size: 12px;
    font-weight: 600;
    color: #4dabf7;
    min-width: 60px;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-message .chat-text {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.9);
    word-wrap: break-word;
    line-height: 1.4;
}

/* Own message styling */
.chat-message.own .chat-name {
    color: #69db7c;
}

/* System message styling */
.chat-message.system {
    justify-content: center;
}

.chat-message.system .chat-text {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    font-style: italic;
    text-align: center;
}

/* Input Container */
.chat-input-container {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.02);
    border-radius: 0 0 12px 12px;
}

.chat-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 13px;
    color: #fff;
    outline: none;
    transition: border-color 0.2s, background 0.2s;
}

.chat-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.chat-input:focus {
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.12);
}

.chat-send {
    background: #4dabf7;
    border: none;
    border-radius: 6px;
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.chat-send:hover {
    background: #339af0;
}

.chat-send:active {
    transform: scale(0.96);
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .game-chat {
        left: 10px;
        right: 10px;
        bottom: 10px;
        width: auto;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .game-chat {
        left: 0;
        right: 0;
        bottom: 0;
        border-radius: 12px 12px 0 0;
    }

    .game-chat.minimized {
        /* Shrink to a small pill button at bottom-left so it doesn't
           overlap the prize board's minimized pill at bottom-right */
        width: auto;
        left: 10px;
        right: auto;
        bottom: 10px;
        border-radius: 12px;
    }

    .chat-input-container {
        border-radius: 0;
    }

    .chat-header {
        border-radius: 12px 12px 0 0;
    }

    .game-chat.minimized .chat-header {
        border-radius: 12px;
    }
}
