/* =========================================================
   YD CLEANING - WEBSITE CHAT WIDGET
   ========================================================= */

.yd-chat-widget {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 99999;
    font-family: inherit;
}

/* Floating button */

.yd-chat-toggle {
    width: 62px;
    height: 62px;
    border: 0;
    border-radius: 50%;
    background: #0072ce;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.20);
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease,
        background 0.2s ease;
}

.yd-chat-toggle:hover {
    transform: translateY(-3px);
    background: #005fae;
    box-shadow: 0 14px 35px rgba(0, 0, 0, 0.25);
}

.yd-chat-toggle i {
    font-size: 25px;
}

/* Notification dot */

.yd-chat-notification {
    position: absolute;
    right: 0;
    top: 0;
    width: 16px;
    height: 16px;
    background: #ef4444;
    border: 3px solid #fff;
    border-radius: 50%;
}

/* Chat window */

.yd-chat-panel {
    position: absolute;
    right: 0;
    bottom: 78px;
    width: 370px;
    max-width: calc(100vw - 30px);
    background: #fff;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.22);
    border: 1px solid #e5e7eb;

    opacity: 0;
    visibility: hidden;
    transform: translateY(15px) scale(0.97);
    transform-origin: bottom right;

    transition:
        opacity 0.2s ease,
        visibility 0.2s ease,
        transform 0.2s ease;
}

.yd-chat-widget.open .yd-chat-panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Header */

.yd-chat-header {
    background: linear-gradient(135deg, #0072ce, #005fae);
    color: #fff;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.yd-chat-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.yd-chat-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255,255,255,0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.yd-chat-title {
    font-size: 16px;
    font-weight: 800;
    margin: 0;
}

.yd-chat-status {
    font-size: 12px;
    opacity: 0.9;
    margin-top: 3px;
}

.yd-chat-close {
    width: 34px;
    height: 34px;
    border: 0;
    background: rgba(255,255,255,0.12);
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
}

/* Body */

.yd-chat-body {
    padding: 20px;
    max-height: 570px;
    overflow-y: auto;
}

.yd-chat-welcome {
    margin-bottom: 18px;
}

.yd-chat-welcome h3 {
    margin: 0 0 7px;
    font-size: 18px;
    color: #111827;
}

.yd-chat-welcome p {
    margin: 0;
    color: #6b7280;
    font-size: 14px;
    line-height: 1.6;
}

/* Quick actions */

.yd-chat-actions {
    display: grid;
    gap: 9px;
    margin-bottom: 18px;
}

.yd-chat-action {
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    color: #111827;
    border-radius: 10px;
    padding: 11px 13px;
    text-align: left;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.yd-chat-action:hover {
    border-color: #0072ce;
    background: #eff6ff;
    color: #0072ce;
}

/* Form */

.yd-chat-form {
    display: none;
}

.yd-chat-form.active {
    display: block;
}

.yd-chat-field {
    margin-bottom: 12px;
}

.yd-chat-field label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: #374151;
    margin-bottom: 5px;
}

.yd-chat-field input,
.yd-chat-field select,
.yd-chat-field textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #d1d5db;
    border-radius: 9px;
    padding: 10px 11px;
    font: inherit;
    font-size: 14px;
    color: #111827;
    background: #fff;
    outline: none;
}

.yd-chat-field input:focus,
.yd-chat-field select:focus,
.yd-chat-field textarea:focus {
    border-color: #0072ce;
    box-shadow: 0 0 0 3px rgba(0, 114, 206, 0.10);
}

.yd-chat-field textarea {
    min-height: 85px;
    resize: vertical;
}

.yd-chat-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

/* Submit */

.yd-chat-submit {
    width: 100%;
    border: 0;
    border-radius: 10px;
    background: #0072ce;
    color: #fff;
    padding: 12px 15px;
    font-weight: 800;
    cursor: pointer;
    transition: background 0.2s ease;
}

.yd-chat-submit:hover {
    background: #005fae;
}

.yd-chat-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Messages */

.yd-chat-result {
    display: none;
    padding: 13px;
    border-radius: 10px;
    margin-bottom: 14px;
    font-size: 13px;
    line-height: 1.5;
}

.yd-chat-result.success {
    display: block;
    background: #ecfdf5;
    color: #166534;
}

.yd-chat-result.error {
    display: block;
    background: #fef2f2;
    color: #991b1b;
}

/* Back */

.yd-chat-back {
    border: 0;
    background: none;
    color: #0072ce;
    padding: 0;
    margin-bottom: 14px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
}

/* Mobile */

@media (max-width: 600px) {

    .yd-chat-widget {
        right: 15px;
        bottom: 15px;
    }

    .yd-chat-toggle {
        width: 56px;
        height: 56px;
    }

    .yd-chat-panel {
        right: -2px;
        bottom: 68px;
        width: calc(100vw - 30px);
        max-width: 390px;
    }

    .yd-chat-body {
        max-height: calc(100vh - 170px);
    }

    .yd-chat-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
}


/* =====================================================
   YD LIVE CHAT
   ===================================================== */

.yd-live-chat {
    display: none;
    flex-direction: column;
    height: 100%;
    min-height: 420px;
}

.yd-live-chat.active {
    display: flex;
}

.yd-live-chat-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #e5e7eb;
}

.yd-live-chat-back {
    border: 0;
    background: transparent;
    cursor: pointer;
    font-weight: 600;
    padding: 6px 0;
}

.yd-live-chat-back:hover {
    text-decoration: underline;
}

#ydLiveChatConnectionStatus {
    font-size: 12px;
    font-weight: 700;
}

.yd-live-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 4px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 280px;
}

.yd-live-chat-message {
    max-width: 82%;
    padding: 10px 13px;
    border-radius: 14px;
    line-height: 1.45;
    font-size: 14px;
    word-wrap: break-word;
}

.yd-live-chat-message.customer {
    align-self: flex-end;
    background: #2563eb;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.yd-live-chat-message.staff {
    align-self: flex-start;
    background: #f1f5f9;
    color: #0f172a;
    border-bottom-left-radius: 4px;
}

.yd-live-chat-system {
    align-self: center;
    color: #64748b;
    font-size: 12px;
    text-align: center;
    padding: 8px;
}

.yd-live-chat-form {
    display: flex;
    gap: 8px;
    padding-top: 10px;
    border-top: 1px solid #e5e7eb;
}

.yd-live-chat-form input {
    flex: 1;
    min-width: 0;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 11px 12px;
    font-size: 14px;
    outline: none;
}

.yd-live-chat-form input:focus {
    border-color: #2563eb;
}

.yd-live-chat-form button {
    border: 0;
    border-radius: 10px;
    padding: 11px 16px;
    background: #2563eb;
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

.yd-live-chat-form button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}