/* EasyPrintDz CRM - Mobile / Browser Polish V19 */
/* UI only - no business logic */

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

body {
    overflow-x: hidden;
}

img,
svg,
video {
    max-width: 100%;
    height: auto;
}

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

.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    vertical-align: middle;
}

.card,
.stat-card,
.dashboard-card,
.panel,
.box {
    overflow: hidden;
}

@media (max-width: 991.98px) {
    body {
        background-size: cover;
    }

    main,
    .main,
    .content,
    .page-content,
    .container,
    .container-fluid {
        max-width: 100%;
        overflow-x: hidden;
    }

    .container,
    .container-fluid {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    .row {
        margin-left: -6px;
        margin-right: -6px;
    }

    .row > * {
        padding-left: 6px;
        padding-right: 6px;
    }

    .card,
    .stat-card,
    .dashboard-card {
        border-radius: 16px !important;
        margin-bottom: 12px;
    }

    .card-body {
        padding: 14px !important;
    }

    h1,
    .h1 {
        font-size: 1.45rem !important;
        line-height: 1.25;
    }

    h2,
    .h2 {
        font-size: 1.25rem !important;
        line-height: 1.3;
    }

    h3,
    .h3 {
        font-size: 1.1rem !important;
    }

    .page-title,
    .content-header h1,
    .page-header h1 {
        font-size: 1.35rem !important;
        margin-bottom: 10px !important;
    }

    .btn {
        min-height: 42px;
        border-radius: 12px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        white-space: normal;
    }

    .btn-sm {
        min-height: 36px;
        padding: 7px 10px;
    }

    .btn-group,
    .actions,
    .action-buttons {
        flex-wrap: wrap;
        gap: 6px;
    }

    .form-control,
    .form-select {
        min-height: 44px;
        border-radius: 12px;
    }

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

    .table {
        min-width: 760px;
        font-size: 13px;
    }

    .table th,
    .table td {
        padding: 9px 10px;
        white-space: nowrap;
    }

    .badge {
        white-space: nowrap;
    }

    .navbar,
    .topbar,
    header {
        max-width: 100%;
        overflow-x: hidden;
    }

    .dropdown-menu {
        max-width: calc(100vw - 24px);
    }

    .modal-dialog {
        margin: 10px;
    }

    .modal-content {
        border-radius: 18px;
    }
}

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

    .card-body {
        padding: 12px !important;
    }

    .page-title,
    .content-header h1,
    .page-header h1 {
        font-size: 1.2rem !important;
    }

    .small,
    small {
        font-size: 0.78rem;
    }

    .btn,
    .form-control,
    .form-select {
        width: 100%;
    }

    .btn.w-auto,
    .btn-auto,
    .input-group .btn {
        width: auto;
    }

    .input-group {
        flex-wrap: nowrap;
    }

    .input-group .form-control {
        width: 1%;
    }

    .d-flex.mobile-stack,
    .mobile-stack,
    .filters,
    .filter-row,
    .toolbar,
    .page-actions {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 8px !important;
    }

    .page-actions .btn,
    .toolbar .btn,
    .filters .btn,
    .filter-row .btn {
        width: 100%;
    }

    .table {
        min-width: 680px;
        font-size: 12.5px;
    }

    .table th,
    .table td {
        padding: 8px;
    }

    .pagination {
        flex-wrap: wrap;
        justify-content: center;
        gap: 4px;
    }

    .pagination .page-link {
        border-radius: 10px;
        min-width: 36px;
        text-align: center;
    }
}

/* POS / quick sale mobile comfort */
@media (max-width: 767.98px) {
    .pos-page .card,
    .quick-sale-page .card,
    body:has(form[action*="quick"]) .card {
        margin-bottom: 10px;
    }

    .pos-page .btn,
    .quick-sale-page .btn {
        font-weight: 700;
    }

    input[type="number"],
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    select {
        touch-action: manipulation;
    }
}

/* iPhone safe area */
@supports (padding: max(0px)) {
    body {
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
}
