/* DoR App – compact QR dropdown */
.top-header,
.top-header .header-utility-row,
.top-header .footer-app-item {
    overflow: visible !important;
}

.top-header .footer-app-item {
    position: relative !important;
    z-index: 2400 !important;
}

.top-header .footer-app-item > .footer-install-app-trigger {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    color: #1769AA;
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.top-header .footer-app-mobile-icon {
    color: #1769AA;
    font-size: 16px;
}

/* QR dropdown: its bottom is constrained by the main menu */
.top-header .footer-app-item > .footer-app-popover {
    position: absolute !important;
    top: calc(100% + 3px) !important;
    right: 0 !important;
    left: auto !important;
    bottom: auto !important;
    z-index: 99999 !important;

    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 3px;

    width: calc(var(--dor-app-qr-size, 82px) + 12px) !important;
    max-width: calc(100vw - 12px) !important;
    height: auto !important;
    max-height: var(--dor-app-max-height, 0px) !important;
    min-height: 0 !important;

    box-sizing: border-box;
    overflow: hidden;
    padding: 4px;
    margin: 0;

    background: #fff;
    border: 1px solid #d8e5f1;
    border-radius: 6px;
    box-shadow: 0 4px 13px rgba(20,45,78,.20);

    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .15s ease, visibility .15s ease;
}

/* Desktop: show only on hover or keyboard focus */
@media (hover: hover) and (pointer: fine) {
    .top-header .footer-app-item:hover > .footer-app-popover,
    .top-header .footer-app-item:focus-within > .footer-app-popover {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }
}

/* Touch devices: existing click handler toggles is-open */
.top-header .footer-app-item.is-open > .footer-app-popover {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Compact, dynamically sized QR */
.top-header .footer-app-popover .footer-qr-image-wrap {
    position: relative;
    flex: 0 0 auto;
    width: var(--dor-app-qr-size, 82px) !important;
    height: var(--dor-app-qr-size, 82px) !important;
    min-width: 0;
    min-height: 0;
    padding: 2px;
    box-sizing: border-box;
    overflow: hidden;
    background: #fff;
    border-radius: 3px;
    line-height: 0;
}

/* Expanded QR remains within the same main-menu height limit */
.top-header .footer-app-item.is-expanded .footer-app-popover {
    width: calc(var(--dor-app-qr-expanded-size, 82px) + 12px) !important;
}

.top-header .footer-app-item.is-expanded .footer-qr-image-wrap {
    width: var(--dor-app-qr-expanded-size, 82px) !important;
    height: var(--dor-app-qr-expanded-size, 82px) !important;
}

.top-header .footer-app-popover .footer-qr-code-image {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain;
    margin: 0;
    padding: 0;
    border: 0;
}

/* Small national emblem in the QR centre */
.top-header .footer-app-popover .footer-qr-emblem {
    position: absolute;
    top: 50%;
    left: 50%;
    display: block !important;
    width: 13% !important;
    height: auto !important;
    max-width: 13%;
    max-height: 13%;
    padding: 2px;
    box-sizing: content-box;
    object-fit: contain;
    background: #fff;
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

/* Three tiny blue premium icons, one line, no button boxes */
.top-header .footer-share-links {
    display: flex !important;
    flex: 0 0 18px;
    flex-wrap: nowrap !important;
    align-items: center;
    justify-content: center;
    gap: 9px;
    width: 100%;
    min-height: 18px;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    background: transparent;
}

.top-header .footer-share-links .footer-app-install-icon,
.top-header .footer-share-links .footer-native-share,
.top-header .footer-share-links .footer-qr-expand {
    display: inline-flex !important;
    flex: 0 0 16px;
    align-items: center;
    justify-content: center;
    width: 16px !important;
    min-width: 16px;
    height: 18px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    font-size: 14px;
    line-height: 1;
    text-decoration: none !important;
    cursor: pointer;
    transition: color .15s ease, transform .15s ease;
}

.top-header .footer-share-links .footer-app-install-icon {
    color: #0876c9 !important;
}

.top-header .footer-share-links .footer-native-share {
    color: #1595cf !important;
}

.top-header .footer-share-links .footer-qr-expand {
    color: #07569b !important;
}

.top-header .footer-share-links .footer-native-share svg {
    display: block;
    width: 14px;
    height: 14px;
}

.top-header .footer-share-links a:hover,
.top-header .footer-share-links button:hover {
    color: #142D4E !important;
    transform: scale(1.12);
}

@media (prefers-reduced-motion: reduce) {
    .top-header .footer-app-popover,
    .top-header .footer-share-links a,
    .top-header .footer-share-links button {
        transition: none;
    }
}

/* TEMP: QR only – hide all other dropdown items */
.top-header .footer-app-item > .footer-app-popover > :not(.footer-qr-image-wrap) {
    display: none !important;
}

.top-header .footer-app-item > .footer-app-popover::before,
.top-header .footer-app-item > .footer-app-popover::after {
    content: none !important;
    display: none !important;
}

.top-header .footer-app-item > .footer-app-popover .footer-share-links {
    display: none !important;
}
