/* Simple AI Chatbot Styles */

#sac-chatbot {
    --sac-primary: #4299e1;
    --sac-primary-dark: #3182ce;
    --sac-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    --sac-radius: 16px;
    
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99999;
}

/* Toggle Button */
.sac-toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--sac-primary);
    border: none;
    cursor: pointer;
    box-shadow: var(--sac-shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, background 0.2s;
}

.sac-toggle:hover {
    transform: scale(1.05);
    background: var(--sac-primary-dark);
}

.sac-toggle svg {
    width: 28px;
    height: 28px;
    fill: white;
}

/* Chat Window */
.sac-window {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 380px;
    max-width: calc(100vw - 48px);
    height: 520px;
    max-height: calc(100vh - 120px);
    background: #fff;
    border-radius: var(--sac-radius);
    box-shadow: var(--sac-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s ease;
}

.sac-window.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Header */
.sac-header {
    background: var(--sac-primary);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.sac-header-icon {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sac-header-icon svg {
    width: 24px;
    height: 24px;
    fill: white;
}

.sac-header-info {
    flex: 1;
}

.sac-header-name {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 2px;
}

.sac-header-status {
    font-size: 13px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 6px;
}

.sac-status-dot {
    width: 8px;
    height: 8px;
    background: #48bb78;
    border-radius: 50%;
}

/* TTS Toggle Button */
.sac-tts-toggle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    margin-left: auto;
    opacity: 0.6;
}

.sac-tts-toggle.active {
    opacity: 1;
    background: rgba(255, 255, 255, 0.25);
}

.sac-tts-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
}

.sac-tts-toggle svg {
    width: 18px;
    height: 18px;
    fill: white;
}

/* Clear/New Chat Button */
.sac-clear {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    margin-left: 0;
}

.sac-clear:hover {
    background: rgba(255, 255, 255, 0.3);
}

.sac-clear svg {
    width: 18px;
    height: 18px;
    fill: white;
}

/* Messages Area */
.sac-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: #fafafa;
}

.sac-message {
    display: flex;
    gap: 10px;
    max-width: 85%;
    animation: sacFadeIn 0.3s ease;
}

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

.sac-message.bot {
    align-self: flex-start;
}

.sac-message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.sac-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--sac-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sac-message-avatar svg {
    width: 18px;
    height: 18px;
    fill: white;
}

.sac-message.user .sac-message-avatar {
    background: #718096;
}

.sac-message-content {
    background: white;
    padding: 12px 16px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    color: #2d3748;
}

.sac-message.user .sac-message-content {
    background: var(--sac-primary);
    color: white;
}

.sac-message-time {
    font-size: 11px;
    color: #a0aec0;
    margin-top: 4px;
}

.sac-message.user .sac-message-time {
    text-align: right;
}

/* Typing Indicator */
.sac-typing {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
}

.sac-typing span {
    width: 8px;
    height: 8px;
    background: #a0aec0;
    border-radius: 50%;
    animation: sacTyping 1.4s infinite;
}

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

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

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

/* Input Area */
.sac-input-area {
    padding: 16px;
    border-top: 1px solid #e2e8f0;
    background: white;
    display: flex;
    gap: 10px;
    align-items: center;
}

.sac-input {
    flex: 1;
    border: 1px solid #e2e8f0;
    border-radius: 24px;
    padding: 12px 18px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}

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

.sac-input::placeholder {
    color: #a0aec0;
}

.sac-send {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--sac-primary);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.1s;
    flex-shrink: 0;
}

.sac-send:hover {
    background: var(--sac-primary-dark);
}

.sac-send:active {
    transform: scale(0.95);
}

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

.sac-send svg {
    width: 20px;
    height: 20px;
    fill: white;
    margin-left: 2px;
}

/* Mic Button */
.sac-mic {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: transparent;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.sac-mic:hover {
    background: #f7fafc;
    border-color: #cbd5e0;
}

.sac-mic svg {
    width: 20px;
    height: 20px;
    fill: #718096;
}

.sac-mic.recording {
    background: #fed7d7;
    border-color: #fc8181;
    animation: sacPulse 1.5s ease-in-out infinite;
}

.sac-mic.recording svg {
    fill: #e53e3e;
}

@keyframes sacPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(229, 62, 62, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(229, 62, 62, 0);
    }
}

/* Date Separator */
.sac-date {
    text-align: center;
    color: #718096;
    font-size: 12px;
    padding: 8px 16px;
    background: #edf2f7;
    border-radius: 16px;
    align-self: center;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    #sac-chatbot {
        bottom: 16px;
        right: 16px;
    }
    
    .sac-window {
        width: calc(100vw - 32px);
        height: 400px;
        max-height: 60vh;
        bottom: 66px;
        right: 0;
    }
    
    .sac-toggle {
        width: 50px;
        height: 50px;
    }
}

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

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

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

.sac-messages::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}
