/* Smart Assistant Widget Styles - Universal for All Themes */
#smart-assistant-widget {
    position: fixed !important;
    z-index: 10050 !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif !important;
}

/* No Questions Message */
.no-questions-message {
    text-align: center;
    padding: 20px;
    color: #666;
}

.no-questions-message p {
    margin: 0;
    font-size: 14px;
}

/* Chat Button - Unified for ALL themes - Match Glow Theme Exactly */
/* Reset Luxe theme button styles - DO NOT use all: initial */
#smart-assistant-button,
.smart-assistant-btn {
    /* Reset inherited styles from Luxe */
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    outline: none !important;
    background: transparent !important;
    background-image: none !important;
    box-shadow: none !important;
    text-decoration: none !important;
    font: normal normal normal 14px/1.4 -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif !important;
    color: inherit !important;
    line-height: 1 !important;
    text-align: left !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    word-spacing: normal !important;
    vertical-align: baseline !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    box-sizing: border-box !important;
}

/* Now apply unified button styles - IDENTICAL for Glow and Luxe */
#smart-assistant-button,
.smart-assistant-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    left: auto !important;
    min-width: 60px !important;
    width: auto !important;
    height: 60px !important;
    border-radius: 30px !important;
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%) !important;
    background-image: linear-gradient(135deg, #25D366 0%, #128C7E 100%) !important;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4) !important;
    cursor: pointer !important;
    pointer-events: auto !important;
    color: white !important;
    font-size: 24px !important;
    transition: all 0.3s ease !important;
    z-index: 10050 !important;
    visibility: visible !important;
    opacity: 1 !important;
    padding: 0 20px !important;
    gap: 12px !important;
    margin: 0 !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif !important;
    font-weight: normal !important;
    line-height: 1 !important;
    text-align: left !important;
    -webkit-tap-highlight-color: rgba(37, 211, 102, 0.3) !important;
    box-sizing: border-box !important;
}

#smart-assistant-button:focus,
.smart-assistant-btn:focus {
    outline: 3px solid rgba(37, 211, 102, 0.3) !important;
    outline-offset: 2px !important;
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%) !important;
}

.smart-assistant-text {
    font-size: 16px !important;
    font-weight: 600 !important;
    white-space: nowrap !important;
    display: inline-block !important;
    color: white !important;
    margin: 0 !important;
    padding: 0 !important;
    font-family: inherit !important;
    line-height: 1 !important;
}

/* Override any Luxe theme button styles */
body #smart-assistant-button,
body .smart-assistant-btn {
    background-color: transparent !important;
    border-color: transparent !important;
}

#smart-assistant-button .fas,
.smart-assistant-btn .fas,
#smart-assistant-button i,
.smart-assistant-btn i {
    color: white !important;
    font-size: 24px !important;
    line-height: 1 !important;
    display: inline-block !important;
    margin: 0 !important;
    padding: 0 !important;
}

#smart-assistant-button:hover,
.smart-assistant-btn:hover {
    transform: scale(1.1) !important;
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.6) !important;
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%) !important;
}

#smart-assistant-button:active,
.smart-assistant-btn:active {
    transform: scale(1.05) !important;
}

#smart-assistant-button.right,
.smart-assistant-btn.right {
    bottom: 20px !important;
    right: 20px !important;
    left: auto !important;
}

#smart-assistant-button.left,
.smart-assistant-btn.left {
    bottom: 20px !important;
    left: 20px !important;
    right: auto !important;
}

/* Hide text on mobile */
@media (max-width: 768px) {
    .smart-assistant-btn .smart-assistant-text {
        display: none !important;
    }
    .smart-assistant-btn {
        width: 60px;
        min-width: 60px;
        padding: 0 !important;
        justify-content: center !important;
    }
}

.smart-assistant-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4444;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* Chat Window */
.smart-assistant-window {
    position: fixed;
    width: 380px;
    max-width: 90vw;
    height: 600px;
    max-height: 90vh;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 10051 !important;
}

.smart-assistant-window.right {
    bottom: 90px;
    right: 20px;
}

.smart-assistant-window.left {
    bottom: 90px;
    left: 20px;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header - Unified for all themes */
.smart-assistant-header {
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    color: white;
    padding: 20px;
    display: flex;
    flex-direction: row-reverse; /* زر الإغلاق في اليسار، النص في اليمين */
    justify-content: space-between;
    align-items: center;
    direction: rtl; /* اتجاه RTL للنص العربي */
}

.smart-assistant-header-content {
    flex: 1;
    text-align: right; /* النص في اليمين */
    direction: rtl;
}

.smart-assistant-header-content h5 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    text-align: right;
}

.smart-assistant-header-content p {
    margin: 5px 0 0 0;
    font-size: 14px;
    opacity: 0.9;
    text-align: right;
}

.smart-assistant-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    margin-left: 15px; /* مسافة من النص */
    order: -1; /* زر الإغلاق في البداية (اليسار) */
}

.smart-assistant-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* Body */
.smart-assistant-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
}

.smart-assistant-body::-webkit-scrollbar {
    width: 6px;
}

.smart-assistant-body::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.smart-assistant-body::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.smart-assistant-body::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Messages */
.smart-assistant-message {
    margin-bottom: 15px;
    display: flex;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.smart-assistant-message.bot {
    justify-content: flex-start;
}

.smart-assistant-message.user {
    justify-content: flex-end;
}

.message-content {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
}

.smart-assistant-message.bot .message-content {
    background: white;
    border: 1px solid #e0e0e0;
    border-bottom-right-radius: 4px;
}

.smart-assistant-message.user .message-content {
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    color: white;
    border-bottom-left-radius: 4px;
}

.message-content p {
    margin: 0;
    line-height: 1.5;
}

/* Question Types */
.smart-assistant-question-types {
    margin-top: 20px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.question-type-btn {
    width: 100%;
    padding: 10px 8px;
    margin: 0;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    cursor: pointer;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: #333;
    min-height: 70px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    outline: none;
}

.question-type-btn:hover {
    border-color: #25D366;
    background: linear-gradient(135deg, #f0fff4 0%, #e8f5e9 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(37, 211, 102, 0.2);
}

.question-type-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(37, 211, 102, 0.15);
}

.question-type-btn:focus {
    outline: 2px solid rgba(37, 211, 102, 0.3);
    outline-offset: 2px;
}

.question-type-btn i {
    margin: 5px 0;
    color: #25D366;
    font-size: 20px;
}

.question-type-btn span {
    font-size: 12px;
    line-height: 1.3;
}

/* Answers */
.smart-assistant-answers {
    margin-top: 20px;
}

.answer-item {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 15px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.answer-question {
    font-weight: 600;
    color: #25D366;
    margin-bottom: 10px;
    font-size: 15px;
}

.answer-text {
    color: #666;
    line-height: 1.6;
    font-size: 14px;
}

.back-btn {
    background: #f0f0f0;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 15px;
    color: #666;
    font-size: 14px;
    transition: all 0.2s ease;
}

.back-btn:hover {
    background: #e0e0e0;
}

/* Welcome Message */
.smart-assistant-welcome {
    margin-bottom: 20px;
}

/* Theme-Specific Overrides - Ensure consistency across all themes */
/* Luxe Theme - Critical Fixes - Complete Style Override */
body:has(.social-links-section) #smart-assistant-button {
    bottom: 20px !important;
    right: 20px !important;
}

/* Luxe Theme - Fix pointer-events and z-index */
body #smart-assistant-widget {
    pointer-events: none !important;
    z-index: 10050 !important;
}

/* Luxe Theme - Complete button style override to match Glow */
body #smart-assistant-button,
body .smart-assistant-btn {
    /* Reset all Luxe theme styles */
    all: initial !important;
    /* Apply unified styles */
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    left: auto !important;
    min-width: 60px !important;
    width: auto !important;
    height: 60px !important;
    border-radius: 30px !important;
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%) !important;
    background-image: linear-gradient(135deg, #25D366 0%, #128C7E 100%) !important;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4) !important;
    cursor: pointer !important;
    pointer-events: auto !important;
    color: white !important;
    font-size: 24px !important;
    transition: all 0.3s ease !important;
    z-index: 10050 !important;
    visibility: visible !important;
    opacity: 1 !important;
    padding: 0 20px !important;
    gap: 12px !important;
    border: none !important;
    outline: none !important;
    margin: 0 !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif !important;
    font-weight: normal !important;
    line-height: 1 !important;
    text-decoration: none !important;
    text-align: left !important;
    -webkit-tap-highlight-color: rgba(37, 211, 102, 0.3) !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    box-sizing: border-box !important;
    text-transform: none !important;
    vertical-align: baseline !important;
}

body #smart-assistant-button:hover,
body .smart-assistant-btn:hover {
    transform: scale(1.1) !important;
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.6) !important;
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%) !important;
}

body #smart-assistant-window {
    pointer-events: auto !important;
    z-index: 10051 !important;
}

body #smart-assistant-window * {
    pointer-events: auto !important;
}

/* Glow Theme - Match Luxe styling */
body #smart-assistant-widget,
body #smart-assistant-button {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif !important;
}

/* Ensure widget is above all theme elements */
.social-links-section ~ #smart-assistant-widget,
#smart-assistant-widget {
    z-index: 10050 !important;
}

/* Responsive - Mobile Small */
@media (max-width: 480px) {
    .smart-assistant-window {
        width: 100vw !important;
        height: 100vh !important;
        max-height: 100vh !important;
        border-radius: 0 !important;
        bottom: 0 !important;
        right: 0 !important;
        left: 0 !important;
        z-index: 10051 !important;
    }
    
    .smart-assistant-btn {
        width: 50px !important;
        height: 50px !important;
        min-width: 50px !important;
        font-size: 20px !important;
        padding: 0 !important;
        bottom: 15px !important;
        right: 15px !important;
    }
    
    .smart-assistant-btn .smart-assistant-text {
        display: none !important;
    }
    
    .smart-assistant-question-types {
        grid-template-columns: 1fr !important;
        gap: 8px !important;
    }
    
    .question-type-btn {
        min-height: 60px !important;
        padding: 8px 6px !important;
        font-size: 12px !important;
    }
    
    .question-type-btn i {
        font-size: 18px !important;
    }
    
    .smart-assistant-header {
        padding: 15px !important;
    }
    
    .smart-assistant-header-content h5 {
        font-size: 16px !important;
    }
    
    .smart-assistant-header-content p {
        font-size: 12px !important;
    }
    
    .smart-assistant-body {
        padding: 15px !important;
    }
}

/* Responsive - Mobile Medium */
@media (min-width: 481px) and (max-width: 768px) {
    .smart-assistant-window {
        width: 90vw !important;
        max-width: 400px !important;
        height: 85vh !important;
        max-height: 700px !important;
        z-index: 10051 !important;
    }
    
    .smart-assistant-btn {
        width: 55px !important;
        height: 55px !important;
        min-width: 55px !important;
        font-size: 22px !important;
        bottom: 15px !important;
        right: 15px !important;
    }
    
    .smart-assistant-btn .smart-assistant-text {
        display: none !important;
    }
    
    .smart-assistant-question-types {
        grid-template-columns: 1fr 1fr !important;
        gap: 10px !important;
    }
    
    .question-type-btn {
        min-height: 65px !important;
        padding: 9px 7px !important;
        font-size: 12px !important;
    }
}

/* Responsive - Tablet */
@media (min-width: 769px) and (max-width: 1024px) {
    .smart-assistant-window {
        width: 400px !important;
        height: 650px !important;
        max-height: 80vh !important;
        z-index: 10051 !important;
    }
    
    .smart-assistant-btn {
        width: 60px !important;
        height: 60px !important;
    }
    
    .smart-assistant-question-types {
        grid-template-columns: 1fr 1fr !important;
        gap: 12px !important;
    }
    
    .question-type-btn {
        min-height: 75px !important;
        padding: 12px 10px !important;
        font-size: 13px !important;
    }
}

/* Responsive - Desktop Large */
@media (min-width: 1025px) {
    .smart-assistant-window {
        width: 420px !important;
        height: 650px !important;
        max-height: 85vh !important;
        z-index: 10051 !important;
    }
    
    .smart-assistant-question-types {
        gap: 12px !important;
    }
    
    .question-type-btn {
        min-height: 80px !important;
        padding: 12px 10px !important;
        font-size: 14px !important;
    }
    
    .question-type-btn i {
        font-size: 22px !important;
    }
}

/* Responsive - Very Large Screens */
@media (min-width: 1440px) {
    .smart-assistant-window {
        width: 450px !important;
        height: 700px !important;
        z-index: 10051 !important;
    }
    
    .question-type-btn {
        min-height: 85px !important;
        padding: 14px 12px !important;
        font-size: 15px !important;
    }
    
    .question-type-btn i {
        font-size: 24px !important;
    }
}

/* RTL Support */
[dir="rtl"] .smart-assistant-message.bot {
    justify-content: flex-end;
}

[dir="rtl"] .smart-assistant-message.user {
    justify-content: flex-start;
}

[dir="rtl"] .question-type-btn {
    text-align: center;
}

[dir="rtl"] .question-type-btn:hover {
    transform: translateY(-2px);
}

[dir="rtl"] .question-type-btn i {
    margin: 5px 0;
}
