/* Explain: Styling for global contact widget and other reusable components. */
/* =========================================================
   Global Contact & WhatsApp floating widget (D.M.A Learn)
   Mobile  (<768px): one unified segmented control (واتساب | اتصال)
   Desktop (>=768px): single circular WhatsApp icon, bottom-left
   ========================================================= */

.dma-contact-widget {
    position: fixed;
    z-index: 40;
    left: 50%;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 1rem);
    transform: translateX(-50%);
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    pointer-events: none;
}

/* Unified container — one shared deep-teal surface */
.dma-contact-widget__inner {
    display: flex;
    align-items: stretch;
    width: 224px;
    background-color: var(--primary-color);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 6px 18px rgba(15, 30, 35, 0.16);
    transition: transform 0.3s ease;
}

/* Segments — transparent over the shared surface */
.dma-contact-btn {
    pointer-events: auto;
    flex: 1 1 0;
    min-width: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-height: 44px;
    height: 44px;
    padding: 0 0.75rem;
    border: none;
    border-radius: 0;
    background-color: transparent;
    color: #ffffff;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 14px;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.18s ease;
    -webkit-tap-highlight-color: transparent;
}

.dma-contact-btn i {
    font-size: 1.05rem;
}

.dma-contact-btn__label {
    white-space: nowrap;
}

/* Subtle divider on the meeting edge (call segment, right edge in RTL) */
.dma-contact-btn--call {
    border-inline-start: 1px solid rgba(255, 255, 255, 0.24);
}

/* Active segment only: slightly darker teal */
.dma-contact-btn:hover,
.dma-contact-btn:focus-visible,
.dma-contact-btn:active {
    background-color: var(--primary-hover);
}

.dma-contact-btn:focus-visible {
    outline: 3px solid var(--accent-color);
    outline-offset: -3px;
}

/* Tooltip (desktop hover/focus only) */
.dma-contact-tooltip {
    position: absolute;
    bottom: 50%;
    left: 100%;
    margin-left: 0.7rem;
    transform: translateY(50%);
    background-color: #1F2937;
    color: #ffffff;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    padding: 0.4rem 0.7rem;
    border-radius: 0.5rem;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

/* Footer-visible state: fade + slide out, not clickable, no space reserved */
.dma-contact-widget.is-hidden {
    opacity: 0;
    visibility: hidden;
}

.dma-contact-widget.is-hidden .dma-contact-widget__inner {
    transform: translateY(14px);
}

/* ---------- Desktop ---------- */
@media (min-width: 768px) {
    .dma-contact-widget {
        left: 1.5rem;
        right: auto;
        bottom: calc(env(safe-area-inset-bottom, 0px) + 1.5rem);
        transform: none;
    }

    /* Dissolve the shared surface; only the WhatsApp circle remains */
    .dma-contact-widget__inner {
        width: auto;
        background-color: transparent;
        border-radius: 0;
        overflow: visible;
        box-shadow: none;
    }

    .dma-contact-btn--call {
        display: none;
    }

    .dma-contact-btn--whatsapp {
        position: relative;
        flex: 0 0 auto;
        width: 56px;
        height: 56px;
        min-height: 56px;
        padding: 0;
        border-radius: 50%;
        background-color: var(--primary-color);
        box-shadow: 0 8px 22px rgba(15, 118, 110, 0.22);
    }

    .dma-contact-btn--whatsapp .dma-contact-btn__label {
        display: none;
    }

    .dma-contact-btn--whatsapp i {
        font-size: 1.5rem;
    }

    .dma-contact-btn--whatsapp:hover,
    .dma-contact-btn--whatsapp:focus-visible {
        background-color: var(--primary-hover);
        transform: translateY(-2px);
        box-shadow: 0 12px 26px rgba(15, 118, 110, 0.3);
    }

    .dma-contact-btn--whatsapp:focus-visible {
        outline-offset: 3px;
    }

    .dma-contact-btn--whatsapp:hover .dma-contact-tooltip,
    .dma-contact-btn--whatsapp:focus-visible .dma-contact-tooltip {
        opacity: 1;
        visibility: visible;
        transform: translateY(50%) translateX(0.3rem);
    }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    .dma-contact-widget,
    .dma-contact-widget__inner,
    .dma-contact-btn,
    .dma-contact-tooltip {
        transition: none !important;
    }
}