/* =============================================
   SUPPORT COMMAND CENTER WIDGET
   Enterprise B2B floating support widget
   ============================================= */

/* Hide default UserWay floating icon — accessibility
   is triggered from inside this widget instead */
.userway_buttons_wrapper,
#userwayBtn,
.uwy .uai {
    display: none !important;
    visibility: hidden !important;
}

/* ── CSS Variables ── */
:root {
    --sw-primary: #2e8795;
    --sw-primary-light: #3a9dac;
    --sw-accent: #2e8795;
    --sw-accent-hover: #247079;
    --sw-whatsapp: #25d366;
    --sw-phone: #3b82f6;
    --sw-email: #8b5cf6;
    --sw-surface: #ffffff;
    --sw-muted: #64748b;
    --sw-border: #e2e8f0;
    --sw-hover: #f8fafc;
    --sw-radius: 16px;
    --sw-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
    --sw-shadow-sm: 0 4px 14px rgba(0,0,0,0.12);
}

/* ── RTL Support ── */
[dir="rtl"] .sw-trigger { left: auto; right: 28px; }
[dir="rtl"] .sw-widget { left: auto; right: 28px; transform-origin: bottom right; }
[dir="rtl"] .sw-row-arrow svg { transform: rotate(180deg); }
[dir="rtl"] .sw-row:hover .sw-row-arrow { transform: translateX(-3px); }
[dir="rtl"] .sw-row:hover { transform: translateX(2px); }
[dir="rtl"] .sw-header::before { right: auto; left: -60px; }

/* ── Trigger FAB Button ── */
.sw-trigger {
    position: fixed;
    bottom: 28px;
    left: 28px;
    z-index: 9999;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--sw-primary);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--sw-shadow-sm);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.3s ease,
                background 0.3s ease;
    outline: none;
}
.sw-trigger:hover {
    transform: scale(1.08);
    box-shadow: 0 8px 25px rgba(15,23,42,0.35);
}
.sw-trigger:active {
    transform: scale(0.95);
}

/* Icon container for animation */
.sw-trigger-icon {
    position: relative;
    width: 26px;
    height: 26px;
}
.sw-trigger-icon svg {
    position: absolute;
    inset: 0;
    width: 26px;
    height: 26px;
    transition: opacity 0.25s ease, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.sw-icon-support {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}
.sw-icon-close {
    opacity: 0;
    transform: rotate(-90deg) scale(0.5);
}
.sw-trigger.sw-active .sw-icon-support {
    opacity: 0;
    transform: rotate(90deg) scale(0.5);
}
.sw-trigger.sw-active .sw-icon-close {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}
.sw-trigger.sw-active {
    background: #ff7f27;
}

/* Pulse ring on trigger */
.sw-trigger::before {
    content: "";
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid var(--sw-accent);
    opacity: 0;
    animation: swPulse 3s ease-in-out infinite;
}
.sw-trigger.sw-active::before {
    animation: none;
    opacity: 0;
}
@keyframes swPulse {
    0%, 100% { opacity: 0; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(1.15); }
}

/* ── Widget Container ── */
.sw-widget {
    position: fixed;
    bottom: 96px;
    left: 28px;
    z-index: 9998;
    width: 380px;
    max-height: 80vh;
    background: var(--sw-surface);
    border-radius: var(--sw-radius);
    border: 1px solid var(--sw-border);
    box-shadow: var(--sw-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;

    /* Hidden by default */
    opacity: 0;
    visibility: hidden;
    transform: translateY(16px) scale(0.95);
    transform-origin: bottom left;
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
                visibility 0.3s;
}
.sw-widget.sw-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* ── Widget Header ── */
.sw-header {
    background: linear-gradient(135deg, var(--sw-primary) 0%, var(--sw-primary-light) 100%);
    padding: 24px 24px 20px;
    position: relative;
    overflow: hidden;
}
.sw-header::before {
    content: "";
    position: absolute;
    width: 200px;
    height: 200px;
    right: -60px;
    top: -80px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 0 0 40px rgba(255,255,255,0.03);
    pointer-events: none;
}
/* Icon next to header title */
.sw-header-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 88px; height: 88px; flex-shrink: 0;
    position: relative; z-index: 1;
}
.sw-header-icon img { width: 88px; height: 88px; object-fit: contain; filter: brightness(10); }

/* Header row: icon + text side by side */
.sw-header-row {
    display: flex; align-items: center; gap: 14px;
    position: relative; z-index: 1;
}
.sw-header-text { flex: 1; min-width: 0; }
.sw-header-title {
    color: #fff;
    font-size: 20px;
    font-weight: 800;
    margin: 0 0 4px;
    letter-spacing: -0.02em;
    position: relative;
    z-index: 1;
}
.sw-header-sub {
    color: rgba(255,255,255,0.6);
    font-size: 13px;
    font-weight: 500;
    margin: 0;
    position: relative;
    z-index: 1;
}
/* Status dot (top-left corner, opposite side) */
.sw-header > .sw-status-dot {
    position: absolute; top: 16px; left: 16px; z-index: 2;
}
[dir="rtl"] .sw-header > .sw-status-dot { left: auto; right: 16px; }
.sw-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    display: inline-block;
    animation: swStatusPulse 2s ease-in-out infinite;
}
@keyframes swStatusPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ── Widget Body ── */
.sw-body {
    padding: 16px;
    overflow-y: auto;
    flex: 1;
}

/* Custom scrollbar */
.sw-body::-webkit-scrollbar { width: 4px; }
.sw-body::-webkit-scrollbar-track { background: transparent; }
.sw-body::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

/* ── Contact Rows ── */
.sw-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: 12px;
    text-decoration: none !important;
    color: var(--sw-primary) !important;
    transition: background 0.2s ease, transform 0.15s ease;
    cursor: pointer;
    border: 1px solid transparent;
}
.sw-row:hover {
    background: var(--sw-hover);
    border-color: var(--sw-border);
    transform: translateX(-2px);
    text-decoration: none !important;
    color: var(--sw-primary) !important;
}
.sw-row + .sw-row {
    margin-top: 4px;
}

/* Icon circle */
.sw-row-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.sw-row-icon svg {
    width: 22px;
    height: 22px;
}
.sw-row-icon--whatsapp { background: rgba(37,211,102,0.12); color: var(--sw-whatsapp); }
.sw-row-icon--phone { background: rgba(59,130,246,0.12); color: var(--sw-phone); }
.sw-row-icon--email { background: rgba(139,92,246,0.12); color: var(--sw-email); }

/* Text */
.sw-row-text {
    flex: 1;
    min-width: 0;
}
.sw-row-title {
    font-size: 15px;
    font-weight: 700;
    margin: 0;
    color: var(--sw-primary);
    line-height: 1.3;
}
.sw-row-sub {
    font-size: 12px;
    color: var(--sw-muted);
    margin: 2px 0 0;
    font-weight: 500;
}

/* Arrow */
.sw-row-arrow {
    color: #cbd5e1;
    flex-shrink: 0;
    transition: transform 0.2s ease, color 0.2s ease;
}
.sw-row-arrow svg {
    width: 18px;
    height: 18px;
}
.sw-row:hover .sw-row-arrow {
    color: var(--sw-accent);
    transform: translateX(3px);
}

/* ── Divider ── */
.sw-divider {
    height: 1px;
    background: var(--sw-border);
    margin: 12px 16px;
}

/* ── Business Hours Block ── */
.sw-hours {
    margin: 8px 16px 4px;
    padding: 12px 14px;
    background: #f1f5f9;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}
.sw-hours-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--sw-muted);
    margin: 0 0 6px;
}
.sw-hours-line {
    font-size: 13px;
    color: var(--sw-primary);
    margin: 0;
    line-height: 1.6;
    font-weight: 500;
}
.sw-hours-line span {
    color: var(--sw-muted);
    font-weight: 400;
}

/* ── Footer ── */
.sw-footer {
    padding: 12px 16px;
    background: #f8fafc;
    border-top: 1px solid var(--sw-border);
}
.sw-footer-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 12px 16px;
    border: none;
    border-radius: 12px;
    background: #747474;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 2px 8px rgba(116,116,116,0.25);
    letter-spacing: 0.3px;
}
.sw-footer-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(116,116,116,0.35);
    filter: brightness(1.1);
}
.sw-footer-btn img {
    width: 22px;
    height: 22px;
}

/* ── Mobile Responsive ── */
@media (max-width: 480px) {
    .sw-widget {
        width: calc(100% - 2rem);
        left: 1rem;
        bottom: 88px;
    }
    [dir="rtl"] .sw-widget {
        left: auto;
        right: 1rem;
    }
    .sw-trigger {
        bottom: 20px;
        left: 20px;
    }
    [dir="rtl"] .sw-trigger {
        left: auto;
        right: 20px;
    }
    .sw-trigger-icon, .sw-trigger-icon svg {
        width: 22px;
        height: 22px;
    }
}
