/**
 * IRNOK Interactive Live Chat & Support Desk Styles
 * Version: 2.1.0
 */

/* Launcher Floating Button */
#irnok-chat-launcher {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999999;
    display: flex;
    align-items: center;
    gap: 10px;
    background: #1E293B;
    color: #FFFFFF;
    padding: 6px 18px 6px 8px;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.28), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 13.5px;
    font-weight: 600;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid rgba(255, 255, 255, 0.16);
    user-select: none;
}

#irnok-chat-launcher:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px -5px rgba(0, 0, 0, 0.4);
    background: #0F172A;
    border-color: rgba(255, 255, 255, 0.25);
}

/* Launcher Avatar with Integrated Status Dot */
.irnok-chat-launcher-avatar {
    position: relative;
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.irnok-chat-launcher-avatar .launcher-avatar-img {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #FFFFFF;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    display: block;
}

.irnok-chat-launcher-avatar .live-indicator {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #22C55E;
    border: 2px solid #1E293B;
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
    animation: irnok-pulse 2s infinite;
}

@keyframes irnok-pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 7px rgba(34, 197, 94, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
    }
}

#irnok-chat-launcher .launcher-label {
    letter-spacing: -0.01em;
}

#irnok-chat-launcher .badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #EF4444;
    color: #FFFFFF;
    font-size: 11px;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #FFFFFF;
    box-shadow: 0 2px 5px rgba(0,0,0,0.25);
}

/* Chat Card Window */
#irnok-chat-window {
    position: fixed;
    bottom: 84px;
    right: 24px;
    width: 370px;
    height: 540px;
    max-height: calc(100vh - 110px);
    background: #FFFFFF;
    border-radius: 18px;
    box-shadow: 0 22px 45px -10px rgba(0, 0, 0, 0.28), 0 1px 4px rgba(0, 0, 0, 0.08);
    z-index: 999999;
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #CBD5E1;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    animation: irnok-slide-up 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes irnok-slide-up {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Header */
.irnok-chat-header {
    background: #1E293B;
    color: #FFFFFF;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.irnok-chat-header .agent-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.irnok-chat-header .agent-avatar {
    position: relative;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.irnok-chat-header .agent-avatar .header-avatar-img {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    display: block;
}

.irnok-chat-header .agent-avatar .avatar-online-dot {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 10px;
    height: 10px;
    background: #22C55E;
    border: 2px solid #1E293B;
    border-radius: 50%;
}

.irnok-chat-header .agent-meta {
    display: flex;
    flex-direction: column;
}

.irnok-chat-header .agent-title {
    font-size: 14px;
    font-weight: 700;
    color: #FFFFFF;
    line-height: 1.25;
}

.irnok-chat-header .agent-status {
    font-size: 11px;
    color: #94A3B8;
    margin-top: 2px;
}

.irnok-chat-header .close-btn {
    background: transparent;
    border: none;
    color: #94A3B8;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.irnok-chat-header .close-btn:hover {
    color: #FFFFFF;
    background: rgba(255, 255, 255, 0.1);
}

/* Promo Announcement Bar */
.irnok-chat-promo {
    background: #F0FDF4;
    border-bottom: 1px solid #DCFCE7;
    padding: 8px 14px;
    font-size: 11.5px;
    color: #166534;
    display: flex;
    align-items: center;
    gap: 7px;
    font-weight: 500;
}

.irnok-chat-promo strong {
    color: #15803D;
}

/* Quick Suggestion Chips */
.irnok-chat-chips {
    padding: 8px 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    background: #F8FAFC;
    border-bottom: 1px solid #E2E8F0;
    max-height: 108px;
    overflow-y: auto;
}

.irnok-chat-chip {
    background: #FFFFFF;
    border: 1px solid #CBD5E1;
    border-radius: 20px;
    padding: 5px 11px;
    font-size: 11.5px;
    font-weight: 500;
    color: #334155;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
    line-height: 1.3;
}

.irnok-chat-chip:hover {
    background: #62A202;
    border-color: #62A202;
    color: #FFFFFF;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(98, 162, 2, 0.25);
}

/* Messages Body */
.irnok-chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #FFFFFF;
}

/* Message Bubble */
.irnok-chat-msg {
    display: flex;
    flex-direction: column;
    max-width: 86%;
    word-break: break-word;
    animation: irnok-fade-in 0.2s ease;
}

@keyframes irnok-fade-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.irnok-chat-msg.customer {
    align-self: flex-end;
}

.irnok-chat-msg.agent {
    align-self: flex-start;
}

/* Agent Message with Avatar */
.irnok-chat-msg.agent .agent-msg-wrap {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

.irnok-chat-msg.agent .msg-avatar-img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    margin-top: 2px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    border: 1px solid #E2E8F0;
}

.irnok-chat-msg.agent .msg-content {
    display: flex;
    flex-direction: column;
}

.irnok-chat-msg .bubble {
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 13px;
    line-height: 1.45;
}

.irnok-chat-msg.customer .bubble {
    background: #62A202;
    color: #FFFFFF;
    border-bottom-right-radius: 3px;
    box-shadow: 0 1px 2px rgba(98, 162, 2, 0.2);
}

.irnok-chat-msg.agent .bubble {
    background: #F1F5F9;
    color: #1E293B;
    border-bottom-left-radius: 3px;
    border: 1px solid #E2E8F0;
}

.irnok-chat-msg .meta {
    font-size: 10px;
    color: #94A3B8;
    margin-top: 3px;
    padding: 0 4px;
}

.irnok-chat-msg.customer .meta {
    text-align: right;
}

/* Typing Indicator */
.irnok-chat-typing {
    display: none;
    align-self: flex-start;
    background: #F1F5F9;
    padding: 8px 12px;
    border-radius: 14px;
    gap: 4px;
    align-items: center;
    border: 1px solid #E2E8F0;
}

.irnok-chat-typing .dot {
    width: 6px;
    height: 6px;
    background: #94A3B8;
    border-radius: 50%;
    animation: irnok-typing 1.4s infinite ease-in-out;
}

.irnok-chat-typing .dot:nth-child(1) { animation-delay: 0s; }
.irnok-chat-typing .dot:nth-child(2) { animation-delay: 0.2s; }
.irnok-chat-typing .dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes irnok-typing {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-4px); }
}

/* Footer & Input */
.irnok-chat-footer {
    padding: 12px 14px;
    background: #FFFFFF;
    border-top: 1px solid #E2E8F0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.irnok-chat-input-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #F8FAFC;
    border: 1px solid #CBD5E1;
    border-radius: 24px;
    padding: 4px 6px 4px 14px;
    transition: all 0.2s;
}

.irnok-chat-input-wrap:focus-within {
    border-color: #62A202;
    box-shadow: 0 0 0 3px rgba(98, 162, 2, 0.15);
    background: #FFFFFF;
}

.irnok-chat-input-wrap input {
    flex: 1;
    border: none !important;
    background: transparent !important;
    font-size: 13px !important;
    line-height: 18px !important;
    padding: 8px 0 !important;
    color: #1E293B !important;
    outline: none !important;
    box-shadow: none !important;
    height: auto !important;
    min-height: 0 !important;
}

.irnok-chat-input-wrap button {
    background: #62A202 !important;
    color: #FFFFFF !important;
    border: none !important;
    width: 32px !important;
    height: 32px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    padding: 0 !important;
    transition: all 0.2s !important;
}

.irnok-chat-input-wrap button:hover {
    background: #4E8201 !important;
    transform: scale(1.05);
}

.irnok-chat-hint {
    font-size: 10px;
    color: #94A3B8;
    text-align: center;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    #irnok-chat-launcher {
        bottom: 18px;
        right: 16px;
        padding: 5px 14px 5px 6px;
        font-size: 12.5px;
    }
    .irnok-chat-launcher-avatar,
    .irnok-chat-launcher-avatar .launcher-avatar-img {
        width: 30px;
        height: 30px;
    }
    #irnok-chat-window {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        height: 82vh;
        max-height: 82vh;
        border-radius: 18px 18px 0 0;
    }
}
