/* ============================================================
   DUDE BOT — Floating AI Assistant
   ============================================================ */

/* --- CSS Custom Properties --- */
:root {
    --dude-pink: #FF08BD;
    --dude-purple: #b45aff;
    --dude-bg: #ffffff;
    --dude-text-main: #0A004A;
    --dude-text-soft: #6b5c8a;
    --dude-glass: rgba(255, 255, 255, 0.88);
    --dude-glass-border: rgba(255, 8, 189, 0.15);
    --dude-radius: 24px;
    --dude-font: 'Inter', sans-serif;
    --dude-font-heading: 'Poppins', sans-serif;
}

/* ============================================================
   FLOATING BOT ICON
   ============================================================ */
#dude-bot-icon {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 68px;
    height: 68px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.35s ease;
    animation: dude-float 3s ease-in-out infinite;
    -webkit-tap-highlight-color: transparent;
}

#dude-bot-icon:hover {
    transform: scale(1.12);
}

/* The bot face — SVG drawn via CSS */
.dude-face {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: linear-gradient(145deg, #ff6fd8, #d63aff, #b83dff);
    position: relative;
    box-shadow:
        0 0 30px rgba(255, 8, 189, 0.5),
        0 0 60px rgba(255, 8, 189, 0.2),
        inset 0 -8px 20px rgba(0, 0, 0, 0.25),
        inset 0 4px 12px rgba(255, 255, 255, 0.15);
    overflow: hidden;
}

/* Subtle highlight on the face */
.dude-face::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 14px;
    width: 40%;
    height: 30%;
    background: radial-gradient(ellipse, rgba(255,255,255,0.25), transparent);
    border-radius: 50%;
    pointer-events: none;
}

/* Eye container */
.dude-eyes {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    gap: 14px;
    align-items: center;
}

/* Individual eye */
.dude-eye {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    background: #fff;
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.9),
                0 0 24px rgba(255, 255, 255, 0.4);
    transition: height 0.08s ease, transform 0.08s ease;
    transform-origin: center;
}

/* Blink states */
.dude-eye.half-blink {
    height: 6px;
    border-radius: 3px;
}

.dude-eye.blink {
    height: 2px;
    border-radius: 2px;
}

/* Outer glow ring */
.dude-glow {
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    background: transparent;
    box-shadow: 0 0 40px rgba(255, 8, 189, 0.35);
    animation: dude-pulse-glow 2.5s ease-in-out infinite;
    pointer-events: none;
}

/* Notification dot */
.dude-notification {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #00ff88;
    border: 2px solid var(--dude-bg);
    box-shadow: 0 0 8px rgba(0, 255, 136, 0.5);
    animation: dude-notif-pulse 2s ease-in-out infinite;
    z-index: 2;
}

/* Float animation */
@keyframes dude-float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-6px); }
}

/* Glow pulse */
@keyframes dude-pulse-glow {
    0%, 100% { box-shadow: 0 0 30px rgba(255, 8, 189, 0.3); }
    50%      { box-shadow: 0 0 50px rgba(255, 8, 189, 0.55); }
}

/* Notification pulse */
@keyframes dude-notif-pulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.2); }
}

/* Hide icon when chat is open */
#dude-bot-icon.hidden {
    transform: scale(0) rotate(90deg);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s ease, opacity 0.25s ease;
}


/* ============================================================
   CHAT PANEL
   ============================================================ */
#dude-chat-panel {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 400px;
    height: 600px;
    max-height: calc(100vh - 56px); /* Fallback */
    max-height: calc(100dvh - 56px);
    max-width: calc(100vw - 24px);
    border-radius: var(--dude-radius);
    background: var(--dude-glass);
    backdrop-filter: blur(28px) saturate(1.6);
    -webkit-backdrop-filter: blur(28px) saturate(1.6);
    border: 1px solid var(--dude-glass-border);
    box-shadow:
        0 24px 80px rgba(10, 0, 74, 0.12),
        0 0 40px rgba(255, 8, 189, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    overflow: hidden;

    /* Hidden by default */
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#dude-chat-panel.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}


/* ============================================================
   CHAT HEADER
   ============================================================ */
.dude-chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 20px;
    border-bottom: 1px solid rgba(10, 0, 74, 0.06);
    flex-shrink: 0;
    background: rgba(10, 0, 74, 0.02);
}

.dude-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(145deg, #ff6fd8, #d63aff);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: 0 0 16px rgba(255, 8, 189, 0.3);
    flex-shrink: 0;
}

.dude-header-avatar-eyes {
    display: flex;
    gap: 8px;
}

.dude-header-avatar-eye {
    width: 8px;
    height: 8px;
    border-radius: 3px;
    background: #fff;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.8);
}

.dude-header-info {
    flex: 1;
    min-width: 0;
}

.dude-header-name {
    font-family: var(--dude-font-heading);
    font-size: 1rem;
    font-weight: 700;
    color: var(--dude-text-main);
    line-height: 1.2;
}

.dude-header-status {
    font-size: 0.72rem;
    color: var(--dude-text-soft);
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 2px;
}

.dude-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #00ff88;
    box-shadow: 0 0 6px rgba(0, 255, 136, 0.5);
}

.dude-status-dot.loading {
    background: #ffaa00;
    box-shadow: 0 0 6px rgba(255, 170, 0, 0.5);
    animation: dude-status-blink 1s ease-in-out infinite;
}

@keyframes dude-status-blink {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.3; }
}

.dude-close-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid rgba(10, 0, 74, 0.1);
    background: rgba(10, 0, 74, 0.04);
    color: var(--dude-text-soft);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.25s, transform 0.25s, color 0.25s;
    flex-shrink: 0;
    line-height: 1;
}

.dude-close-btn:hover {
    background: rgba(255, 8, 189, 0.3);
    color: #fff;
    transform: rotate(90deg);
}


/* ============================================================
   CHAT MESSAGES
   ============================================================ */
.dude-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 18px 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 8, 189, 0.2) transparent;
}

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

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

.dude-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 8, 189, 0.25);
    border-radius: 4px;
}

/* Message wrapper */
.dude-msg {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    animation: dude-msg-in 0.3s ease forwards;
}

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

.dude-msg.bot {
    align-self: flex-start;
}

.dude-msg.user {
    align-self: flex-end;
}

/* Message bubble */
.dude-msg-bubble {
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 0.88rem;
    line-height: 1.65;
    font-family: var(--dude-font);
    word-break: break-word;
}

.dude-msg.bot .dude-msg-bubble {
    background: #ffffff;
    border: 1px solid rgba(10, 0, 74, 0.08);
    color: var(--dude-text-main);
    box-shadow: 0 4px 12px rgba(10, 0, 74, 0.03);
    border-bottom-left-radius: 6px;
}

.dude-msg.user .dude-msg-bubble {
    background: linear-gradient(135deg, rgba(255, 8, 189, 0.15), rgba(180, 90, 255, 0.1));
    border: 1px solid rgba(255, 8, 189, 0.2);
    color: var(--dude-text-main);
    border-bottom-right-radius: 6px;
}

/* Timestamp */
.dude-msg-time {
    font-size: 0.65rem;
    color: rgba(10, 0, 74, 0.4);
    margin-top: 4px;
    padding: 0 4px;
}

.dude-msg.user .dude-msg-time {
    text-align: right;
}

/* Typing indicator */
.dude-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 14px 18px;
    background: #ffffff;
    border: 1px solid rgba(10, 0, 74, 0.08);
    border-radius: 18px;
    border-bottom-left-radius: 6px;
    align-self: flex-start;
    max-width: 80px;
}

.dude-typing-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgba(255, 8, 189, 0.6);
    animation: dude-typing-bounce 1.4s ease-in-out infinite;
}

.dude-typing-dot:nth-child(2) { animation-delay: 0.15s; }
.dude-typing-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes dude-typing-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30%           { transform: translateY(-6px); opacity: 1; }
}


/* ============================================================
   QUICK PROMPTS
   ============================================================ */
.dude-quick-prompts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 16px 12px;
    flex-shrink: 0;
}

.dude-quick-btn {
    padding: 8px 14px;
    border-radius: 20px;
    border: 1px solid rgba(255, 8, 189, 0.2);
    background: rgba(255, 8, 189, 0.06);
    color: var(--dude-text-main);
    font-size: 0.74rem;
    font-family: var(--dude-font);
    cursor: pointer;
    transition: background 0.25s, border-color 0.25s, color 0.25s, transform 0.2s;
    white-space: nowrap;
}

.dude-quick-btn:hover {
    background: rgba(255, 8, 189, 0.18);
    border-color: rgba(255, 8, 189, 0.4);
    color: var(--dude-text-main);
    transform: translateY(-1px);
}


/* ============================================================
   CHAT INPUT
   ============================================================ */
.dude-chat-input-area {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-top: 1px solid rgba(10, 0, 74, 0.06);
    flex-shrink: 0;
    background: rgba(10, 0, 74, 0.02);
}

.dude-chat-input {
    flex: 1;
    padding: 10px 16px;
    border-radius: 50px;
    border: 1px solid rgba(10, 0, 74, 0.15);
    background: #ffffff;
    color: var(--dude-text-main);
    font-size: 0.88rem;
    font-family: var(--dude-font);
    outline: none;
    box-shadow: inset 0 2px 6px rgba(10, 0, 74, 0.02);
    transition: border-color 0.25s, box-shadow 0.25s;
}

.dude-chat-input::placeholder {
    color: rgba(10, 0, 74, 0.4);
}

.dude-chat-input:focus {
    border-color: rgba(255, 8, 189, 0.35);
    box-shadow: 0 0 16px rgba(255, 8, 189, 0.1);
}

.dude-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--dude-pink), var(--dude-purple));
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.2s, box-shadow 0.25s;
    box-shadow: 0 4px 16px rgba(255, 8, 189, 0.3);
}

.dude-send-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 4px 24px rgba(255, 8, 189, 0.5);
}

.dude-send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

/* Send arrow icon */
.dude-send-btn svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}






/* ============================================================
   MOBILE RESPONSIVE
   ============================================================ */
@media (max-width: 480px) {
    #dude-bot-icon {
        bottom: 18px;
        right: 18px;
        width: 58px;
        height: 58px;
    }

    .dude-face {
        width: 58px;
        height: 58px;
    }

    .dude-eyes {
        gap: 11px;
    }

    .dude-eye {
        width: 12px;
        height: 12px;
    }

    #dude-chat-panel {
        bottom: 0;
        right: 0;
        width: 100vw;
        height: 100vh; /* Fallback */
        height: 100dvh;
        max-height: 100vh; /* Fallback */
        max-height: 100dvh;
        max-width: 100vw;
        border-radius: 0;
    }

    .dude-quick-prompts {
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
        -ms-overflow-style: none;
        padding-bottom: 8px;
    }

    .dude-quick-prompts::-webkit-scrollbar {
        display: none;
    }
}

@media (min-width: 481px) and (max-width: 768px) {
    #dude-chat-panel {
        bottom: 12px;
        right: 12px;
        width: calc(100vw - 24px);
        height: calc(100vh - 80px); /* Fallback */
        height: calc(100dvh - 80px);
    }
}
