/* ==========================================================================
   AI Copilot Stylesheet — PMS Pro Ndour (Cyberpunk Theme)
   ========================================================================== */

:root {
    --copilot-cyan: #00F2FF;
    --copilot-bg: rgba(5, 10, 10, 0.85);
    --copilot-card: rgba(13, 17, 23, 0.9);
    --copilot-text: #E2E8F0;
    --copilot-muted: #94A3B8;
    --copilot-border: rgba(0, 242, 255, 0.25);
    --copilot-glow: rgba(0, 242, 255, 0.4);
}

/* --- Floating Trigger Bubble --- */
.copilot-trigger {
    position: fixed;
    bottom: 120px; /* Placé au-dessus de la barre de navigation sur desktop */
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #0D1117;
    border: 2px solid var(--copilot-cyan);
    box-shadow: 0 0 15px var(--copilot-glow), inset 0 0 10px rgba(0, 242, 255, 0.2);
    cursor: pointer;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.copilot-trigger:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 0 25px var(--copilot-cyan), inset 0 0 15px rgba(0, 242, 255, 0.4);
}

.copilot-trigger-pulse {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 1px solid var(--copilot-cyan);
    animation: copilot-ping 2s cubic-bezier(0, 0, 0.2, 1) infinite;
    opacity: 0.6;
    pointer-events: none;
}

@keyframes copilot-ping {
    75%, 100% {
        transform: scale(1.6);
        opacity: 0;
    }
}

.copilot-trigger svg {
    width: 28px;
    height: 28px;
    fill: none;
    stroke: var(--copilot-cyan);
    stroke-width: 2;
    filter: drop-shadow(0 0 3px var(--copilot-cyan));
    transition: all 0.3s ease;
}

/* --- Chat Container Panel --- */
.copilot-panel {
    position: fixed;
    bottom: 195px; /* Placé au-dessus du bouton de déclenchement */
    right: 30px;
    width: 380px;
    height: 550px;
    border-radius: 12px;
    background: var(--copilot-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--copilot-border);
    box-shadow: 0 10px 40px rgba(0, 242, 255, 0.15), inset 0 0 20px rgba(0, 242, 255, 0.05);
    z-index: 9998;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: 'Inter', sans-serif;
    transform: translateY(30px) scale(0.95);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.copilot-panel.active {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: auto;
}

/* --- Header Section --- */
.copilot-header {
    background: rgba(13, 17, 23, 0.95);
    padding: 12px 15px;
    border-bottom: 1px solid var(--copilot-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.copilot-title-area {
    display: flex;
    align-items: center;
    gap: 10px;
}

.copilot-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--copilot-cyan);
    box-shadow: 0 0 8px var(--copilot-cyan);
    animation: copilot-glow-pulse 1.5s ease-in-out infinite alternate;
}

@keyframes copilot-glow-pulse {
    0% { opacity: 0.4; }
    100% { opacity: 1; box-shadow: 0 0 12px var(--copilot-cyan); }
}

.copilot-header h4 {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    color: var(--copilot-text);
    margin: 0;
    letter-spacing: 1px;
}

.copilot-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.copilot-header-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--copilot-muted);
    transition: color 0.3s ease;
}

.copilot-header-btn:hover {
    color: var(--copilot-cyan);
    filter: drop-shadow(0 0 2px var(--copilot-cyan));
}

.copilot-header-btn svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
}

/* --- Messages Content --- */
.copilot-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scrollbar-width: thin;
    scrollbar-color: var(--copilot-cyan) transparent;
}

.copilot-messages::-webkit-scrollbar {
    width: 4px;
}

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

.copilot-messages::-webkit-scrollbar-thumb {
    background: var(--copilot-cyan);
    border-radius: 2px;
}

/* --- Message Bubbles --- */
.copilot-msg {
    max-width: 85%;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    line-height: 1.4;
    word-wrap: break-word;
    position: relative;
    animation: copilot-fade-in 0.3s ease forwards;
}

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

.copilot-msg.user {
    align-self: flex-end;
    background: rgba(148, 163, 184, 0.08);
    border: 1px solid rgba(148, 163, 184, 0.2);
    color: var(--copilot-text);
    border-bottom-right-radius: 1px;
}

.copilot-msg.assistant {
    align-self: flex-start;
    background: var(--copilot-card);
    border: 1px solid var(--copilot-border);
    color: var(--copilot-text);
    border-bottom-left-radius: 1px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.copilot-msg-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    display: block;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.copilot-msg.assistant .copilot-msg-label {
    color: var(--copilot-cyan);
}

.copilot-msg.user .copilot-msg-label {
    color: var(--copilot-muted);
}

.copilot-msg p {
    margin: 0;
}

.copilot-msg p + p {
    margin-top: 8px;
}

/* Commands action log in chat */
.copilot-action-log {
    align-self: center;
    background: rgba(0, 242, 255, 0.05);
    border: 1px dashed var(--copilot-border);
    color: var(--copilot-cyan);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    padding: 5px 10px;
    border-radius: 4px;
    text-align: center;
    width: 90%;
    margin: 4px 0;
}

/* --- Typing Indicator --- */
.copilot-typing {
    display: flex;
    gap: 4px;
    padding: 10px 15px;
    background: var(--copilot-card);
    border: 1px solid var(--copilot-border);
    border-radius: 8px;
    align-self: flex-start;
    margin-bottom: 5px;
}

.copilot-typing span {
    width: 6px;
    height: 6px;
    background: var(--copilot-cyan);
    border-radius: 50%;
    animation: copilot-typing-dots 1.4s infinite ease-in-out both;
}

.copilot-typing span:nth-child(1) { animation-delay: -0.32s; }
.copilot-typing span:nth-child(2) { animation-delay: -0.16s; }

@keyframes copilot-typing-dots {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* --- Input Area --- */
.copilot-input-area {
    padding: 12px 15px;
    background: rgba(13, 17, 23, 0.95);
    border-top: 1px solid var(--copilot-border);
    display: flex;
    gap: 10px;
}

.copilot-input-container {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.copilot-prompt-symbol {
    position: absolute;
    left: 10px;
    font-family: 'JetBrains Mono', monospace;
    color: var(--copilot-cyan);
    font-size: 0.85rem;
    pointer-events: none;
}

.copilot-input {
    width: 100%;
    background: rgba(5, 10, 10, 0.6);
    border: 1px solid var(--copilot-border);
    border-radius: 4px;
    padding: 8px 10px 8px 24px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: var(--copilot-text);
    outline: none;
    transition: all 0.3s ease;
}

.copilot-input:focus {
    border-color: var(--copilot-cyan);
    box-shadow: 0 0 8px rgba(0, 242, 255, 0.2);
}

.copilot-send-btn {
    background: rgba(0, 242, 255, 0.05);
    border: 1px solid var(--copilot-cyan);
    color: var(--copilot-cyan);
    padding: 0 15px;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.copilot-send-btn:hover {
    background: var(--copilot-cyan);
    color: #000;
    box-shadow: 0 0 10px var(--copilot-cyan);
}

/* --- Settings Overlay Panel --- */
.copilot-settings-panel {
    position: absolute;
    top: 45px;
    left: 0;
    width: 100%;
    height: calc(100% - 45px);
    background: rgba(13, 17, 23, 0.95);
    border-top: 1px solid var(--copilot-border);
    z-index: 10;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.copilot-settings-panel.active {
    transform: translateY(0);
}

.copilot-settings-panel h5 {
    font-family: 'JetBrains Mono', monospace;
    color: var(--copilot-cyan);
    margin: 0;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--copilot-border);
    padding-bottom: 5px;
}

.copilot-settings-panel p {
    font-size: 0.75rem;
    color: var(--copilot-muted);
    margin: 0;
    line-height: 1.3;
}

.copilot-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.copilot-field label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: var(--copilot-text);
}

.copilot-field input {
    background: rgba(5, 10, 10, 0.8);
    border: 1px solid var(--copilot-border);
    padding: 8px;
    border-radius: 4px;
    color: var(--copilot-text);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    outline: none;
}

.copilot-field input:focus {
    border-color: var(--copilot-cyan);
}

.copilot-settings-actions {
    display: flex;
    gap: 10px;
    margin-top: auto;
}

.copilot-settings-btn {
    flex: 1;
    padding: 8px 0;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    cursor: pointer;
    text-align: center;
    transition: all 0.3s ease;
}

.copilot-settings-btn.save {
    background: var(--copilot-cyan);
    color: #000;
    border: 1px solid var(--copilot-cyan);
}

.copilot-settings-btn.save:hover {
    box-shadow: 0 0 10px var(--copilot-cyan);
}

.copilot-settings-btn.close {
    background: transparent;
    color: var(--copilot-text);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.copilot-settings-btn.close:hover {
    border-color: var(--copilot-text);
}

/* --- Live Popups / HUD Info Box --- */
.copilot-hud-popup {
    position: fixed;
    bottom: 30px;
    left: 30px;
    width: 320px;
    background: var(--copilot-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--copilot-cyan);
    box-shadow: 0 0 20px rgba(0, 242, 255, 0.2);
    border-radius: 8px;
    z-index: 9999;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-family: 'JetBrains Mono', monospace;
    animation: copilot-slide-up 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes copilot-slide-up {
    from { transform: translateY(50px) scale(0.9); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

.copilot-hud-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0, 242, 255, 0.2);
    padding-bottom: 4px;
}

.copilot-hud-title {
    color: var(--copilot-cyan);
    font-size: 0.75rem;
    font-weight: bold;
    text-shadow: 0 0 5px rgba(0, 242, 255, 0.5);
}

.copilot-hud-close {
    cursor: pointer;
    color: var(--copilot-muted);
    font-size: 0.8rem;
}

.copilot-hud-close:hover {
    color: #FF0055;
}

.copilot-hud-body {
    font-size: 0.75rem;
    color: var(--copilot-text);
    line-height: 1.4;
}

/* --- Element Scan Highlight Target Effect --- */
.copilot-scan-target {
    position: relative;
    outline: 2px solid var(--copilot-cyan) !important;
    outline-offset: 4px;
    box-shadow: 0 0 25px rgba(0, 242, 255, 0.6) !important;
    transition: all 0.3s ease;
    animation: copilot-target-glow 1.5s infinite alternate !important;
}

@keyframes copilot-target-glow {
    0% {
        box-shadow: 0 0 15px rgba(0, 242, 255, 0.3);
    }
    100% {
        box-shadow: 0 0 35px rgba(0, 242, 255, 0.8);
        outline-color: #ffffff;
    }
}

/* Dynamic scanning laser line overlay inside highlight target */
.copilot-scan-target::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, transparent, var(--copilot-cyan), transparent);
    box-shadow: 0 0 8px var(--copilot-cyan);
    animation: copilot-laser-scan 2s linear infinite;
    pointer-events: none;
    z-index: 10;
}

@keyframes copilot-laser-scan {
    0% { top: 0%; opacity: 0; }
    5% { opacity: 1; }
    95% { opacity: 1; }
    100% { top: 100%; opacity: 0; }
}

/* --- Cyber Glitch Effect (CSS helper for actions) --- */
.copilot-glitch-active {
    animation: copilot-glitch-anim 0.3s 3 alternate;
}

@keyframes copilot-glitch-anim {
    0% {
        clip-path: inset(40% 0 61% 0);
        transform: skew(0.3deg);
    }
    20% {
        clip-path: inset(92% 0 1% 0);
        transform: skew(-0.5deg);
    }
    40% {
        clip-path: inset(15% 0 80% 0);
        transform: skew(0.5deg);
    }
    60% {
        clip-path: inset(80% 0 5% 0);
        transform: skew(-0.2deg);
    }
    80% {
        clip-path: inset(3% 0 92% 0);
        transform: skew(0.8deg);
    }
    100% {
        clip-path: inset(67% 0 20% 0);
        transform: skew(0deg);
    }
}

/* --- Floating WhatsApp Button --- */
#whatsapp-float {
    position: fixed;
    bottom: 120px; /* Aligné avec le bouton du Copilot sur desktop */
    left: 30px;
    z-index: 9999;
    width: 60px;
    height: 60px;
    background: #25D366;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 20px rgba(37, 211, 102, 0.4);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

#whatsapp-float:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(37, 211, 102, 0.6);
}

#whatsapp-float svg {
    width: 30px;
    height: 30px;
    fill: white;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #whatsapp-float {
        bottom: 20px !important;
        left: 20px !important;
        width: 50px !important;
        height: 50px !important;
    }
    #whatsapp-float svg {
        width: 25px !important;
        height: 25px !important;
    }
    .copilot-trigger {
        bottom: 20px !important;
        right: 20px !important;
        width: 50px !important;
        height: 50px !important;
    }
    .copilot-panel {
        width: calc(100% - 40px) !important;
        height: 450px !important;
        right: 20px !important;
        bottom: 85px !important;
    }
}
