/* =====================================================
   SAKITH PERSONAL ASSISTANT — Full CSS
   assistant.css
===================================================== */

.sakith-assistant {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

/* ── FAB ── */
.sa-fab {
    position: relative;
    width: 62px;
    height: 62px;
    border-radius: 50%;
    background: linear-gradient(135deg, #8b5cf6 0%, #06b6d4 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 32px rgba(139,92,246,.5);
    transition: transform .3s cubic-bezier(.34,1.56,.64,1), box-shadow .3s ease;
    outline: none;
    flex-shrink: 0;
    z-index: 2;
    animation: sa-pulse 2.8s ease-in-out infinite;
}

@keyframes sa-pulse {
    0%,100% { box-shadow: 0 8px 32px rgba(139,92,246,.5), 0 0 0 0 rgba(139,92,246,.4); }
    50%      { box-shadow: 0 8px 32px rgba(139,92,246,.5), 0 0 0 14px rgba(139,92,246,0); }
}

.sa-fab:hover {
    transform: scale(1.1) rotate(8deg);
    animation: none;
    box-shadow: 0 14px 40px rgba(139,92,246,.65);
}

.sa-fab-icon {
    font-size: 1.65rem;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .3s ease, opacity .2s ease;
}

/* Badge */
.sa-fab-badge {
    position: absolute;
    top: -2px; right: -2px;
    width: 20px; height: 20px;
    background: #ec4899;
    border: 2px solid #050510;
    border-radius: 50%;
    font-size: .65rem; font-weight: 700;
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    line-height: 1;
    transition: transform .3s, opacity .3s;
}

.sa-fab-badge.hidden { transform: scale(0); opacity: 0; pointer-events: none; }

/* Ripple ring */
.sa-fab-ripple {
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 1.5px solid rgba(139,92,246,.4);
    animation: sa-ripple 2.5s ease-in-out infinite;
    pointer-events: none;
}

@keyframes sa-ripple {
    0%,100% { transform: scale(1); opacity: .6; }
    50%      { transform: scale(1.22); opacity: 0; }
}

/* ── Panel ── */
.sa-panel {
    position: absolute;
    bottom: 76px; right: 0;
    width: 390px;
    max-height: 620px;
    display: flex;
    flex-direction: column;
    background: rgba(7,7,22,.97);
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
    border: 1px solid rgba(139,92,246,.22);
    border-radius: 22px;
    overflow: hidden;
    box-shadow:
        0 40px 90px rgba(0,0,0,.75),
        0 0 0 1px rgba(255,255,255,.04),
        inset 0 1px 0 rgba(255,255,255,.07);
    transform: scale(.88) translateY(18px);
    transform-origin: bottom right;
    opacity: 0;
    pointer-events: none;
    transition: transform .38s cubic-bezier(.34,1.56,.64,1), opacity .25s ease;
}

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

.sa-panel.sa-minimised {
    max-height: 68px;
    overflow: hidden;
}

/* ── Header ── */
.sa-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 16px;
    background: linear-gradient(135deg, rgba(139,92,246,.28) 0%, rgba(6,182,212,.17) 100%);
    border-bottom: 1px solid rgba(255,255,255,.06);
    flex-shrink: 0;
    cursor: default;
}

.sa-header-left { display: flex; align-items: center; gap: 12px; }

/* Avatar in header */
.sa-avatar {
    position: relative;
    width: 42px; height: 42px;
    flex-shrink: 0;
}

.sa-avatar img {
    width: 100%; height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(139,92,246,.55);
    display: block;
}

.sa-avatar-fallback {
    display: none;
    width: 100%; height: 100%;
    border-radius: 50%;
    background: linear-gradient(135deg, #8b5cf6, #06b6d4);
    align-items: center; justify-content: center;
    font-size: 1.2rem; color: #fff;
}

.sa-status-dot {
    position: absolute;
    bottom: 1px; right: 1px;
    width: 11px; height: 11px;
    background: #22c55e;
    border: 2px solid rgba(7,7,22,.97);
    border-radius: 50%;
    animation: sa-sdot 2.2s ease-in-out infinite;
}

@keyframes sa-sdot {
    0%,100% { box-shadow: 0 0 0 0 rgba(34,197,94,.6); }
    50%      { box-shadow: 0 0 0 5px rgba(34,197,94,0); }
}

.sa-header-info h4 {
    margin: 0 0 2px;
    font-family: 'Space Grotesk', sans-serif;
    font-size: .93rem; font-weight: 700;
    color: #f8fafc;
}

.sa-online-label {
    display: flex; align-items: center; gap: 5px;
    font-size: .71rem;
    color: rgba(148,163,184,.88);
}

.sa-online-dot {
    width: 6px; height: 6px;
    border-radius: 50%; background: #22c55e; flex-shrink: 0;
}

/* Header buttons */
.sa-header-actions { display: flex; gap: 4px; }

.sa-header-btn {
    width: 30px; height: 30px;
    border-radius: 8px; border: none;
    background: rgba(255,255,255,.06);
    color: rgba(148,163,184,.8);
    font-size: 1rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background .2s, color .2s, transform .15s;
}

.sa-header-btn:hover { background: rgba(139,92,246,.22); color: #f8fafc; transform: scale(1.08); }
.sa-close-btn:hover  { background: rgba(239,68,68,.22); color: #ef4444; }

/* ── Messages ── */
.sa-messages {
    flex: 1; overflow-y: auto;
    padding: 16px;
    display: flex; flex-direction: column; gap: 10px;
    scrollbar-width: thin;
    scrollbar-color: rgba(139,92,246,.3) transparent;
    min-height: 0;
}

.sa-messages::-webkit-scrollbar { width: 4px; }
.sa-messages::-webkit-scrollbar-track { background: transparent; }
.sa-messages::-webkit-scrollbar-thumb { background: rgba(139,92,246,.3); border-radius: 4px; }

/* Message row */
.sa-msg {
    display: flex; gap: 8px; align-items: flex-end;
    animation: sa-msg-in .35s cubic-bezier(.4,0,.2,1);
}

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

@keyframes sa-msg-in {
    from { opacity: 0; transform: translateY(12px) scale(.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Mini avatar in message */
.sa-msg-avatar {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #8b5cf6, #06b6d4);
    display: flex; align-items: center; justify-content: center;
    font-size: .75rem; color: #fff;
    flex-shrink: 0; overflow: hidden;
}

.sa-msg-avatar img { width:100%; height:100%; object-fit:cover; border-radius:50%; }

.sa-msg-group {
    display: flex; flex-direction: column; gap: 3px;
    max-width: 82%;
}

.sa-msg.sa-user .sa-msg-group { align-items: flex-end; }

/* Bubble */
.sa-bubble {
    padding: 10px 14px;
    border-radius: 18px;
    font-size: .875rem;
    line-height: 1.58;
    word-break: break-word;
}

.sa-bot .sa-bubble {
    background: rgba(139,92,246,.1);
    border: 1px solid rgba(139,92,246,.18);
    color: #e2e8f0;
    border-bottom-left-radius: 4px;
}

.sa-user .sa-bubble {
    background: linear-gradient(135deg, #8b5cf6 0%, #06b6d4 100%);
    color: #fff;
    border-bottom-right-radius: 4px;
}

/* Bubble list items */
.sa-bubble ul { padding-left: 1.1em; margin: 6px 0; }
.sa-bubble ul li { margin-bottom: 4px; }

/* Bubble links */
.sa-bubble a { color: #38bdf8; text-decoration: underline; text-underline-offset: 2px; }
.sa-user .sa-bubble a { color: rgba(255,255,255,.88); }

/* Timestamp */
.sa-ts {
    font-size: .67rem;
    color: rgba(100,116,139,.75);
    padding: 0 4px;
    margin-top: 2px;
    user-select: none;
}

/* ── Welcome card ── */
.sa-welcome-card {
    background: linear-gradient(135deg, rgba(139,92,246,.13), rgba(6,182,212,.08));
    border: 1px solid rgba(139,92,246,.22);
    border-radius: 14px;
    padding: 16px 18px;
    margin-bottom: 4px;
}

.sa-wc-emoji { 
    font-size: 2.2rem; 
    display: flex; 
    margin-bottom: 12px;
    background: var(--gradient-main);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    width: fit-content;
}

.sa-welcome-card h5 {
    margin: 0 0 6px;
    font-family: 'Space Grotesk', sans-serif;
    font-size: .96rem; font-weight: 700;
    color: #f8fafc;
}

.sa-welcome-card p {
    margin: 0;
    font-size: .83rem;
    color: rgba(148,163,184,.9);
    line-height: 1.58;
}

/* ── Typing indicator ── */
.sa-typing-indicator {
    display: flex; align-items: center; gap: 8px;
    padding-bottom: 4px;
}

.sa-typing-bubble {
    display: flex; gap: 5px; align-items: center;
    padding: 10px 16px;
    background: rgba(139,92,246,.1);
    border: 1px solid rgba(139,92,246,.18);
    border-radius: 18px;
    border-bottom-left-radius: 4px;
}

.sa-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: rgba(139,92,246,.65);
    animation: sa-bounce 1.4s infinite ease-in-out;
}

.sa-dot:nth-child(2) { animation-delay: .18s; }
.sa-dot:nth-child(3) { animation-delay: .36s; }

@keyframes sa-bounce {
    0%,60%,100% { transform: translateY(0); opacity: .5; }
    30%           { transform: translateY(-7px); opacity: 1; }
}

/* ── Quick replies ── */
.sa-quick-replies {
    display: flex; flex-wrap: nowrap; gap: 8px;
    padding: 12px 14px;
    overflow-x: auto; scrollbar-width: none;
    border-top: 1px solid rgba(255,255,255,.05);
    flex-shrink: 0;
}

.sa-quick-replies::-webkit-scrollbar { display: none; }

.sa-chip {
    flex-shrink: 0;
    background: rgba(139,92,246,.09);
    border: 1px solid rgba(139,92,246,.22);
    border-radius: 100px;
    padding: 8px 16px;
    font-size: .78rem; font-weight: 500;
    color: rgba(167,139,250,.9);
    cursor: pointer;
    transition: all .25s ease;
    white-space: nowrap;
    font-family: 'Inter', sans-serif;
    display: flex;
    align-items: center;
    gap: 7px;
}

.sa-chip i {
    font-size: 1rem;
    color: var(--accent-secondary);
}

.sa-chip:hover {
    background: rgba(139,92,246,.22);
    border-color: rgba(139,92,246,.5);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139,92,246,.15);
}

.sa-chip:active { transform: scale(.96); }

/* ── Input bar ── */
.sa-input-bar {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 14px;
    border-top: 1px solid rgba(255,255,255,.05);
    background: rgba(0,0,0,.28);
    flex-shrink: 0;
}

.sa-input-wrap {
    flex: 1; position: relative;
    display: flex; align-items: center;
}

#saInput {
    width: 100%;
    padding: 11px 44px 11px 15px;
    background: rgba(255,255,255,.05);
    border: 1px solid rgba(139,92,246,.22);
    border-radius: 100px;
    color: #f1f5f9;
    font-size: .875rem;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: border-color .25s, box-shadow .25s;
}

#saInput::placeholder { color: rgba(100,116,139,.75); }

#saInput:focus {
    border-color: rgba(139,92,246,.55);
    box-shadow: 0 0 0 3px rgba(139,92,246,.13);
    background: rgba(255,255,255,.07);
}

.sa-input-hint {
    position: absolute; right: 12px;
    font-size: .67rem;
    color: rgba(100,116,139,.55);
    pointer-events: none;
}

.sa-send-btn {
    width: 42px; height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #8b5cf6, #06b6d4);
    border: none; color: #fff; font-size: 1.1rem;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; flex-shrink: 0;
    transition: transform .2s, box-shadow .2s;
    box-shadow: 0 4px 14px rgba(139,92,246,.4);
}

.sa-send-btn:hover {
    transform: scale(1.1) rotate(-5deg);
    box-shadow: 0 7px 22px rgba(139,92,246,.55);
}

.sa-send-btn:disabled { opacity: .4; cursor: not-allowed; transform: none !important; }

/* ── Panel footer ── */
.sa-panel-footer {
    padding: 5px 16px 8px;
    text-align: center;
    flex-shrink: 0;
}

.sa-panel-footer span {
    font-size: .67rem;
    color: rgba(100,116,139,.45) !important;
    background: none !important;
    -webkit-text-fill-color: rgba(100,116,139,.45) !important;
}

/* ── Date divider ── */
.sa-date-divider {
    display: flex; align-items: center; gap: 8px;
    margin: 4px 0;
}

.sa-date-divider span {
    font-size: .67rem; white-space: nowrap;
    color: rgba(100,116,139,.55) !important;
    background: none !important;
    -webkit-text-fill-color: rgba(100,116,139,.55) !important;
}

.sa-date-divider::before,
.sa-date-divider::after {
    content: '';
    flex: 1; height: 1px;
    background: rgba(255,255,255,.06);
}

/* ── Responsive ── */
@media (max-width: 480px) {
    .sakith-assistant { bottom: 16px; right: 16px; }

    .sa-panel {
        width: calc(100vw - 32px);
        right: 0;
        bottom: 74px;
        max-height: 530px;
    }

    .sa-fab { width: 56px; height: 56px; }
}

@media (max-width: 360px) {
    .sa-panel { max-height: 470px; }
}
