/*
|--------------------------------------------------------------------------
| ENCOT PWA FLOATING INSTALL CONTROL - POSITION FIX
|--------------------------------------------------------------------------
| Layout:
|   Bottom-left       = WhatsApp
|   Above WhatsApp    = Install ENCOT
|   Bottom-right      = Customer Care
|
| This file deliberately overrides only floating action controls.
|--------------------------------------------------------------------------
*/

/* --------------------------------------------------------------
   1. Restore WhatsApp to a compact circular floating control
   -------------------------------------------------------------- */
.encot-restored-whatsapp,
a.encot-restored-whatsapp.whatsapp-button {
    position: fixed !important;
    left: 16px !important;
    right: auto !important;
    bottom: 16px !important;

    width: 54px !important;
    height: 54px !important;
    min-width: 54px !important;
    min-height: 54px !important;
    max-width: 54px !important;

    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;

    gap: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;

    border: 0 !important;
    border-radius: 50% !important;

    background: #25D366 !important;
    color: #ffffff !important;

    box-shadow: 0 14px 34px rgba(17, 94, 50, .28) !important;

    font-size: 0 !important;
    line-height: 1 !important;
    text-decoration: none !important;

    z-index: 10003 !important;
}

/* Remove the older generic WhatsApp pseudo-icon, which was creating
   the doubled / widened appearance together with the footer icon. */
.encot-restored-whatsapp::before,
a.encot-restored-whatsapp.whatsapp-button::before {
    content: none !important;
    display: none !important;
}

.encot-restored-whatsapp .encot-restored-whatsapp-icon {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;

    width: 100% !important;
    height: 100% !important;

    color: #ffffff !important;
    font-size: 22px !important;
    line-height: 1 !important;
}

.encot-restored-whatsapp .whatsapp-button-text,
.encot-restored-whatsapp .whatsapp-button-number {
    display: none !important;
}

.encot-restored-whatsapp:hover,
.encot-restored-whatsapp:focus-visible {
    transform: translateY(-2px) !important;
    background: #1FAE55 !important;
    box-shadow: 0 18px 38px rgba(17, 94, 50, .34) !important;
}

/* Small label only on hover/focus on devices that support hover. */
@media (hover: hover) and (pointer: fine) {
    .encot-restored-whatsapp::after {
        content: "WhatsApp";
        position: absolute;
        left: calc(100% + 9px);
        top: 50%;
        transform: translateY(-50%);
        display: block;
        padding: 6px 9px;
        border-radius: 8px;
        background: #075e54;
        color: #fff;
        font-size: 10px;
        font-weight: 800;
        line-height: 1;
        white-space: nowrap;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: .16s ease;
    }

    .encot-restored-whatsapp:hover::after,
    .encot-restored-whatsapp:focus-visible::after {
        opacity: 1;
        visibility: visible;
    }
}

/* --------------------------------------------------------------
   2. Install icon: vertical stack ABOVE WhatsApp
   -------------------------------------------------------------- */
.encot-install-app[hidden] {
    display: none !important;
}

.encot-install-app {
    position: fixed !important;
    left: 16px !important;
    right: auto !important;
    bottom: 82px !important;

    width: 54px !important;
    height: 54px !important;
    min-width: 54px !important;
    min-height: 54px !important;
    max-width: 54px !important;

    display: none;
    align-items: center !important;
    justify-content: center !important;

    gap: 0 !important;
    padding: 4px !important;
    overflow: visible !important;

    border: 2px solid #ffffff !important;
    border-radius: 50% !important;

    background: #ffffff !important;
    color: #064945 !important;

    box-shadow:
        0 14px 34px rgba(6, 73, 69, .28),
        0 0 0 1px rgba(2, 121, 117, .10) !important;

    font: inherit;
    cursor: pointer;

    z-index: 10004 !important;

    transition:
        transform .18s ease,
        box-shadow .18s ease,
        opacity .18s ease,
        visibility .18s ease;
}

.encot-install-app.is-visible {
    display: inline-flex !important;
    animation: encotInstallEntrance .25s ease both;
}

.encot-install-app:hover,
.encot-install-app:focus-visible {
    transform: translateY(-2px) !important;
    box-shadow:
        0 18px 42px rgba(6, 73, 69, .34),
        0 0 0 2px rgba(2, 121, 117, .14) !important;
}

.encot-install-app-logo {
    width: 46px !important;
    height: 46px !important;
    min-width: 46px !important;
    flex: 0 0 46px !important;

    display: grid !important;
    place-items: center !important;

    overflow: hidden !important;
    border-radius: 50% !important;
    background: #ffffff !important;
    box-shadow: none !important;
}

.encot-install-app-logo img {
    width: 46px !important;
    height: 46px !important;
    display: block !important;
    object-fit: contain !important;
    border-radius: 50% !important;
}

.encot-install-app-copy {
    display: none !important;
}

/* Persistent tiny "Install" tag above the logo so the purpose is clear. */
.encot-install-app::after {
    content: "Install";
    position: absolute;
    left: 50%;
    bottom: calc(100% + 7px);
    transform: translateX(-50%);

    padding: 5px 8px;
    border-radius: 8px;

    background: #064945;
    color: #ffffff;

    font-size: 10px;
    font-weight: 850;
    line-height: 1;
    white-space: nowrap;

    box-shadow: 0 7px 18px rgba(6, 73, 69, .20);
}

/* When Customer Care is open, remove competing floating controls. */
body.encot-chat-open .encot-install-app,
body.encot-chat-open .encot-restored-whatsapp {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    transform: translateY(8px) !important;
}

/* --------------------------------------------------------------
   3. PWA manual-install dialog
   -------------------------------------------------------------- */
.encot-pwa-dialog {
    position: fixed;
    inset: 0;
    z-index: 12000;

    display: grid;
    place-items: center;

    padding: 18px;

    background: rgba(6, 73, 69, .60);

    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.encot-pwa-dialog[hidden] {
    display: none !important;
}

.encot-pwa-dialog-card {
    width: min(430px, 100%);
    max-height: calc(100dvh - 36px);
    overflow-y: auto;

    padding: 24px;

    border-radius: 22px;
    background: #ffffff;

    box-shadow: 0 30px 90px rgba(0, 0, 0, .26);
}

.encot-pwa-dialog-head {
    display: flex;
    align-items: center;
    gap: 13px;
    margin-bottom: 16px;
}

.encot-pwa-dialog-head img {
    width: 54px;
    height: 54px;
    object-fit: contain;
    border-radius: 15px;
}

.encot-pwa-dialog-head h2 {
    margin: 0;
    color: #064945;
    font-size: 21px;
    line-height: 1.2;
}

.encot-pwa-dialog-card p {
    margin: 0 0 12px;
    color: #516667;
    line-height: 1.65;
}

.encot-pwa-dialog-card ol {
    margin: 12px 0 20px;
    padding-left: 22px;
    color: #233536;
}

.encot-pwa-dialog-card li + li {
    margin-top: 8px;
}

.encot-pwa-dialog-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.encot-pwa-dialog-actions button {
    min-height: 44px;
    padding: 10px 16px;

    border: 1px solid #d8e6e5;
    border-radius: 999px;

    background: #ffffff;
    color: #064945;

    font-weight: 850;
    cursor: pointer;
}

.encot-pwa-dialog-actions .primary {
    border-color: #027975;
    background: #027975;
    color: #ffffff;
}

@keyframes encotInstallEntrance {
    from {
        opacity: 0;
        transform: translateY(9px) scale(.94);
    }

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

/* Installation was requested primarily for phones/tablets.
   Hide it on ordinary wide desktop screens. */
@media (min-width: 981px) and (pointer: fine) {
    .encot-install-app {
        display: none !important;
    }
}

@media (max-width: 680px) {
    .encot-restored-whatsapp,
    a.encot-restored-whatsapp.whatsapp-button {
        left: 14px !important;
        bottom: 14px !important;

        width: 50px !important;
        height: 50px !important;
        min-width: 50px !important;
        min-height: 50px !important;
        max-width: 50px !important;
    }

    .encot-install-app {
        left: 14px !important;
        bottom: 76px !important;

        width: 50px !important;
        height: 50px !important;
        min-width: 50px !important;
        min-height: 50px !important;
        max-width: 50px !important;
    }

    .encot-install-app-logo,
    .encot-install-app-logo img {
        width: 42px !important;
        height: 42px !important;
        min-width: 42px !important;
        flex-basis: 42px !important;
    }
}

@media (max-width: 380px) {
    .encot-restored-whatsapp,
    a.encot-restored-whatsapp.whatsapp-button {
        left: 11px !important;
        bottom: 11px !important;
    }

    .encot-install-app {
        left: 11px !important;
        bottom: 72px !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .encot-install-app.is-visible {
        animation: none;
    }

    .encot-install-app,
    .encot-restored-whatsapp {
        transition: none !important;
    }
}
