/* Eyewearista Chatbot — Ariane widget
   Clean, luxury-friendly, mobile-responsive.
*/

#eyew-chat-root * {
    box-sizing: border-box;
}

.eyew-chat-bubble {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #111;
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
    z-index: 999990;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.eyew-chat-bubble:hover {
    transform: scale(1.06);
}

.eyew-chat-bubble svg {
    width: 28px;
    height: 28px;
    stroke: #fff;
    fill: none;
    stroke-width: 1.6;
}

.eyew-chat-panel {
    position: fixed;
    right: 24px;
    bottom: 96px;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 600px;
    max-height: calc(100vh - 120px);
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 999991;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    color: #222;
    animation: eyew-slide-up 0.25s ease-out;
}

.eyew-chat-panel.open {
    display: flex;
}

@keyframes eyew-slide-up {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.eyew-chat-header {
    background: #111;
    color: #fff;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.eyew-chat-header-title {
    font-weight: 500;
    font-size: 15px;
    letter-spacing: 0.3px;
}

.eyew-chat-header-subtitle {
    font-size: 11px;
    color: #bbb;
    margin-top: 2px;
}

.eyew-chat-close {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    opacity: 0.7;
}
.eyew-chat-close:hover { opacity: 1; }

.eyew-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 18px 16px;
    background: #fafafa;
}

.eyew-chat-msg {
    margin-bottom: 12px;
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.eyew-chat-msg.user {
    background: #111;
    color: #fff;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.eyew-chat-msg.assistant {
    background: #fff;
    color: #222;
    border: 1px solid #eee;
    border-bottom-left-radius: 4px;
}

.eyew-chat-msg.typing {
    background: transparent;
    border: none;
    color: #888;
    font-style: italic;
}
.eyew-chat-msg.typing::after {
    content: '•••';
    display: inline-block;
    animation: eyew-dots 1.2s infinite;
}
@keyframes eyew-dots {
    0%, 20%   { opacity: 0.2; }
    50%       { opacity: 1; }
    80%, 100% { opacity: 0.2; }
}

.eyew-chat-products {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 6px 0 14px;
}

.eyew-chat-product {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 10px;
    overflow: hidden;
    text-decoration: none;
    color: #222;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    display: flex;
    flex-direction: column;
}

.eyew-chat-product:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.eyew-chat-product img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    background: #f5f5f5;
    display: block;
}

.eyew-chat-product-info {
    padding: 8px 10px;
}

.eyew-chat-product-brand {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #888;
}

.eyew-chat-product-name {
    font-size: 13px;
    font-weight: 500;
    margin: 2px 0 4px;
    line-height: 1.3;
    max-height: 2.6em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.eyew-chat-product-price {
    font-size: 13px;
    font-weight: 600;
}

.eyew-chat-product-stock {
    font-size: 11px;
    margin-top: 2px;
}
.eyew-chat-product-stock.in  { color: #0a7b2a; }
.eyew-chat-product-stock.out { color: #b00; }

.eyew-chat-suggestions {
    padding: 0 16px 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    background: #fafafa;
}

.eyew-chat-suggestion {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 12px;
    cursor: pointer;
    color: #444;
    transition: all 0.15s ease;
}
.eyew-chat-suggestion:hover {
    background: #111;
    color: #fff;
    border-color: #111;
}

.eyew-chat-input {
    padding: 10px 12px;
    border-top: 1px solid #eee;
    background: #fff;
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.eyew-chat-input textarea {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: 10px 12px;
    font-family: inherit;
    font-size: 14px;
    resize: none;
    min-height: 40px;
    max-height: 100px;
    outline: none;
}

.eyew-chat-input textarea:focus {
    border-color: #111;
}

.eyew-chat-send {
    background: #111;
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 10px 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease;
}
.eyew-chat-send:hover { background: #000; }
.eyew-chat-send:disabled { opacity: 0.5; cursor: not-allowed; }

.eyew-chat-footer {
    padding: 6px 12px;
    font-size: 10px;
    color: #999;
    text-align: center;
    border-top: 1px solid #eee;
    background: #fff;
}

.eyew-chat-error {
    color: #b00;
    font-size: 12px;
    padding: 8px 14px;
    background: #fff0f0;
    border-radius: 8px;
    margin-bottom: 10px;
}

@media (max-width: 480px) {
    .eyew-chat-panel {
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
    .eyew-chat-bubble {
        right: 16px;
        bottom: 16px;
    }
}

/* ---------------- Phase 12 : Wishlist + suggestions contextuelles ---------------- */

.eyew-chat-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.eyew-chat-wishlist-btn {
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 6px 8px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border-radius: 4px;
    transition: background 0.15s ease;
    position: relative;
}
.eyew-chat-wishlist-btn:hover { background: rgba(255,255,255,0.1); }
.eyew-chat-wishlist-btn svg { display: block; }

#eyew-chat-wishlist-badge {
    display: none;
    background: #c9a96e;
    color: #111;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.eyew-chat-wishlist-panel {
    display: none;
    position: absolute;
    top: 64px;
    right: 8px;
    left: 8px;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.18);
    padding: 12px;
    z-index: 5;
    max-height: 70%;
    overflow-y: auto;
}
.eyew-chat-wishlist-panel.open { display: block; }

.eyew-chat-wishlist-empty {
    color: #777;
    font-size: 14px;
    margin: 0;
    text-align: center;
    padding: 8px;
}

.eyew-chat-wishlist-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.eyew-chat-wishlist-list li {
    display: grid;
    grid-template-columns: 48px 1fr 22px;
    gap: 10px;
    align-items: center;
    padding: 6px;
    border-radius: 6px;
    background: #fafafa;
}
.eyew-chat-wishlist-list img {
    width: 48px; height: 48px; object-fit: cover; border-radius: 4px;
}
.eyew-chat-wishlist-brand { font-size: 11px; color: #777; text-transform: uppercase; letter-spacing: 0.5px; }
.eyew-chat-wishlist-name  { font-size: 13px; font-weight: 600; color: #222; line-height: 1.3; }
.eyew-chat-wishlist-price { font-size: 12px; color: #c9a96e; }

.eyew-chat-wishlist-rm {
    background: transparent;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 18px;
    padding: 0;
    line-height: 1;
}
.eyew-chat-wishlist-rm:hover { color: #c33; }

.eyew-chat-wishlist-send {
    margin-top: 12px;
    width: 100%;
    background: #111;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.eyew-chat-wishlist-send:hover { background: #c9a96e; color: #111; }

.eyew-chat-wishlist-form { display: flex; flex-direction: column; gap: 10px; }
.eyew-chat-wishlist-form label { font-size: 12px; color: #555; display: flex; flex-direction: column; gap: 4px; }
.eyew-chat-wishlist-form input,
.eyew-chat-wishlist-form textarea {
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 8px;
    font-size: 13px;
    font-family: inherit;
}
.eyew-chat-wishlist-actions { display: flex; gap: 8px; }
.eyew-chat-wishlist-cancel,
.eyew-chat-wishlist-submit {
    flex: 1; padding: 9px; border-radius: 6px; cursor: pointer; font-size: 13px; font-weight: 600;
}
.eyew-chat-wishlist-cancel { background: #f0f0f0; border: none; color: #333; }
.eyew-chat-wishlist-submit { background: #111; border: none; color: #fff; }
.eyew-chat-wishlist-submit:hover { background: #c9a96e; color: #111; }

.eyew-chat-wishlist-status { font-size: 12px; min-height: 16px; }
.eyew-chat-wishlist-status.ok  { color: #2a7e3b; }
.eyew-chat-wishlist-status.err { color: #c33; }

/* Coeur sur product card */
.eyew-chat-product-card {
    position: relative;
}
.eyew-chat-heart {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(255,255,255,0.9);
    border: none;
    border-radius: 50%;
    width: 30px; height: 30px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #aaa;
    box-shadow: 0 1px 4px rgba(0,0,0,0.12);
    transition: color 0.15s ease, transform 0.15s ease;
    z-index: 2;
}
.eyew-chat-heart:hover { transform: scale(1.1); }
.eyew-chat-heart.on { color: #d8556a; }
.eyew-chat-heart svg { display: block; }

/* Suggestion buttons "next" (post-réponse) — distinguées des suggestions initiales */
.eyew-chat-suggestion-next {
    background: #111 !important;
    color: #fff !important;
    border-color: #111 !important;
}
.eyew-chat-suggestion-next:hover {
    background: #c9a96e !important;
    color: #111 !important;
    border-color: #c9a96e !important;
}

/* ---------------- Phase 13 : proactivité ---------------- */
@keyframes eyew-pulse {
    0%   { transform: scale(1); box-shadow: 0 6px 24px rgba(0,0,0,0.25), 0 0 0 0 rgba(201,169,110,0.6); }
    50%  { transform: scale(1.08); box-shadow: 0 6px 24px rgba(0,0,0,0.25), 0 0 0 14px rgba(201,169,110,0); }
    100% { transform: scale(1); box-shadow: 0 6px 24px rgba(0,0,0,0.25), 0 0 0 0 rgba(201,169,110,0); }
}
.eyew-chat-bubble.pulse { animation: eyew-pulse 1.6s ease-out 2; }

.eyew-chat-proactive {
    position: fixed;
    right: 96px;
    bottom: 32px;
    background: #fff;
    color: #222;
    padding: 12px 36px 12px 16px;
    border-radius: 10px;
    box-shadow: 0 8px 28px rgba(0,0,0,0.18);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.4;
    max-width: 280px;
    z-index: 999990;
    cursor: pointer;
    animation: eyew-fade-in 0.3s ease-out;
}
.eyew-chat-proactive::after {
    content: '';
    position: absolute;
    right: -8px; top: 50%;
    transform: translateY(-50%);
    border: 8px solid transparent;
    border-left-color: #fff;
}
.eyew-chat-proactive-close {
    position: absolute;
    top: 4px; right: 6px;
    background: none; border: none;
    color: #999;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}
.eyew-chat-proactive-close:hover { color: #c33; }

@keyframes eyew-fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

@media (max-width: 480px) {
    .eyew-chat-proactive { right: 16px; bottom: 92px; max-width: calc(100vw - 32px); }
    .eyew-chat-proactive::after { display: none; }
}

/* Phase 22B — Accessibilité */

/* Utility screen-reader-only (texte visible des AT, masqué visuellement) */
.eyew-chat-sr-only {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* Focus visible WCAG 2.2 — outline doré accessible (>= 3:1 contraste) sur tous
   les éléments interactifs du widget. Override l'outline:none agressif des thèmes. */
#eyewearista-chat-root button:focus-visible,
#eyewearista-chat-root a:focus-visible,
#eyewearista-chat-root textarea:focus-visible,
#eyewearista-chat-root [tabindex]:focus-visible {
    outline: 2px solid #c6a64e !important;
    outline-offset: 2px !important;
    border-radius: 4px;
}

/* Respecte la préférence "réduire les animations" (vestibulaire, motion sickness) */
@media (prefers-reduced-motion: reduce) {
    #eyewearista-chat-root *,
    #eyewearista-chat-root *::before,
    #eyewearista-chat-root *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}

/* Phase 37A — Bubble assistant en cours de streaming.
   Petit caret clignotant en fin de bulle pour signaler "en train d'écrire". */
.eyew-chat-msg-streaming .eyew-chat-bubble-text::after {
    content: '▍';
    display: inline-block;
    margin-left: 2px;
    color: #c6a64e;
    animation: eyew-blink 1s step-end infinite;
}
@keyframes eyew-blink {
    50% { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
    .eyew-chat-msg-streaming .eyew-chat-bubble-text::after { animation: none; }
}


/* Sec37 (2026-06-08) — Voice cockpit button (Web Speech API) */
.eyew-chat-voice {
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 8px;
    padding: 8px 10px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    transition: background 0.15s;
    margin-right: 4px;
}
.eyew-chat-voice:hover { background: #f5f5f5; }
.eyew-chat-voice-on {
    background: #ef4444;
    color: #fff;
    border-color: #ef4444;
    animation: eyew-chat-pulse 1.4s infinite;
}
@keyframes eyew-chat-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}
