/* ═══════════════════════════════════════════════
   asIma™ Agency — Chat Widget Styles v2
   Dark glassmorphism theme with teal accents
   ═══════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Outfit:wght@500;600;700&display=swap');

/* ── CSS Custom Properties ── */
:root {
    --widget-w: 390px;
    --widget-h: 620px;
    --widget-radius: 18px;
    --bubble-radius: 52px;

    --bg-primary: #0a0e1a;
    --bg-secondary: #0f1525;
    --bg-card: rgba(15, 21, 40, 0.85);
    --bg-glass: rgba(16, 24, 48, 0.72);
    --bg-input: rgba(12, 18, 36, 0.9);
    --bg-bot-bubble: rgba(20, 30, 56, 0.85);

    --accent: #00e5c3;
    --accent-glow: rgba(0, 229, 195, 0.25);
    --accent-dark: #00b89c;
    --accent-muted: rgba(0, 229, 195, 0.08);

    --text-primary: #e8ecf4;
    --text-secondary: #8a94a6;
    --text-muted: #5a6478;

    --border: rgba(255, 255, 255, 0.06);
    --border-accent: rgba(0, 229, 195, 0.15);

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 16px 64px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 0 30px rgba(0, 229, 195, 0.12);

    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-spring: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── Reset ── */
.asima-widget *,
.asima-widget *::before,
.asima-widget *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ═══════════════════════════════════════════════
   Floating Action Button (FAB)
   ═══════════════════════════════════════════════ */
.asima-fab {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 99998;
    width: var(--bubble-radius);
    height: var(--bubble-radius);
    border-radius: 50%;
    border: none;
    cursor: pointer;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md), 0 0 24px var(--accent-glow);
    transition: transform var(--transition-spring), box-shadow var(--transition-smooth);
    animation: fabPulse 3s ease-in-out infinite;
}

.asima-fab:hover {
    transform: scale(1.08);
    box-shadow: var(--shadow-lg), 0 0 40px rgba(0, 229, 195, 0.3);
}

.asima-fab.is-hidden {
    transform: scale(0);
    pointer-events: none;
}

.asima-fab svg {
    width: 26px;
    height: 26px;
    transition: transform var(--transition-smooth);
}

.asima-fab:hover svg {
    transform: rotate(-8deg) scale(1.05);
}

@keyframes fabPulse {
    0%, 100% { box-shadow: var(--shadow-md), 0 0 24px var(--accent-glow); }
    50% { box-shadow: var(--shadow-md), 0 0 40px rgba(0, 229, 195, 0.2); }
}

/* ═══════════════════════════════════════════════
   Widget Container
   ═══════════════════════════════════════════════ */
.asima-widget {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 99999;
    width: var(--widget-w);
    height: var(--widget-h);
    max-height: calc(100dvh - 56px);
    border-radius: var(--widget-radius);
    background: var(--bg-primary);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    transform-origin: bottom right;
    transition: transform var(--transition-spring), opacity var(--transition-smooth);
}

.asima-widget.is-hidden {
    transform: scale(0.4);
    opacity: 0;
    pointer-events: none;
}

/* Ambient glow border */
.asima-widget::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: var(--widget-radius);
    padding: 1px;
    background: linear-gradient(160deg, rgba(0, 229, 195, 0.15), transparent 40%, transparent 60%, rgba(0, 229, 195, 0.08));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

/* ═══════════════════════════════════════════════
   Header
   ═══════════════════════════════════════════════ */
.asima-header {
    padding: 16px 18px 12px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
}

.asima-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-accent), transparent);
}

.asima-header-logo {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--accent-muted);
    border: 1px solid var(--border-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.asima-header-logo svg {
    width: 22px;
    height: 22px;
    color: var(--accent);
}

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

.asima-header-title {
    font-family: 'Outfit', sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.3px;
    line-height: 1.2;
}

.asima-header-title span {
    color: var(--accent);
}

.asima-header-subtitle {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 1.8px;
    text-transform: uppercase;
    margin-top: 2px;
}

.asima-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.asima-status-badge {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 20px;
    background: rgba(0, 229, 195, 0.06);
    border: 1px solid rgba(0, 229, 195, 0.12);
    font-size: 11px;
    font-weight: 600;
    color: var(--accent);
}

.asima-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
    animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 4px var(--accent-glow); }
    50% { opacity: 0.5; box-shadow: none; }
}

.asima-btn-close {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.asima-btn-close:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.1);
}

.asima-btn-close svg {
    width: 16px;
    height: 16px;
}

/* ═══════════════════════════════════════════════
   Tab Bar — Two Tabs
   ═══════════════════════════════════════════════ */
.asima-tabs {
    padding: 0 18px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 0;
}

.asima-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 12px 14px;
    border: none;
    background: none;
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    cursor: pointer;
    position: relative;
    transition: color var(--transition-fast);
}

.asima-tab svg {
    width: 15px;
    height: 15px;
}

/* Active tab */
.asima-tab.is-active {
    color: var(--accent);
}

.asima-tab.is-active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2.5px;
    background: var(--accent);
    border-radius: 2px 2px 0 0;
}

/* Inactive tab */
.asima-tab:not(.is-active) {
    color: var(--text-muted);
}

.asima-tab:not(.is-active):hover {
    color: var(--text-secondary);
}

/* Tab content panels */
.asima-tab-panel {
    display: none;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.asima-tab-panel.is-active {
    display: flex;
}

/* ═══════════════════════════════════════════════
   Chat Messages Area
   ═══════════════════════════════════════════════ */
.asima-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.08) transparent;
}

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

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

.asima-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
}

/* ── Message Wrapper ── */
.asima-msg {
    max-width: 82%;
    animation: msgSlideIn 0.35s ease-out backwards;
}

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

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

/* ── Message Bubble ── */
.asima-msg-bubble {
    padding: 12px 15px;
    font-size: 13.5px;
    line-height: 1.55;
    color: var(--text-primary);
    position: relative;
    word-wrap: break-word;
}

.asima-msg.is-bot .asima-msg-bubble {
    background: var(--bg-bot-bubble);
    border: 1px solid var(--border);
    border-radius: 4px 16px 16px 16px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.asima-msg.is-user .asima-msg-bubble {
    background: linear-gradient(135deg, rgba(0, 229, 195, 0.18), rgba(0, 229, 195, 0.08));
    border: 1px solid rgba(0, 229, 195, 0.2);
    border-radius: 16px 4px 16px 16px;
    color: var(--text-primary);
}

.asima-msg-time {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 4px;
    margin-bottom: 6px;
    padding: 0 4px;
}

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

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

/* ── In-Chat Suggestion Chip ── */
.asima-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 4px 0 8px;
    align-self: center;
    justify-content: center;
}

.asima-chip {
    padding: 8px 18px;
    border-radius: 22px;
    border: 1px solid var(--border-accent);
    background: rgba(0, 229, 195, 0.05);
    color: var(--accent);
    font-family: 'Inter', sans-serif;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    animation: msgSlideIn 0.35s ease-out backwards;
}

.asima-chip:hover {
    background: rgba(0, 229, 195, 0.15);
    border-color: rgba(0, 229, 195, 0.35);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 229, 195, 0.1);
}

/* ── Typing Indicator ── */
.asima-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 14px 18px;
    background: var(--bg-bot-bubble);
    border: 1px solid var(--border);
    border-radius: 4px 16px 16px 16px;
    align-self: flex-start;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    max-width: 82%;
}

.asima-typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    animation: typingBounce 1.4s ease-in-out infinite;
}

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

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

/* ═══════════════════════════════════════════════
   Speech Call Tab Content
   ═══════════════════════════════════════════════ */
.asima-speech-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 40px 24px;
    text-align: center;
}

.asima-speech-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--accent-muted);
    border: 2px solid var(--border-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.asima-speech-icon svg {
    width: 32px;
    height: 32px;
    color: var(--accent);
}

/* Ripple rings */
.asima-speech-icon::before,
.asima-speech-icon::after {
    content: '';
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    border: 1px solid rgba(0, 229, 195, 0.1);
}

.asima-speech-icon::after {
    inset: -18px;
    border-color: rgba(0, 229, 195, 0.05);
}

.asima-speech-title {
    font-family: 'Outfit', sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.asima-speech-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    max-width: 280px;
}

.asima-speech-btn {
    padding: 12px 32px;
    border-radius: 28px;
    border: none;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: var(--bg-primary);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all var(--transition-fast);
    box-shadow: 0 4px 16px var(--accent-glow);
}

.asima-speech-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 229, 195, 0.3);
}

.asima-speech-btn svg {
    width: 18px;
    height: 18px;
}

.asima-speech-status {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.asima-speech-status .asima-status-dot {
    width: 6px;
    height: 6px;
}

/* ═══════════════════════════════════════════════
   Input Area
   ═══════════════════════════════════════════════ */
.asima-input-area {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
}

.asima-input-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 4px 4px 16px;
    border-radius: 28px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.asima-input-row:focus-within {
    border-color: var(--border-accent);
    box-shadow: 0 0 0 3px rgba(0, 229, 195, 0.06);
}

.asima-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 13.5px;
    line-height: 1.4;
    min-width: 0;
}

.asima-input::placeholder {
    color: var(--text-muted);
}

.asima-btn-send {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: all var(--transition-fast);
    box-shadow: 0 2px 8px var(--accent-glow);
}

.asima-btn-send:hover {
    transform: scale(1.06);
    box-shadow: 0 4px 16px rgba(0, 229, 195, 0.3);
}

.asima-btn-send:active {
    transform: scale(0.95);
}

.asima-btn-send:disabled {
    opacity: 0.4;
    cursor: default;
    transform: none;
    box-shadow: none;
}

.asima-btn-send svg {
    width: 18px;
    height: 18px;
    transform: rotate(-2deg);
}

/* ═══════════════════════════════════════════════
   Footer
   ═══════════════════════════════════════════════ */
.asima-footer {
    padding: 10px 18px;
    text-align: center;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
}

.asima-footer a {
    font-size: 11.5px;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: color var(--transition-fast);
}

.asima-footer a:hover {
    color: var(--accent);
}

.asima-footer a span {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 0.3px;
}

.asima-footer svg {
    width: 12px;
    height: 12px;
    opacity: 0.6;
}

/* ═══════════════════════════════════════════════
   Responsive
   ═══════════════════════════════════════════════ */
@media (max-width: 440px) {
    .asima-widget {
        width: calc(100vw - 16px);
        height: calc(100dvh - 16px);
        max-height: none;
        bottom: 8px;
        right: 8px;
        border-radius: 14px;
    }

    .asima-fab {
        bottom: 18px;
        right: 18px;
    }
}
