/* =========================================================
   BioManager phone app: bottom tab bar, install banner, phone layout fixes.
   Used by _Layout (signed-in pages) and the sign-in page. Colours come from eve-theme.css.
   ========================================================= */

/* ---------- bottom tab bar (phones and the installed app) ---------- */
.eve-tabbar { display: none; }

@media (max-width: 768px) {
    .eve-tabbar {
        display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
        position: fixed; inset-inline: 0; bottom: 0; z-index: 1040;
        background: var(--surface); border-top: 1px solid var(--border);
        padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
        box-shadow: 0 -4px 16px rgba(16, 24, 40, .06);
    }
    body .eve-tabbar > a, body .eve-tabbar > button {
        appearance: none; border: 0; background: none; font: inherit; cursor: pointer;
        display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
        min-height: 54px; padding: 4px 2px; border-radius: 12px;
        color: var(--muted); font-size: 11px; font-weight: 600; text-decoration: none; line-height: 1.1;
        -webkit-tap-highlight-color: transparent;
    }
    body .eve-tabbar > a:hover, body .eve-tabbar > a:focus { color: var(--muted); text-decoration: none; }
    body .eve-tabbar i { font-size: 19px; }
    body .eve-tabbar > .is-active, body .eve-tabbar > .is-active:hover, body .eve-tabbar > .is-active:focus { color: var(--acc-text); }
    body .eve-tabbar > .is-active i { transform: translateY(-1px); }
    body .eve-tabbar > a:active, body .eve-tabbar > button:active { background: var(--surface-2); }
    .eve-tabbar [hidden] { display: none !important; }

    /* room for the bar; the footer is replaced by it */
    body.eve-app { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
    body.eve-app .eve-footer { display: none; }

    /* header: compact and safe-area aware (iPhone notch) */
    body.eve-app .eve-header { padding-top: env(safe-area-inset-top); }
    body.eve-app .eve-date { display: none; }

    /* page content: no sideways scrolling of the whole page; wide tables scroll on their own */
    html, body { max-width: 100%; overflow-x: hidden; }
    body.eve-app .eve-main { padding: 12px 10px 16px; min-height: 0; }
    body.eve-app .eve-main .table-responsive,
    body.eve-app .eve-main .dataTables_wrapper,
    body.eve-app .eve-main .dataTables_scrollBody { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    body.eve-app .eve-main .dataTables_wrapper { width: 100%; }
    body.eve-app .eve-main .dataTables_wrapper .row { margin-inline: 0; }
    body.eve-app .eve-main .dataTables_filter, body.eve-app .eve-main .dataTables_length { float: none; text-align: start; }
    body.eve-app .eve-main .dataTables_filter input { width: 100%; margin-inline-start: 0; }
    body.eve-app .eve-main .card-body { padding: 12px; }
    body.eve-app .eve-main .modal-dialog { margin: 8px; }

    /* forms: full-width fields and touch-size controls; 16px text stops iPhone zooming into fields */
    body.eve-app .eve-main .form-control, body.eve-app .eve-main select, body.eve-app .eve-main input[type="text"],
    body.eve-app .eve-main input[type="date"], body.eve-app .eve-main input[type="number"], body.eve-app .eve-main textarea {
        font-size: 16px; min-height: 42px;
    }
    body.eve-app .eve-main .btn { min-height: 42px; }
    body.eve-app .eve-main [class*="col-md-"], body.eve-app .eve-main [class*="col-lg-"] { flex: 0 0 100%; max-width: 100%; }
}

/* installed app: no text selection on the chrome, feels native */
html.is-app .eve-tabbar, html.is-app .eve-header { -webkit-user-select: none; user-select: none; }

/* ---------- install banner (Android) / Add-to-Home-Screen tip (iPhone) ---------- */
.eve-install {
    position: fixed; inset-inline: 10px; z-index: 1060;
    bottom: calc(12px + env(safe-area-inset-bottom));
    display: flex; align-items: center; gap: 12px;
    background: var(--surface, #fff); color: var(--text, #1F2937);
    border: 1px solid var(--border, #E1E4EA); border-radius: 16px;
    padding: 12px 12px 12px 14px; box-shadow: 0 10px 30px rgba(16, 24, 40, .18);
    font-family: var(--font, system-ui, sans-serif); font-size: 13.5px; line-height: 1.4;
    animation: eve-install-in .25s ease-out;
}
html[dir="rtl"] .eve-install { font-family: var(--font-ar, Tahoma, sans-serif); }
@media (max-width: 768px) { body.eve-app .eve-install { bottom: calc(74px + env(safe-area-inset-bottom)); } }
@media (min-width: 769px) { .eve-install { inset-inline: auto 20px; max-width: 380px; } }
.eve-install img { width: 44px; height: 44px; border-radius: 10px; flex: none; }
.eve-install .txt { flex: 1; min-width: 0; }
.eve-install b { display: block; font-size: 14.5px; color: var(--strong, #111827); }
.eve-install .go {
    border: 0; border-radius: 10px; background: var(--acc, #C8102E); color: #fff;
    font-weight: 600; font-size: 14px; padding: 9px 14px; min-height: 40px; cursor: pointer; flex: none;
}
.eve-install .x {
    border: 0; background: none; color: var(--muted, #6B7280); font-size: 20px; line-height: 1;
    width: 32px; height: 32px; border-radius: 8px; cursor: pointer; flex: none;
}
.eve-install .share { display: inline-block; vertical-align: -3px; width: 16px; height: 16px; }
@keyframes eve-install-in { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .eve-install { animation: none; } }

/* ---------- sign-in page on small phones: keep the language switch whole ---------- */
@media (max-width: 420px) {
    .lg-tools { gap: 6px; }
    .lg-tools img { height: 30px; width: auto; }
    .lg-tools .eve-seg { flex-shrink: 0; }
    .lg-tools .eve-seg button { padding-inline: 9px; font-size: 12.5px; }
}
