/* * Plugin CSS for SmartChat AI Pro
 */

:root {
    --sc-bg: #ffffff;
    --sc-text: #1e293b;
    --sc-gray: #f8fafc;
    --sc-shadow: 0 12px 40px rgba(0,0,0,0.15);
    /* --sc-primary سيتم تعريفها ديناميكياً من PHP */
}

#smartchat-wrapper {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    z-index: 999999;
    position: fixed;
    bottom: 0;
    line-height: 1.5;
    box-sizing: border-box;
}
#smartchat-wrapper * { box-sizing: border-box; }

/* Bubble */
#smartchat-bubble {
    position: fixed; bottom: 20px; width: 60px; height: 60px;
    background: var(--sc-primary); color: #fff; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; box-shadow: 0 4px 20px rgba(0,0,0,0.25);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1000000; line-height: 0; padding: 0;
}
#smartchat-bubble svg { width: 30px; height: 30px; fill: white; display: block; margin: auto; }
#smartchat-bubble:hover { transform: scale(1.1); }
#smartchat-bubble .icon-close { display: none; font-size: 24px; line-height: 1; }
#smartchat-bubble.opened .icon-open { display: none; }
#smartchat-bubble.opened .icon-close { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; }
#smartchat-bubble.opened { transform: rotate(90deg); background: #1e293b; }

/* Window */
#smartchat-window {
    position: fixed; bottom: 90px; width: 380px; height: 600px;
    max-height: 80vh; max-width: 90vw; background: var(--sc-bg);
    border-radius: 20px; box-shadow: var(--sc-shadow);
    display: none; flex-direction: column; overflow: hidden;
    opacity: 0; transition: all 0.3s ease; border: 1px solid rgba(0,0,0,0.08);
}
#smartchat-window.show { display: flex; opacity: 1; animation: sc-slide-in 0.3s forwards; }

@keyframes sc-slide-in {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Header */
.sc-header {
    background: linear-gradient(135deg, var(--sc-primary), #1e293b); /* Fallback gradient */
    padding: 20px; display: flex; justify-content: space-between;
    align-items: center; color: white; flex-shrink: 0;
}
.sc-header-info { display: flex; align-items: center; gap: 12px; }
.sc-avatar { position: relative; width: 45px; height: 45px; }
.sc-avatar img { width: 100%; height: 100%; border-radius: 50%; border: 2px solid rgba(255,255,255,0.8); object-fit: cover; }
.sc-status-dot { position: absolute; bottom: 0; right: 0; width: 12px; height: 12px; background: #22c55e; border-radius: 50%; border: 2px solid #fff; }
.sc-title-group { display: flex; flex-direction: column; }
.sc-bot-name { font-weight: 700; font-size: 16px; margin: 0; }
.sc-bot-status { font-size: 12px; opacity: 0.9; margin: 0; }
#sc-close-btn { background: none; border: none; color: rgba(255,255,255,0.8); font-size: 20px; cursor: pointer; padding: 0; margin: 0; }

/* Chat Body */
.sc-body-container { flex: 1; position: relative; overflow-y: auto; overflow-x: hidden; background: #fff; padding-bottom: 20px; }
.sc-view { position: absolute; top: 0; left: 0; width: 100%; min-height: 100%; padding: 25px; display: none; flex-direction: column; opacity: 0; transition: opacity 0.4s ease; }
.sc-view.active { display: flex; opacity: 1; z-index: 10; position: relative; }

/* Form Elements */
.sc-form-welcome { background: #f8fafc; padding: 15px; border-radius: 12px; margin-bottom: 25px; display: flex; gap: 10px; align-items: flex-start; border: 1px solid #e2e8f0; }
.sc-welcome-icon { font-size: 20px; }
.sc-welcome-text { font-size: 14px; color: #475569; line-height: 1.5; }
.sc-form-fields-wrapper { display: flex; flex-direction: column; gap: 18px; margin-bottom: 25px; }
.sc-field-group label { display: block; font-size: 13px; font-weight: 600; color: #334155; margin-bottom: 6px; }
.sc-input-field { width: 100%; padding: 14px 16px; background: #fff; border: 1px solid #cbd5e1; border-radius: 10px; font-size: 14px; transition: all 0.2s ease; outline: none; }
.sc-input-field:focus { border-color: var(--sc-primary); box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1); }
.sc-send-btn { background: var(--sc-primary); color: white; border: none; padding: 15px; border-radius: 12px; font-weight: 700; font-size: 15px; cursor: pointer; transition: 0.3s; margin-top: auto; box-shadow: 0 4px 15px rgba(0,0,0,0.1); }
.sc-send-btn:hover { transform: translateY(-2px); opacity: 0.9; }

/* Loading */
#sc-view-loading { align-items: center; justify-content: center; text-align: center; height: 100%; }
.sc-ai-pulse { position: relative; width: 80px; height: 80px; display: flex; align-items: center; justify-content: center; margin-bottom: 25px; }
.pulse-avatar { z-index: 2; width: 60px; height: 60px; border-radius: 50%; overflow: hidden; border: 3px solid #fff; box-shadow: 0 4px 10px rgba(0,0,0,0.1); }
.pulse-avatar img { width: 100%; height: 100%; object-fit: cover; }
.pulse-ring { position: absolute; width: 100%; height: 100%; border-radius: 50%; border: 2px solid var(--sc-primary); opacity: 0; animation: pulse-ring 2s infinite; }
.pulse-ring.delay { animation-delay: 0.5s; }
@keyframes pulse-ring { 0% { transform: scale(0.8); opacity: 0.5; } 100% { transform: scale(1.5); opacity: 0; } }
.sc-loading-text { font-weight: 600; color: var(--sc-text); animation: fadeText 1.5s infinite alternate; }
@keyframes fadeText { from { opacity: 0.6; } to { opacity: 1; } }

/* Results */
#sc-view-result { align-items: center; padding-top: 10px; }
.sc-result-card { background: #fff; width: 100%; border-radius: 16px; box-shadow: 0 4px 20px rgba(0,0,0,0.06); border: 1px solid #f1f5f9; overflow: hidden; display: flex; flex-direction: column; animation: slideUp 0.5s cubic-bezier(0.165, 0.84, 0.44, 1); margin-bottom: 20px; }
@keyframes slideUp { from { transform: translateY(30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.sc-result-header { background: #f8fafc; padding: 12px 20px; font-weight: 700; font-size: 13px; color: #64748b; border-bottom: 1px solid #e2e8f0; letter-spacing: 0.5px; text-transform: uppercase; }
#sc-result-content { padding: 20px; font-size: 15px; line-height: 1.7; color: #334155; }

.sc-action-area { display: flex; justify-content: center; margin-top: 10px; width: 100%; }
.sc-icon-action-btn { width: 50px; height: 50px; border-radius: 50%; background: #ffffff !important; border: 2px solid #e2e8f0 !important; display: flex !important; align-items: center !important; justify-content: center !important; cursor: pointer; transition: all 0.3s; box-shadow: 0 2px 10px rgba(0,0,0,0.05); padding: 0; }
.sc-icon-action-btn:hover { border-color: var(--sc-primary) !important; transform: rotate(-180deg) scale(1.1); box-shadow: 0 5px 15px rgba(0,0,0,0.1); }
.sc-icon-action-btn svg { stroke: #64748b !important; width: 24px; height: 24px; display: block; margin: auto; }
.sc-icon-action-btn:hover svg { stroke: var(--sc-primary) !important; }

/* Chat Mode */
#smartchat-messages { flex: 1; padding: 20px; overflow-y: auto; background: #f8fafc; display: flex; flex-direction: column; gap: 15px; }
.bot-msg, .user-msg { max-width: 85%; font-size: 14px; position: relative; word-wrap: break-word; }
.bot-msg { align-self: flex-start; }
.bot-msg .msg-content { background: #ffffff; color: var(--sc-text); padding: 12px 16px; border-radius: 0 16px 16px 16px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); border: 1px solid #e2e8f0; }
.user-msg { align-self: flex-end; }
.user-msg .msg-content { background: var(--sc-primary); color: white; padding: 12px 16px; border-radius: 16px 0 16px 16px; box-shadow: 0 4px 10px rgba(0,0,0,0.1); }
.sc-footer { padding: 15px; background: #fff; border-top: 1px solid #f1f5f9; }
.sc-input-group { display: flex; align-items: flex-end; gap: 8px; background: #f8fafc; padding: 8px; border-radius: 12px; border: 1px solid #e2e8f0; }
.sc-input-group:focus-within { border-color: var(--sc-primary); }
#smartchat-input { width: 100%; border: none; background: transparent; resize: none; max-height: 100px; padding: 8px; font-family: inherit; font-size: 14px; outline: none; color: #334155; }
.sc-send-btn-icon { background: var(--sc-primary); border: none; width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: 0.2s; padding: 0; }
.sc-send-btn-icon:hover { transform: scale(1.05); }
.sc-send-btn-icon svg { width: 20px; height: 20px; fill: white !important; }
.sc-branding { text-align: center; font-size: 10px; color: #94a3b8; margin-top: 10px; }
.typing-indicator { display: flex; gap: 4px; padding: 10px 14px; }
.typing-indicator span { width: 6px; height: 6px; background: #94a3b8; border-radius: 50%; animation: typing 1.4s infinite ease-in-out; }
.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }
@keyframes typing { 0%, 80%, 100% { transform: scale(0); } 40% { transform: scale(1); } }