/**
 * Advanced WordPress Chatbot - Widget Styles
 * עיצוב מתקדם לווידג'ט הצ'אטבוט
 */

/* משתנים גלובליים */
:root {
    --chatbot-primary: #2563eb;
    --chatbot-primary-hover: #1d4ed8;
    --chatbot-secondary: #64748b;
    --chatbot-success: #10b981;
    --chatbot-warning: #f59e0b;
    --chatbot-error: #ef4444;
    --chatbot-bg: #ffffff;
    --chatbot-surface: #f8fafc;
    --chatbot-border: #e2e8f0;
    --chatbot-text: #1e293b;
    --chatbot-text-muted: #64748b;
    --chatbot-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --chatbot-shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --chatbot-radius: 12px;
    --chatbot-radius-sm: 8px;
    --chatbot-font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* תמיכה בעברית */
[dir="rtl"] .chatbot-widget,
.chatbot-widget.rtl-mode {
    direction: rtl;
    text-align: right;
}

/* ערכת צבעים כהה */
.chatbot-theme-dark {
    --chatbot-bg: #1e293b;
    --chatbot-surface: #334155;
    --chatbot-border: #475569;
    --chatbot-text: #f1f5f9;
    --chatbot-text-muted: #94a3b8;
}

/* ערכת צבעים אוטומטית */
@media (prefers-color-scheme: dark) {
    .chatbot-theme-auto {
        --chatbot-bg: #1e293b;
        --chatbot-surface: #334155;
        --chatbot-border: #475569;
        --chatbot-text: #f1f5f9;
        --chatbot-text-muted: #94a3b8;
    }
}

/* קונטיינר ראשי */
.chatbot-widget {
    position: fixed;
    z-index: 999999;
    font-family: var(--chatbot-font-family);
    font-size: 14px;
    line-height: 1.5;
    color: var(--chatbot-text);
    direction: ltr;
}

/* מיקומים */
.chatbot-bottom-right {
    bottom: 20px;
    right: 20px;
}

.chatbot-bottom-left {
    bottom: 20px;
    left: 20px;
}

.chatbot-top-right {
    top: 20px;
    right: 20px;
}

.chatbot-top-left {
    top: 20px;
    left: 20px;
}

/* כפתור פתיחה/סגירה */
.chatbot-toggle {
    width: 60px;
    height: 60px;
    background: var(--chatbot-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--chatbot-shadow);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    color: white;
    position: relative;
    overflow: hidden;
}

.chatbot-toggle:hover {
    background: var(--chatbot-primary-hover);
    transform: scale(1.05);
    box-shadow: var(--chatbot-shadow-lg);
}

.chatbot-toggle:active {
    transform: scale(0.95);
}

.chatbot-toggle svg {
    transition: all 0.3s ease;
}

.chatbot-toggle.active .chatbot-icon-chat {
    display: none;
}

.chatbot-toggle.active .chatbot-icon-close {
    display: block !important;
}

/* אנימציית פעימה */
.chatbot-toggle::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 50%;
    background: var(--chatbot-primary);
    animation: chatbot-pulse 2s infinite;
    opacity: 0.3;
}

@keyframes chatbot-pulse {
    0% {
        transform: scale(1);
        opacity: 0.3;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.1;
    }
    100% {
        transform: scale(1.4);
        opacity: 0;
    }
}

/* חלון הצ'אט */
.chatbot-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 500px;
    max-height: calc(100vh - 120px);
    background: var(--chatbot-bg);
    border-radius: var(--chatbot-radius);
    box-shadow: var(--chatbot-shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--chatbot-border);
    animation: chatbot-slide-up 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes chatbot-slide-up {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* מיקום חלון בצד שמאל */
.chatbot-bottom-left .chatbot-window,
.chatbot-top-left .chatbot-window {
    right: auto;
    left: 0;
}

/* כותרת */
.chatbot-header {
    background: var(--chatbot-surface);
    padding: 16px 20px;
    border-bottom: 1px solid var(--chatbot-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chatbot-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chatbot-avatar {
    width: 36px;
    height: 36px;
    background: var(--chatbot-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.chatbot-title h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--chatbot-text);
}

.chatbot-status {
    font-size: 12px;
    color: var(--chatbot-success);
    display: flex;
    align-items: center;
    gap: 4px;
}

.chatbot-status::before {
    content: '';
    width: 6px;
    height: 6px;
    background: var(--chatbot-success);
    border-radius: 50%;
}

.chatbot-minimize {
    background: none;
    border: none;
    color: var(--chatbot-text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.chatbot-minimize:hover {
    background: var(--chatbot-border);
    color: var(--chatbot-text);
}

/* אזור ההודעות */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}

.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: var(--chatbot-surface);
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: var(--chatbot-border);
    border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: var(--chatbot-text-muted);
}

/* הודעות */
.chatbot-message {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

.chatbot-message-user {
    flex-direction: row-reverse;
}

.chatbot-message-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chatbot-message-bot .chatbot-message-avatar {
    background: var(--chatbot-primary);
    color: white;
}

.chatbot-message-user .chatbot-message-avatar {
    background: var(--chatbot-secondary);
    color: white;
}

.chatbot-message-content {
    max-width: 80%;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chatbot-message-text {
    padding: 12px 16px;
    border-radius: var(--chatbot-radius-sm);
    word-wrap: break-word;
    line-height: 1.4;
}

.chatbot-message-bot .chatbot-message-text {
    background: var(--chatbot-surface);
    color: var(--chatbot-text);
    border-bottom-left-radius: 4px;
}

.chatbot-message-user .chatbot-message-text {
    background: var(--chatbot-primary);
    color: white;
    border-bottom-right-radius: 4px;
}

.chatbot-message-time {
    font-size: 11px;
    color: var(--chatbot-text-muted);
    padding: 0 4px;
}

.chatbot-message-user .chatbot-message-time {
    text-align: right;
}

/* אינדיקטור הקלדה */
.chatbot-typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: var(--chatbot-surface);
    border-radius: var(--chatbot-radius-sm);
    border-bottom-left-radius: 4px;
}

.chatbot-typing-indicator span {
    width: 6px;
    height: 6px;
    background: var(--chatbot-text-muted);
    border-radius: 50%;
    animation: chatbot-typing 1.4s infinite ease-in-out;
}

.chatbot-typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.chatbot-typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes chatbot-typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* אזור הקלט */
.chatbot-input-area {
    border-top: 1px solid var(--chatbot-border);
    background: var(--chatbot-bg);
}

.chatbot-form {
    padding: 16px 20px;
}

.chatbot-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.chatbot-input {
    flex: 1;
    border: 1px solid var(--chatbot-border);
    border-radius: var(--chatbot-radius-sm);
    padding: 12px 16px;
    font-size: 14px;
    font-family: inherit;
    background: var(--chatbot-bg);
    color: var(--chatbot-text);
    resize: none;
    min-height: 44px;
    max-height: 120px;
    transition: all 0.2s ease;
}

.chatbot-input:focus {
    outline: none;
    border-color: var(--chatbot-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.chatbot-input::placeholder {
    color: var(--chatbot-text-muted);
}

.chatbot-send-btn {
    width: 44px;
    height: 44px;
    background: var(--chatbot-primary);
    border: none;
    border-radius: var(--chatbot-radius-sm);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.chatbot-send-btn:hover:not(:disabled) {
    background: var(--chatbot-primary-hover);
    transform: translateY(-1px);
}

.chatbot-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.chatbot-input-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    font-size: 12px;
}

.chatbot-char-count {
    color: var(--chatbot-text-muted);
}

.chatbot-quick-actions {
    display: flex;
    gap: 8px;
}

.chatbot-quick-btn {
    background: none;
    border: 1px solid var(--chatbot-border);
    border-radius: 16px;
    padding: 4px 12px;
    font-size: 11px;
    color: var(--chatbot-text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.chatbot-quick-btn:hover {
    background: var(--chatbot-surface);
    color: var(--chatbot-text);
    border-color: var(--chatbot-primary);
}

/* כפתורי פעולה */
.chatbot-actions {
    position: absolute;
    bottom: 16px;
    left: 16px;
    display: flex;
    gap: 8px;
}

.chatbot-action-btn {
    width: 32px;
    height: 32px;
    background: var(--chatbot-surface);
    border: 1px solid var(--chatbot-border);
    border-radius: 50%;
    color: var(--chatbot-text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.chatbot-action-btn:hover {
    background: var(--chatbot-primary);
    color: white;
    border-color: var(--chatbot-primary);
}

/* מודל משוב */
.chatbot-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000000;
    animation: chatbot-fade-in 0.2s ease;
}

@keyframes chatbot-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.chatbot-modal-content {
    background: var(--chatbot-bg);
    border-radius: var(--chatbot-radius);
    box-shadow: var(--chatbot-shadow-lg);
    width: 90%;
    max-width: 400px;
    animation: chatbot-modal-slide 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes chatbot-modal-slide {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.chatbot-modal-header {
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--chatbot-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chatbot-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--chatbot-text);
}

.chatbot-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--chatbot-text-muted);
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-modal-body {
    padding: 20px 24px 24px;
}

.chatbot-rating {
    margin-bottom: 16px;
}

.chatbot-rating span {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--chatbot-text);
}

.chatbot-stars {
    display: flex;
    gap: 4px;
}

.chatbot-star {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--chatbot-border);
    cursor: pointer;
    transition: all 0.2s ease;
}

.chatbot-star:hover,
.chatbot-star.active {
    color: var(--chatbot-warning);
}

#chatbot-feedback-text {
    width: 100%;
    border: 1px solid var(--chatbot-border);
    border-radius: var(--chatbot-radius-sm);
    padding: 12px;
    font-family: inherit;
    font-size: 14px;
    background: var(--chatbot-bg);
    color: var(--chatbot-text);
    resize: vertical;
    margin-bottom: 16px;
}

#chatbot-feedback-text:focus {
    outline: none;
    border-color: var(--chatbot-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.chatbot-modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.chatbot-btn {
    padding: 10px 20px;
    border-radius: var(--chatbot-radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.chatbot-btn-primary {
    background: var(--chatbot-primary);
    color: white;
}

.chatbot-btn-primary:hover {
    background: var(--chatbot-primary-hover);
}

.chatbot-btn-secondary {
    background: var(--chatbot-surface);
    color: var(--chatbot-text);
    border: 1px solid var(--chatbot-border);
}

.chatbot-btn-secondary:hover {
    background: var(--chatbot-border);
}

/* רספונסיביות */
@media (max-width: 480px) {
    .chatbot-widget {
        bottom: 10px;
        right: 10px;
        left: 10px;
    }
    
    .chatbot-window {
        width: 100%;
        height: 70vh;
        bottom: 70px;
        right: 0;
        left: 0;
        border-radius: var(--chatbot-radius) var(--chatbot-radius) 0 0;
    }
    
    .chatbot-toggle {
        width: 56px;
        height: 56px;
        position: fixed;
        bottom: 16px;
        right: 16px;
    }
}

/* אנימציות נוספות */
.chatbot-message {
    animation: chatbot-message-appear 0.3s ease;
}

@keyframes chatbot-message-appear {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* מצב טעינה */
.chatbot-loading .chatbot-send-btn {
    animation: chatbot-spin 1s linear infinite;
}

@keyframes chatbot-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* הודעות שגיאה */
.chatbot-error-message {
    background: var(--chatbot-error) !important;
    color: white !important;
}

.chatbot-error-message::before {
    content: '⚠️ ';
}

/* הודעות הצלחה */
.chatbot-success-message {
    background: var(--chatbot-success) !important;
    color: white !important;
}

.chatbot-success-message::before {
    content: '✅ ';
}