/**
 *  @author    SendApp <info@sendapp.live>
 *  @copyright 2010-2026 SendApp
 *  @license   https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
 *  International Registered Trademark & Property of sendapp.live
 *
 *  Front-office click-to-chat floating widget with popup of representatives.
 *  Loaded only when WAL_C2C_ENABLED is on and at least one representative is configured.
 */

/* ============== ROOT CONTAINER ============== */
.wal-c2c {
    position: fixed;
    bottom: 22px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
.wal-c2c--right { right: 22px; }
.wal-c2c--left  { left:  22px; }

/* ============== FLOATING ACTION BUTTON ============== */
.wal-c2c__fab {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 58px;
    height: 58px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: #25D366;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 6px 22px rgba(37, 211, 102, 0.45), 0 2px 6px rgba(0, 0, 0, 0.18);
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
    -webkit-tap-highlight-color: transparent;
}

.wal-c2c__fab:hover,
.wal-c2c__fab:focus {
    background: #128C7E;
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(18, 140, 126, 0.55), 0 4px 10px rgba(0, 0, 0, 0.22);
    outline: none;
}

.wal-c2c.is-open .wal-c2c__fab {
    background: #128C7E;
}

.wal-c2c__icon {
    width: 32px;
    height: 32px;
    display: block;
    flex-shrink: 0;
    pointer-events: none;
}

/* Pulse halo */
.wal-c2c__pulse {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: rgba(37, 211, 102, 0.55);
    opacity: 0;
    animation: wal-c2c-pulse 2.4s ease-out infinite;
    pointer-events: none;
    z-index: -1;
}

.wal-c2c.is-open .wal-c2c__pulse {
    animation: none;
    opacity: 0;
}

@keyframes wal-c2c-pulse {
    0%   { transform: scale(1);   opacity: 0.55; }
    70%  { transform: scale(1.6); opacity: 0;    }
    100% { transform: scale(1.6); opacity: 0;    }
}

/* ============== POPUP PANEL ============== */
.wal-c2c__panel {
    position: absolute;
    bottom: calc(100% + 14px);
    width: 320px;
    max-width: calc(100vw - 32px);
    background: #fff;
    border-radius: 18px;
    box-shadow:
        0 24px 60px rgba(7, 94, 84, 0.22),
        0 8px 22px rgba(0, 0, 0, 0.10);
    overflow: hidden;
    transform-origin: bottom center;
    animation: wal-c2c-pop 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.wal-c2c--right .wal-c2c__panel { right: 0;  transform-origin: bottom right; }
.wal-c2c--left  .wal-c2c__panel { left:  0;  transform-origin: bottom left;  }

@keyframes wal-c2c-pop {
    0%   { opacity: 0; transform: translateY(8px) scale(0.96); }
    100% { opacity: 1; transform: translateY(0)   scale(1);    }
}

[hidden].wal-c2c__panel {
    display: none;
}

/* Panel header */
.wal-c2c__panel-head {
    position: relative;
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    color: #fff;
    padding: 18px 44px 18px 22px;
}

.wal-c2c__panel-text strong {
    display: block;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.25;
    margin: 0 0 4px;
    color: #fff;
}

.wal-c2c__panel-text span {
    display: block;
    font-size: 12.5px;
    opacity: 0.92;
    color: #fff;
}

.wal-c2c__panel-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    font-size: 20px;
    line-height: 26px;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
}

.wal-c2c__panel-close:hover,
.wal-c2c__panel-close:focus {
    background: rgba(255, 255, 255, 0.32);
    transform: rotate(90deg);
    outline: none;
}

/* Panel body — list of reps */
.wal-c2c__panel-body {
    padding: 12px 12px 14px;
    max-height: 60vh;
    overflow-y: auto;
    background: #f7faf9;
}

.wal-c2c__panel-body::-webkit-scrollbar { width: 6px; }
.wal-c2c__panel-body::-webkit-scrollbar-thumb { background: #d6e0dc; border-radius: 3px; }

/* Single rep card */
.wal-c2c__rep {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    margin-bottom: 8px;
    background: #fff;
    border-radius: 12px;
    text-decoration: none !important;
    color: inherit !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.wal-c2c__rep:last-child {
    margin-bottom: 0;
}

.wal-c2c__rep:hover,
.wal-c2c__rep:focus {
    background: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.18);
}

/* Avatar with online dot */
.wal-c2c__rep-avatar {
    position: relative;
    width: 46px;
    height: 46px;
    flex-shrink: 0;
    border-radius: 50%;
    overflow: visible;
    background: #e8f5ec;
}

.wal-c2c__rep-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.wal-c2c__rep-initials {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    letter-spacing: 0.4px;
}

.wal-c2c__rep-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-sizing: border-box;
}

.wal-c2c__rep-dot--on  { background: #25D366; }
.wal-c2c__rep-dot--off { background: #b0b6b3; }

/* Meta column */
.wal-c2c__rep-meta {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.wal-c2c__rep-meta strong {
    font-size: 14px;
    font-weight: 700;
    color: #1f2d2a;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wal-c2c__rep-role {
    font-size: 12px;
    color: #6b7975;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wal-c2c__rep-status {
    align-self: flex-start;
    margin-top: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.2px;
    line-height: 1.4;
    text-transform: none;
}

.wal-c2c__rep-status--on  { background: #d6f5e0; color: #0a6b3a; }
.wal-c2c__rep-status--off { background: #ececec; color: #6b6b6b; }

/* ============== RESPONSIVE ============== */
@media (max-width: 480px) {
    .wal-c2c          { bottom: 14px; }
    .wal-c2c--right   { right: 14px; }
    .wal-c2c--left    { left:  14px; }
    .wal-c2c__fab     { width: 52px; height: 52px; }
    .wal-c2c__icon    { width: 28px; height: 28px; }
    .wal-c2c__panel   { width: calc(100vw - 28px); }
}

/* Honour reduced-motion users */
@media (prefers-reduced-motion: reduce) {
    .wal-c2c__pulse,
    .wal-c2c__panel,
    .wal-c2c__fab,
    .wal-c2c__rep,
    .wal-c2c__panel-close { animation: none; transition: none; }
}
