/* تصميم نافذة دردشة عصري مثل الصورة المرفقة */
#pico-chatbot * { box-sizing: border-box; font-family: 'Tajawal', 'Cairo', Arial, sans-serif; }

/* فقاعة الترحيب */
#pico-chatbot .pico-welcome-bubble {
    position: fixed;
    bottom: 95px;
    right: 24px;
    background: #fff;
    border-radius: 16px;
    padding: 14px 18px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 99997;
    opacity: 0;
    transform: translateY(10px) scale(0.9);
    transition: all 0.4s ease;
    max-width: 280px;
}

#pico-chatbot .pico-welcome-bubble.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

#pico-chatbot .pico-welcome-bubble::after {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 30px;
    width: 16px;
    height: 16px;
    background: #fff;
    transform: rotate(45deg);
    box-shadow: 4px 4px 8px rgba(0, 0, 0, 0.05);
}

#pico-chatbot .pico-bubble-content {
    display: flex;
    align-items: center;
    gap: 8px;
}

#pico-chatbot .pico-bubble-wave {
    font-size: 22px;
    animation: wave 1.5s ease-in-out infinite;
}

@keyframes wave {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(20deg); }
    50% { transform: rotate(-10deg); }
    75% { transform: rotate(20deg); }
}

#pico-chatbot .pico-bubble-text {
    color: #333;
    font-size: 14px;
    line-height: 1.4;
}

#pico-chatbot .pico-bubble-text strong {
    color: #d32f2f;
    font-weight: 700;
}

#pico-chatbot .pico-bubble-close {
    position: absolute;
    top: -8px;
    left: -8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #f3f4f6;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#pico-chatbot .pico-bubble-close:hover {
    background: #ef4444;
    color: #fff;
}

/* زر فتح الشات */
#pico-chatbot .pico-chat-button {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #d32f2f 0%, #b71c1c 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(211, 47, 47, 0.4);
    transition: all 0.3s ease;
    z-index: 99998;
    opacity: 0;
    transform: scale(0.8);
}

#pico-chatbot .pico-chat-button:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(211, 47, 47, 0.5);
}

#pico-chatbot .pico-chat-button.active {
    background: linear-gradient(135deg, #666 0%, #444 100%);
}

#pico-chatbot .pico-chat-button svg {
    width: 28px;
    height: 28px;
    fill: white;
}

#pico-chatbot .pico-chat-button .notification-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 14px;
    height: 14px;
    background: #4CAF50;
    border-radius: 50%;
    border: 2px solid white;
}

#pico-chatbot .pico-chat-window {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 370px;
    height: 540px;
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 99999;
    border: none;
    transition: all 0.3s ease;
    transform: translateY(20px);
    opacity: 0;
}

#pico-chatbot .pico-chat-window.open {
    display: flex;
    transform: translateY(0);
    opacity: 1;
}

#pico-chatbot .pico-chat-header {
    background: linear-gradient(90deg, #d32f2f 0%, #b71c1c 100%);
    padding: 18px 18px 12px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    border-bottom: 1px solid #eee;
}
#pico-chatbot .pico-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #fff;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    border: 2px solid #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}
#pico-chatbot .pico-header-info h4 {
    color: #fff;
    font-size: 17px;
    font-weight: 700;
    margin: 0 0 2px 0;
}
#pico-chatbot .pico-header-info span {
    color: #fff;
    font-size: 13px;
    opacity: 0.8;
}
#pico-chatbot .pico-header-actions {
    margin-right: auto;
    display: flex;
    gap: 2px;
}
#pico-chatbot .pico-header-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,0.18);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
#pico-chatbot .pico-header-btn:hover {
    background: rgba(255,255,255,0.32);
}
#pico-chatbot .pico-header-btn svg {
    width: 18px;
    height: 18px;
    fill: #fff;
}

#pico-chatbot .pico-chat-area {
    flex: 1;
    background: #fff;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}
#pico-chatbot .pico-chat-messages {
    flex: 1 1 0;
    overflow-y: auto;
    padding: 16px 18px 10px 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #fff;
    min-height: 0;
    max-height: calc(100% - 160px);
}
#pico-chatbot .pico-message {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    max-width: 90%;
}
#pico-chatbot .pico-message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}
#pico-chatbot .pico-message.bot {
    align-self: flex-start;
    flex-direction: row;
}
#pico-chatbot .pico-message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #eee;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    overflow: hidden;
}
#pico-chatbot .pico-message-content {
    background: #f6f6f6;
    border-radius: 16px;
    padding: 10px 16px 8px 16px;
    color: #222;
    font-size: 15px;
    line-height: 1.7;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
    min-width: 60px;
    max-width: 100%;
    word-break: break-word;
}
#pico-chatbot .pico-message.user .pico-message-content {
    background: #e3e3e3;
    color: #222;
}
#pico-chatbot .pico-message.bot .pico-message-content {
    background: #f6f6f6;
    color: #222;
}
#pico-chatbot .pico-message-time {
    font-size: 11px;
    color: #b0b0b0;
    margin-top: 2px;
    text-align: left;
}

#pico-chatbot .pico-chat-input {
    background: #fff;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-top: 1px solid #eee;
    flex-shrink: 0;
    min-height: 60px;
}

#pico-chatbot .pico-quick-actions {
    display: flex;
    gap: 8px;
    padding: 10px 16px;
    flex-wrap: wrap;
    background: #fafafa;
    border-top: 1px solid #eee;
    flex-shrink: 0;
}
#pico-chatbot .pico-quick-btn {
    padding: 8px 14px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 18px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
#pico-chatbot .pico-quick-btn:hover {
    background: #d32f2f;
    color: #fff;
    border-color: #d32f2f;
}
#pico-chatbot .pico-input-wrapper {
    flex: 1;
    position: relative;
}
#pico-chatbot .pico-input-wrapper textarea {
    width: 100%;
    padding: 13px 18px;
    background: #fafafa;
    border: none;
    border-radius: 22px;
    color: #222;
    font-size: 15px;
    resize: none;
    min-height: 44px;
    max-height: 90px;
    outline: none;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
    transition: box-shadow 0.2s;
}
#pico-chatbot .pico-input-wrapper textarea:focus {
    box-shadow: 0 2px 8px rgba(211,47,47,0.08);
}
#pico-chatbot .pico-input-wrapper textarea::placeholder {
    color: #b0b0b0;
    font-size: 15px;
}
#pico-chatbot .pico-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #d32f2f 0%, #b71c1c 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 8px rgba(211,47,47,0.08);
}
#pico-chatbot .pico-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
#pico-chatbot .pico-send-btn svg {
    width: 20px;
    height: 20px;
    fill: #fff;
}

#pico-chatbot .pico-form-container {
    flex: 1;
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: #fff;
    overflow-y: auto;
}
#pico-chatbot .pico-form-title {
    text-align: center;
    margin-bottom: 25px;
}
#pico-chatbot .pico-form-title h3 {
    font-size: 22px;
    color: #d32f2f;
    margin-bottom: 8px;
}
#pico-chatbot .pico-form-title p {
    color: #888;
    font-size: 14px;
}
#pico-chatbot .pico-form-group {
    margin-bottom: 15px;
}
#pico-chatbot .pico-form-group label {
    display: block;
    margin-bottom: 8px;
    color: #b71c1c;
    font-size: 13px;
}
#pico-chatbot .pico-form-group input {
    width: 100%;
    padding: 14px 16px;
    background: #fafafa;
    border: 1px solid #eee;
    border-radius: 12px;
    color: #222;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}
#pico-chatbot .pico-form-group input:focus {
    border-color: #d32f2f;
}
#pico-chatbot .pico-form-group input::placeholder {
    color: #bbb;
}
#pico-chatbot .pico-form-group .error-text {
    display: none;
    color: #d32f2f;
    font-size: 12px;
    margin-top: 5px;
}
#pico-chatbot .pico-form-group.error input {
    border-color: #d32f2f;
}
#pico-chatbot .pico-form-group.error .error-text {
    display: block;
}
#pico-chatbot .pico-start-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #d32f2f 0%, #b71c1c 100%);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 10px;
    transition: transform 0.2s, opacity 0.2s;
}
#pico-chatbot .pico-start-btn:hover {
    transform: translateY(-2px);
    opacity: 0.95;
}

/* نافذة التأكيد */
#pico-chatbot .pico-confirm-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    backdrop-filter: blur(4px);
}

#pico-chatbot .pico-confirm-box {
    background: #fff;
    border-radius: 20px;
    padding: 30px 25px;
    text-align: center;
    max-width: 300px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    animation: confirmIn 0.3s ease;
}

@keyframes confirmIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

#pico-chatbot .pico-confirm-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

#pico-chatbot .pico-confirm-box h4 {
    color: #333;
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 10px 0;
}

#pico-chatbot .pico-confirm-box p {
    color: #666;
    font-size: 14px;
    margin: 0 0 20px 0;
    line-height: 1.5;
}

#pico-chatbot .pico-confirm-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

#pico-chatbot .pico-confirm-yes {
    padding: 12px 24px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

#pico-chatbot .pico-confirm-yes:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

#pico-chatbot .pico-confirm-no {
    padding: 12px 24px;
    background: #f3f4f6;
    border: none;
    border-radius: 10px;
    color: #666;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

#pico-chatbot .pico-confirm-no:hover {
    background: #e5e7eb;
}

/* Responsive */
@media (max-width: 480px) {
    #pico-chatbot .pico-chat-window {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100vw;
        height: 100dvh;
        border-radius: 0;
        max-width: 100vw;
        max-height: 100dvh;
    }
    #pico-chatbot .pico-chat-header {
        padding: 14px 12px;
    }
    #pico-chatbot .pico-chat-input {
        padding: 10px 12px;
        min-height: 56px;
    }
    #pico-chatbot .pico-chat-messages {
        padding: 12px;
        max-height: calc(100dvh - 200px);
    }
    #pico-chatbot .pico-quick-actions {
        padding: 8px 12px;
    }
    #pico-chatbot .pico-message-content {
        padding: 8px 12px;
        font-size: 14px;
    }
    #pico-chatbot .pico-input-wrapper textarea {
        padding: 10px 14px;
        font-size: 14px;
        min-height: 40px;
    }
    #pico-chatbot .pico-send-btn {
        width: 40px;
        height: 40px;
    }
    #pico-chatbot .pico-chat-button {
        width: 54px;
        height: 54px;
        bottom: 16px;
        right: 16px;
    }
}

/* ==================== بطاقات المنتجات ==================== */
#pico-chatbot .pico-product-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    transition: all 0.3s ease;
}

#pico-chatbot .pico-product-card:hover {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

#pico-chatbot .pico-product-card.unavailable {
    opacity: 0.7;
}

#pico-chatbot .pico-product-card img {
    width: 100%;
    height: 120px;
    object-fit: cover;
}

#pico-chatbot .pico-product-info {
    padding: 12px;
}

#pico-chatbot .pico-product-name {
    font-weight: 600;
    font-size: 14px;
    color: #333;
    margin-bottom: 6px;
    line-height: 1.4;
}

#pico-chatbot .pico-product-stock {
    font-size: 12px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
    margin-bottom: 8px;
}

#pico-chatbot .pico-product-stock.in-stock {
    background: #dcfce7;
    color: #16a34a;
}

#pico-chatbot .pico-product-stock.low-stock {
    background: #fef3c7;
    color: #d97706;
}

#pico-chatbot .pico-product-stock.out-of-stock {
    background: #fee2e2;
    color: #dc2626;
}

#pico-chatbot .pico-product-price {
    font-size: 14px;
    margin-bottom: 10px;
}

#pico-chatbot .pico-product-price .current-price {
    font-weight: 700;
    color: #d32f2f;
}

#pico-chatbot .pico-product-price .original-price {
    color: #999;
    text-decoration: line-through;
    font-size: 12px;
    margin-left: 6px;
}

#pico-chatbot .pico-product-btn {
    display: inline-block;
    padding: 8px 16px;
    background: linear-gradient(135deg, #d32f2f 0%, #b71c1c 100%);
    color: white;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}

#pico-chatbot .pico-product-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(211, 47, 47, 0.3);
}

#pico-chatbot .pico-product-btn.disabled {
    background: #ccc;
    cursor: not-allowed;
    pointer-events: none;
}

