/* Regras comuns para manter paineis, formularios e portal confortaveis no telefone. */
:root {
    --sigep-mobile-touch: 44px;
}

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

body {
    max-width: 100%;
    overflow-x: hidden;
}

input,
select,
textarea,
button {
    font-size: 16px;
}

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

.table-responsive {
    width: 100%;
}

.table-responsive table {
    margin-bottom: 0;
}

.btn,
button,
[role="button"],
.nav-link,
.dropdown-item,
.collapse-item {
    touch-action: manipulation;
}

.sigep-portal-return {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 3000;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    padding: .55rem .85rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, .94);
    color: #1e6fc0;
    border: 1px solid rgba(30, 111, 192, .18);
    box-shadow: 0 10px 24px rgba(15, 23, 42, .16);
    font-weight: 800;
    font-size: .85rem;
    text-decoration: none;
    backdrop-filter: blur(10px);
}

.sigep-portal-return:hover {
    color: #155a9e;
    text-decoration: none;
    transform: translateY(-1px);
}

@media (max-width: 768px) {
    .container,
    .container-fluid {
        padding-left: .85rem !important;
        padding-right: .85rem !important;
    }

    #content,
    #content-wrapper,
    main,
    .page-content {
        min-width: 0 !important;
        max-width: 100% !important;
    }

    .row {
        row-gap: .75rem;
    }

    [class*="col-"] {
        min-width: 0;
    }

    .d-sm-flex,
    .d-md-flex,
    .card-header,
    .page-header,
    .page-title,
    .content-header {
        min-width: 0;
        flex-wrap: wrap !important;
        gap: .5rem;
    }

    .card-header > *,
    .page-header > *,
    .page-title > *,
    .content-header > * {
        min-width: 0;
    }

    .card,
    .modal-content,
    .dropdown-menu,
    .collapse-inner {
        border-radius: 14px !important;
    }

    .card-body,
    .card-header,
    .modal-body,
    .modal-header,
    .modal-footer {
        padding: 1rem !important;
    }

    .btn {
        min-height: var(--sigep-mobile-touch);
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: .35rem;
        white-space: normal;
        line-height: 1.2;
        overflow-wrap: anywhere;
    }

    .btn-group,
    .btn-toolbar,
    .form-inline {
        flex-wrap: wrap;
        gap: .4rem;
    }

    .btn-group > .btn,
    .btn-toolbar > .btn,
    .btn-toolbar .btn-group {
        flex: 1 1 auto;
    }

    .form-control,
    .custom-select,
    .select2-container,
    input[type="date"],
    input[type="datetime-local"],
    input[type="file"],
    input[type="month"],
    input[type="number"],
    input[type="search"],
    input[type="time"] {
        width: 100% !important;
        min-height: var(--sigep-mobile-touch);
    }

    label {
        line-height: 1.25;
    }

    .form-row,
    form .row {
        row-gap: .75rem;
    }

    .input-group {
        flex-wrap: nowrap;
        min-width: 0;
    }

    .input-group > .form-control {
        min-width: 0;
    }

    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        max-width: 100%;
        border-radius: 12px;
    }

    .table-responsive table,
    .dataTable {
        min-width: max-content;
        width: max-content;
        max-width: none;
    }

    .table-responsive th,
    .table-responsive td {
        white-space: nowrap;
        vertical-align: middle;
    }

    .table-responsive td .btn,
    .table-responsive td .badge,
    .table-responsive td .dropdown-toggle {
        white-space: nowrap;
    }

    .table-responsive td:last-child,
    .table-responsive th:last-child {
        position: sticky;
        right: 0;
        z-index: 1;
        background: inherit;
        box-shadow: -8px 0 12px rgba(15, 23, 42, .05);
    }

    .dataTables_wrapper .row {
        margin-left: 0;
        margin-right: 0;
    }

    .dataTables_filter,
    .dataTables_length,
    .dataTables_info,
    .dataTables_paginate {
        width: 100%;
        text-align: left !important;
    }

    .dataTables_filter input,
    .dataTables_length select {
        width: 100% !important;
        margin: .35rem 0 !important;
    }

    .dataTables_paginate .pagination {
        flex-wrap: wrap;
        gap: .25rem;
    }

    .modal-dialog {
        margin: .5rem !important;
        max-width: calc(100% - 1rem) !important;
    }

    .modal-footer {
        flex-wrap: wrap;
        gap: .5rem;
    }

    .modal-footer > * {
        margin: 0 !important;
    }

    .topbar,
    .navbar {
        min-width: 0;
    }

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

    .sidebar .nav-item .nav-link,
    .sidebar .collapse-item {
        min-height: var(--sigep-mobile-touch);
        display: flex;
        align-items: center;
    }

    .sigep-portal-return {
        top: 10px;
        left: 10px;
        max-width: calc(100vw - 20px);
    }
    
    /* Reduzir o tamanho dos cartões do dashboard em mobile */
    .border-left-primary,
    .border-left-success,
    .border-left-info,
    .border-left-warning,
    .border-left-danger,
    .border-left-dark,
    .card-kpi,
    .stat-card {
        min-height: 0 !important;
        border-radius: 12px !important;
    }

    .border-left-primary .card-body,
    .border-left-success .card-body,
    .border-left-info .card-body,
    .border-left-warning .card-body,
    .border-left-danger .card-body,
    .border-left-dark .card-body,
    .card-kpi .card-body,
    .stat-card .card-body {
        padding: .8rem .85rem !important;
    }

    .border-left-primary.py-2,
    .border-left-success.py-2,
    .border-left-info.py-2,
    .border-left-warning.py-2,
    .border-left-danger.py-2,
    .border-left-dark.py-2 {
        padding-top: .15rem !important;
        padding-bottom: .15rem !important;
    }

    .card .row.no-gutters {
        align-items: center !important;
    }

    .card .col-auto {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .text-xs {
        font-size: .65rem !important;
        line-height: 1.2 !important;
    }

    .h5,
    .h3,
    h5 {
        font-size: 1rem !important;
        line-height: 1.15 !important;
    }

    .fa-2x {
        font-size: 1.25em !important;
    }

    .welcome-card .card-body,
    .ped-eval-alert-card .card-body,
    .search-student-card .card-body,
    .absence-summary-card .card-body {
        padding: 1rem !important;
    }

    .welcome-card h1,
    .profile-card h3 {
        font-size: 1.25rem !important;
        line-height: 1.2 !important;
    }

    .topbar-menu-badges {
        min-width: 0;
    }
}

@media (max-width: 480px) {
    h1,
    .h1 {
        font-size: 1.55rem;
    }

    h2,
    .h2 {
        font-size: 1.35rem;
    }

    h3,
    .h3 {
        font-size: 1.15rem;
    }

    .btn-block-xs {
        width: 100%;
    }

    .small,
    small {
        line-height: 1.35;
    }
}
