﻿/* â•â•â• FILOMAR â€” Mari AI Chat Widget â•â•â• */

/* â”€â”€ Floating trigger button â”€â”€ */
.mari-trigger {
    position: fixed;
    bottom: 1.75rem;
    left: 1.25rem;
    z-index: 8900;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4338ca, #6d28d9);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(67,56,202,0.45);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.mari-trigger:hover  { transform: scale(1.08); box-shadow: 0 6px 28px rgba(67,56,202,0.55); }
.mari-trigger:active { transform: scale(0.96); }
.mari-trigger img    { width: 36px; height: 36px; border-radius: 50%; }

/* Unread badge */
.mari-trigger-badge {
    position: absolute;
    top: -3px; right: -3px;
    width: 16px; height: 16px;
    border-radius: 50%;
    background: #ef4444;
    border: 2px solid #fff;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: 700;
    color: #fff;
    line-height: 1;
}
.mari-trigger-badge.show { display: flex; }

/* Mobile: trigger is in bottom bar, hide the floating button */
@media (max-width: 767px) {
    .mari-trigger { display: none !important; }
}
@media (display-mode: standalone) {
    .mari-trigger { display: none !important; }
}

/* â”€â”€ Chat panel â”€â”€ */
.mari-panel {
    position: fixed;
    bottom: 5.5rem;
    left: 1.25rem;
    z-index: 8901;
    width: 360px;
    max-width: calc(100vw - 1.5rem);
    max-height: 520px;
    border-radius: 1.25rem;
    background: #fff;
    box-shadow: 0 20px 60px rgba(0,0,0,0.20), 0 4px 16px rgba(0,0,0,0.10);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(0,0,0,0.06);

    /* animation */
    opacity: 0;
    transform: translateY(16px) scale(0.97);
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s ease;
    transform-origin: bottom left;
}
.mari-panel.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* Mobile: tam ekran panel */
@media (max-width: 767px) {
    .mari-panel {
        top: 0; bottom: 0; left: 0; right: 0;
        width: 100%; max-width: 100%;
        height: 100%; max-height: 100%;
        border-radius: 0;
        border: none;
        z-index: 9100;
        padding-top: env(safe-area-inset-top, 0px);
        padding-bottom: env(safe-area-inset-bottom, 0px);
        transform-origin: bottom center;
        transform: translateY(100%);
    }
    .mari-panel.open { transform: translateY(0); }
}
@media (display-mode: standalone) {
    .mari-panel {
        top: 0; bottom: 0; left: 0; right: 0;
        width: 100%; max-width: 100%;
        height: 100%; max-height: 100%;
        border-radius: 0; border: none;
        z-index: 9100;
        padding-top: env(safe-area-inset-top, 0px);
        padding-bottom: env(safe-area-inset-bottom, 0px);
        transform: translateY(100%);
    }
    .mari-panel.open { transform: translateY(0); }
}

/* â”€â”€ Panel header â”€â”€ */
.mari-header {
    background: linear-gradient(135deg, #4338ca, #6d28d9);
    padding: 0.875rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-shrink: 0;
}
.mari-header img    { width: 34px; height: 34px; border-radius: 50%; }
.mari-header-info   { flex: 1; }
.mari-header-name   { font-size: 0.9375rem; font-weight: 700; color: #fff; line-height: 1.2; }
.mari-header-status { font-size: 0.72rem; color: rgba(255,255,255,0.70); }
.mari-header-close  {
    width: 32px; height: 32px; border-radius: 50%;
    background: rgba(255,255,255,0.15);
    border: none; cursor: pointer; color: #fff;
    font-size: 1rem; display: flex; align-items: center; justify-content: center;
    transition: background 0.15s;
}
.mari-header-close:hover { background: rgba(255,255,255,0.28); }

/* â”€â”€ Messages area â”€â”€ */
.mari-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    scroll-behavior: smooth;
}
.mari-messages::-webkit-scrollbar { width: 4px; }
.mari-messages::-webkit-scrollbar-track { background: transparent; }
.mari-messages::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 4px; }

.mari-msg {
    display: flex;
    align-items: flex-end;
    gap: 0.4rem;
    max-width: 88%;
}
.mari-msg.assistant { align-self: flex-start; }
.mari-msg.user      { align-self: flex-end; flex-direction: row-reverse; }

.mari-msg-avatar {
    width: 26px; height: 26px; border-radius: 50%;
    flex-shrink: 0; object-fit: cover;
}
.mari-bubble {
    padding: 0.55rem 0.8rem;
    border-radius: 1rem;
    font-size: 0.875rem;
    line-height: 1.55;
    word-break: break-word;
}
.mari-msg.assistant .mari-bubble {
    background: #f1f5f9;
    color: #1e293b;
    border-bottom-left-radius: 0.25rem;
}
.mari-msg.user .mari-bubble {
    background: linear-gradient(135deg, #4338ca, #6d28d9);
    color: #fff;
    border-bottom-right-radius: 0.25rem;
}

/* Typing indicator */
.mari-typing .mari-bubble { padding: 0.65rem 0.85rem; }
.mari-dots span {
    display: inline-block;
    width: 7px; height: 7px;
    border-radius: 50%;
    background: #94a3b8;
    animation: mariDot 1.2s infinite ease-in-out;
}
.mari-dots span:nth-child(2) { animation-delay: 0.2s; }
.mari-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes mariDot {
    0%, 80%, 100% { transform: scale(0.65); opacity: 0.4; }
    40%           { transform: scale(1);    opacity: 1;   }
}

/* â”€â”€ Input area â”€â”€ */
.mari-input-wrap {
    flex-shrink: 0;
    border-top: 1px solid #e2e8f0;
    padding: 0.6rem 0.75rem;
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
    background: #fff;
}
.mari-input {
    flex: 1;
    border: 1px solid #e2e8f0;
    border-radius: 0.875rem;
    padding: 0.55rem 0.85rem;
    font-size: 1rem;
    font-family: inherit;
    resize: none;
    outline: none;
    max-height: 100px;
    overflow-y: auto;
    line-height: 1.5;
    transition: border-color 0.15s;
}
.mari-input:focus { border-color: #6366f1; }
.mari-send {
    width: 38px; height: 38px;
    flex-shrink: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, #4338ca, #6d28d9);
    border: none; cursor: pointer; color: #fff;
    font-size: 0.9rem;
    display: flex; align-items: center; justify-content: center;
    transition: transform 0.15s, opacity 0.15s;
}
.mari-send:hover   { transform: scale(1.07); }
.mari-send:active  { transform: scale(0.95); }
.mari-send:disabled{ opacity: 0.5; cursor: not-allowed; transform: none; }

/* â”€â”€ Powered by footer â”€â”€ */
.mari-powered {
    text-align: center;
    font-size: 0.68rem;
    color: #94a3b8;
    padding: 0.35rem 0.75rem 0.45rem;
    border-top: 1px solid #f1f5f9;
    background: #fff;
    flex-shrink: 0;
}
.mari-powered span { color: #6366f1; font-weight: 600; }

/* â”€â”€ Welcome message â”€â”€ */
.mari-welcome {
    text-align: center;
    padding: 1rem;
    color: #64748b;
    font-size: 0.8125rem;
    line-height: 1.55;
}
.mari-welcome img {
    width: 48px; height: 48px; border-radius: 50%;
    margin: 0 auto 0.5rem; display: block;
}
.mari-welcome strong { display: block; color: #1e293b; font-size: 0.9375rem; margin-bottom: 0.25rem; }

/* -- Quick question chips (input'un hemen üstünde) -- */
.mari-quick-qs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0.5rem 0.75rem 0.35rem;
    border-top: 1px solid #f1f5f9;
    background: #fff;
    flex-shrink: 0;
}
.mari-quick-btn {
    padding: 0.4rem 0.75rem;
    border-radius: 9999px;
    border: 1.5px solid #e0e7ff;
    background: #fff;
    color: #4f46e5;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
    touch-action: manipulation;
    white-space: nowrap;
    font-family: inherit;
}
.mari-quick-btn:hover  { background: #eef2ff; border-color: #818cf8; }
.mari-quick-btn:active { background: #e0e7ff; }

/* â”€â”€ Contact action buttons (WhatsApp + Ara) â”€â”€ */
.mari-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding-left: calc(28px + 0.5rem); /* align with bubble */
}
.mari-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.85rem;
    border-radius: 9999px;
    font-size: 0.78rem;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.15s;
    touch-action: manipulation;
    white-space: nowrap;
}
.mari-action-btn:hover  { opacity: 0.88; transform: translateY(-1px); color: #fff; }
.mari-action-btn:active { opacity: 0.75; transform: translateY(0); }
.mari-action-wa  { background: linear-gradient(135deg, #25d366, #128c50); }
.mari-action-tel { background: linear-gradient(135deg, #1e3a8a, #2563eb); }
