/* ============================================================
   WA Click Tracker – Frontend Chat Box Styles
   ============================================================ */

/* ---- Launcher overrides ---- */
#wact-widget {
    pointer-events: none; /* Let clicks pass through to child elements */
}
.wact-launchers-stack, .wact-launcher, .wact-whatsapp-launcher, .wact-chatbox {
    pointer-events: auto; /* Re-enable clicks for actual interactive widget components */
}

.wact-launcher {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--wact-color, #25D366);
    border-radius: 50%;
    box-shadow: 0 4px 20px rgba(37, 211, 102, 0.45), 0 2px 8px rgba(0,0,0,0.3);
    transition: transform 0.25s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.25s;
    color: #fff;
    cursor: pointer;
}
.wact-launcher:hover {
    transform: scale(1.12);
    box-shadow: 0 6px 28px rgba(37, 211, 102, 0.6), 0 4px 12px rgba(0,0,0,0.3);
}

/* Launcher sizes matching main classes */
.wact-size-small  .wact-launcher { width: 48px; height: 48px; }
.wact-size-small  .wact-launcher svg { width: 24px; height: 24px; }
.wact-size-medium .wact-launcher { width: 60px; height: 60px; }
.wact-size-medium .wact-launcher svg { width: 30px; height: 30px; }
.wact-size-large  .wact-launcher { width: 72px; height: 72px; }
.wact-size-large  .wact-launcher svg { width: 36px; height: 36px; }

/* ---- Chat Box Window ---- */
.wact-chatbox {
    position: absolute;
    width: 330px;
    height: 440px;
    background: linear-gradient(135deg, #111827 0%, #1f2937 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.6);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #e5e7eb;
    animation: wactSlideIn 0.3s cubic-bezier(0.34,1.56,0.64,1);
}

@keyframes wactSlideIn {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Chatbox Positioning based on Widget Corner */
.wact-position-bottom-right .wact-chatbox { bottom: 148px; right: 0; }
.wact-position-bottom-left  .wact-chatbox { bottom: 148px; left: 0; }
.wact-position-top-right    .wact-chatbox { top: 148px; right: 0; }
.wact-position-top-left     .wact-chatbox { top: 148px; left: 0; }

/* Adjust heights for launcher sizes */
.wact-size-small.wact-position-bottom-right .wact-chatbox { bottom: 120px; }
.wact-size-small.wact-position-bottom-left  .wact-chatbox { bottom: 120px; }
.wact-size-large.wact-position-bottom-right .wact-chatbox { bottom: 168px; }
.wact-size-large.wact-position-bottom-left  .wact-chatbox { bottom: 168px; }

/* Header */
.wact-chatbox-header {
    background: #0f172a;
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.wact-chatbox-header-title h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #f3f4f6;
}
.wact-chatbox-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    margin-top: 2px;
}
.wact-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}
.wact-chatbox-status.online .wact-status-dot { background: #25D366; }
.wact-chatbox-status.online .wact-status-text { color: #25D366; }
.wact-chatbox-status.offline .wact-status-dot { background: #9ca3af; }
.wact-chatbox-status.offline .wact-status-text { color: #9ca3af; }

.wact-chatbox-close {
    background: transparent;
    border: none;
    color: #9ca3af;
    font-size: 22px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}
.wact-chatbox-close:hover {
    color: #f3f4f6;
}

/* Messages Feed */
.wact-chatbox-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #0b0f19;
}
.wact-chatbox-msg {
    display: flex;
    width: 100%;
}
.wact-chatbox-msg.msg-received { justify-content: flex-start; }
.wact-chatbox-msg.msg-sent { justify-content: flex-end; }

.wact-chatbox-bubble {
    max-width: 80%;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.4;
    word-break: break-word;
}
.wact-chatbox-msg.msg-received .wact-chatbox-bubble {
    background: #1f2937;
    color: #e5e7eb;
    border-bottom-left-radius: 2px;
    border: 1px solid #374151;
}
.wact-chatbox-msg.msg-sent .wact-chatbox-bubble {
    background: var(--wact-color, #25D366);
    color: #fff;
    border-bottom-right-radius: 2px;
}

/* Form & Input */
.wact-chatbox-form {
    display: flex;
    padding: 12px;
    background: #0f172a;
    border-top: 1px solid rgba(255,255,255,0.08);
    gap: 8px;
}
.wact-chatbox-input {
    flex: 1;
    background: #0b0f19;
    color: #e5e7eb;
    border: 1px solid #374151;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 13px;
    box-sizing: border-box;
}
.wact-chatbox-input:focus {
    outline: none;
    border-color: var(--wact-color, #25D366);
}
.wact-chatbox-send-btn {
    background: var(--wact-color, #25D366);
    color: #fff;
    border: none;
    border-radius: 6px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    flex-shrink: 0;
}

/* Footer / Direct Link */
.wact-chatbox-footer {
    padding: 10px;
    background: #0b0f19;
    border-top: 1px solid rgba(255,255,255,0.05);
    text-align: center;
}
.wact-chatbox-wa-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: #25D366 !important;
    text-decoration: none !important;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.wact-chatbox-wa-link:hover {
    text-decoration: underline !important;
}
.wact-chatbox-wa-link svg {
    flex-shrink: 0;
}

/* ---- Stacked Dual Launchers ---- */
.wact-launchers-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    position: relative;
}

/* WhatsApp direct launcher button */
.wact-whatsapp-launcher {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #25D366;
    border-radius: 50%;
    box-shadow: 0 4px 20px rgba(37, 211, 102, 0.45), 0 2px 8px rgba(0,0,0,0.3);
    transition: transform 0.25s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.25s;
    color: #fff;
    cursor: pointer;
    text-decoration: none;
    z-index: 2;
}
.wact-whatsapp-launcher:hover {
    transform: scale(1.12);
    box-shadow: 0 6px 28px rgba(37, 211, 102, 0.65), 0 4px 12px rgba(0,0,0,0.3);
    color: #fff;
}

/* Icon inside WA launcher */
.wact-icon-wa {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Launcher sizes for WA button */
.wact-size-small  .wact-whatsapp-launcher { width: 48px; height: 48px; }
.wact-size-medium .wact-whatsapp-launcher { width: 60px; height: 60px; }
.wact-size-large  .wact-whatsapp-launcher { width: 72px; height: 72px; }

/* Live Chat launcher overrides (uses --wact-color as background) */
.wact-launcher {
    background: #334155 !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.35), 0 2px 8px rgba(0,0,0,0.3) !important;
}
.wact-launcher:hover {
    box-shadow: 0 6px 28px rgba(0,0,0,0.5), 0 4px 12px rgba(0,0,0,0.3) !important;
}

/* Tooltip adjustments for stacked launchers */
.wact-tooltip-chat,
.wact-tooltip-wa {
    white-space: nowrap;
    font-size: 11px;
    padding: 5px 10px;
}
.wact-position-bottom-right .wact-tooltip-chat,
.wact-position-bottom-right .wact-tooltip-wa,
.wact-position-top-right    .wact-tooltip-chat,
.wact-position-top-right    .wact-tooltip-wa {
    right: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%) translateX(6px);
    opacity: 0;
    transition: opacity 0.2s, transform 0.2s;
}
.wact-launcher:hover .wact-tooltip-chat,
.wact-whatsapp-launcher:hover .wact-tooltip-wa {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

.wact-position-bottom-left .wact-tooltip-chat,
.wact-position-bottom-left .wact-tooltip-wa,
.wact-position-top-left    .wact-tooltip-chat,
.wact-position-top-left    .wact-tooltip-wa {
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%) translateX(-6px);
    opacity: 0;
    transition: opacity 0.2s, transform 0.2s;
}
.wact-position-bottom-left .wact-launcher:hover .wact-tooltip-chat,
.wact-position-bottom-left .wact-whatsapp-launcher:hover .wact-tooltip-wa,
.wact-position-top-left    .wact-launcher:hover .wact-tooltip-chat,
.wact-position-top-left    .wact-whatsapp-launcher:hover .wact-tooltip-wa {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

/* ---- Light Theme Overrides ---- */
.wact-theme-light .wact-chatbox {
    background: #ffffff;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
    border: 1px solid #e5e7eb;
}
.wact-theme-light .wact-chatbox-header {
    /* Header keeps the brand color, no change needed unless requested */
}
.wact-theme-light .wact-chatbox-body {
    background: #f3f4f6;
}
.wact-theme-light .wact-chat-message-admin .wact-chat-bubble {
    background: #ffffff;
    color: #1f2937;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 4px;
}
.wact-theme-light .wact-chat-message-visitor .wact-chat-bubble {
    background: var(--wact-color);
    color: #ffffff;
    border-bottom-right-radius: 4px;
}
.wact-theme-light .wact-chat-timestamp {
    color: #6b7280;
}
.wact-theme-light .wact-chatbox-footer {
    background: #ffffff;
    border-top: 1px solid #e5e7eb;
}
.wact-theme-light .wact-chatbox-input-wrap {
    background: #f9fafb;
    border: 1px solid #d1d5db;
}
.wact-theme-light .wact-chatbox-input {
    color: #111827;
}
.wact-theme-light .wact-chatbox-input::placeholder {
    color: #9ca3af;
}
.wact-theme-light .wact-chatbox-send {
    color: var(--wact-color);
}
.wact-theme-light .wact-chatbox-wa-link {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #e5e7eb;
}
.wact-theme-light .wact-chatbox-wa-link:hover {
    background: #e5e7eb;
}
