/* ============================================
   UCKIM AI ASSISTANT — Robot Assistant
   Identité Visuelle UCKIM
   Université Chrétienne de Kimpese

   Couleurs officielles :
   -- Bleu UCKIM : #0067b8
   -- Or UCKIM   : #c8a84e
   -- Charbon    : #111111
   Devise       : Foi · Innovation · Conscience
   ============================================ */

.uckim-robot-container * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.uckim-robot-container {
    font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    direction: ltr;
}

/* ============================================
   AVATAR IA — Design compact et élégant
   ============================================ */

.uckim-robot {
    position: fixed;
    bottom: 28px;
    left: 28px;
    z-index: 9998;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    width: 60px;
    height: 60px;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.uckim-robot:hover {
    transform: scale(1.08);
}

.uckim-robot:active {
    transform: scale(0.94);
}

.uckim-robot:focus-visible {
    outline: 2px solid #0067b8;
    outline-offset: 4px;
    border-radius: 50%;
}

/* ============================================
   GLOW — Halo lumineux externe
   ============================================ */

.uckim-robot-glow {
    position: absolute;
    top: -8px;
    left: -8px;
    width: 76px;
    height: 76px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 103, 184, 0.12) 0%, transparent 70%);
    animation: uckim-glow-pulse 3s ease-in-out infinite;
    pointer-events: none;
}

@keyframes uckim-glow-pulse {
    0%, 100% { opacity: 0.4; transform: scale(0.95); }
    50% { opacity: 1; transform: scale(1.08); }
}

/* ============================================
   BODY — Disque glassmorphique
   ============================================ */

.uckim-robot-body {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1.5px solid rgba(0, 103, 184, 0.12);
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.08),
        0 0 0 1px rgba(200, 168, 78, 0.04),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    animation: uckim-breathing 4s ease-in-out infinite;
}

.uckim-robot-body::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(from 0deg, transparent, rgba(0, 103, 184, 0.04), transparent, rgba(200, 168, 78, 0.03), transparent);
    animation: uckim-conic-rotate 10s linear infinite;
    pointer-events: none;
}

@keyframes uckim-conic-rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes uckim-breathing {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.04); }
}

/* ============================================
   YEUX — Bleu UCKIM avec halo
   ============================================ */

.uckim-robot-eyes {
    display: flex;
    gap: 14px;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
}

.uckim-robot-eye {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #0067b8;
    box-shadow:
        0 0 6px rgba(0, 103, 184, 0.6),
        0 0 12px rgba(0, 103, 184, 0.2);
    animation: uckim-eyes-glow 4s ease-in-out infinite, uckim-blink 6s ease-in-out infinite;
}

@keyframes uckim-eyes-glow {
    0%, 100% {
        box-shadow: 0 0 4px rgba(0, 103, 184, 0.5), 0 0 10px rgba(0, 103, 184, 0.2);
    }
    50% {
        box-shadow: 0 0 8px rgba(0, 103, 184, 0.8), 0 0 18px rgba(0, 103, 184, 0.3), 0 0 28px rgba(0, 103, 184, 0.1);
    }
}

@keyframes uckim-blink {
    0%, 44%, 48%, 100% { transform: scaleY(1); opacity: 1; }
    45%, 47% { transform: scaleY(0.1); opacity: 0.3; }
}

/* ============================================
   INITIALE — Marque U discrète
   ============================================ */

.uckim-robot-initial {
    position: absolute;
    bottom: 14px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0067b8, #004b8f);
    color: #fff;
    font-size: 0.5rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Open Sans', sans-serif;
    box-shadow: 0 1px 4px rgba(0, 103, 184, 0.3);
    z-index: 2;
}

/* ============================================
   ANIMATION D'ATTENTION
   ============================================ */

.uckim-robot.attention .uckim-robot-eye {
    animation: uckim-attention-glow 1.2s ease-in-out;
}

@keyframes uckim-attention-glow {
    0%, 100% {
        box-shadow: 0 0 6px rgba(0, 103, 184, 0.7), 0 0 12px rgba(0, 103, 184, 0.3);
    }
    30%, 60% {
        box-shadow: 0 0 20px rgba(0, 103, 184, 1), 0 0 40px rgba(0, 103, 184, 0.5), 0 0 60px rgba(0, 103, 184, 0.15);
    }
}

/* ============================================
   RÉACTION AU CLIC
   ============================================ */

.uckim-robot.clicked .uckim-robot-body {
    animation: uckim-click-react 0.5s ease;
}

@keyframes uckim-click-react {
    0% { transform: scale(1); }
    20% { transform: scale(0.9); }
    50% { transform: scale(1.06); }
    100% { transform: scale(1); }
}

.uckim-robot.clicked .uckim-robot-eye {
    animation: uckim-eye-flash 0.4s ease;
}

@keyframes uckim-eye-flash {
    0%, 100% { box-shadow: 0 0 6px rgba(0, 103, 184, 0.7); }
    30% { box-shadow: 0 0 25px rgba(0, 103, 184, 1), 0 0 50px rgba(0, 103, 184, 0.4); }
}

/* ============================================
   ÉTAT CHAT OUVERT
   ============================================ */

.uckim-robot.chat-open {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.8);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* ============================================
   BULLE D'ACCUEIL — UCKIM
   ============================================ */

.uckim-bubble {
    position: fixed;
    bottom: 105px;
    left: 32px;
    width: 270px;
    background: linear-gradient(135deg, #ffffff 0%, #f8faff 100%);
    border: 1px solid rgba(0, 103, 184, 0.08);
    border-radius: 16px;
    padding: 18px 16px 14px;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(200, 168, 78, 0.04);
    z-index: 9997;
    display: none;
    animation: uckim-bubble-enter 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.uckim-bubble.show {
    display: block;
}

.uckim-bubble::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 32px;
    width: 16px;
    height: 16px;
    background: #ffffff;
    border-left: 1px solid rgba(0, 103, 184, 0.08);
    border-bottom: 1px solid rgba(0, 103, 184, 0.08);
    transform: rotate(45deg);
    border-radius: 0 0 0 2px;
}

.uckim-bubble-close {
    position: absolute;
    top: 6px;
    right: 8px;
    background: none;
    border: none;
    color: #a0a0a0;
    font-size: 1rem;
    cursor: pointer;
    padding: 2px 6px;
    line-height: 1;
    transition: color 0.15s;
}

.uckim-bubble-close:hover {
    color: #605e5c;
}

.uckim-bubble-content {
    margin-bottom: 10px;
}

.uckim-bubble-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: #0067b8;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
    letter-spacing: 0.2px;
}

.uckim-bubble-title::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #c8a84e;
    box-shadow: 0 0 4px rgba(200, 168, 78, 0.5);
    display: inline-block;
    animation: uckim-bubble-dot 2s ease-in-out infinite;
}

@keyframes uckim-bubble-dot {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

.uckim-bubble-text {
    font-size: 0.78rem;
    color: #242424;
    line-height: 1.6;
}

.uckim-bubble-text strong {
    color: #1a1a2e;
}

.uckim-bubble-cta {
    display: block;
    width: 100%;
    padding: 8px 14px;
    background: linear-gradient(135deg, #0067b8, #004b8f);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    letter-spacing: 0.2px;
}

.uckim-bubble-cta:hover {
    background: linear-gradient(135deg, #005a9e, #003d6b);
    box-shadow: 0 2px 8px rgba(0, 103, 184, 0.3);
}

@keyframes uckim-bubble-enter {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.92);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ============================================
   FENÊTRE DE CHAT — Glassmorphism UCKIM
   ============================================ */

.uckim-chat {
    position: fixed;
    bottom: 28px;
    left: 28px;
    width: 380px;
    height: 560px;
    max-height: calc(100vh - 80px);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    box-shadow:
        0 8px 48px rgba(0, 0, 0, 0.12),
        0 0 0 1px rgba(200, 168, 78, 0.04);
    z-index: 9997;
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: uckim-chat-enter 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.uckim-chat.open {
    display: flex;
}

@keyframes uckim-chat-enter {
    from {
        opacity: 0;
        transform: translateY(24px) scale(0.94);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ============================================
   EN-TÊTE — Identité UCKIM
   ============================================ */

.uckim-chat-header {
    background: linear-gradient(135deg, #0d0d1a 0%, #1a1a2e 100%);
    color: #ffffff;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

.uckim-chat-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 140px;
    height: 140px;
    background: radial-gradient(circle, rgba(0, 103, 184, 0.08) 0%, transparent 70%);
    pointer-events: none;
}

.uckim-chat-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 10%;
    width: 80%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(200, 168, 78, 0.08), transparent);
    pointer-events: none;
}

.uckim-chat-header-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0067b8, #004b8f);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 800;
    color: #ffffff;
    flex-shrink: 0;
    box-shadow: 0 1px 8px rgba(0, 103, 184, 0.3);
    position: relative;
    z-index: 1;
    font-family: 'Open Sans', sans-serif;
}

.uckim-chat-header-avatar::after {
    content: '';
    position: absolute;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid rgba(200, 168, 78, 0.08);
    animation: uckim-header-ring 3s ease-in-out infinite;
}

@keyframes uckim-header-ring {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.1); opacity: 0; }
}

.uckim-chat-header-info {
    flex: 1;
    position: relative;
    z-index: 1;
}

.uckim-chat-header-title {
    font-size: 0.88rem;
    font-weight: 600;
}

.uckim-chat-header-motto {
    font-size: 0.62rem;
    color: rgba(200, 168, 78, 0.6);
    font-weight: 400;
    letter-spacing: 0.3px;
    font-style: italic;
    font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    margin-top: 0;
    line-height: 1.3;
}

.uckim-chat-header-status {
    font-size: 0.7rem;
    color: #4caf50;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 1px;
}

.uckim-chat-header-status::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #4caf50;
    display: inline-block;
    animation: uckim-status-pulse 2s ease-in-out infinite;
}

@keyframes uckim-status-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.uckim-chat-header-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.35);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 4px 6px;
    transition: color 0.15s;
    position: relative;
    z-index: 1;
    line-height: 1;
}

.uckim-chat-header-close:hover {
    color: rgba(200, 168, 78, 0.6);
}

/* ============================================
   MESSAGES
   ============================================ */

.uckim-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: rgba(248, 249, 250, 0.8);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

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

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

.uckim-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.12);
    border-radius: 2px;
}

.uckim-chat-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 0.85rem;
    line-height: 1.5;
    word-wrap: break-word;
    animation: uckim-msg-in 0.3s ease;
}

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

.uckim-chat-msg.bot {
    background: rgba(255, 255, 255, 0.95);
    color: #242424;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.uckim-chat-msg.visitor {
    background: linear-gradient(135deg, #0067b8, #005a9e);
    color: #ffffff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.uckim-chat-msg.admin {
    background: rgba(243, 242, 241, 0.95);
    color: #242424;
    align-self: flex-start;
    border-left: 3px solid #c8a84e;
    border-bottom-left-radius: 4px;
}

.uckim-chat-msg-time {
    display: block;
    font-size: 0.65rem;
    color: #a0a0a0;
    margin-top: 6px;
    text-align: right;
}

.uckim-chat-msg.visitor .uckim-chat-msg-time {
    color: rgba(255, 255, 255, 0.6);
}

/* ============================================
   TYPING INDICATOR
   ============================================ */

.uckim-chat-typing {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.95);
    padding: 12px 16px;
    border-radius: 14px;
    border-bottom-left-radius: 4px;
    display: none;
    gap: 4px;
    margin: 0 16px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.uckim-chat-typing.show {
    display: inline-flex;
}

.uckim-chat-typing span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #c8c6c4;
    animation: uckim-typing-bounce 1.4s infinite ease-in-out;
}

.uckim-chat-typing span:nth-child(2) {
    animation-delay: 0.16s;
}

.uckim-chat-typing span:nth-child(3) {
    animation-delay: 0.32s;
}

@keyframes uckim-typing-bounce {
    0%, 80%, 100% { transform: scale(0.6); }
    40% { transform: scale(1); }
}

/* ============================================
   SUGGESTIONS
   ============================================ */

.uckim-chat-suggestions {
    display: none;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 16px 4px;
    background: rgba(248, 249, 250, 0.8);
    flex-shrink: 0;
}

.uckim-chat-suggestion {
    padding: 6px 12px;
    font-size: 0.75rem;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.15s;
    color: #242424;
    white-space: nowrap;
}

.uckim-chat-suggestion:hover {
    border-color: rgba(0, 103, 184, 0.3);
    color: #0067b8;
    background: rgba(0, 103, 184, 0.04);
}

/* ============================================
   INPUT
   ============================================ */

.uckim-chat-input-area {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid rgba(0, 0, 0, 0.04);
    background: rgba(255, 255, 255, 0.95);
    flex-shrink: 0;
}

.uckim-chat-input {
    flex: 1;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 0.85rem;
    outline: none;
    font-family: inherit;
    resize: none;
    max-height: 100px;
    transition: border-color 0.15s, box-shadow 0.15s;
    background: rgba(248, 249, 250, 0.6);
}

.uckim-chat-input:focus {
    border-color: rgba(0, 103, 184, 0.3);
    box-shadow: 0 0 0 2px rgba(0, 103, 184, 0.06);
    background: #ffffff;
}

.uckim-chat-input::placeholder {
    color: #a0a0a0;
}

.uckim-chat-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0067b8, #004b8f);
    color: #ffffff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    transition: all 0.15s;
    flex-shrink: 0;
}

.uckim-chat-send:hover {
    background: linear-gradient(135deg, #005a9e, #003d6b);
    transform: scale(1.05);
}

.uckim-chat-send:disabled {
    background: #c8c6c4;
    cursor: not-allowed;
    transform: none;
}

/* ============================================
   FEEDBACK
   ============================================ */

.uckim-chat-feedback {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(248, 249, 250, 0.8);
    font-size: 0.75rem;
    color: #605e5c;
    flex-shrink: 0;
}

.uckim-chat-feedback.show {
    display: flex;
}

.uckim-chat-feedback button {
    background: none;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.15s;
}

.uckim-chat-feedback button:hover {
    border-color: rgba(0, 103, 184, 0.3);
    color: #0067b8;
}

.uckim-chat-feedback .uckim-feedback-thanks {
    color: #107c10;
    font-weight: 500;
    display: none;
}

/* ============================================
   OFFLINE
   ============================================ */

.uckim-chat-offline {
    display: none;
    padding: 16px;
    background: rgba(255, 255, 255, 0.95);
    border-top: 1px solid rgba(0, 0, 0, 0.04);
    flex-shrink: 0;
}

.uckim-chat-offline.show {
    display: block;
}

.uckim-chat-offline h4 {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: #242424;
}

.uckim-chat-offline input,
.uckim-chat-offline select,
.uckim-chat-offline textarea {
    width: 100%;
    padding: 8px 10px;
    font-size: 0.8rem;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 6px;
    margin-bottom: 8px;
    outline: none;
    font-family: inherit;
    background: rgba(248, 249, 250, 0.6);
    transition: border-color 0.15s;
}

.uckim-chat-offline input:focus,
.uckim-chat-offline textarea:focus {
    border-color: rgba(0, 103, 184, 0.3);
    background: #ffffff;
}

.uckim-chat-offline textarea {
    resize: vertical;
    min-height: 60px;
}

.uckim-chat-offline .uckim-chat-send-offline {
    width: 100%;
    padding: 10px;
    background: linear-gradient(135deg, #0067b8, #004b8f);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.uckim-chat-offline .uckim-chat-send-offline:hover {
    background: linear-gradient(135deg, #005a9e, #003d6b);
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (min-width: 481px) and (max-width: 991px) {
    .uckim-robot {
        bottom: 20px;
        left: 20px;
        width: 52px;
        height: 52px;
    }

    .uckim-robot-glow {
        top: -6px;
        left: -6px;
        width: 64px;
        height: 64px;
    }

    .uckim-robot-eye {
        width: 7px;
        height: 7px;
    }

    .uckim-robot-eyes { gap: 12px; }

    .uckim-robot-initial {
        bottom: 12px;
        width: 16px;
        height: 16px;
        font-size: 0.45rem;
    }

    .uckim-bubble {
        left: 20px;
        bottom: 90px;
        width: 250px;
    }

    .uckim-bubble::after {
        left: 28px;
    }

    .uckim-chat {
        left: 20px;
        bottom: 20px;
        width: 360px;
        height: 520px;
    }
}

@media (max-width: 480px) {
    .uckim-robot {
        bottom: 16px;
        left: 12px;
        width: 48px;
        height: 48px;
    }

    .uckim-robot-glow {
        top: -5px;
        left: -5px;
        width: 58px;
        height: 58px;
    }

    .uckim-robot-eye {
        width: 6px;
        height: 6px;
    }

    .uckim-robot-eyes { gap: 10px; }

    .uckim-robot-initial {
        bottom: 10px;
        width: 14px;
        height: 14px;
        font-size: 0.4rem;
    }

    .uckim-bubble {
        left: 12px;
        bottom: 80px;
        width: 220px;
        padding: 14px 12px 12px;
    }

    .uckim-bubble::after {
        left: 24px;
    }

    .uckim-chat {
        left: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
}
