/**
 * AI Chat-SJPRO Elementor Widgets
 */

/* ================================================================
   Full Chatbot Widget  — inline embed of the complete chatbot UI
   ================================================================ */

.aicpro-fw-widget {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-width: 280px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    box-sizing: border-box;
}

/* ── Header ────────────────────────────────────────────────────── */
.aicpro-fw-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--aichatbot-primary-color, #0073aa);
    color: #fff;
    flex-shrink: 0;
    border-radius: 12px 12px 0 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    cursor: default;
}

.aicpro-fw-header-avatar {
    position: relative;
    flex-shrink: 0;
}

.aicpro-fw-header-avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.6);
    display: block;
    object-fit: cover;
}

.aicpro-fw-status-dot {
    position: absolute;
    bottom: 1px;
    right: 1px;
    width: 11px;
    height: 11px;
    background: #4ade80;
    border-radius: 50%;
    border: 2px solid #fff;
    animation: aicpro-fw-blink 2.5s infinite;
}

@keyframes aicpro-fw-blink {
    0%,100% { opacity: 1; }
    50%      { opacity: 0.55; }
}

.aicpro-fw-header-info {
    flex: 1;
    min-width: 0;
}

.aicpro-fw-header-title {
    font-size: 15px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0 0 2px;
}

.aicpro-fw-header-subtitle {
    font-size: 12px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 4px;
}

.aicpro-fw-online {
    font-weight: 600;
    color: #a7f3d0;
}

.aicpro-fw-header-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.aicpro-fw-btn-icon {
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: background 0.2s;
    line-height: 1;
    padding: 0;
}

.aicpro-fw-btn-icon:hover {
    background: rgba(255,255,255,0.35);
}

/* ── Messages area ─────────────────────────────────────────────── */
.aicpro-fw-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 16px 8px;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 0;
    scroll-behavior: smooth;
}

.aicpro-fw-messages::-webkit-scrollbar { width: 5px; }
.aicpro-fw-messages::-webkit-scrollbar-track { background: transparent; }
.aicpro-fw-messages::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }
.aicpro-fw-messages::-webkit-scrollbar-thumb:hover { background: #999; }

/* Reuse existing message bubble classes from frontend.css */
.aicpro-fw-messages .ai-chat-sjpro-message          { margin-bottom: 14px; }
.aicpro-fw-messages .ai-chat-sjpro-chips            { margin-bottom: 10px; }
.aicpro-fw-messages .ai-chat-sjpro-product-grid     { margin-bottom: 10px; }
.aicpro-fw-messages .ai-chat-sjpro-order-card       { margin-bottom: 10px; }

/* ── Typing indicator ──────────────────────────────────────────── */
.aicpro-fw-typing-indicator {
    display: inline-flex;
    gap: 4px;
    padding: 10px 14px;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    margin-bottom: 12px;
    align-self: flex-start;
}

.aicpro-fw-typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #999;
    animation: aicpro-fw-typing 1.4s infinite ease-in-out;
    display: block;
}

.aicpro-fw-typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.aicpro-fw-typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

@keyframes aicpro-fw-typing {
    0%,80%,100% { transform: scale(0); opacity: 0.5; }
    40%         { transform: scale(1); opacity: 1; }
}

/* ── Input area ────────────────────────────────────────────────── */
.aicpro-fw-input-area {
    padding: 12px 16px;
    background: #fff;
    border-top: 1px solid #e9ecef;
    flex-shrink: 0;
}

.aicpro-fw-input-wrap {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 24px;
    padding: 6px 6px 6px 14px;
}

.aicpro-fw-input {
    flex: 1;
    border: none;
    background: transparent;
    resize: none;
    font-size: 14px;
    line-height: 1.4;
    max-height: 90px;
    min-height: 20px;
    font-family: inherit;
    padding: 4px 0;
    outline: none;
}

.aicpro-fw-send-btn {
    background: var(--aichatbot-primary-color, #0073aa);
    border: none;
    color: #fff;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s, transform 0.15s;
    padding: 0;
}

.aicpro-fw-send-btn:hover  { background: var(--aichatbot-secondary-color, #005a87); transform: scale(1.07); }
.aicpro-fw-send-btn:active { transform: scale(0.96); }

.aicpro-fw-icon-send::before { content: "➤"; font-size: 14px; }

/* ── Quick action bar ──────────────────────────────────────────── */
.aicpro-fw-quick-actions {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    padding: 8px 12px 10px;
    background: #fff;
    border-top: 1px solid #e9ecef;
    flex-shrink: 0;
}

.aicpro-fw-quick-btn {
    flex: 1;
    min-width: 58px;
    padding: 6px 5px;
    background: #f0f4ff;
    border: 1px solid #dce3f5;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.18s, color 0.18s, transform 0.12s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    color: #4a5568;
    line-height: 1.2;
    text-align: center;
    font-family: inherit;
}

.aicpro-fw-quick-btn:hover {
    background: var(--aichatbot-primary-color, #0073aa);
    color: #fff;
    border-color: var(--aichatbot-primary-color, #0073aa);
    transform: translateY(-1px);
}

/* ── Theme variants ────────────────────────────────────────────── */

/* Dark */
.ai-chat-sjpro-theme-dark .aicpro-fw-widget           { background: #2d3748; color: #fff; }
.ai-chat-sjpro-theme-dark .aicpro-fw-messages         { background: #1a202c; }
.ai-chat-sjpro-theme-dark .aicpro-fw-input-area,
.ai-chat-sjpro-theme-dark .aicpro-fw-quick-actions    { background: #2d3748; border-color: #4a5568; }
.ai-chat-sjpro-theme-dark .aicpro-fw-input-wrap       { background: #4a5568; border-color: #718096; }
.ai-chat-sjpro-theme-dark .aicpro-fw-input            { color: #fff; }
.ai-chat-sjpro-theme-dark .aicpro-fw-quick-btn        { background: #4a5568; border-color: #718096; color: #fff; }

/* Modern */
.ai-chat-sjpro-theme-modern .aicpro-fw-widget         { border-radius: 20px; box-shadow: 0 10px 30px rgba(0,0,0,0.2); }
.ai-chat-sjpro-theme-modern .aicpro-fw-header         {
    border-radius: 20px 20px 0 0;
    background: linear-gradient(135deg, var(--aichatbot-primary-color, #0073aa), var(--aichatbot-secondary-color, #005a87)) !important;
}

/* Light */
.ai-chat-sjpro-theme-light .aicpro-fw-header          { background: #f8f9fa !important; color: #333; }

/* Minimal */
.ai-chat-sjpro-theme-minimal .aicpro-fw-widget        { border: 1px solid #e9ecef; box-shadow: 0 2px 10px rgba(0,0,0,0.08); }
.ai-chat-sjpro-theme-minimal .aicpro-fw-header        { background: #fff !important; color: #333; border-bottom: 1px solid #e9ecef; }
.ai-chat-sjpro-theme-minimal .aicpro-fw-status-dot    { border-color: #fff; }

/* Glass / Ocean */
.ai-chat-sjpro-theme-glass .aicpro-fw-widget {
    background: linear-gradient(180deg, #0B2340 0%, #04131F 100%);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.12);
    box-shadow: 0 24px 64px rgba(0,0,0,0.55);
}
.ai-chat-sjpro-theme-glass .aicpro-fw-header {
    background: linear-gradient(135deg, rgba(0,174,239,0.35) 0%, rgba(11,35,64,0.85) 100%) !important;
    border-bottom: 1px solid rgba(255,255,255,0.12);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}
.ai-chat-sjpro-theme-glass .aicpro-fw-messages {
    background: linear-gradient(180deg, rgba(7,27,46,0.92) 0%, rgba(4,19,31,0.96) 100%);
}
.ai-chat-sjpro-theme-glass .aicpro-fw-input-area,
.ai-chat-sjpro-theme-glass .aicpro-fw-quick-actions {
    background: rgba(4,19,31,0.9);
    border-color: rgba(255,255,255,0.12);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
.ai-chat-sjpro-theme-glass .aicpro-fw-input-wrap {
    background: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.1);
}
.ai-chat-sjpro-theme-glass .aicpro-fw-input          { color: rgba(255,255,255,0.9); }
.ai-chat-sjpro-theme-glass .aicpro-fw-input::placeholder { color: rgba(255,255,255,0.35); }
.ai-chat-sjpro-theme-glass .aicpro-fw-quick-btn {
    background: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.85);
}
.ai-chat-sjpro-theme-glass .aicpro-fw-quick-btn:hover {
    background: rgba(0,174,239,0.22);
    border-color: rgba(0,174,239,0.45);
    color: #fff;
}
.ai-chat-sjpro-theme-glass .aicpro-fw-send-btn {
    background: linear-gradient(135deg, #00AEEF 0%, #4F8EFF 100%);
}
.ai-chat-sjpro-theme-glass .aicpro-fw-typing-indicator {
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.12);
}
.ai-chat-sjpro-theme-glass .aicpro-fw-typing-indicator span { background: rgba(0,174,239,0.7); }

/* Disclaimer theme overrides for full chatbot widget */
.ai-chat-sjpro-theme-dark .ai-chat-sjpro-disclaimer {
    background: #2d3748;
    color: rgba(255, 255, 255, 0.5);
    border-top-color: #4a5568;
}
.ai-chat-sjpro-theme-glass .ai-chat-sjpro-disclaimer {
    background: rgba(4, 19, 31, 0.85);
    color: rgba(255, 255, 255, 0.4);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width: 480px) {
    .aicpro-fw-widget { border-radius: 8px; }
    .aicpro-fw-header { border-radius: 8px 8px 0 0; }
    .aicpro-fw-quick-btn { min-width: calc(33.333% - 6px); }
}

.ai-chat-sjpro-elementor-widget {
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.ai-chat-sjpro-widget-title {
    margin: 0 0 15px;
    font-size: 1.25rem;
    font-weight: 600;
}

.ai-chat-sjpro-widget-notice {
    padding: 12px 15px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    color: #6b7280;
    font-size: 0.95rem;
}

/* Tracking Widget */
.ai-chat-sjpro-tracking-widget .ai-chat-sjpro-tracking-form {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
}

.ai-chat-sjpro-tracking-widget .ai-chat-sjpro-tracking-input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.95rem;
    line-height: 1.4;
}

.ai-chat-sjpro-tracking-widget .ai-chat-sjpro-tracking-submit {
    padding: 10px 18px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: background 0.2s ease;
}

.ai-chat-sjpro-tracking-widget .ai-chat-sjpro-tracking-submit:hover {
    background: #1d4ed8;
}

.ai-chat-sjpro-tracking-widget .ai-chat-sjpro-tracking-result {
    padding: 15px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    margin-bottom: 15px;
}

.ai-chat-sjpro-tracking-widget .ai-chat-sjpro-tracking-result p {
    margin: 0 0 8px;
}

.ai-chat-sjpro-tracking-widget .ai-chat-sjpro-tracking-result .ai-chat-sjpro-tracking-status {
    display: inline-block;
    padding: 4px 10px;
    background: #dbeafe;
    color: #1e40af;
    border-radius: 9999px;
    font-size: 0.85rem;
    font-weight: 500;
}

.ai-chat-sjpro-tracking-widget .ai-chat-sjpro-tracking-recent h4 {
    margin: 0 0 10px;
    font-size: 1rem;
}

.ai-chat-sjpro-tracking-widget .ai-chat-sjpro-tracking-recent ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.ai-chat-sjpro-tracking-widget .ai-chat-sjpro-tracking-recent li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #e5e7eb;
}

.ai-chat-sjpro-tracking-widget .ai-chat-sjpro-tracking-recent li:last-child {
    border-bottom: none;
}

.ai-chat-sjpro-tracking-widget .ai-chat-sjpro-tracking-number {
    font-weight: 500;
}

/* Chat Box Widget */
.ai-chat-sjpro-chat-box-widget {
    display: flex;
    flex-direction: column;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.ai-chat-sjpro-chat-box-widget .ai-chat-sjpro-chat-box-header {
    padding: 12px 15px;
    background: #2563eb;
    color: #fff;
}

.ai-chat-sjpro-chat-box-widget .ai-chat-sjpro-chat-box-title {
    font-weight: 600;
}

.ai-chat-sjpro-chat-box-widget .ai-chat-sjpro-chat-box-body {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background: #f9fafb;
}

.ai-chat-sjpro-chat-box-widget .ai-chat-sjpro-chat-messages {
    min-height: 100%;
}

.ai-chat-sjpro-chat-box-widget .ai-chat-sjpro-chat-box-footer {
    display: flex;
    gap: 8px;
    padding: 12px 15px;
    background: #fff;
    border-top: 1px solid #e5e7eb;
}

.ai-chat-sjpro-chat-box-widget .ai-chat-sjpro-chat-input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.95rem;
}

.ai-chat-sjpro-chat-box-widget .ai-chat-sjpro-chat-send {
    padding: 10px 16px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
}

.ai-chat-sjpro-chat-box-widget .ai-chat-sjpro-chat-send:hover {
    background: #1d4ed8;
}

/* User Info Widget */
.ai-chat-sjpro-user-info-widget .ai-chat-sjpro-user-info-card {
    padding: 15px;
    margin-bottom: 15px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.ai-chat-sjpro-user-info-widget .ai-chat-sjpro-user-info-card h4 {
    margin: 0 0 12px;
    font-size: 1rem;
    font-weight: 600;
}

.ai-chat-sjpro-user-info-widget .ai-chat-sjpro-user-info-card p {
    margin: 0 0 8px;
    color: #374151;
}

.ai-chat-sjpro-user-info-widget .ai-chat-sjpro-user-orders {
    list-style: none;
    margin: 0;
    padding: 0;
}

.ai-chat-sjpro-user-info-widget .ai-chat-sjpro-user-orders li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid #f3f4f6;
}

.ai-chat-sjpro-user-info-widget .ai-chat-sjpro-user-orders li:last-child {
    border-bottom: none;
}

.ai-chat-sjpro-user-info-widget .ai-chat-sjpro-order-status {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
}

.ai-chat-sjpro-user-info-widget .ai-chat-sjpro-order-status-pending {
    background: #fef3c7;
    color: #92400e;
}

.ai-chat-sjpro-user-info-widget .ai-chat-sjpro-order-status-processing {
    background: #dbeafe;
    color: #1e40af;
}

.ai-chat-sjpro-user-info-widget .ai-chat-sjpro-order-status-on-hold,
.ai-chat-sjpro-user-info-widget .ai-chat-sjpro-order-status-hold {
    background: #fce7f3;
    color: #9d174d;
}

.ai-chat-sjpro-user-info-widget .ai-chat-sjpro-order-status-completed,
.ai-chat-sjpro-user-info-widget .ai-chat-sjpro-order-status-delivered {
    background: #d1fae5;
    color: #065f46;
}

.ai-chat-sjpro-user-info-widget .ai-chat-sjpro-order-status-cancelled,
.ai-chat-sjpro-user-info-widget .ai-chat-sjpro-order-status-failed {
    background: #fee2e2;
    color: #991b1b;
}

.ai-chat-sjpro-user-info-widget .ai-chat-sjpro-order-date {
    margin-left: auto;
    font-size: 0.85rem;
    color: #6b7280;
}

.ai-chat-sjpro-user-info-widget .ai-chat-sjpro-tracking-stats {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.ai-chat-sjpro-user-info-widget .ai-chat-sjpro-tracking-stat {
    flex: 1;
    min-width: 80px;
    text-align: center;
    padding: 12px;
    background: #f9fafb;
    border-radius: 8px;
}

.ai-chat-sjpro-user-info-widget .ai-chat-sjpro-stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
}

.ai-chat-sjpro-user-info-widget .ai-chat-sjpro-stat-label {
    font-size: 0.8rem;
    color: #6b7280;
    text-transform: uppercase;
}

/* AI Disclaimer */
.ai-chat-sjpro-disclaimer {
    padding: 6px 15px 8px;
    font-size: 10px;
    line-height: 1.4;
    color: #999;
    opacity: 0.6;
    text-align: center;
    border-top: 1px solid #f0f0f0;
}

.ai-chat-sjpro-chat-box-widget .ai-chat-sjpro-disclaimer {
    background: #fff;
}
