/* Widget tchat en ligne UniversCarte */
.uc-live-chat {
    --uc-chat-primary: #21bdd0;
    --uc-chat-primary-dark: #1a9ba8;
    --uc-chat-bg: #ffffff;
    --uc-chat-text: #1f2547;
    --uc-chat-muted: #64748b;
    --uc-chat-shadow: 0 12px 40px rgba(13, 36, 73, 0.18);
    font-family: "Inter", system-ui, -apple-system, sans-serif;
}

.uc-live-chat__launcher {
    position: fixed;
    right: max(20px, env(safe-area-inset-right, 0px));
    bottom: max(20px, env(safe-area-inset-bottom, 0px));
    z-index: 9975;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    border: none;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--uc-chat-primary) 0%, var(--uc-chat-primary-dark) 100%);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--uc-chat-shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.uc-live-chat__launcher:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 48px rgba(33, 189, 208, 0.35);
}

.uc-live-chat__launcher:focus-visible {
    outline: 3px solid rgba(33, 189, 208, 0.45);
    outline-offset: 3px;
}

.uc-live-chat__launcher--offline {
    background: linear-gradient(135deg, #64748b 0%, #475569 100%);
}

.uc-live-chat__launcher--unread {
    animation: uc-chat-pulse 2s ease-in-out infinite;
}

.uc-live-chat__launcher-badge {
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    line-height: 22px;
    text-align: center;
    border: 2px solid #fff;
    flex-shrink: 0;
}

@keyframes uc-chat-pulse {
    0%, 100% { box-shadow: 0 12px 40px rgba(33, 189, 208, 0.35); }
    50% { box-shadow: 0 12px 40px rgba(239, 68, 68, 0.55); }
}

.uc-live-chat__launcher-icon {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.uc-live-chat__panel {
    position: fixed;
    right: max(20px, env(safe-area-inset-right, 0px));
    bottom: max(88px, calc(20px + env(safe-area-inset-bottom, 0px)));
    z-index: 9976;
    width: min(380px, calc(100vw - 32px));
    height: min(520px, calc(100vh - 140px));
    max-height: min(560px, calc(100vh - 120px));
    display: flex;
    flex-direction: column;
    background: var(--uc-chat-bg);
    border-radius: 16px;
    box-shadow: var(--uc-chat-shadow);
    overflow: hidden;
    border: 1px solid rgba(41, 84, 145, 0.1);
}

.uc-live-chat__panel[hidden] {
    display: none !important;
}

.uc-live-chat__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #fff;
    flex-shrink: 0;
}

.uc-live-chat__header h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
}

.uc-live-chat__status {
    margin: 4px 0 0;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.75);
}

.uc-live-chat__status--online::before {
    content: "";
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 6px;
    border-radius: 50%;
    background: #34d399;
    vertical-align: middle;
}

.uc-live-chat__close {
    border: none;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
}

.uc-live-chat__body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px;
    background: #f8fafc;
    -webkit-overflow-scrolling: touch;
}

.uc-live-chat__body.uc-live-chat__body--chat {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
}

.uc-live-chat__intro,
.uc-live-chat__offline {
    font-size: 14px;
    color: var(--uc-chat-muted);
    line-height: 1.5;
}

.uc-live-chat__offline a {
    color: var(--uc-chat-primary-dark);
    font-weight: 600;
}

.uc-live-chat__form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 12px;
}

.uc-live-chat__form input:not([type="checkbox"]):not([type="radio"]),
.uc-live-chat__form textarea {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    box-sizing: border-box;
}

.uc-live-chat__form input:not([type="checkbox"]):not([type="radio"]):focus,
.uc-live-chat__form textarea:focus {
    outline: none;
    border-color: var(--uc-chat-primary);
}

.uc-live-chat__btn {
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    background: var(--uc-chat-primary);
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
}

.uc-live-chat__btn:hover {
    background: var(--uc-chat-primary-dark);
}

.uc-live-chat__btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.uc-live-chat__messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    -webkit-overflow-scrolling: touch;
}

.uc-live-chat__closed {
    font-size: 14px;
    color: var(--uc-chat-muted);
    line-height: 1.5;
}

.uc-live-chat__closed p {
    margin: 0 0 12px;
}

.uc-live-chat__msg {
    max-width: 88%;
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.45;
    word-break: break-word;
}

.uc-live-chat__msg--visitor {
    align-self: flex-end;
    background: var(--uc-chat-primary);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.uc-live-chat__msg--staff {
    align-self: flex-start;
    background: #fff;
    color: var(--uc-chat-text);
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 4px;
}

.uc-live-chat__msg time {
    display: block;
    margin-top: 4px;
    font-size: 11px;
    opacity: 0.7;
}

.uc-live-chat__footer {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid #e2e8f0;
    background: #fff;
    flex-shrink: 0;
}

.uc-live-chat__footer-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.uc-live-chat__gdpr {
    padding: 10px 12px;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.45;
    color: #0c4a6e;
}

.uc-live-chat__gdpr p {
    margin: 0 0 8px;
}

.uc-live-chat__gdpr a {
    color: #0369a1;
    font-weight: 600;
}

.uc-live-chat__gdpr-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-weight: 600;
    width: 100%;
    margin: 0;
}

.uc-live-chat__gdpr-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    min-width: 16px;
    margin: 2px 0 0;
    padding: 0;
    border: 1px solid #94a3b8;
    border-radius: 4px;
    flex-shrink: 0;
    box-sizing: border-box;
    accent-color: var(--uc-chat-primary);
}

.uc-live-chat__gdpr-check span {
    flex: 1;
    min-width: 0;
    line-height: 1.4;
    word-break: normal;
}

.uc-live-chat__link-btn {
    display: inline-block;
    margin: 8px 0 12px;
    padding: 0;
    border: none;
    background: none;
    color: #0369a1;
    font-size: 13px;
    font-weight: 600;
    text-decoration: underline;
    cursor: pointer;
}

.uc-live-chat__link-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.uc-live-chat__gdpr-done {
    margin: 8px 0 12px;
    padding: 10px 12px;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-radius: 8px;
    color: #065f46;
    font-size: 13px;
}

.uc-live-chat__footer-row textarea {
    flex: 1;
    min-height: 42px;
    max-height: 100px;
    resize: none;
    padding: 10px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
}

.uc-live-chat__footer-row textarea:focus {
    outline: none;
    border-color: var(--uc-chat-primary);
}

.uc-live-chat__error {
    margin-top: 8px;
    font-size: 13px;
    color: #dc2626;
}

@media (max-width: 720px) {
    .uc-live-chat__launcher {
        right: max(16px, env(safe-area-inset-right, 0px));
        bottom: max(76px, calc(16px + env(safe-area-inset-bottom, 0px)));
        padding: 12px 14px;
        font-size: 14px;
    }

    .uc-live-chat__panel {
        right: max(16px, env(safe-area-inset-right, 0px));
        bottom: max(140px, calc(76px + env(safe-area-inset-bottom, 0px)));
        height: min(70vh, calc(100vh - 160px));
    }
}

body:has(.hamburger-menu-panel.open) .uc-live-chat__launcher,
body:has(.hamburger-menu-panel.open) .uc-live-chat__panel {
    opacity: 0;
    pointer-events: none;
}

/* Accès admin — visible uniquement pour les comptes internes connectés */
button.uc-live-chat-admin-fab,
.uc-live-chat-admin-fab,
.uc-live-chat-admin-fab:visited,
.uc-live-chat-admin-fab:hover,
.uc-live-chat-admin-fab:focus,
.uc-live-chat-admin-fab:active {
    position: fixed;
    right: max(20px, env(safe-area-inset-right, 0px));
    bottom: max(20px, env(safe-area-inset-bottom, 0px));
    z-index: 9990;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    border-radius: 999px;
    border: 2px solid rgba(255, 255, 255, 0.9);
    background: linear-gradient(135deg, #21bdd0 0%, #1a9ba8 100%);
    color: #ffffff !important;
    text-decoration: none !important;
    font-size: 14px;
    font-weight: 700;
    font-family: var(--font-sans, "Inter", system-ui, sans-serif);
    box-shadow: 0 10px 28px rgba(33, 189, 208, 0.45);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

button.uc-live-chat-admin-fab {
    appearance: none;
    -webkit-appearance: none;
}

.uc-live-chat-admin-fab:hover,
.uc-live-chat-admin-fab:focus-visible {
    color: #ffffff !important;
    transform: translateY(-2px);
    box-shadow: 0 14px 36px rgba(33, 189, 208, 0.55);
}

.uc-live-chat-admin-fab__icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    fill: currentColor;
    color: #ffffff;
}

.uc-live-chat-admin-fab__label {
    color: #ffffff !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
    white-space: nowrap;
}

.uc-live-chat-admin-fab__badge {
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 999px;
    background: #ef4444;
    color: #ffffff !important;
    font-size: 12px;
    font-weight: 700;
    line-height: 22px;
    text-align: center;
    border: 2px solid #ffffff;
}

@media (max-width: 720px) {
    .uc-live-chat-admin-fab {
        right: max(16px, env(safe-area-inset-right, 0px));
        bottom: max(16px, env(safe-area-inset-bottom, 0px));
        padding: 10px 14px;
    }

    .uc-live-chat-admin-fab__label {
        display: none;
    }
}

body:has(.hamburger-menu-panel.open) .uc-live-chat-admin-fab {
    opacity: 0;
    pointer-events: none;
}

.uc-live-chat-admin-fab--alert {
    animation: uc-admin-chat-alert 1s ease-in-out infinite;
}

@keyframes uc-admin-chat-alert {
    0%, 100% {
        box-shadow: 0 10px 28px rgba(33, 189, 208, 0.45);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 14px 40px rgba(239, 68, 68, 0.65);
        transform: scale(1.04);
    }
}
