/**
 * Frontend chatbot styles for Gemini WP Chatbot
 *
 * @package Gemini_WP_Chatbot
 */

/* CSS Variables for theming */
:root {
    --gc-primary-color: #2563eb;
}

/* Toggle Button */
.gc-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--gc-primary-color);
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.gc-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.gc-btn:focus {
    outline: 2px solid var(--gc-primary-color);
    outline-offset: 2px;
}

/* Chat Window */
.gc-window {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 9999;
    border: 1px solid #e2e8f0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
}

/* Header */
.gc-header {
    background: var(--gc-primary-color);
    color: white;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gc-bot-name {
    font-weight: bold;
    font-size: 16px;
}

.gc-close {
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
    transition: opacity 0.2s ease;
    padding: 0 4px;
}

.gc-close:hover {
    opacity: 0.7;
}

/* Messages Container */
.gc-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Scrollbar Styling */
.gc-messages::-webkit-scrollbar {
    width: 6px;
}

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

.gc-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.gc-messages::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Message Bubbles */
.gc-msg {
    padding: 10px 14px;
    border-radius: 12px;
    max-width: 80%;
    line-height: 1.5;
    font-size: 14px;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.gc-msg.user {
    align-self: flex-end;
    background: var(--gc-primary-color);
    color: white;
    border-bottom-right-radius: 2px;
}

.gc-msg.model {
    align-self: flex-start;
    background: white;
    border: 1px solid #e2e8f0;
    color: #334155;
    border-bottom-left-radius: 2px;
}

/* Input Area */
.gc-input-area {
    padding: 12px;
    background: white;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 8px;
}

.gc-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 20px;
    outline: none;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s ease;
}

.gc-input:focus {
    border-color: var(--gc-primary-color);
}

.gc-input::placeholder {
    color: #94a3b8;
}

/* Send Button */
.gc-send {
    background: var(--gc-primary-color);
    border: none;
    color: white;
    cursor: pointer;
    font-weight: 600;
    padding: 10px 16px;
    border-radius: 20px;
    font-size: 14px;
    transition: opacity 0.2s ease, transform 0.1s ease;
}

.gc-send:hover {
    opacity: 0.9;
}

.gc-send:active {
    transform: scale(0.98);
}

.gc-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Setup Message */
.gc-setup-msg {
    background: #fff3cd !important;
    border-color: #ffeeba !important;
    color: #856404 !important;
}

.gc-setup-msg strong {
    display: block;
    margin-bottom: 5px;
}

/* Typing Indicator */
.gc-typing {
    display: flex;
    gap: 4px;
    padding: 4px 0;
}

.gc-typing span {
    width: 8px;
    height: 8px;
    background: #94a3b8;
    border-radius: 50%;
    animation: gc-typing 1.4s infinite;
}

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

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

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

/* Mobile Responsive */
@media (max-width: 480px) {
    .gc-window {
        width: calc(100% - 40px);
        height: calc(100% - 120px);
        bottom: 80px;
        right: 20px;
        left: 20px;
        border-radius: 12px;
    }

    .gc-btn {
        width: 50px;
        height: 50px;
    }

    .gc-msg {
        max-width: 85%;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .gc-btn,
    .gc-send,
    .gc-close,
    .gc-input {
        transition: none;
    }

    .gc-typing span {
        animation: none;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .gc-window {
        background: #1e293b;
        border-color: #334155;
    }

    .gc-messages {
        background: #0f172a;
    }

    .gc-msg.model {
        background: #1e293b;
        border-color: #334155;
        color: #e2e8f0;
    }

    .gc-input-area {
        background: #1e293b;
        border-color: #334155;
    }

    .gc-input {
        background: #0f172a;
        border-color: #334155;
        color: #e2e8f0;
    }

    .gc-input::placeholder {
        color: #64748b;
    }
}
