/**
 * E.F.C Auto-École - Chatbot Widget Styles
 * Styles pour le widget de chat flottant
 */

/* Variables CSS */
:root {
    --chatbot-primary: #0ea5e9;
    --chatbot-accent: #fa9223;
    --chatbot-bg: #ffffff;
    --chatbot-text: #1e293b;
    --chatbot-text-light: #64748b;
    --chatbot-border: #e2e8f0;
    --chatbot-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    --chatbot-shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.25);
}

/* Bouton flottant */
.chatbot-button {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--chatbot-primary) 0%, var(--chatbot-accent) 100%);
    border: none;
    color: white;
    cursor: pointer;
    box-shadow: var(--chatbot-shadow);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    padding: 0;
}

.chatbot-button:hover {
    transform: scale(1.1);
    box-shadow: var(--chatbot-shadow-lg);
}

.chatbot-button:active {
    transform: scale(0.95);
}

.chatbot-button-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: white;
    font-size: 12px;
    font-weight: 700;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    animation: pulse 2s infinite;
}

.chatbot-button-hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0);
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* Container du chat */
.chatbot-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 400px;
    max-width: calc(100vw - 48px);
    height: 600px;
    max-height: calc(100vh - 48px);
    background: var(--chatbot-bg);
    border-radius: 24px;
    box-shadow: var(--chatbot-shadow-lg);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.chatbot-container.chatbot-open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* Header */
.chatbot-header {
    background: linear-gradient(135deg, var(--chatbot-primary) 0%, var(--chatbot-accent) 100%);
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 24px 24px 0 0;
}

.chatbot-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chatbot-avatar {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chatbot-header-text h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.2;
}

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

.chatbot-status::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #22c55e;
    border-radius: 50%;
    display: inline-block;
    animation: pulse 2s infinite;
}

.chatbot-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

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

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

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

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

.chatbot-messages::-webkit-scrollbar-thumb {
    background: var(--chatbot-border);
    border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #cbd5e1;
}

.chatbot-welcome {
    text-align: center;
    padding: 24px;
    color: var(--chatbot-text-light);
    font-size: 14px;
    line-height: 1.6;
}

.chatbot-message {
    display: flex;
    flex-direction: column;
    max-width: 80%;
    animation: messageSlideIn 0.3s ease;
}

.chatbot-message-user {
    align-self: flex-end;
}

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

.chatbot-message-content {
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.chatbot-message-user .chatbot-message-content {
    background: linear-gradient(135deg, var(--chatbot-primary) 0%, var(--chatbot-accent) 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.chatbot-message-bot .chatbot-message-content {
    background: white;
    color: var(--chatbot-text);
    border: 1px solid var(--chatbot-border);
    border-bottom-left-radius: 4px;
}

.chatbot-message-error .chatbot-message-content {
    background: #fef2f2;
    color: #dc2626;
    border-color: #fecaca;
}

.chatbot-message-time {
    font-size: 11px;
    color: var(--chatbot-text-light);
    margin-top: 4px;
    padding: 0 4px;
}

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

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

/* Questions rapides */
.chatbot-quick-questions {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: white;
    border-top: 1px solid var(--chatbot-border);
}

.chatbot-quick-btn {
    background: #f1f5f9;
    border: 1px solid var(--chatbot-border);
    border-radius: 12px;
    padding: 10px 16px;
    font-size: 13px;
    color: var(--chatbot-text);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.chatbot-quick-btn:hover {
    background: #e2e8f0;
    border-color: var(--chatbot-primary);
    transform: translateX(4px);
}

.chatbot-quick-btn:active {
    transform: translateX(2px);
}

/* Input container */
.chatbot-input-container {
    background: white;
    border-top: 1px solid var(--chatbot-border);
    padding: 16px;
}

.chatbot-typing-indicator {
    display: none;
    padding: 12px 16px;
    gap: 4px;
    align-items: center;
}

.chatbot-typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--chatbot-text-light);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

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

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

.chatbot-form {
    display: flex;
    gap: 8px;
    align-items: center;
}

.chatbot-input {
    flex: 1;
    border: 1px solid var(--chatbot-border);
    border-radius: 24px;
    padding: 12px 16px;
    font-size: 14px;
    outline: none;
    transition: all 0.2s ease;
    font-family: inherit;
}

.chatbot-input:focus {
    border-color: var(--chatbot-primary);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.chatbot-input::placeholder {
    color: var(--chatbot-text-light);
}

.chatbot-send {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--chatbot-primary) 0%, var(--chatbot-accent) 100%);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.chatbot-send:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.4);
}

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

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

/* Responsive */
@media (max-width: 768px) {
    .chatbot-container {
        width: 100%;
        height: 100%;
        max-width: 100vw;
        max-height: 100vh;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }

    .chatbot-container.chatbot-open {
        border-radius: 24px 24px 0 0;
    }

    .chatbot-button {
        bottom: 16px;
        right: 16px;
        width: 56px;
        height: 56px;
    }

    .chatbot-message {
        max-width: 85%;
    }
}

/* Formulaire de capture de coordonnées */
.chatbot-contact-form {
    background: white;
    border: 2px solid var(--chatbot-primary);
    border-radius: 16px;
    padding: 20px;
    margin: 16px 0;
    animation: slideInUp 0.3s ease;
}

.chatbot-form-header {
    margin-bottom: 16px;
}

.chatbot-form-header p {
    margin: 0;
    color: var(--chatbot-text);
    font-size: 14px;
    font-weight: 600;
}

.chatbot-form-group {
    margin-bottom: 12px;
}

.chatbot-form-group input,
.chatbot-form-group select {
    width: 100%;
    border: 1px solid var(--chatbot-border);
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: all 0.2s ease;
}

.chatbot-form-group input:focus,
.chatbot-form-group select:focus {
    border-color: var(--chatbot-primary);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.chatbot-form-group input::placeholder {
    color: var(--chatbot-text-light);
}

.chatbot-form-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.chatbot-form-submit {
    flex: 1;
    background: linear-gradient(135deg, var(--chatbot-primary) 0%, var(--chatbot-accent) 100%);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.chatbot-form-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.4);
}

.chatbot-form-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.chatbot-form-cancel {
    background: #f1f5f9;
    color: var(--chatbot-text);
    border: 1px solid var(--chatbot-border);
    border-radius: 12px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chatbot-form-cancel:hover {
    background: #e2e8f0;
}

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

@media (max-width: 480px) {
    .chatbot-header {
        padding: 16px;
    }

    .chatbot-messages {
        padding: 16px;
    }

    .chatbot-input-container {
        padding: 12px;
    }

    .chatbot-contact-form {
        padding: 16px;
    }

    .chatbot-form-actions {
        flex-direction: column;
    }

    .chatbot-form-submit,
    .chatbot-form-cancel {
        width: 100%;
    }
}
