/* ============================================
   DeRochÿ AI Chat Widget
   Glassmorphism dark theme matching DEROCHA DIGITAL
   ============================================ */

/* -- Chat Toggle Button -- */
.derochy-toggle {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #e94560, #f0c040);
    border: none;
    cursor: pointer;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 30px rgba(233, 69, 96, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.derochy-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 40px rgba(233, 69, 96, 0.6);
}

.derochy-toggle img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.derochy-toggle .close-icon {
    display: none;
    font-size: 1.6rem;
    color: #fff;
    font-weight: 300;
}

.derochy-toggle.active img { display: none; }
.derochy-toggle.active .close-icon { display: block; }

/* Ping animation on toggle */
.derochy-toggle::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(135deg, #e94560, #f0c040);
    animation: chatPing 2s ease-out infinite;
    z-index: -1;
}

.derochy-toggle.active::after { animation: none; }

@keyframes chatPing {
    0% { transform: scale(1); opacity: 0.5; }
    100% { transform: scale(1.8); opacity: 0; }
}

/* Notification badge */
.derochy-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 18px;
    height: 18px;
    background: #4ade80;
    border-radius: 50%;
    border: 2px solid #0a0e1a;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.55rem;
    font-weight: 800;
    color: #0a0e1a;
}

.derochy-toggle.active .derochy-badge { display: none; }

/* -- Chat Window -- */
.derochy-chat {
    position: fixed;
    bottom: 105px;
    right: 28px;
    width: 400px;
    height: 560px;
    background: rgba(10, 14, 26, 0.92);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    z-index: 9998;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 1px rgba(255, 255, 255, 0.1);
}

.derochy-chat.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* -- Chat Header -- */
.derochy-header {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 1rem 1.2rem;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.derochy-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(233, 69, 96, 0.3);
}

.derochy-header-info h4 {
    font-family: 'Inter', sans-serif;
    font-size: 0.92rem;
    font-weight: 700;
    color: #fff;
    margin: 0;
}

.derochy-header-info span {
    font-size: 0.68rem;
    color: #4ade80;
    display: flex;
    align-items: center;
    gap: 4px;
}

.derochy-header-info span::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #4ade80;
    display: inline-block;
}

.derochy-powered {
    margin-left: auto;
    font-size: 0.58rem;
    color: rgba(255, 255, 255, 0.3);
    text-align: right;
    line-height: 1.3;
}

/* -- Messages Area -- */
.derochy-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    scroll-behavior: smooth;
}

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

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

.derochy-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

/* -- Message Bubbles -- */
.derochy-msg {
    display: flex;
    gap: 0.6rem;
    align-items: flex-end;
    animation: msgSlide 0.3s ease-out;
}

@keyframes msgSlide {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.derochy-msg.bot .msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.derochy-msg.user {
    flex-direction: row-reverse;
}

.msg-bubble {
    max-width: 80%;
    padding: 0.7rem 1rem;
    border-radius: 16px;
    font-size: 0.85rem;
    line-height: 1.55;
    color: rgba(255, 255, 255, 0.92);
}

.derochy-msg.bot .msg-bubble {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-bottom-left-radius: 4px;
}

.derochy-msg.user .msg-bubble {
    background: linear-gradient(135deg, rgba(233, 69, 96, 0.25), rgba(240, 192, 64, 0.15));
    border: 1px solid rgba(233, 69, 96, 0.2);
    border-bottom-right-radius: 4px;
}

.msg-time {
    font-size: 0.6rem;
    color: rgba(255, 255, 255, 0.25);
    margin-top: 0.3rem;
}

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

/* -- Typing Indicator -- */
.derochy-typing {
    display: none;
    align-items: center;
    gap: 0.6rem;
    padding: 0 0.2rem;
}

.derochy-typing.show { display: flex; }

.derochy-typing .msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.typing-dots {
    display: flex;
    gap: 4px;
    padding: 0.7rem 1rem;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    border-bottom-left-radius: 4px;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    animation: typingBounce 1.4s infinite;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.3; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* -- Quick Actions -- */
.derochy-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0 1rem 0.6rem;
}

.quick-btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.72rem;
    border: 1px solid rgba(233, 69, 96, 0.2);
    border-radius: 20px;
    background: rgba(233, 69, 96, 0.06);
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Inter', sans-serif;
}

.quick-btn:hover {
    background: rgba(233, 69, 96, 0.15);
    border-color: rgba(233, 69, 96, 0.4);
    color: #fff;
}

/* -- Input Area -- */
.derochy-input-area {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.8rem 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.02);
}

.derochy-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 0.65rem 1rem;
    color: #fff;
    font-size: 0.85rem;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: border-color 0.2s;
    resize: none;
    max-height: 80px;
    min-height: 38px;
    line-height: 1.4;
}

.derochy-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.derochy-input:focus {
    border-color: rgba(233, 69, 96, 0.4);
}

.derochy-send {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #e94560, #f0c040);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.derochy-send:hover {
    transform: scale(1.08);
    box-shadow: 0 3px 15px rgba(233, 69, 96, 0.35);
}

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

.derochy-send svg {
    width: 16px;
    height: 16px;
    fill: #fff;
}

/* -- Responsive Mobile -- */
@media (max-width: 480px) {
    .derochy-chat {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        height: 100dvh;
        border-radius: 0;
    }

    .derochy-toggle {
        bottom: 20px;
        right: 20px;
        width: 56px;
        height: 56px;
    }

    .derochy-toggle img {
        width: 42px;
        height: 42px;
    }

    .msg-bubble {
        max-width: 88%;
    }
}
