/**
 * Styles du Widget de Tchat IA - C2Script.com
 * 
 * Widget flottant en bas à droite avec design responsive
 */

/* Container principal du widget */
#c2chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: Arial, sans-serif;
    font-size: 14px;
}

/* Bouton CTA (fermé) */
#c2chat-toggle {
    position: fixed;
    z-index: 9999;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #8cc731 0%, #6da613 100%);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(140, 199, 49, 0.4);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

#c2chat-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(140, 199, 49, 0.6);
}

#c2chat-toggle svg {
    width: 28px;
    height: 28px;
    fill: white;
}

#c2chat-toggle .tooltip {
    position: absolute;
    bottom: 70px;
    right: 0;
    background: #333;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

#c2chat-toggle:hover .tooltip {
    opacity: 1;
    visibility: visible;
}

/* Fenêtre de tchat (ouverte) */
#c2chat-window {
    position: fixed;
    z-index: 9999;
    bottom: 90px;
    right: 20px;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    font-family: Arial, sans-serif;
}

/* État ouvert */
#c2chat-window.open {
    display: flex;
}

/* Header du tchat */
#c2chat-header {
    background: linear-gradient(135deg, #8cc731 0%, #6da613 100%);
    color: white;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

#c2chat-header .title {
    display: flex;
    align-items: center;
    gap: 10px;
}

#c2chat-header .title svg {
    width: 24px;
    height: 24px;
    fill: white;
}

#c2chat-header .title span {
    font-weight: bold;
    font-size: 16px;
}

#c2chat-header .actions {
    display: flex;
    gap: 10px;
}

#c2chat-header .actions button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    border-radius: 5px;
    transition: background 0.2s;
}

#c2chat-header .actions button:hover {
    background: rgba(255, 255, 255, 0.2);
}

#c2chat-header .actions svg {
    width: 20px;
    height: 20px;
    fill: white;
}

/* Zone des messages */
#c2chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background: #f5f5f5;
}

/* Message utilisateur */
.c2chat-message.user {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 10px;
}

.c2chat-message.user .bubble {
    background: #8cc731;
    color: white;
    border-radius: 15px 15px 5px 15px;
    padding: 10px 15px;
    max-width: 80%;
    word-wrap: break-word;
}

/* Message IA */
.c2chat-message.ia {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 10px;
}

.c2chat-message.ia .bubble {
    background: white;
    color: #333;
    border-radius: 15px 15px 15px 5px;
    padding: 10px 15px;
    max-width: 80%;
    word-wrap: break-word;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* Styles pour les éléments Markdown dans les bubbles */
.c2chat-message.ia .bubble h1,
.c2chat-message.ia .bubble h2,
.c2chat-message.ia .bubble h3 {
    margin: 10px 0 5px;
    font-size: 1.1em;
}
.c2chat-message.ia .bubble h3::before {
  top: 6px;
}
.c2chat-message.ia .bubble h1 { font-size: 1.3em; }
.c2chat-message.ia .bubble h2 { font-size: 1.2em; }
.c2chat-message.ia .bubble h3 { font-size: 1.1em; }


.c2chat-message.ia .bubble em {
    font-style: italic;
}

.c2chat-message.ia .bubble ul {
    margin: 5px 0;
    padding-left: 20px;
    list-style-type: disc;
}

.c2chat-message.ia .bubble li {
    margin: 3px 0;
}

.c2chat-message.ia .bubble hr {
    border: none;
    border-top: 1px solid #ddd;
    margin: 10px 0;
}

.c2chat-message.ia .bubble p {
    margin: 5px 0;
}

.c2chat-message.ia .bubble br {
    margin-bottom: 3px;
}

/* Lien dans les messages */
.c2chat-message a {
    color: #8cc731;
    text-decoration: none;
}

.c2chat-message a:hover {
    text-decoration: underline;
}

/* Indicateur de typing */
#c2chat-typing {
    display: none;
    padding: 10px 15px;
    background: white;
    border-radius: 15px 15px 15px 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    margin-bottom: 10px;
    max-width: 80%;
}

#c2chat-typing.visible {
    display: flex;
}

#c2chat-typing .dots {
    display: flex;
    gap: 4px;
}

#c2chat-typing .dot {
    width: 8px;
    height: 8px;
    background: #8cc731;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

#c2chat-typing .dot:nth-child(2) {
    animation-delay: 0.2s;
}

#c2chat-typing .dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-5px);
        opacity: 1;
    }
}

/* Zone de saisie */
#c2chat-input-area {
    padding: 15px;
    background: white;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
}

#c2chat-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 25px;
    padding: 10px 15px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

#c2chat-input:focus {
    border-color: #8cc731;
}

#c2chat-send {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: #8cc731;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

#c2chat-send:hover {
    background: #6da613;
}

#c2chat-send svg {
    width: 20px;
    height: 20px;
    fill: white;
}

#c2chat-send:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Message d'erreur */
#c2chat-error {
    background: #ffebee;
    color: #c62828;
    padding: 10px 15px;
    text-align: center;
    font-size: 12px;
    display: none;
}

/* Mode plein écran */
#c2chat-window.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    bottom: 0;
    right: 0;
    border-radius: 0;
}

/* Responsive - Tablette */
@media (max-width: 768px) {
    #c2chat-window {
        width: 300px;
        height: 450px;
        bottom: 80px;
    }
}

/* Responsive - Mobile */
@media (max-width: 480px) {
    #c2chat-widget {
        bottom: 10px;
        right: 10px;
    }
    
    #c2chat-toggle {
        width: 40px;
        height: 40px;
    }
    
    #c2chat-window {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }
    
    #c2chat-window.open {
        display: flex;
    }
    
    #c2chat-header .title span {
        font-size: 14px;
    }
}

/* Scrollbar personnalisée */
#c2chat-messages::-webkit-scrollbar {
    width: 6px;
}

#c2chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

#c2chat-messages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

#c2chat-messages::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

/* Animation d'ouverture */
@keyframes c2chat-slide-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#c2chat-window.open {
    animation: c2chat-slide-up 0.3s ease;
}

/* Message de bienvenu */
#c2chat-welcome {
    text-align: center;
    padding: 20px;
    color: #666;
}

#c2chat-welcome h3 {
    margin: 0 0 10px;
    color: #8cc731;
}

#c2chat-welcome p {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
}
