/* Motley Dog Chat Styles */

/* Motley Character Positioning */
#motley {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 999;
    cursor: pointer;
    transition: transform 0.3s ease;
}

#motley:hover {
    transform: scale(1.05);
}

.motley-svg {
    width: 80px;
    height: 100px;
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.3));
}

/* Tail wagging animation when connected */
.motley-tail {
    transform-origin: 22px 70px;
    transition: none;
}

.motley-tail.wagging {
    animation: tailWag 2s ease-in-out infinite;
}

@keyframes tailWag {
    0%, 100% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(-15deg);
    }
    75% {
        transform: rotate(15deg);
    }
}

/* Faster wag on hover when connected */
#motley:hover .motley-tail.wagging {
    animation-duration: 0.8s;
}

/* Motley Name Ribbon */
.motley-ribbon {
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #8B4513, #A0522D);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    border: 1px solid #654321;
}

/* Motley Chat Window - Matching Foreman's Size */
.motley-chat-window {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 850px;
    height: calc(100vh - 60px);
    max-height: 90vh;
    background: linear-gradient(135deg, #2C1810, #3E2B23);
    border: 3px solid #8B4513;
    border-radius: 15px;
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.5),
        0 0 100px rgba(139, 69, 19, 0.2);
    display: flex;
    flex-direction: column;
    z-index: 10001;
    overflow: hidden;
}

/* Chat Header */
.motley-chat-header {
    background: linear-gradient(135deg, #8B4513, #A0522D);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #654321;
}

.motley-chat-header .chat-title {
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
    font-weight: bold;
    font-size: 1.1rem;
}

.motley-chat-header .dog-icon {
    font-size: 1.5rem;
}

.motley-chat-header .chat-close {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid white;
    color: white;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.motley-chat-header .chat-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* Subheader */
.motley-chat-subheader {
    background: rgba(139, 69, 19, 0.2);
    padding: 10px 20px;
    border-bottom: 1px solid rgba(139, 69, 19, 0.3);
}

.motley-chat-subheader p {
    color: #D2691E;
    font-style: italic;
    font-size: 0.9rem;
    margin: 0;
    text-align: center;
}

/* Messages Area - Spacious Like Foreman */
.motley-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    background: rgba(0, 0, 0, 0.2);
    min-height: 400px;
}

.motley-chat-messages .message {
    padding: 12px 15px;
    border-radius: 10px;
    line-height: 1.5;
    animation: messageSlide 0.3s ease;
}

.motley-chat-messages .message.user {
    background: rgba(139, 69, 19, 0.3);
    color: white;
    margin-left: auto;
    max-width: 70%;
    border: 1px solid #8B4513;
}

.motley-chat-messages .message.assistant {
    background: rgba(210, 105, 30, 0.2);
    color: #FFE4B5;
    max-width: 85%;
    border: 1px solid #D2691E;
}

.motley-chat-messages .message strong {
    color: #FFD700;
    display: block;
    margin-bottom: 5px;
    font-size: 0.9rem;
}

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

/* Input Container - More Spacious Like Foreman */
.motley-chat-input-container {
    padding: 20px;
    background: rgba(139, 69, 19, 0.1);
    border-top: 2px solid rgba(139, 69, 19, 0.3);
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.preset-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.preset-btn {
    flex: 1;
    padding: 8px 12px;
    background: linear-gradient(135deg, #8B4513, #A0522D);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.preset-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(139, 69, 19, 0.3);
    background: linear-gradient(135deg, #A0522D, #8B4513);
}

.preset-btn .btn-icon {
    font-size: 1.2rem;
}

.chat-input-wrapper {
    display: flex;
    gap: 15px;
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(139, 69, 19, 0.3);
    border-radius: 12px;
    min-height: 50px;
    color: white;
    font-size: 1rem;
    transition: all 0.3s ease;
}

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

.chat-input:focus {
    outline: none;
    border-color: #D2691E;
    background: rgba(255, 255, 255, 0.15);
}

.send-btn {
    padding: 12px 20px;
    background: linear-gradient(135deg, #D2691E, #FF8C00);
    color: white;
    border: none;
    border-radius: 10px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.send-btn:hover {
    transform: translateX(2px);
    box-shadow: 0 5px 15px rgba(210, 105, 30, 0.3);
    background: linear-gradient(135deg, #FF8C00, #D2691E);
}

/* Chat Footer */
.motley-chat-window .chat-footer {
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border-top: 1px solid rgba(139, 69, 19, 0.3);
    text-align: center;
}

.motley-chat-window .chat-footer p {
    margin: 5px 0;
    color: #D2691E;
    font-size: 0.85rem;
}

.motley-chat-window .api-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
}

.motley-chat-window .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #DC143C;
    animation: pulse 2s infinite;
}

/* Scrollbar Styling */
.motley-chat-messages::-webkit-scrollbar {
    width: 8px;
}

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

.motley-chat-messages::-webkit-scrollbar-thumb {
    background: #8B4513;
    border-radius: 4px;
}

.motley-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #A0522D;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    #motley {
        bottom: 10px;
        left: 10px;
    }

    .motley-svg {
        width: 60px;
        height: 75px;
    }

    .motley-chat-window {
        width: 95%;
        height: 90vh;
        max-height: none;
    }

    .motley-chat-messages .message.assistant {
        max-width: 95%;
    }

    .preset-btn .btn-icon {
        display: none;
    }
}