/*
 * ==========================================================
 * COMUNIK COBROWSE - styles
 * ==========================================================
 */

/* Boutons de la barre du chat editor (visiteur + agent) */
.sb-bar-icons > div.sb-btn-cobrowse,
.sb-bar-icons > div.sb-btn-cobrowse-request {
    background-repeat: no-repeat;
    background-position: center center;
    background-size: 22px 22px;
    opacity: 0.9;
    transition: opacity .2s ease;
}

.sb-bar-icons > div.sb-btn-cobrowse {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23566069' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='2' y='4' width='20' height='13' rx='2'/><line x1='8' y1='21' x2='16' y2='21'/><line x1='12' y1='17' x2='12' y2='21'/><polyline points='9 11 12 8 15 11'/><line x1='12' y1='8' x2='12' y2='14'/></svg>");
}

.sb-bar-icons > div.sb-btn-cobrowse-request {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23566069' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='2' y='4' width='20' height='13' rx='2'/><line x1='8' y1='21' x2='16' y2='21'/><line x1='12' y1='17' x2='12' y2='21'/><circle cx='12' cy='10' r='1'/><path d='M9.5 8a2.5 2.5 0 0 1 5 0c0 1.5-2.5 2-2.5 3'/></svg>");
}

.sb-bar-icons > div.sb-btn-cobrowse:hover,
.sb-bar-icons > div.sb-btn-cobrowse-request:hover {
    opacity: 1;
}

.sb-bar-icons > div.sb-btn-cobrowse.sb-cobrowse-active {
    opacity: 1;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e74c3c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='2' y='4' width='20' height='13' rx='2'/><line x1='8' y1='21' x2='16' y2='21'/><line x1='12' y1='17' x2='12' y2='21'/><circle cx='12' cy='10' r='3' fill='%23e74c3c'/></svg>");
}

/* Badge "Partage actif" cote visiteur */
.sb-cobrowse-badge {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: #e74c3c;
    color: #fff;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    z-index: 2147483645;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .25);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.sb-cobrowse-badge::before {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #fff;
    animation: sb-cobrowse-pulse 1.2s infinite;
}

.sb-cobrowse-badge .sb-cobrowse-stop {
    margin-left: 8px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.25);
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.sb-cobrowse-badge .sb-cobrowse-stop:hover {
    background: rgba(255, 255, 255, 0.4);
}

@keyframes sb-cobrowse-pulse {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: .4; transform: scale(.85); }
    100% { opacity: 1; transform: scale(1); }
}

/* Modal cote agent */
.sb-cobrowse-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 2147483646;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.sb-cobrowse-modal.sb-active {
    display: flex;
}

.sb-cobrowse-modal-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
}

.sb-cobrowse-modal-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sb-cobrowse-modal-header h3::before {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #2ecc71;
    animation: sb-cobrowse-pulse 1.2s infinite;
}

.sb-cobrowse-modal-header .sb-cobrowse-status {
    font-size: 12px;
    font-weight: 400;
    opacity: 0.7;
    margin-left: 12px;
}

.sb-cobrowse-modal-close {
    cursor: pointer;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border: none;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
}

.sb-cobrowse-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.sb-cobrowse-modal video {
    max-width: 95%;
    max-height: 88vh;
    background: #000;
    box-shadow: 0 12px 60px rgba(0, 0, 0, 0.6);
    border-radius: 6px;
}

.sb-cobrowse-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: #fff;
    padding: 10px 18px;
    border-radius: 6px;
    font-size: 13px;
    z-index: 2147483647;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .3);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    animation: sb-cobrowse-toast-in .25s ease;
}

@keyframes sb-cobrowse-toast-in {
    from { opacity: 0; transform: translate(-50%, 8px); }
    to   { opacity: 1; transform: translate(-50%, 0); }
}

/* État désactivé : canal non-web (Messenger/WA/IG/Email/SMS) */
.sb-bar-icons > div.sb-btn-cobrowse-request.sb-cobrowse-disabled {
    opacity: 0.3 !important;
    cursor: not-allowed !important;
    pointer-events: auto !important;
}
.sb-bar-icons > div.sb-btn-cobrowse-request.sb-cobrowse-disabled:hover {
    opacity: 0.4 !important;
}

/* =========================================================
   REMOTE CONTROL — CSS
   ========================================================= */

/* Modal agent : actions header + wrap video */
.sb-cobrowse-modal-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}
.sb-cobrowse-rc-toggle {
    cursor: pointer;
    border: none;
    color: #fff;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    transition: background .15s ease, transform .1s ease;
}
.sb-cobrowse-rc-toggle.sb-cobrowse-btn-rc-request {
    background: #2ecc71;
}
.sb-cobrowse-rc-toggle.sb-cobrowse-btn-rc-request:hover {
    background: #27ae60;
}
.sb-cobrowse-rc-toggle.sb-cobrowse-btn-rc-stop {
    background: #e74c3c;
}
.sb-cobrowse-rc-toggle.sb-cobrowse-btn-rc-stop:hover {
    background: #c0392b;
}
.sb-cobrowse-rc-toggle:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.sb-cobrowse-rc-badge {
    background: #e74c3c;
    color: #fff;
    padding: 3px 9px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-left: 10px;
}
.sb-cobrowse-rc-badge::before {
    content: "🎛 ";
}
.sb-cobrowse-video-wrap {
    position: relative;
    max-width: 95%;
    max-height: 88vh;
    display: flex;
}
.sb-cobrowse-video-wrap video {
    max-width: 100%;
    max-height: 88vh;
    width: 100%;
    background: #000;
    box-shadow: 0 12px 60px rgba(0, 0, 0, 0.6);
    border-radius: 6px;
    object-fit: contain;
}
.sb-cobrowse-agent-cursor {
    position: fixed;
    width: 16px;
    height: 16px;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: rgba(46, 204, 113, 0.6);
    pointer-events: none;
    z-index: 2147483647;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .4);
}

/* VISITEUR : bandeau rouge sticky "Contrôle distant actif" */
.sb-cobrowse-rc-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #ef4444;
    color: #fff;
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 2147483646;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 2px 12px rgba(0, 0, 0, .35);
    animation: sb-cobrowse-banner-in .25s ease;
}
.sb-cobrowse-rc-banner-text::before {
    content: "🎛 ";
}
.sb-cobrowse-rc-banner-stop {
    cursor: pointer;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.5);
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .4px;
}
.sb-cobrowse-rc-banner-stop:hover {
    background: rgba(255, 255, 255, 0.35);
}
@keyframes sb-cobrowse-banner-in {
    from { opacity: 0; transform: translateY(-100%); }
    to   { opacity: 1; transform: translateY(0); }
}

/* VISITEUR : curseur fantôme de l'agent */
.sb-cobrowse-remote-cursor {
    position: fixed;
    width: 18px;
    height: 18px;
    margin-left: -9px;
    margin-top: -9px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.85);
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.35), 0 2px 8px rgba(0, 0, 0, 0.4);
    pointer-events: none;
    z-index: 2147483645;
    animation: sb-cobrowse-rc-pulse 1.4s infinite;
    transition: left .05s linear, top .05s linear;
}
.sb-cobrowse-remote-cursor-label {
    position: absolute;
    top: 22px;
    left: 50%;
    transform: translateX(-50%);
    background: #ef4444;
    color: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    white-space: nowrap;
}
@keyframes sb-cobrowse-rc-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7), 0 2px 8px rgba(0, 0, 0, 0.4); }
    70%  { box-shadow: 0 0 0 14px rgba(239, 68, 68, 0), 0 2px 8px rgba(0, 0, 0, 0.4); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0), 0 2px 8px rgba(0, 0, 0, 0.4); }
}

/* VISITEUR : warning éphémère (action bloquée) */
.sb-cobrowse-rc-warning {
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    background: #f59e0b;
    color: #1a1a1a;
    padding: 10px 18px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .25);
    z-index: 2147483647;
    animation: sb-cobrowse-toast-in .2s ease;
}

/* Sélecteur d'onglets côté agent (Comunik RMC Helper extension) */
.sb-cobrowse-tab-selector {
    background: rgba(255,255,255,0.15);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    max-width: 280px;
    text-overflow: ellipsis;
}
.sb-cobrowse-tab-selector option { background: #1f2630; color: #fff; }
.sb-cobrowse-tab-selector:hover { background: rgba(255,255,255,0.22); }

/* ==========================================================
 * Extension install prompt (côté visiteur, dans le widget chat)
 * ========================================================== */
.sb-cobrowse-ext-prompt {
    position: fixed;
    left: 50%;
    bottom: 100px;
    transform: translateX(-50%);
    width: 360px;
    max-width: 92vw;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 16px 48px rgba(0,0,0,.18);
    padding: 16px 18px;
    display: flex;
    gap: 12px;
    z-index: 2147483646;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #1f2630;
    border: 1px solid #e3e8ef;
    animation: sb-cobrowse-ext-slide .25s ease-out;
}
@keyframes sb-cobrowse-ext-slide {
    from { opacity: 0; transform: translate(-50%, 12px); }
    to   { opacity: 1; transform: translate(-50%, 0); }
}
.sb-cobrowse-ext-prompt-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: #d4edda;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}
.sb-cobrowse-ext-prompt-body { flex: 1; min-width: 0; }
.sb-cobrowse-ext-prompt-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
    line-height: 1.3;
}
.sb-cobrowse-ext-prompt-text {
    font-size: 12.5px;
    color: #5a6470;
    line-height: 1.5;
    margin-bottom: 12px;
}
.sb-cobrowse-ext-prompt-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}
.sb-cobrowse-ext-prompt-btn-primary {
    background: #25d366;
    color: #fff;
    padding: 7px 12px;
    border-radius: 6px;
    font-size: 12.5px;
    font-weight: 600;
    text-decoration: none;
    transition: background .15s;
}
.sb-cobrowse-ext-prompt-btn-primary:hover { background: #1fb556; }
.sb-cobrowse-ext-prompt-btn-secondary {
    color: #2d8cff;
    padding: 7px 8px;
    font-size: 12px;
    text-decoration: none;
    border-radius: 6px;
}
.sb-cobrowse-ext-prompt-btn-secondary:hover { background: #f0f7ff; text-decoration: underline; }
.sb-cobrowse-ext-prompt-close {
    margin-left: auto;
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 14px;
    padding: 6px;
    border-radius: 4px;
}
.sb-cobrowse-ext-prompt-close:hover { background: #f0f3f7; color: #1f2630; }

/* Dark mode */
.sb-dark-mode .sb-cobrowse-ext-prompt,
[data-sb-dark="true"] .sb-cobrowse-ext-prompt {
    background: #1f2630;
    color: #d0d6dd;
    border-color: #3a4452;
}
.sb-dark-mode .sb-cobrowse-ext-prompt-text { color: #a0a8b0; }
