/* ویجت چت — استایل شبیه گفتینو */

.koofa-chat-widget {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 10050;
    font-family: dana, Tahoma, sans-serif;
}

.koofa-chat-panel {
    position: absolute;
    right: 0;
    bottom: 76px;
    width: 400px;
    max-width: calc(100vw - 32px);
    height: 580px;
    max-height: calc(100vh - 110px);
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.16), 0 2px 8px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transform-origin: bottom right;
    transition: opacity 0.28s ease, transform 0.28s ease, visibility 0.28s;
    pointer-events: none;
}

.koofa-chat-widget.is-open .koofa-chat-panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.koofa-chat-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    background: linear-gradient(135deg, var(--main-color-one, #fdb913) 0%, #f5a623 100%);
    color: #1a1a1a;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.koofa-chat-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.koofa-chat-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.koofa-chat-header-avatar i {
    font-size: 20px;
    color: var(--main-color-one, #fdb913);
}

.koofa-chat-header-title {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.35;
    margin: 0;
}

.koofa-chat-header-subtitle {
    font-size: 12px;
    opacity: 0.85;
    margin: 2px 0 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.koofa-chat-header-close {
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.55);
    color: #333;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s;
}

.koofa-chat-header-close:hover {
    background: #fff;
}

.koofa-chat-body {
    flex: 1;
    min-height: 0;
    background: #f8f9fa;
    position: relative;
}

.koofa-chat-body iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
    background: #fff;
}

.koofa-chat-loader {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: #f8f9fa;
    color: #666;
    font-size: 13px;
    transition: opacity 0.25s;
}

.koofa-chat-loader.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.koofa-chat-loader-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e8e8e8;
    border-top-color: var(--main-color-one, #fdb913);
    border-radius: 50%;
    animation: koofa-chat-spin 0.7s linear infinite;
}

@keyframes koofa-chat-spin {
    to {
        transform: rotate(360deg);
    }
}

.koofa-chat-bubble {
    width: 62px;
    height: 62px;
    border: none;
    border-radius: 50%;
    background: var(--main-color-one, #fdb913);
    color: #1a1a1a;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 24px rgba(253, 185, 19, 0.45);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
}

.koofa-chat-bubble:hover {
    transform: scale(1.06);
    box-shadow: 0 8px 28px rgba(253, 185, 19, 0.55);
}

.koofa-chat-bubble::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid var(--main-color-one, #fdb913);
    opacity: 0;
    animation: koofa-chat-pulse 2.5s ease-out infinite;
}

.koofa-chat-widget.is-open .koofa-chat-bubble::before {
    animation: none;
    opacity: 0;
}

@keyframes koofa-chat-pulse {
    0% {
        transform: scale(1);
        opacity: 0.6;
    }
    100% {
        transform: scale(1.35);
        opacity: 0;
    }
}

.koofa-chat-bubble i {
    font-size: 28px;
    line-height: 1;
    transition: transform 0.25s ease, opacity 0.2s;
}

.koofa-chat-bubble .icon-close {
    display: none;
    font-size: 26px;
}

.koofa-chat-widget.is-open .koofa-chat-bubble {
    background: #2f353e;
    color: #fff;
    box-shadow: 0 6px 24px rgba(47, 53, 62, 0.35);
}

.koofa-chat-widget.is-open .koofa-chat-bubble .icon-chat {
    display: none;
}

.koofa-chat-widget.is-open .koofa-chat-bubble .icon-close {
    display: block;
}

@media (max-width: 576px) {
    .koofa-chat-widget {
        right: 14px;
        bottom: 14px;
    }

    .koofa-chat-panel {
        right: -6px;
        width: calc(100vw - 16px);
        height: calc(100vh - 100px);
        max-height: calc(100vh - 100px);
        border-radius: 14px;
    }

    .koofa-chat-bubble {
        width: 56px;
        height: 56px;
    }
}
