/**
 * Styles CSS pour le chatbot GPT - Frontend
 */

:root {
    --couleur-principale-chatbot: #e96531;
    --couleur-fond-chatbot: #f7f7f7;
}

/* Bouton flottant du chatbot */
.wp-chatbot-gpt-toggle {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 60px;
    height: 60px;
    background: var(--couleur-principale-chatbot);
    border-radius: 50%;
    box-shadow: 0 4px 20px rgba(233, 101, 49, 0.3);
    cursor: pointer;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    color: white;
}

.wp-chatbot-gpt-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(233, 101, 49, 0.4);
}

.wp-chatbot-gpt-toggle-icon,
.wp-chatbot-gpt-toggle-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.wp-chatbot-gpt-toggle svg {
    width: 24px;
    height: 24px;
    color: white;
}

/* Popover du chatbot */
.wp-chatbot-gpt-container {
    max-width: 100%;
    margin: 0 auto;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.wp-chatbot-gpt-popover {
    position: fixed;
    bottom: 90px;
    left: 20px;
    width: 400px;
    height: 600px;
    z-index: 9998;
    display: none;
    animation: slideUp 0.3s ease-out;
}

.wp-chatbot-gpt-popover.wp-chatbot-gpt-popover-open {
    display: block;
}

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

.wp-chatbot-gpt-header {
    background: var(--couleur-principale-chatbot);
    color: white;
    padding: 10px 20px;
    text-align: center;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wp-chatbot-gpt-title {
    margin: 0;
    font-size: 18px;
    font-weight: 800;
    color: white !important;
    padding-bottom: 0;
}

.wp-chatbot-gpt-clear {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 5px;
    border-radius: 3px;
    transition: background-color 0.2s ease;
    opacity: 0.8;
}

.wp-chatbot-gpt-clear:hover {
    background-color: rgba(255, 255, 255, 0.2);
    opacity: 1;
}

.wp-chatbot-gpt-clear svg {
    width: 16px;
    height: 16px;
    color: white;
}

.wp-chatbot-gpt-messages {
    height: 450px;
    max-height: 450px;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.wp-chatbot-gpt-popover .wp-chatbot-gpt-messages {
    height: 450px;
    max-height: 450px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.wp-chatbot-gpt-message {
    margin-bottom: 0;
    display: flex;
    align-items: flex-start;
    animation: messageSlideIn 0.3s ease-out;
    gap: 8px;
}

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

.wp-chatbot-gpt-message.user {
    justify-content: flex-end;
    flex-direction: row-reverse;
}

.wp-chatbot-gpt-message.bot {
    justify-content: flex-start;
}

.wp-chatbot-gpt-message.error {
    justify-content: center;
}

/* Avatars */
.wp-chatbot-gpt-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    flex-shrink: 0;
}

.wp-chatbot-gpt-message.user .wp-chatbot-gpt-avatar {
    background: var(--couleur-principale-chatbot);
    color: white;
}

.wp-chatbot-gpt-message.bot .wp-chatbot-gpt-avatar {
    background: #e9ecef;
    color: #6c757d;
}

.wp-chatbot-gpt-message-content {
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
    position: relative;
    max-width: 70%;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.wp-chatbot-gpt-message-content:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.wp-chatbot-gpt-message.user .wp-chatbot-gpt-message-content {
    background: linear-gradient(135deg, var(--couleur-principale-chatbot) 0%, #d4552a 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.wp-chatbot-gpt-message.user .wp-chatbot-gpt-message-content::before {
    content: '';
    position: absolute;
    bottom: 0;
    right: -8px;
    width: 0;
    height: 0;
    border-left: 8px solid #d4552a;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
}

.wp-chatbot-gpt-message.bot .wp-chatbot-gpt-message-content {
    background: white;
    color: #333;
    border: 1px solid #e1e5e9;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.wp-chatbot-gpt-message.bot .wp-chatbot-gpt-message-content::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: -8px;
    width: 0;
    height: 0;
    border-right: 8px solid #e1e5e9;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
}

.wp-chatbot-gpt-message.error .wp-chatbot-gpt-message-content {
    background: #fed7d7;
    color: #c53030;
    border: 1px solid #fed7d7;
    border-radius: 18px;
    text-align: center;
    max-width: 90%;
}

.wp-chatbot-gpt-message.error .wp-chatbot-gpt-avatar {
    background: #fed7d7;
    color: #c53030;
}

.wp-chatbot-gpt-message-timestamp {
    font-size: 10px;
    color: #999;
    margin-top: 4px;
    text-align: center;
    opacity: 0.7;
    font-style: italic;
}

.wp-chatbot-gpt-message.user .wp-chatbot-gpt-message-timestamp {
    text-align: right;
}

.wp-chatbot-gpt-message.bot .wp-chatbot-gpt-message-timestamp {
    text-align: left;
}



.wp-chatbot-gpt-input-container {
    padding: 15px;
    background: white;
    border-top: 1px solid #e1e5e9;
}

.wp-chatbot-gpt-popover .wp-chatbot-gpt-input-container {
    padding: 10px 15px;
}

.wp-chatbot-gpt-form {
    display: flex;
    align-items: center;
}

.wp-chatbot-gpt-input-wrapper {
    display: flex;
    width: 100%;
    background: var(--couleur-fond-chatbot);
    border-radius: 25px;
    overflow: hidden;
    transition: border-color 0.3s ease;
}

.wp-chatbot-gpt-input-wrapper:focus-within {
    border-color: var(--couleur-principale-chatbot);
    box-shadow: 0 0 0 3px rgba(233, 101, 49, 0.1);
}

.wp-chatbot-gpt-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 12px 16px;
    font-size: 14px;
    outline: none;
    color: #333;
}

.wp-chatbot-gpt-input::placeholder {
    color: #999;
}

.wp-chatbot-gpt-input:disabled {
    background: var(--couleur-fond-chatbot);
    color: #999;
    cursor: not-allowed;
}

.wp-chatbot-gpt-send {
    background: var(--couleur-principale-chatbot);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 0 25px 25px 0;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.wp-chatbot-gpt-send:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(233, 101, 49, 0.3);
}

.wp-chatbot-gpt-send:active:not(:disabled) {
    transform: translateY(0);
}

.wp-chatbot-gpt-send:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.wp-chatbot-gpt-send-text {
    display: inline;
}

.wp-chatbot-gpt-send-icon {
    display: inline;
    font-size: 16px;
}

.wp-chatbot-gpt-send-disabled .wp-chatbot-gpt-send-text {
    display: none;
}

.wp-chatbot-gpt-send-disabled .wp-chatbot-gpt-send-icon {
    display: inline;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.wp-chatbot-gpt-typing {
    padding: 0 20px 20px;
    order: 999999;
}

.wp-chatbot-gpt-typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    max-width: 70%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.wp-chatbot-gpt-typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--couleur-principale-chatbot);
    animation: typing 1.4s infinite ease-in-out;
}

.wp-chatbot-gpt-typing-indicator span:nth-child(1) {
    animation-delay: -0.32s;
}

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

@keyframes typing {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}


/* Styles pour les liens dans les messages */
.wp-chatbot-gpt-message-content a {
    color: var(--couleur-principale-chatbot);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.3s ease;
}

.wp-chatbot-gpt-message-content a:hover {
    border-bottom-color: var(--couleur-principale-chatbot);
}

.wp-chatbot-gpt-message.user .wp-chatbot-gpt-message-content a {
    color: #ffffff;
    border-bottom-color: rgba(255, 255, 255, 0.7);
}

.wp-chatbot-gpt-message.user .wp-chatbot-gpt-message-content a:hover {
    border-bottom-color: #ffffff;
}

/* Responsive design */
@media (max-width: 768px) {
    .wp-chatbot-gpt-container {
        border-radius: 0;
        box-shadow: none;
    }
    
    .wp-chatbot-gpt-popover {
        width: calc(100vw - 40px);
        height: calc(100vh - 120px);
        left: 20px;
        right: 20px;
        bottom: 90px;
    }
    
    .wp-chatbot-gpt-messages {
        height: 300px;
        max-height: 300px;
        padding: 15px;
    }
    
    .wp-chatbot-gpt-popover .wp-chatbot-gpt-messages {
        height: calc(100vh - 180px);
        max-height: calc(100vh - 180px);
    }
    
    .wp-chatbot-gpt-message-content {
        max-width: 85%;
        font-size: 13px;
    }
    
    .wp-chatbot-gpt-input-container {
        padding: 15px;
    }
    
    .wp-chatbot-gpt-popover .wp-chatbot-gpt-input-container {
        padding: 8px 15px;
    }
    
    .wp-chatbot-gpt-input {
        font-size: 13px;
    }
    
    .wp-chatbot-gpt-send {
        padding: 12px 16px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .wp-chatbot-gpt-messages {
        height: 250px;
        max-height: 250px;
        padding: 10px;
    }
    
    .wp-chatbot-gpt-message-content {
        max-width: 90%;
        padding: 10px 12px;
        font-size: 12px;
    }
    
    .wp-chatbot-gpt-input-container {
        padding: 10px;
    }
    
    .wp-chatbot-gpt-input {
        padding: 10px 12px;
        font-size: 12px;
    }
    
    .wp-chatbot-gpt-send {
        padding: 10px 12px;
        font-size: 12px;
    }
    
    .wp-chatbot-gpt-send-text {
        display: none;
    }
    
    .wp-chatbot-gpt-send-icon {
        display: inline;
    }
}

/* Styles pour l'accessibilité */
.wp-chatbot-gpt-input:focus {
    outline: none;
}

.wp-chatbot-gpt-send:focus {
    outline: 2px solid var(--couleur-principale-chatbot);
    outline-offset: 2px;
}

/* Styles pour les thèmes sombres (si supporté) */
@media (prefers-color-scheme: dark) {
    .wp-chatbot-gpt-container {
        background: #1a1a1a;
        color: #ffffff;
    }
    
    .wp-chatbot-gpt-messages {
        background: #2a2a2a;
    }
    
    .wp-chatbot-gpt-message.bot .wp-chatbot-gpt-message-content {
        background: #333;
        color: #ffffff;
        border-color: #444;
    }
    
    .wp-chatbot-gpt-input-container {
        background: #1a1a1a;
        border-top-color: #444;
    }
    
    .wp-chatbot-gpt-input-wrapper {
        background: #2a2a2a;
        border-color: #444;
    }
    
    .wp-chatbot-gpt-input {
        color: #ffffff;
    }
    
    .wp-chatbot-gpt-input::placeholder {
        color: #888;
    }
    
    .wp-chatbot-gpt-typing {
        background: #1a1a1a;
    }
    
    .wp-chatbot-gpt-typing-indicator {
        background: #333;
        border-color: #444;
    }
} 