/* Shared mobile and touch usability rules for every routed application page. */
:root {
    --arclla-touch-target: 44px;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

.arclla-mobile-brand,
.arclla-footer-mobile {
    display: none;
}

.arclla-search-dialog {
    z-index: 1;
}

.arclla-footer-desktop {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.arclla-footer-copyright {
    flex: 0 1 auto;
}

.arclla-footer-links {
    display: inline-flex;
    flex: 1 1 auto;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.75rem;
    min-width: 0;
}

.arclla-footer-version {
    flex: 0 0 auto;
    margin-left: auto;
}

@media (max-width: 767.98px), (any-pointer: coarse) {
    html,
    body {
        max-width: 100%;
    }

    body {
        overflow-wrap: anywhere;
        -webkit-tap-highlight-color: rgba(15, 118, 110, 0.16);
    }

    body.arclla-dark-theme.arclla-gradient-theme:not(.arclla-public-layout) .content-wrapper > .content-header h1 {
        color: #f8fafc !important;
    }

    a,
    button,
    input,
    select,
    textarea,
    [role="button"],
    summary {
        touch-action: manipulation;
    }

    button,
    input[type="button"],
    input[type="submit"],
    input[type="reset"],
    .btn,
    .page-link,
    .dropdown-item,
    .list-group-item-action,
    summary,
    [role="button"] {
        min-height: var(--arclla-touch-target);
    }

    .btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        white-space: normal;
    }

    .btn-tool,
    button.close,
    .navbar-toggler,
    .arclla-search-close,
    a.icon {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: var(--arclla-touch-target);
        min-height: var(--arclla-touch-target);
    }

    .user-profile-password-toggle,
    .manual-anchor-link,
    .property-dashboard-admin .dashboard-widget-drag-handle,
    .property-dashboard-admin .dashboard-widget-order-button {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: var(--arclla-touch-target);
        min-height: var(--arclla-touch-target);
    }

    .arclla-gradient-theme .btn,
    .arclla-gradient-theme .app-action-btn,
    .arclla-gradient-theme .app-page-actions .btn,
    .arclla-gradient-theme .arclla-property-switcher-search,
    .arclla-gradient-theme .arclla-property-switcher-action,
    .arclla-gradient-theme .arclla-property-menu-item > .arclla-property-menu-link,
    .arclla-gradient-theme .nav-sidebar .arclla-property-menu-entry > .nav-link,
    .arclla-gradient-theme .nav-sidebar .arclla-admin-menu-entry > .nav-link {
        min-height: var(--arclla-touch-target);
    }

    .main-header .nav-link,
    .nav-sidebar .nav-link,
    .manual-section-nav .nav-link {
        min-height: var(--arclla-touch-target);
    }

    .arclla-app-navbar {
        position: relative;
        padding-right: max(0.25rem, env(safe-area-inset-right));
        padding-left: max(0.25rem, env(safe-area-inset-left));
    }

    .arclla-app-navbar > .navbar-nav,
    .arclla-app-navbar .arclla-search-launch-wrap {
        position: relative;
        z-index: 2;
    }

    .arclla-app-navbar.has-global-search > .navbar-nav.ml-auto {
        margin-left: 0 !important;
    }

    .arclla-menu-toggle,
    .arclla-app-navbar .arclla-search-launch {
        width: var(--arclla-touch-target);
        min-width: var(--arclla-touch-target);
        height: var(--arclla-touch-target);
        justify-content: center;
        padding: 0 !important;
    }

    .arclla-app-navbar .arclla-search-launch,
    .arclla-app-navbar .arclla-search-launch:hover,
    .arclla-app-navbar .arclla-search-launch:focus {
        color: #ffffff;
        border-color: transparent;
        background: transparent;
        box-shadow: none;
    }

    .arclla-app-navbar .arclla-search-launch:hover,
    .arclla-app-navbar .arclla-search-launch:focus {
        background: rgba(255, 255, 255, 0.14);
    }

    .arclla-mobile-brand {
        position: absolute;
        z-index: 1;
        top: 50%;
        left: 50%;
        display: inline-flex;
        width: 94px;
        height: var(--arclla-touch-target);
        align-items: center;
        justify-content: center;
        overflow: hidden;
        transform: translate(-50%, -50%);
    }

    .arclla-mobile-brand img {
        display: block;
        width: 92px;
        height: auto;
        max-height: 30px;
        object-fit: contain;
    }

    .arclla-search-close i {
        font-size: 1.1rem;
    }

    .nav-sidebar .nav-link,
    .dropdown-item,
    .list-group-item-action {
        display: flex;
        align-items: center;
    }

    .pg-button,
    .pg-action-link,
    .public-viewing-error-powered-cta,
    .property-dashboard-admin .dashboard-section-nav a,
    .content-wrapper.tenant-portal .tenant-home-empty-link-list a,
    .content-wrapper.tenant-portal .tenant-home-contact-links a,
    .content-wrapper.tenant-portal .tenant-home-info-head a {
        min-height: var(--arclla-touch-target);
    }

    .property-dashboard-admin .dashboard-widget-drag-handle,
    .property-dashboard-admin .dashboard-widget-order-button,
    .property-dashboard-admin .dashboard-widget-toggle {
        min-height: var(--arclla-touch-target) !important;
    }

    .property-dashboard-admin .dashboard-widget-drag-handle,
    .property-dashboard-admin .dashboard-widget-order-button {
        min-width: var(--arclla-touch-target) !important;
    }

    .property-dashboard-admin .dashboard-color-input {
        min-height: var(--arclla-touch-target) !important;
    }

    .form-control:not(textarea),
    .custom-select,
    input[type="file"],
    .input-group-text,
    .custom-file-label,
    .custom-file-label::after {
        min-height: var(--arclla-touch-target);
    }

    input.form-control,
    select.form-control,
    textarea.form-control,
    .custom-select {
        font-size: 16px;
    }

    textarea.form-control {
        min-height: 88px;
    }

    .input-group,
    .form-group,
    .card,
    .card-body,
    .modal-content,
    .dataTables_wrapper .row > [class*="col-"] {
        min-width: 0;
    }

    .custom-control {
        min-height: var(--arclla-touch-target);
    }

    .custom-control-label {
        display: flex;
        align-items: center;
        min-height: var(--arclla-touch-target);
        padding-top: 0.35rem;
        padding-bottom: 0.35rem;
    }

    .custom-control-label::before,
    .custom-control-label::after {
        top: 14px;
    }

    .form-check {
        display: flex;
        align-items: center;
        min-height: var(--arclla-touch-target);
    }

    .form-check-label {
        padding-top: 0.65rem;
        padding-bottom: 0.65rem;
    }

    label:has(> input[type="checkbox"]:not(.custom-control-input)),
    label:has(> input[type="radio"]:not(.custom-control-input)),
    .arclla-checkbox-touch {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: var(--arclla-touch-target);
        min-height: var(--arclla-touch-target);
        gap: 0.5rem;
        margin-bottom: 0;
        touch-action: manipulation;
    }

    label > input[type="checkbox"]:not(.custom-control-input),
    label > input[type="radio"]:not(.custom-control-input),
    .arclla-checkbox-touch > input[type="checkbox"],
    .arclla-checkbox-touch > input[type="radio"] {
        width: 20px;
        height: 20px;
        min-width: 20px;
        margin: 0;
    }

    .select2-container .select2-selection--single,
    .select2-container .select2-selection--multiple {
        min-height: var(--arclla-touch-target);
    }

    .select2-container--default .select2-selection--single .select2-selection__rendered {
        line-height: 42px;
    }

    .select2-container--default .select2-selection--single .select2-selection__arrow {
        height: 42px;
    }

    .nav-tabs {
        flex-wrap: nowrap;
        max-width: 100%;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }

    .nav-tabs .nav-item {
        flex: 0 0 auto;
    }

    .nav-tabs .nav-link {
        display: flex;
        align-items: center;
        min-height: var(--arclla-touch-target);
        white-space: nowrap;
    }

    .pagination {
        flex-wrap: wrap;
        gap: 0.25rem;
    }

    .page-link {
        display: flex;
        align-items: center;
        justify-content: center;
        min-width: var(--arclla-touch-target);
        padding: 0.5rem 0.7rem;
    }

    .dropdown-menu {
        max-width: calc(100vw - 1rem);
    }

    .dropdown-item {
        min-height: var(--arclla-touch-target);
        white-space: normal;
    }

    .arclla-navbar-account-language-option,
    .arclla-navbar-account-theme-option {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: var(--arclla-touch-target) !important;
        min-height: var(--arclla-touch-target) !important;
        padding: 0.35rem 0.45rem !important;
    }

    .card.card-outline.card-info .card-body .d-flex > .text-info:first-child {
        flex: 0 0 auto;
        align-self: flex-start;
        margin-top: 0.15rem;
    }

    .card.card-outline.card-info .card-body .d-flex > .text-info:first-child + .text-muted {
        flex: 1 1 0;
        min-width: 0;
    }

    .dataTables_wrapper .dataTables_length select,
    .dataTables_wrapper .dataTables_filter input {
        min-height: var(--arclla-touch-target);
        font-size: 16px;
    }

    .dataTables_wrapper .dataTables_filter input {
        max-width: 100%;
    }

    .dataTables_scrollBody,
    .table-responsive,
    .content .card-body > table.table:not(.dataTable) {
        overflow-x: auto;
        overscroll-behavior-x: contain;
        -webkit-overflow-scrolling: touch;
    }

    .content .card-body > table.table:not(.dataTable) {
        display: block;
        width: 100%;
        max-width: 100%;
    }

    .table .btn + .btn,
    .table a.icon + a.icon {
        margin-left: 0.25rem;
    }

    .modal {
        padding-left: max(0.5rem, env(safe-area-inset-left)) !important;
        padding-right: max(0.5rem, env(safe-area-inset-right)) !important;
    }

    .modal-dialog {
        width: auto;
        max-width: 100%;
        margin: max(0.5rem, env(safe-area-inset-top)) 0 max(0.5rem, env(safe-area-inset-bottom));
    }

    .modal-content {
        max-height: calc(100dvh - 1rem - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    }

    .modal-body {
        overflow-y: auto;
        overscroll-behavior-y: contain;
        -webkit-overflow-scrolling: touch;
    }

    .modal-header,
    .modal-footer {
        flex-shrink: 0;
    }

    .modal-footer {
        gap: 0.5rem;
    }

    .modal-footer > .btn {
        margin: 0;
    }

    img,
    video,
    canvas {
        max-width: 100%;
    }

    code,
    pre {
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .arclla-footer-desktop {
        display: none;
    }

    .arclla-footer-mobile {
        display: flex;
        width: 100%;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem;
        min-height: 40px;
        white-space: nowrap;
    }

    .arclla-footer-mobile-copyright {
        overflow: hidden;
        font-size: 0.76rem;
        font-weight: 600;
        text-overflow: ellipsis;
    }

    .arclla-footer-legal-menu {
        flex: 0 0 auto;
    }

    .arclla-footer-legal-menu > .btn {
        min-height: 40px !important;
        padding: 0 0.25rem;
        font-size: 0.76rem;
        font-weight: 600;
        text-decoration: none;
    }

    .arclla-footer-legal-menu .dropdown-menu {
        max-height: min(70vh, 22rem);
        overflow-y: auto;
    }

    .main-footer {
        padding: 0 max(0.65rem, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(0.65rem, env(safe-area-inset-left));
    }
}

@media (max-width: 767.98px) {
    .layout-footer-fixed .wrapper .main-footer {
        position: static !important;
        right: auto;
        bottom: auto;
        left: auto;
    }

    .layout-footer-fixed .wrapper .content-wrapper {
        padding-bottom: 0 !important;
    }

    .content-header .row.mb-2 {
        margin-bottom: 0 !important;
    }

    .content-header .breadcrumb {
        flex-wrap: nowrap;
        align-items: center;
        margin: 0;
        padding: 0;
        overflow-x: auto;
        line-height: 1.2;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .content-header .breadcrumb::-webkit-scrollbar {
        display: none;
    }

    .content-header .breadcrumb-item {
        flex: 0 0 auto;
        font-size: 0.76rem;
        white-space: nowrap;
    }

    .content-header .breadcrumb-item.active:only-child {
        display: none;
    }

    .content-header .breadcrumb-item a {
        display: inline-flex;
        align-items: center;
        min-height: 28px;
        padding: 0.15rem 0;
    }
}

@media (max-width: 575.98px) {
    .content-wrapper:not(.tenant-portal) > .content-header,
    .content-wrapper:not(.tenant-portal) > .content {
        padding-left: 0.65rem;
        padding-right: 0.65rem;
    }

    .content-wrapper > .content > .container-fluid,
    .content-wrapper > .content-header > .container-fluid {
        padding-left: 0;
        padding-right: 0;
    }

    .card-header,
    .card-body,
    .card-footer {
        padding-left: 0.85rem;
        padding-right: 0.85rem;
    }

    .card-body.p-0 {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    .app-page-actions,
    .modal-footer {
        width: 100%;
    }

    .app-page-actions > .btn,
    .modal-footer > .btn {
        flex: 1 1 100%;
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    html:focus-within {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
