/* =============================================================================
   Lucky Copilot Vitrine - styles du widget
   Reprend la charte de Lucky Copilot dans l'app : bleu nuit + violet neon.
   ============================================================================= */

:root {
    --glcv-bg-deep: #0A1228;
    --glcv-bg-mid: #1A1640;
    --glcv-bg-low: #2D1545;
    --glcv-card: rgba(15, 26, 53, 0.85);
    --glcv-card-border: rgba(123, 79, 224, 0.35);
    --glcv-purple: #7B4FE0;
    --glcv-purple-light: #9B6FFF;
    --glcv-magenta: #E84A8C;
    --glcv-text: #FFFFFF;
    --glcv-text-dim: #8B92A8;
    --glcv-bubble-user: linear-gradient(135deg, #7B4FE0 0%, #E84A8C 100%);
    --glcv-bubble-ai: rgba(155, 111, 255, 0.10);
    --glcv-shadow: 0 8px 32px rgba(123, 79, 224, 0.35);
}

#glcv-root,
#glcv-root * {
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

/* Bouton flottant */
#glcv-bubble {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #FFE4EF 0%, #FFB1C9 100%);
    box-shadow: 0 8px 24px rgba(232, 74, 140, 0.35), 0 0 0 4px rgba(232, 74, 140, 0.12);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999998;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: none;
    overflow: hidden;
}
#glcv-bubble:hover {
    transform: translateY(-2px) scale(1.04);
    box-shadow: 0 12px 30px rgba(232, 74, 140, 0.45), 0 0 0 6px rgba(232, 74, 140, 0.18);
}
#glcv-bubble::before {
    content: "";
    width: 42px;
    height: 42px;
    background: url("https://www.locationcourteduree.fr/wp-content/uploads/2026/05/Capture-decran-2026-05-16-a-11.02.01.png") center/contain no-repeat;
    border-radius: 10px;
}

/* Panneau de chat */
#glcv-panel {
    position: fixed;
    right: 24px;
    bottom: 100px;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 580px;
    max-height: calc(100vh - 130px);
    background: linear-gradient(180deg, var(--glcv-bg-deep) 0%, var(--glcv-bg-mid) 50%, var(--glcv-bg-low) 100%);
    border: 1px solid var(--glcv-card-border);
    border-radius: 20px;
    box-shadow: var(--glcv-shadow);
    z-index: 999999;
    display: none;
    flex-direction: column;
    overflow: hidden;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}
#glcv-panel.glcv-open {
    display: flex;
    animation: glcv-slide-up 0.25s ease;
}
@keyframes glcv-slide-up {
    from { transform: translateY(20px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}

/* En-tete */
#glcv-header {
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(155, 111, 255, 0.15);
    background: rgba(10, 18, 40, 0.6);
}
#glcv-header-avatar {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, #FFE4EF 0%, #FFB1C9 100%) url("https://www.locationcourteduree.fr/wp-content/uploads/2026/05/Capture-decran-2026-05-16-a-11.02.01.png") center/26px 26px no-repeat;
    box-shadow: 0 0 10px rgba(232, 74, 140, 0.35);
    flex: 0 0 auto;
}
#glcv-header-text {
    flex: 1;
    min-width: 0;
}
#glcv-header-title {
    color: var(--glcv-text);
    font-weight: 600;
    font-size: 15px;
    line-height: 1.2;
}
#glcv-header-status {
    color: var(--glcv-text-dim);
    font-size: 12px;
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 6px;
}
#glcv-header-status::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #4ade80;
    box-shadow: 0 0 6px #4ade80;
}
#glcv-close {
    background: transparent;
    border: none;
    color: var(--glcv-text-dim);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}
#glcv-close:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--glcv-text);
}

/* Zone messages */
#glcv-messages {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}
#glcv-messages::-webkit-scrollbar { width: 6px; }
#glcv-messages::-webkit-scrollbar-thumb {
    background: rgba(155, 111, 255, 0.3);
    border-radius: 3px;
}

.glcv-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    white-space: pre-wrap;
}
.glcv-msg-user {
    align-self: flex-end;
    background: var(--glcv-bubble-user);
    color: white;
    border-bottom-right-radius: 4px;
}
.glcv-msg-ai {
    align-self: flex-start;
    background: var(--glcv-bubble-ai);
    color: var(--glcv-text);
    border: 1px solid rgba(155, 111, 255, 0.18);
    border-bottom-left-radius: 4px;
}
.glcv-msg-error {
    align-self: flex-start;
    background: rgba(232, 74, 140, 0.12);
    color: #FFB1C9;
    border: 1px solid rgba(232, 74, 140, 0.35);
    border-radius: 14px;
}

/* ---- Rendered markdown inside AI messages ---- */
.glcv-msg-ai { white-space: normal; }
.glcv-msg-ai p { margin: 0 0 8px; }
.glcv-msg-ai p:last-child { margin-bottom: 0; }
.glcv-msg-ai strong { color: #FFB1C9; font-weight: 700; }
.glcv-msg-ai em { font-style: italic; }
.glcv-msg-ai code {
    background: rgba(0, 0, 0, 0.25);
    padding: 1px 6px;
    border-radius: 4px;
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 12.5px;
    color: #FFE0F0;
}
.glcv-msg-ai ul, .glcv-msg-ai ol {
    margin: 4px 0 10px;
    padding-left: 22px;
}
.glcv-msg-ai li { margin-bottom: 4px; }
.glcv-msg-ai li:last-child { margin-bottom: 0; }
.glcv-msg-ai .glcv-md-h {
    font-weight: 700;
    margin: 10px 0 4px;
    color: #FF8FBE;
    font-size: 14px;
    letter-spacing: -0.01em;
}
.glcv-msg-ai .glcv-md-h:first-child { margin-top: 0; }
.glcv-msg-ai a { color: #9B6FFF; text-decoration: underline; }
.glcv-msg-ai a:hover { color: #B68BFF; }

/* Etat "ecrit en train" */
.glcv-typing {
    align-self: flex-start;
    background: var(--glcv-bubble-ai);
    border: 1px solid rgba(155, 111, 255, 0.18);
    padding: 14px 18px;
    border-radius: 14px;
    display: flex;
    gap: 4px;
}
.glcv-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--glcv-purple-light);
    animation: glcv-bounce 1.2s ease-in-out infinite;
}
.glcv-typing span:nth-child(2) { animation-delay: 0.15s; }
.glcv-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes glcv-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
    30%          { transform: translateY(-6px); opacity: 1; }
}

/* Accueil */
.glcv-welcome {
    color: var(--glcv-text-dim);
    text-align: center;
    padding: 24px 12px 8px;
}
.glcv-welcome strong {
    color: var(--glcv-text);
    font-size: 16px;
    display: block;
    margin-bottom: 8px;
}
.glcv-suggestions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 14px;
}
.glcv-suggestion {
    background: rgba(155, 111, 255, 0.08);
    border: 1px solid rgba(155, 111, 255, 0.22);
    color: var(--glcv-text);
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s ease;
}
.glcv-suggestion:hover {
    background: rgba(155, 111, 255, 0.18);
}

/* Zone saisie */
#glcv-input-row {
    display: flex;
    gap: 8px;
    padding: 14px 16px 16px;
    border-top: 1px solid rgba(155, 111, 255, 0.15);
    background: rgba(10, 18, 40, 0.6);
}
#glcv-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(155, 111, 255, 0.22);
    border-radius: 12px;
    color: var(--glcv-text);
    padding: 10px 14px;
    font-size: 14px;
    resize: none;
    max-height: 100px;
    line-height: 1.4;
    outline: none;
}
#glcv-input::placeholder { color: var(--glcv-text-dim); }
#glcv-input:focus {
    border-color: var(--glcv-purple-light);
    background: rgba(255, 255, 255, 0.08);
}
#glcv-send {
    background: linear-gradient(135deg, var(--glcv-purple) 0%, var(--glcv-magenta) 100%);
    border: none;
    color: white;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.15s ease;
}
#glcv-send:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
#glcv-send:not(:disabled):hover {
    opacity: 0.9;
}

#glcv-footer {
    text-align: center;
    color: var(--glcv-text-dim);
    font-size: 11px;
    padding: 0 16px 8px;
}
#glcv-footer a {
    color: var(--glcv-purple-light);
    text-decoration: none;
}

/* Responsive */
@media (max-width: 480px) {
    #glcv-panel {
        right: 8px;
        left: 8px;
        width: auto;
        height: 80vh;
        bottom: 90px;
    }
}

/* ============================================================
   MOBILE UNIQUEMENT : masquer la bulle Lucky Copilot
   (on la garde sur ordinateur). Demande Sébastien 25/07/2026.
   ============================================================ */
@media (max-width: 768px) {
  #glcv-bubble { display: none !important; }
}
