/* B1 – oldalváltás fade / View Transitions */
.pwa-nav-fade-overlay {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    pointer-events: none;
    opacity: 0;
    background: #f8fafc;
    transition: opacity 0.2s ease;
}

.pwa-nav-fade-overlay.is-active {
    pointer-events: auto;
    opacity: 1;
}

@supports (view-transition-name: root) {
    ::view-transition-old(root),
    ::view-transition-new(root) {
        animation-duration: 0.22s;
        animation-timing-function: ease;
    }
}

html.auvi-nav-transitioning main {
    pointer-events: none;
}

/* B2 – branded splash / betöltő */
#pwa-app-splash {
    position: fixed;
    inset: 0;
    z-index: 2147482000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    background: #f8fafc;
    transition: opacity 0.35s ease, visibility 0.35s ease;
}

#pwa-app-splash.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

#pwa-app-splash .pwa-app-splash__logo {
    width: min(42vw, 168px);
    height: auto;
    object-fit: contain;
}

#pwa-app-splash .pwa-app-splash__spinner {
    width: 2rem;
    height: 2rem;
    border: 3px solid #e2e8f0;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: pwa-splash-spin 0.75s linear infinite;
}

@keyframes pwa-splash-spin {
    to { transform: rotate(360deg); }
}

/* Oldalváltás: diszkrét sarok-spinner (nem teljes képernyős splash) */
.pwa-nav-loader {
    position: fixed;
    z-index: 2147483100;
    right: max(14px, env(safe-area-inset-right, 0px));
    bottom: max(14px, env(safe-area-inset-bottom, 0px));
    width: 20px;
    height: 20px;
    border: 2px solid rgba(37, 99, 235, 0.12);
    border-top-color: rgba(37, 99, 235, 0.72);
    border-radius: 50%;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.18s ease, visibility 0.18s ease;
    animation: pwa-splash-spin 0.65s linear infinite;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06);
}

.pwa-nav-loader.is-active,
html.auvi-nav-loading .pwa-nav-loader {
    opacity: 1;
    visibility: visible;
}

/* B3 – skeleton / shimmer listáknál */
.auvi-list-skeleton {
    display: none;
    gap: 1rem;
}

.auvi-list-skeleton-host.is-loading .auvi-list-skeleton {
    display: grid;
}

.auvi-list-skeleton-host.is-loading .auvi-list-content {
    opacity: 0;
    pointer-events: none;
}

.auvi-list-skeleton-host.is-ready .auvi-list-content {
    opacity: 1;
    pointer-events: auto;
    transition: opacity 0.22s ease;
}

.auvi-list-skeleton-host.is-loading {
    display: block;
}

.auvi-list-skeleton--cards {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.auvi-list-skeleton--operator {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.auvi-skeleton-card {
    border-radius: 12px;
    background: #fff;
    border: 1px solid #e2e8f0;
    padding: 1rem 1.1rem;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.auvi-skeleton-line {
    height: 0.75rem;
    border-radius: 6px;
    background: linear-gradient(90deg, #e2e8f0 0%, #f1f5f9 45%, #e2e8f0 90%);
    background-size: 200% 100%;
    animation: auvi-shimmer 1.2s ease-in-out infinite;
    margin-bottom: 0.55rem;
}

.auvi-skeleton-line--title {
    height: 1.1rem;
    width: 68%;
    margin-bottom: 0.85rem;
}

.auvi-skeleton-line--short { width: 42%; }
.auvi-skeleton-line--badge {
    height: 1.5rem;
    width: 38%;
    border-radius: 999px;
    margin-bottom: 1rem;
}

.auvi-skeleton-line:last-child {
    margin-bottom: 0;
}

@keyframes auvi-shimmer {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

/* C2 – nyomás-effekt gombokon / kártyákon */
.auvi-pressable,
.btn,
.btn-primary,
.btn-secondary,
.dashboard-quick-card,
.dashboard-action-card,
.dashboard-activity-item,
.client-card.client-list-card,
.client-card.location-card,
.operator-check-card,
.pagination-btn:not(.pagination-btn-disabled) {
    transition: transform 0.14s cubic-bezier(0.2, 0, 0, 1), box-shadow 0.14s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.btn:active:not(:disabled),
.btn-primary:active:not(:disabled),
.btn-secondary:active:not(:disabled),
.dashboard-quick-card:active,
.dashboard-action-card:active,
.dashboard-activity-item:active,
.client-card.client-list-card:active,
.client-card.location-card:active,
.operator-check-card:active,
.pagination-btn:not(.pagination-btn-disabled):active {
    transform: scale(0.97);
}

.task-action-btn:active {
    transform: scale(0.94);
}

/* C3 – ripple / highlight lista sorokon */
.auvi-touch-ripple {
    position: relative;
    overflow: hidden;
}

.auvi-ripple-wave {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.14) 0%, rgba(37, 99, 235, 0.06) 45%, transparent 70%);
    transform: scale(0);
    animation: auvi-ripple-expand 0.48s cubic-bezier(0.2, 0, 0, 1) forwards;
    z-index: 0;
}

@keyframes auvi-ripple-expand {
    to {
        transform: scale(1);
        opacity: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .pwa-nav-fade-overlay,
    #pwa-app-splash,
    .pwa-nav-loader,
    .auvi-list-skeleton-host.is-ready .auvi-list-content {
        transition: none;
    }

    .auvi-skeleton-line {
        animation: none;
        background: #e2e8f0;
    }

    #pwa-app-splash .pwa-app-splash__spinner,
    .pwa-nav-loader {
        animation: none;
        border-top-color: #94a3b8;
    }

    .btn:active,
    .dashboard-quick-card:active,
    .dashboard-activity-item:active,
    .client-card.client-list-card:active,
    .client-card.location-card:active,
    .operator-check-card:active,
    .pagination-btn:active,
    .task-action-btn:active {
        transform: none;
    }

    .auvi-ripple-wave {
        animation: none;
        opacity: 0;
    }
}

/* PWA frissítés – teljes szélességű, alulról beúszó sáv */
.pwa-update-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2147483640;
    transform: translate3d(0, 100%, 0);
    transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
    pointer-events: none;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
}

.pwa-update-sheet.is-visible {
    transform: translate3d(0, 0, 0);
    pointer-events: auto;
}

.pwa-update-sheet__inner {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    width: 100%;
    box-sizing: border-box;
    padding: 1rem 1.1rem calc(1rem + env(safe-area-inset-bottom, 0px));
    background: #0f172a;
    color: #f8fafc;
    box-shadow: 0 -10px 36px rgba(15, 23, 42, 0.35);
    border-radius: 16px 16px 0 0;
}

.pwa-update-sheet__copy {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.pwa-update-sheet__icon {
    flex-shrink: 0;
    font-size: 1.65rem;
    line-height: 1;
    color: #60a5fa;
    margin-top: 0.1rem;
}

.pwa-update-sheet__text-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

.pwa-update-sheet__title {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.3;
}

.pwa-update-sheet__sub {
    font-size: 0.875rem;
    line-height: 1.4;
    color: #cbd5e1;
}

.pwa-update-sheet__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    width: 100%;
}

.pwa-update-sheet__actions .btn {
    flex: 1 1 auto;
    min-width: 0;
    justify-content: center;
}

.pwa-update-sheet__btn {
    min-width: 9rem;
}

.pwa-update-sheet__later {
    min-width: 6rem;
}

/* Régi toast osztályok – ha cache-elt JS még azt építi */
.pwa-update-toast {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2147483640;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 1rem 1.1rem calc(1rem + env(safe-area-inset-bottom, 0px));
    background: #0f172a;
    color: #f8fafc;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -10px 36px rgba(15, 23, 42, 0.35);
    max-width: none;
    width: 100%;
    box-sizing: border-box;
    transform: none;
}

.pwa-update-toast__btn {
    border: none;
    border-radius: 8px;
    padding: 0.4rem 0.75rem;
    background: #2563eb;
    color: #fff;
    font-weight: 600;
    cursor: pointer;
}

.pwa-update-toast__close {
    border: none;
    background: transparent;
    color: #cbd5e1;
    cursor: pointer;
    display: inline-flex;
    padding: 0.15rem;
    margin-left: auto;
}

@media (prefers-reduced-motion: reduce) {
    .pwa-update-sheet {
        transition: none;
    }
}

/* Alkalmazások – inline telepítés */
.pwa-install-inline {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    margin: 0 0 1rem;
    padding: 1rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    position: relative;
}

.pwa-install-inline__icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 10px;
    background: #eff6ff;
    color: #2563eb;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.pwa-install-inline__body h3 {
    margin: 0 0 0.25rem;
    font-size: 1rem;
}

.pwa-install-inline__body p {
    margin: 0 0 0.5rem;
    color: #64748b;
    font-size: 0.9rem;
}

.pwa-install-inline .pwa-install-dismiss {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    border: none;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
}

html.pwa-standalone .pwa-install-inline,
html.pwa-standalone [data-pwa-install-banner] {
    display: none !important;
}

.pwa-install-more {
    margin: 0.35rem 0 0;
    font-size: 0.85rem;
}

.pwa-install-more a {
    color: #2563eb;
    text-decoration: none;
    font-weight: 600;
}

.pwa-install-more a:hover {
    text-decoration: underline;
}

/* Globális offline sáv (minden bejelentkezett oldalon) – js/pwa-status.js kezeli */
.auvi-offline-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 11000;
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.7rem 1rem;
    padding-bottom: calc(0.7rem + env(safe-area-inset-bottom, 0px));
    background: #1e293b;
    color: #f8fafc;
    font-size: 0.85rem;
    line-height: 1.4;
    box-shadow: 0 -2px 12px rgba(15, 23, 42, 0.25);
}

.auvi-offline-bar[hidden] {
    display: none;
}

.auvi-offline-bar .material-symbols-outlined {
    flex-shrink: 0;
    font-size: 1.3rem;
    color: #fbbf24;
}

.auvi-offline-bar__text strong {
    color: #fff;
}

/* Ha van alsó tab bar, a sáv fölé kerüljön */
body.auvi-has-tabbar .auvi-offline-bar {
    bottom: calc(var(--auvi-tabbar-height, 56px));
}
