/**
 * Frontend Styles - أنماط الواجهة الأمامية
 * WhatsApp Button Pro
 * @version 1.0.0
 */

/* ========================================
   متغيرات CSS - CSS Variables
   ======================================== */
:root {
    --wbp-button-color: #25D366;
    --wbp-button-text-color: #ffffff;
    --wbp-button-hover-color: #128C7E;
    --wbp-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    --wbp-transition: all 0.3s ease;
}

/* ========================================
   حاوية الزر - Button Container
   ======================================== */
.wbp-button-container {
    position: fixed;
    z-index: 999999;
    direction: ltr;
}

/* المواضع - Positions */
.wbp-position-bottom-right {
    bottom: 20px;
    right: 20px;
}

.wbp-position-bottom-left {
    bottom: 20px;
    left: 20px;
}

.wbp-position-top-right {
    top: 20px;
    right: 20px;
}

.wbp-position-top-left {
    top: 20px;
    left: 20px;
}

/* ========================================
   الزر الرئيسي - Main Button
   ======================================== */
.wbp-chat-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    background-color: var(--wbp-button-color);
    border: none;
    border-radius: 50%;
    box-shadow: var(--wbp-shadow);
    cursor: pointer;
    transition: var(--wbp-transition);
    outline: none;
}

.wbp-chat-button:hover {
    background-color: var(--wbp-button-hover-color);
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.wbp-button-icon {
    width: 32px;
    height: 32px;
    color: var(--wbp-button-text-color);
}

/* الأحجام - Sizes */
.wbp-size-small .wbp-chat-button {
    width: 50px;
    height: 50px;
}

.wbp-size-small .wbp-button-icon {
    width: 26px;
    height: 26px;
}

.wbp-size-large .wbp-chat-button {
    width: 70px;
    height: 70px;
}

.wbp-size-large .wbp-button-icon {
    width: 38px;
    height: 38px;
}

/* ========================================
   الأنيميشن - Animations
   ======================================== */

/* نبض - Pulse */
@keyframes wbp-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.7);
    }
    70% {
        box-shadow: 0 0 0 15px rgba(37, 211, 102, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(37, 211, 102, 0);
    }
}

.wbp-animation-pulse .wbp-chat-button {
    animation: wbp-pulse 2s infinite;
}

/* اهتزاز - Shake */
@keyframes wbp-shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }
}

.wbp-animation-shake .wbp-chat-button:hover {
    animation: wbp-shake 0.5s;
}

/* دوران - Rotate */
@keyframes wbp-rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.wbp-animation-rotate .wbp-chat-button:hover .wbp-button-icon {
    animation: wbp-rotate 0.6s ease-in-out;
}

/* ========================================
   نافذة الدردشة - Chat Box
   ======================================== */
.wbp-chat-box {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    max-width: calc(100vw - 40px);
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    transition: var(--wbp-transition);
    opacity: 0;
    transform: translateY(20px) scale(0.9);
    pointer-events: none;
}

.wbp-chat-box.wbp-active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* رأس نافذة الدردشة - Chat Header */
.wbp-chat-header {
    background: var(--wbp-button-color);
    color: #ffffff;
    padding: 15px 20px;
    position: relative;
}

.wbp-chat-header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.wbp-chat-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.wbp-close-button {
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    transition: var(--wbp-transition);
}

.wbp-close-button:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* محتوى نافذة الدردشة - Chat Body */
.wbp-chat-body {
    padding: 20px;
}

.wbp-message-input {
    width: 100%;
    min-height: 80px;
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    transition: var(--wbp-transition);
}

.wbp-message-input:focus {
    outline: none;
    border-color: var(--wbp-button-color);
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.1);
}

.wbp-send-button {
    width: 100%;
    margin-top: 15px;
    padding: 12px 20px;
    background: var(--wbp-button-color);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--wbp-transition);
}

.wbp-send-button:hover {
    background: var(--wbp-button-hover-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
}

/* ========================================
   قائمة الوكلاء - Agents List
   ======================================== */
.wbp-agents-list {
    max-height: 400px;
    overflow-y: auto;
}

.wbp-agent-item {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #f0f0f0;
    text-decoration: none;
    color: inherit;
    transition: var(--wbp-transition);
}

.wbp-agent-item:last-child {
    border-bottom: none;
}

.wbp-agent-item:hover {
    background: #f8f9fa;
}

.wbp-agent-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    margin-right: 15px;
    object-fit: cover;
}

.wbp-agent-avatar-default {
    background: var(--wbp-button-color);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 20px;
}

.wbp-agent-info {
    flex: 1;
}

.wbp-agent-info h4 {
    margin: 0 0 5px 0;
    font-size: 15px;
    font-weight: 600;
}

.wbp-agent-title {
    margin: 0 0 5px 0;
    font-size: 13px;
    color: #666;
}

.wbp-agent-status {
    display: inline-block;
    font-size: 12px;
    padding: 3px 8px;
    border-radius: 12px;
    background: #e8f5e9;
    color: #2e7d32;
}

.wbp-agent-offline .wbp-agent-status {
    background: #ffebee;
    color: #c62828;
}

/* ========================================
   Shortcode Styles - أنماط الشورت كود
   ======================================== */
.wbp-shortcode-button {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    background: var(--wbp-button-color);
    color: #ffffff;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: var(--wbp-transition);
}

.wbp-shortcode-button:hover {
    background: var(--wbp-button-hover-color);
    transform: translateY(-2px);
    box-shadow: var(--wbp-shadow);
}

.wbp-shortcode-button .wbp-button-icon {
    width: 20px;
    height: 20px;
}

/* Minimal Style */
.wbp-style-minimal {
    background: transparent;
    color: var(--wbp-button-color);
    border: 2px solid var(--wbp-button-color);
}

.wbp-style-minimal:hover {
    background: var(--wbp-button-color);
    color: #ffffff;
}

/* Icon Only */
.wbp-style-icon-only {
    padding: 12px;
    border-radius: 50%;
}

/* ========================================
   Widget Styles - أنماط الويدجت
   ======================================== */
.wbp-whatsapp-widget {
    padding: 20px;
}

.wbp-widget-description {
    margin-bottom: 15px;
    font-size: 14px;
    color: #666;
}

.wbp-widget-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 12px 20px;
    background: var(--wbp-button-color);
    color: #ffffff;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: var(--wbp-transition);
}

.wbp-widget-button:hover {
    background: var(--wbp-button-hover-color);
    transform: translateY(-2px);
}

.wbp-widget-icon {
    width: 24px;
    height: 24px;
}

/* ========================================
   Responsive - استجابة الشاشات
   ======================================== */
@media (max-width: 768px) {
    .wbp-chat-box {
        width: 320px;
        bottom: 70px;
    }

    .wbp-position-bottom-right,
    .wbp-position-top-right {
        right: 10px;
    }

    .wbp-position-bottom-left,
    .wbp-position-top-left {
        left: 10px;
    }

    .wbp-position-bottom-right .wbp-chat-box,
    .wbp-position-bottom-left .wbp-chat-box {
        bottom: 70px;
    }
}

/* ========================================
   دعم RTL - RTL Support
   ======================================== */
[dir="rtl"] .wbp-agent-avatar {
    margin-right: 0;
    margin-left: 15px;
}

[dir="rtl"] .wbp-position-bottom-right {
    right: auto;
    left: 20px;
}

[dir="rtl"] .wbp-position-bottom-left {
    left: auto;
    right: 20px;
}

[dir="rtl"] .wbp-position-top-right {
    right: auto;
    left: 20px;
}

[dir="rtl"] .wbp-position-top-left {
    left: auto;
    right: 20px;
}

[dir="rtl"] .wbp-chat-box {
    right: auto;
    left: 0;
}
