#jazi-chat-container {
    position: fixed;
    bottom: 20px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

#jazi-chat-container.jazi-pos-right {
    right: 20px;
}

#jazi-chat-container.jazi-pos-left {
    left: 20px;
}

#jazi-chat-bubble {
    width: 60px;
    height: 60px;
    background-color: var(--jazi-primary-color, #aa085f);
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.3s ease, background-color 0.3s ease;
    color: white;
    position: relative;
}

#jazi-chat-bubble:hover {
    transform: scale(1.05);
}

#jazi-chat-bubble.jazi-bubble-close {
    background-color: var(--jazi-primary-color, #aa085f);
    transform: rotate(90deg);
}

#jazi-chat-bubble.jazi-bubble-close:hover {
    background-color: var(--jazi-primary-color, #aa085f);
    filter: brightness(0.9);
    transform: rotate(90deg) scale(1.05);
}

#jazi-chat-bubble svg {
    transition: transform 0.3s ease;
}

.jazi-unread-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #ef4444;
    color: white;
    font-size: 11px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    border: 2px solid white;
}

.jazi-bounce {
    animation: jazi-bounce 2s infinite;
}

@keyframes jazi-bounce {
    0%, 20%, 50%, 80%, 100% {transform: translateY(0);}
    40% {transform: translateY(-10px);}
    60% {transform: translateY(-5px);}
}

#jazi-chat-widget {
    position: fixed;
    bottom: 90px;
    width: 350px;
    height: 550px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
    max-height: calc(100vh - 120px);
}

.jazi-pos-right #jazi-chat-widget {
    right: 20px;
}

.jazi-pos-left #jazi-chat-widget {
    left: 20px;
}

#jazi-chat-widget.jazi-open {
    display: flex;
    animation: jazi-slide-up 0.3s ease;
}

@keyframes jazi-slide-up {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

#jazi-chat-widget.jazi-closing {
    animation: jazi-slide-down 0.3s ease forwards;
}

@keyframes jazi-slide-down {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(20px); }
}


.jazi-chat-header {
    background: var(--jazi-primary-color);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 12px 12px 0 0;
}

.jazi-header-info {
    display: flex;
    flex-direction: column;
}

.jazi-header-title {
    font-weight: 600;
    font-size: 16px;
}

.jazi-header-status {
    display: flex;
    align-items: center;
    font-size: 11px;
    opacity: 0.9;
    margin-top: 2px;
}

.jazi-status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
    border: 1px solid rgba(255,255,255,0.3);
}

.jazi-agent-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.jazi-agent-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    position: relative;
}

.jazi-agent-status-dot {
    width: 10px;
    height: 10px;
    background: #10b981; /* Online green */
    border: 2px solid var(--jazi-primary-color, #aa085f);
    border-radius: 50%;
    position: absolute;
    bottom: 0;
    right: 0;
}

.jazi-agent-details {
    display: flex;
    flex-direction: column;
}

.jazi-header-title {
    font-weight: 600;
    font-size: 16px;
    line-height: 1.2;
}

.jazi-agent-status-text {
    font-size: 12px;
    opacity: 0.9;
}

.jazi-header-controls button {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 0 5px;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.jazi-header-controls button:hover {
    opacity: 1;
}

.jazi-message-text a {
    color: var(--jazi-link-color, #2563eb);
    text-decoration: underline;
}

#jazi-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background: #fdfdfd;
}

.jazi-message {
    margin-bottom: 12px;
    display: flex;
    align-items: flex-end;
}

.jazi-message.jazi-message-visitor {
    flex-direction: row-reverse;
}

.jazi-message-avatar {
    width: 28px;
    height: 28px;
    background: #ddd;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    margin: 0 8px;
    flex-shrink: 0;
    color: #555;
    background-size: cover;
    background-position: center;
    overflow: hidden; /* clip the agent picture to the circle */
}

/* Agent profile picture (uploaded avatar, else the WordPress/Gravatar one) */
.jazi-message-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.jazi-agent-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.jazi-message-content {
    max-width: 75%;
}

.jazi-message-name {
    font-size: 11px;
    color: #999;
    margin-bottom: 2px;
    margin-left: 5px;
}

.jazi-message-visitor .jazi-message-name {
    text-align: right;
    margin-right: 5px;
}

.jazi-message-text {
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.jazi-message-visitor .jazi-message-text {
    background: var(--jazi-bubble-bg, var(--jazi-primary-color, #aa085f));
    color: var(--jazi-bubble-fg, white);
    border-bottom-right-radius: 4px;
}

.jazi-message-agent .jazi-message-text {
    background: #f0f2f5; 
    color: #333;
    border-bottom-left-radius: 4px;
}

.jazi-message-time {
    font-size: 10px;
    color: #aaa;
    margin-top: 2px;
    text-align: right;
}

.jazi-input-area {
    padding: 16px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
    z-index: 5;
}

.jazi-input-wrapper {
    display: flex;
    width: 100%;
    gap: 8px;
    align-items: center;
}

#jazi-message-input {
    flex: 1;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 22px;
    padding: 10px 18px;
    outline: none;
    font-size: 14px;
    background: rgba(255, 255, 255, 0.9);
    min-width: 0;
    resize: none;
    height: 44px;
    box-sizing: border-box;
    font-family: inherit;
    line-height: inherit;
    transition: all 0.2s ease;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.03);
}

#jazi-message-input:focus {
    border-color: var(--jazi-primary-color, #aa085f);
    background: white;
    box-shadow: 0 0 0 3px rgba(170, 8, 95, 0.1), inset 0 1px 2px rgba(0, 0, 0, 0.03);
}

/* Toolbar Styling */
.jazi-toolbar {
    display: flex;
    gap: 12px;
    align-items: center;
    width: 100%;
}

.jazi-toolbar button, .jazi-file-label {
    background: rgba(0, 0, 0, 0.03);
    border: none !important;
    box-shadow: none !important;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    font-size: 18px;
    color: #666;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
}

.jazi-toolbar button:hover, .jazi-file-label:hover {
    color: var(--jazi-primary-color, #aa085f);
    background: rgba(170, 8, 95, 0.08);
    transform: translateY(-1px);
}

.jazi-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 20px;
    color: #888;
    padding: 6px;
    border-radius: 50%;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
}

.jazi-action-btn:hover {
    background: #f0f0f0;
    color: var(--jazi-primary-color, #aa085f);
}

#jazi-send-btn {
    background: var(--jazi-primary-color, #aa085f);
    color: white;
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    padding: 0;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(170, 8, 95, 0.3);
}

#jazi-send-btn:hover {
    transform: scale(1.1) translateY(-1px);
    box-shadow: 0 6px 14px rgba(170, 8, 95, 0.4);
}

#jazi-send-btn:active {
    transform: scale(0.95);
}

#jazi-send-btn svg {
    margin-left: 2px; /* Visual centering adjustment for send icon */
}

/* Pre-chat form */
.jazi-pre-chat-form {
    padding: 25px;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.jazi-form-header {
    text-align: center;
    margin-bottom: 25px;
}
.jazi-form-header h3 {
    margin: 0 0 10px;
    color: #333;
}
.jazi-form-header p {
    color: #666;
    font-size: 14px;
    margin: 0;
}
.jazi-form-group {
    margin-bottom: 20px;
}
.jazi-form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    color: #555;
    font-weight: 500;
}
.jazi-input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-sizing: border-box;
    font-size: 14px;
    background: #fafafa;
}
.jazi-input:focus {
    border-color: var(--jazi-primary-color, #aa085f);
    background: white;
    outline: none;
}
.jazi-btn-primary {
    width: 100%;
    background: var(--jazi-primary-color, #aa085f);
    color: white;
    border: none;
    padding: 14px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 15px;
    transition: opacity 0.2s;
}
.jazi-btn-primary:hover {
    opacity: 0.9;
}

.jazi-privacy-text {
    margin-top: 12px;
    font-size: 12px;
    color: #6b7280;
    text-align: center;
    line-height: 1.5;
}

.jazi-privacy-text a {
    color: var(--jazi-primary-color, #aa085f);
    text-decoration: none;
    font-weight: 500;
}

.jazi-privacy-text a:hover {
    text-decoration: underline;
}

.jazi-btn-secondary {
    background: #f3f4f6;
    color: #4b5563;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.jazi-btn-secondary:hover {
    background: #e5e7eb;
    color: #111827;
}
.jazi-btn-secondary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Typing Indicator */
#jazi-typing-indicator {
    padding: 8px 20px;
    font-size: 11px;
    color: #888;
    background: #fdfdfd;
    display: none;
}
.jazi-typing-dots {
    display: inline-block;
}

/* Emoji Picker */
.jazi-emoji-picker {
    position: absolute;
    bottom: 75px; /* Above input area */
    left: 20px;
    background: white;
    border: 1px solid #eee;
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    z-index: 1000;
    width: 280px;
}
.jazi-emoji {
    cursor: pointer;
    font-size: 22px;
    text-align: center;
    transition: transform 0.2s;
    padding: 4px;
    border-radius: 4px;
}
.jazi-emoji:hover {
    background: #f5f5f5;
    transform: scale(1.1);
}

/* Upload Progress */
.jazi-upload-progress {
    position: absolute;
    top: 60px; /* Below header */
    left: 0;
    width: 100%;
    height: 3px;
    background: #eee;
    z-index: 10;
}
.jazi-upload-bar {
    height: 100%;
    background: #10b981;
    transition: width 0.3s;
}

@media (max-width: 480px) {
    #jazi-chat-widget {
        width: 100%;
        height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
        max-height: 100vh;
    }
}

/* Notifications */
.jazi-notification {
    position: absolute;
    bottom: 80px;
    left: 20px;
    right: 20px;
    padding: 12px 16px;
    border-radius: 8px;
    color: white;
    font-size: 13px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    animation: jazi-slide-up 0.3s ease-out;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
}

.jazi-notification-error {
    background: rgba(220, 38, 38, 0.9);
}

.jazi-notification-info {
    background: rgba(37, 99, 235, 0.9);
}

.jazi-notification-close {
    cursor: pointer;
    font-size: 18px;
    line-height:1;
    opacity: 0.7;
    margin-left: 10px;
}

.jazi-notification-close:hover {
    opacity: 1;
}

.jazi-fade-out {
    opacity: 0;
    transition: opacity 0.5s;
}

@keyframes jazi-slide-up {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
