/*
 * Tablet / touch adjustments. Everything is scoped to touch pointers or the installed
 * (standalone) app, so desktop rendering is unchanged.
 */

/* Header dropdowns opened by tap (see tablet.js) */
.admin-link.pwa-open .sublinks-admin-wrapper { display: flex; }
.profile-logo.pwa-open .profile-dropdown { display: flex; }
.admin-link.pwa-open .downwards-caret,
.profile-logo.pwa-open .downwards-caret { transform: translateY(50%) rotateZ(-135deg); }

@media (pointer: coarse) {
    html { -webkit-tap-highlight-color: rgba(0, 74, 173, .15); }

    /* Minimum ~44px touch targets for common controls */
    /* Kendo composite widgets (pickers, dropdowns) keep their own internal sizing. */
    .btn,
    .k-button,
    .k-pager-wrap .k-link,
    .form-control:not(.k-input),
    .custom-select,
    select:not(.k-input),
    input[type="text"]:not(.k-input),
    input[type="search"]:not(.k-input),
    input[type="email"],
    input[type="password"],
    input[type="number"]:not(.k-input),
    input[type="date"] {
        min-height: 44px;
    }

    .k-pager-numbers .k-link,
    .k-pager-wrap .k-link { min-width: 44px; line-height: 44px; }

    .k-grid td { padding-top: .7em; padding-bottom: .7em; }

    input[type="checkbox"],
    input[type="radio"] { min-width: 22px; min-height: 22px; }

    .sublinks-admin-container a,
    .profile-links-container a { min-height: 44px; }

    /* Horizontal scroll for wide grids instead of squeezing columns */
    .k-grid-content,
    .table-responsive { -webkit-overflow-scrolling: touch; }
}

/* Installed app only */
.pwa-standalone body { overscroll-behavior-y: contain; }

.pwa-reload {
    position: fixed;
    left: 16px;
    bottom: 16px;
    z-index: 99998;
    width: 48px;
    height: 48px;
    border: 0;
    border-radius: 50%;
    background: #004aad;
    color: #fff;
    font-size: 24px;
    line-height: 48px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .25);
    opacity: .85;
    cursor: pointer;
}

.pwa-reload:active { opacity: 1; }

@media print {
    .pwa-reload, .pwa-install, .pwa-banner { display: none !important; }
}

/* Non-blocking network messages (tablet.js showToast) */
.pwa-toast {
    position: fixed;
    left: 50%;
    bottom: 80px;
    z-index: 100001;
    max-width: min(560px, calc(100% - 32px));
    padding: 14px 18px;
    border-radius: 8px;
    background: #b91c1c;
    color: #fff;
    font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .25);
    transform: translate(-50%, 20px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease, transform .2s ease;
}

.pwa-toast.pwa-toast-visible {
    opacity: 1;
    transform: translate(-50%, 0);
    pointer-events: auto;
}

@media print {
    .pwa-toast { display: none !important; }
}
