/**
 * Mox Toolbox — Chat Support Widget CSS
 *
 * Premium frontend styling for the WhatsApp & Telegram floating chat widget.
 */

/* Inter self-hosted locally (no external Google Fonts request — privacy/GDPR/UU PDP). */
@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:100 900;src:url('../fonts/inter-latin-variable.woff2') format('woff2');}

/* Container */
.mox-chat-widget {
    position: fixed;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    box-sizing: border-box;
}

.mox-chat-widget * {
    box-sizing: border-box;
}

/* Floating Trigger Button */
.mox-chat-trigger {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: var(--mox-theme-color);
    color: var(--mox-text-color);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15), 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    outline: none;
    transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.25s ease;
}

.mox-chat-trigger:hover {
    transform: scale(1.06);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2), 0 2px 6px rgba(0, 0, 0, 0.12);
}

.mox-chat-trigger:active {
    transform: scale(0.95);
}

.mox-chat-trigger svg {
    width: 26px;
    height: 26px;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

/* Pulse animation around the button */
.mox-trigger-pulse {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 50%;
    background-color: var(--mox-theme-color);
    z-index: -1;
    animation: moxPulse 2s infinite ease-in-out;
    pointer-events: none;
}

@keyframes moxPulse {
    0% {
        transform: scale(0.95);
        opacity: 0.5;
    }
    50% {
        transform: scale(1.25);
        opacity: 0.25;
    }
    100% {
        transform: scale(1.45);
        opacity: 0;
    }
}

/* Chat Card Popup */
.mox-chat-card {
    position: absolute;
    bottom: 76px;
    width: 360px;
    max-height: 480px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: opacity 0.25s cubic-bezier(0.25, 0.8, 0.25, 1), transform 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
    z-index: 999998;
}

/* Position adjustment for card */
.mox-pos-bottom-right .mox-chat-card {
    right: 0;
    transform-origin: bottom right;
}

.mox-pos-bottom-left .mox-chat-card {
    left: 0;
    transform-origin: bottom left;
}

/* Active State of Card */
.mox-chat-card.mox-active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Header */
.mox-chat-header {
    background: linear-gradient(135deg, var(--mox-theme-color) 0%, rgba(0, 0, 0, 0.05) 100%);
    background-color: var(--mox-theme-color);
    color: var(--mox-text-color);
    padding: 20px 24px;
    position: relative;
}

.mox-chat-header-content {
    padding-right: 20px;
}

.mox-chat-title {
    margin: 0 0 6px 0 !important;
    font-size: 17px !important;
    font-weight: 700 !important;
    color: var(--mox-text-color) !important;
    line-height: 1.3;
}

.mox-chat-desc {
    margin: 0 !important;
    font-size: 13px !important;
    line-height: 1.4 !important;
    color: var(--mox-text-color) !important;
    opacity: 0.85;
}

.mox-chat-card-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    color: var(--mox-text-color);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.15s ease;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mox-chat-card-close:hover {
    opacity: 1;
}

/* Body */
.mox-chat-body {
    padding: 20px;
    overflow-y: auto;
    flex-grow: 1;
    max-height: 320px;
    background: #fcfcfd;
}

/* Custom Scrollbar for Chat Body */
.mox-chat-body::-webkit-scrollbar {
    width: 6px;
}
.mox-chat-body::-webkit-scrollbar-track {
    background: transparent;
}
.mox-chat-body::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 3px;
}

.mox-chat-dept-group {
    margin-bottom: 20px;
}

.mox-chat-dept-group:last-child {
    margin-bottom: 0;
}

.mox-chat-dept-title {
    font-size: 11px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    color: #94a3b8 !important;
    letter-spacing: 0.05em !important;
    margin: 0 0 10px 0 !important;
    border-bottom: none !important;
    padding-bottom: 0 !important;
}

/* Agent Item */
.mox-chat-agent-item {
    display: flex;
    align-items: center;
    background: #ffffff;
    border: 1px solid #f1f5f9;
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.mox-chat-agent-item:hover {
    transform: translateY(-1px);
    border-color: #e2e8f0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

.mox-chat-agent-item:last-child {
    margin-bottom: 0;
}

/* Avatar Circle */
.mox-chat-agent-avatar-wrap {
    position: relative;
    margin-right: 12px;
}

.mox-chat-agent-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #f1f5f9;
    color: #475569;
    font-weight: 700;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e2e8f0;
    overflow: hidden;
}

.mox-chat-agent-avatar-img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border-radius: 50% !important;
    display: block !important;
}

/* Dot Indicator */
.mox-chat-agent-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #22c55e; /* Online Green */
    border: 2px solid #ffffff;
    position: absolute;
    bottom: 0;
    right: 0;
}

/* Agent Info */
.mox-chat-agent-info {
    flex-grow: 1;
}

.mox-chat-agent-name {
    margin: 0 0 2px 0 !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    color: #1e293b !important;
}

.mox-chat-agent-status {
    margin: 0 !important;
    font-size: 12px !important;
    color: #64748b !important;
    line-height: 1.2;
}

/* Action Buttons */
.mox-chat-agent-channels {
    display: flex;
    gap: 6px;
}

.mox-channel-btn {
    width: 28px !important;
    height: 28px !important;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    text-decoration: none;
    transition: transform 0.15s ease, opacity 0.15s ease;
}

.mox-channel-btn:hover {
    transform: scale(1.1);
    opacity: 0.95;
}

.mox-channel-btn svg {
    width: 28px !important;
    height: 28px !important;
    display: block;
}

.mox-channel-wa {
    background-color: #ffffff !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.mox-channel-tg {
    background-color: transparent !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

/* Footer branding */
.mox-chat-footer {
    padding: 8px 12px;
    text-align: center;
    border-top: 1px solid #f1f5f9;
    background: #ffffff;
}

.mox-chat-footer span {
    font-size: 12.5px;
    color: #94a3b8;
    letter-spacing: 0.02em;
}

/* Offline Notice & Email Support Styling */
.mox-chat-offline-content {
    animation: moxFadeIn 0.3s ease-out;
}

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

.mox-offline-icon-wrap {
    animation: moxPulseSlow 3s infinite ease-in-out;
}

@keyframes moxPulseSlow {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.mox-offline-email-btn {
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 14px rgba(56, 88, 233, 0.25);
}

.mox-offline-email-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(56, 88, 233, 0.35);
    opacity: 0.95;
}

.mox-offline-email-btn:active {
    transform: translateY(0);
}

.mox-offline-msg {
    animation: moxFadeIn 0.4s ease-out;
}

/* Responsiveness */
@media (max-width: 480px) {
    .mox-chat-card {
        width: calc(100vw - 32px);
        max-height: 420px;
        bottom: 70px;
    }
    
    .mox-pos-bottom-right .mox-chat-card {
        right: 0;
    }
    
    .mox-pos-bottom-left .mox-chat-card {
        left: 0;
    }
}
