/* =========================
   Footer
========================= */

.footer {
    width: 100%;
    padding: 28px 40px;
    box-sizing: border-box;
    background: linear-gradient(135deg, #020617, #0f172a);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
}

.footer-left {
    display: flex;
    align-items: center;
    gap: 14px;
    justify-self: start;
}

.footer-left img {
    width: 42px;
    height: 42px;
    object-fit: contain;
}

.footer-brand {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.footer-title {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
}

.footer-subtitle,
.footer-center {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.65);
}

.footer-center {
    text-align: center;
}

.footer-right {
    display: flex;
    align-items: center;
    gap: 20px;
    justify-self: end;
}

.footer-right a {
    color: #fff;
    font-size: 20px;
    transition: color 0.25s ease, transform 0.25s ease;
}

.footer-right a:hover {
    color: #a3e635;
    transform: translateY(-2px);
}

.footer-links {
    margin-top: 8px;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 0.85rem;
}

.footer-links a {
    color: #cbd5e1;
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-links a:hover {
    color: #fff;
}

.footer-links span {
    color: #64748b;
}


/* =========================
   Chat flottant
========================= */

.group-chat-widget {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 9999;
    font-family: inherit;
}

.group-chat-toggle {
    position: relative;
    width: 58px;
    height: 58px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: #fff;
    font-size: 1.35rem;
    cursor: pointer;
    box-shadow: 0 14px 32px rgba(22, 163, 74, 0.35);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.group-chat-toggle:hover {
    transform: translateY(-2px) scale(1.06);
    box-shadow: 0 18px 40px rgba(22, 163, 74, 0.45);
}

.group-chat-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 21px;
    height: 21px;
    padding: 0 6px;
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 0.68rem;
    font-weight: 800;
    border: 2px solid #020617;
}

.group-chat-badge.active {
    display: flex;
}

.group-chat-box {
    position: absolute;
    right: 0;
    bottom: 76px;
    width: 360px;
    max-width: calc(100vw - 30px);
    height: 500px;
    display: none;
    flex-direction: column;
    overflow: hidden;
    background: linear-gradient(180deg, #111827, #0f172a);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 22px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.group-chat-box.active {
    display: flex;
}


/* =========================
   Header chat
========================= */

.group-chat-header {
    padding: 15px;
    background: rgba(2, 6, 23, 0.86);
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.group-chat-header strong {
    display: block;
    margin-bottom: 7px;
    font-size: 0.98rem;
}

.group-chat-header select {
    width: 100%;
    max-width: 250px;
    padding: 8px 10px;
    background: #1f2937;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    outline: none;
    font-size: 0.85rem;
}

.group-chat-online {
    margin-bottom: 8px;
    font-size: 0.78rem;
    color: #9ca3af;
}

.group-chat-online.online {
    color: #22c55e;
    font-weight: 600;
}

.group-chat-tabs {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

.group-chat-tab {
    border: none;
    border-radius: 999px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.08);
    color: #cbd5e1;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.group-chat-tab:hover {
    background: rgba(255, 255, 255, 0.14);
}

.group-chat-tab.active {
    background: #22c55e;
    color: #fff;
}

#groupChatClose {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.08);
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

#groupChatClose:hover {
    background: rgba(255, 255, 255, 0.14);
    transform: rotate(90deg);
}


/* =========================
   Messages
========================= */

.group-chat-messages {
    flex: 1;
    padding: 14px;
    overflow-y: auto;
    scroll-behavior: smooth;
}

.group-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.group-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.35);
    border-radius: 999px;
}

.group-chat-empty {
    margin-top: 55px;
    color: #9ca3af;
    text-align: center;
}

.group-chat-empty i {
    display: block;
    margin-bottom: 10px;
    font-size: 2rem;
    opacity: 0.65;
}

.group-chat-empty p {
    margin: 0;
    font-size: 0.9rem;
}

.group-chat-message {
    max-width: 82%;
    margin-bottom: 11px;
    padding: 10px 11px;
    border-radius: 14px;
    color: #fff;
    animation: chatMessageIn 0.18s ease both;
}

.group-chat-message.other {
    margin-right: auto;
    background: rgba(255, 255, 255, 0.08);
    border-bottom-left-radius: 5px;
}

.group-chat-message.mine {
    margin-left: auto;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    border-bottom-right-radius: 5px;
}

.group-chat-message-top {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 5px;
    font-size: 0.76rem;
}

.group-chat-message-top strong {
    font-weight: 800;
}

.group-chat-message-top span {
    color: #9ca3af;
    white-space: nowrap;
}

.group-chat-message.mine .group-chat-message-top span {
    color: rgba(255, 255, 255, 0.78);
}

.group-chat-message p {
    margin: 0;
    font-size: 0.92rem;
    line-height: 1.38;
    word-break: break-word;
}

.group-chat-new-messages {
    position: absolute;
    left: 50%;
    bottom: 76px;
    transform: translateX(-50%);
    display: none;
    border: none;
    border-radius: 999px;
    padding: 8px 13px;
    background: #22c55e;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.28);
    z-index: 5;
}

.group-chat-new-messages.active {
    display: block;
}


/* =========================
   Formulaire chat
========================= */

.group-chat-form {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: rgba(2, 6, 23, 0.9);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.group-chat-form input[type="text"] {
    flex: 1;
    min-width: 0;
    padding: 12px 14px;
    border: 1px solid transparent;
    border-radius: 999px;
    outline: none;
    background: #1f2937;
    color: #fff;
    font-size: 0.92rem;
}

.group-chat-form input[type="text"]:focus {
    border-color: rgba(34, 197, 94, 0.65);
}

.group-chat-form button {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: #fff;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.group-chat-form button:hover {
    transform: scale(1.06);
}

@keyframes chatMessageIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* =========================
   Responsive footer + chat
========================= */

@media (max-width: 768px) {
    .footer {
        grid-template-columns: 1fr;
        gap: 18px;
        padding: 26px 20px;
        text-align: center;
    }

    .footer-left,
    .footer-right {
        justify-self: center;
    }

    .footer-left {
        flex-direction: column;
        gap: 10px;
    }

    .footer-right {
        gap: 18px;
    }

    .group-chat-widget {
        right: 14px;
        bottom: 14px;
    }

    .group-chat-toggle {
        width: 54px;
        height: 54px;
        font-size: 1.2rem;
    }

    .group-chat-badge {
        top: -3px;
        right: -3px;
        min-width: 19px;
        height: 19px;
        font-size: 0.64rem;
    }

    .group-chat-box {
        bottom: 70px;
        width: min(390px, calc(100vw - 28px));
        height: min(500px, calc(100vh - 120px));
        border-radius: 18px;
    }
}

@media (max-width: 480px) {
    .footer {
        padding: 24px 16px;
    }

    .footer-title {
        font-size: 13px;
    }

    .footer-subtitle,
    .footer-center {
        font-size: 12px;
    }

    .footer-links {
        gap: 8px;
        font-size: 0.8rem;
    }

    .footer-right a {
        font-size: 18px;
    }

    .group-chat-widget {
        right: 10px;
        bottom: 10px;
    }

    .group-chat-toggle {
        width: 52px;
        height: 52px;
        font-size: 1.15rem;
    }

    .group-chat-box {
        position: fixed;
        left: 10px;
        right: 10px;
        bottom: 72px;
        width: auto;
        max-width: none;
        height: 68vh;
        min-height: 350px;
        max-height: 560px;
        border-radius: 18px;
    }

    .group-chat-header {
        padding: 12px;
    }

    .group-chat-header select {
        max-width: 220px;
        font-size: 0.82rem;
    }

    .group-chat-message {
        max-width: 90%;
        padding: 9px 10px;
    }

    .group-chat-message-top {
        font-size: 0.72rem;
    }

    .group-chat-message p {
        font-size: 0.86rem;
    }

    .group-chat-messages,
    .group-chat-form {
        padding: 10px;
    }

    .group-chat-form input[type="text"] {
        padding: 11px 12px;
        font-size: 0.9rem;
    }

    .group-chat-form button {
        width: 40px;
        height: 40px;
        flex-basis: 40px;
    }
}

@media (max-width: 360px) {
    .group-chat-box {
        left: 6px;
        right: 6px;
        bottom: 68px;
        height: 62vh;
        min-height: 320px;
    }

    .group-chat-toggle {
        width: 48px;
        height: 48px;
        font-size: 1.05rem;
    }

    .group-chat-header select {
        max-width: 190px;
    }
}

.back-to-top {
    position: fixed;
    right: 22px;
    bottom: 92px;
    width: 46px;
    height: 46px;
    border: none;
    border-radius: 50%;
    background: #1f2937;
    color: white;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.back-to-top:hover {
    transform: translateY(-3px);
    opacity: 0.9;
}

.back-to-top.show {
    display: flex;
}

@media (max-width: 768px) {
    .back-to-top {
        right: 14px;
        bottom: 82px;
    }
}

@media (max-width: 480px) {
    .back-to-top {
        right: 10px;
        bottom: 76px;
        width: 44px;
        height: 44px;
        font-size: 22px;
    }
}