/* =========================================================
   Modirjadeh Final RC UI Polish
   Scope: Driver App + Owner App + mobile authentication only.
   Loaded LAST after the existing application styles.
   ========================================================= */

@font-face {
    font-family: 'IRANSansWeb';
    src: url('../../fonts/IRANSansWeb.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'IRANSansWeb';
    src: url('../../fonts/IRANSansWeb_Bold.ttf') format('truetype');
    font-weight: 700 950;
    font-style: normal;
    font-display: swap;
}

body.mj-owner-app,
body.mj-driver-app,
body.mj-auth-mobile,
body.mj-owner-app button,
body.mj-owner-app input,
body.mj-owner-app select,
body.mj-owner-app textarea,
body.mj-driver-app button,
body.mj-driver-app input,
body.mj-driver-app select,
body.mj-driver-app textarea,
body.mj-auth-mobile button,
body.mj-auth-mobile input,
body.mj-auth-mobile select,
body.mj-auth-mobile textarea {
    font-family: 'IRANSansWeb', Tahoma, Arial, sans-serif !important;
}

/* ---------- Shared phone-canvas rhythm ---------- */
body.mj-owner-app .mjv3-app-content,
body.mj-driver-app .mj-driver-content {
    padding: 14px 12px 104px !important;
}

body.mj-owner-app .mj-card,
body.mj-driver-app .mj-card,
body.mj-owner-app .mj-stat,
body.mj-driver-app .mj-stat,
body.mj-driver-app .mj-driver-filter-card,
body.mj-driver-app .mj-driver-load-card {
    border-radius: 16px !important;
}

body.mj-owner-app .mj-card-head,
body.mj-driver-app .mj-card-head {
    padding: 14px 15px !important;
    gap: 9px !important;
}

body.mj-owner-app .mj-card-body,
body.mj-driver-app .mj-card-body {
    padding: 15px !important;
}

body.mj-owner-app .mj-card-head h3,
body.mj-driver-app .mj-card-head h3 {
    font-size: 13px !important;
    line-height: 1.8 !important;
}

body.mj-owner-app .mj-card-head p,
body.mj-owner-app .mj-card-head small,
body.mj-driver-app .mj-card-head p,
body.mj-driver-app .mj-card-head small {
    font-size: 9.5px !important;
    line-height: 1.9 !important;
}

body.mj-owner-app .mj-page-head,
body.mj-driver-app .mj-page-head {
    align-items: flex-start !important;
    flex-direction: column !important;
    gap: 10px !important;
    margin-bottom: 14px !important;
}

body.mj-owner-app .mj-page-head h2,
body.mj-driver-app .mj-page-head h2 {
    font-size: 18px !important;
    line-height: 1.65 !important;
}

body.mj-owner-app .mj-page-head p,
body.mj-driver-app .mj-page-head p {
    font-size: 10px !important;
    line-height: 1.9 !important;
}

body.mj-owner-app .mj-page-actions,
body.mj-driver-app .mj-page-actions {
    width: 100% !important;
    display: flex !important;
    gap: 8px !important;
    flex-wrap: wrap !important;
}

body.mj-owner-app .mj-page-actions > *,
body.mj-driver-app .mj-page-actions > * {
    flex: 1 1 130px;
}

/* ---------- Touch-safe form controls ---------- */
body.mj-owner-app .mj-control,
body.mj-driver-app .mj-control,
body.mj-owner-app .form-control,
body.mj-driver-app .form-control,
body.mj-owner-app select,
body.mj-driver-app select {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 46px !important;
    padding: 10px 12px !important;
    border-radius: 12px !important;
    font-size: 11px !important;
    line-height: 1.7 !important;
}

body.mj-owner-app textarea.mj-control,
body.mj-driver-app textarea.mj-control,
body.mj-owner-app textarea.form-control,
body.mj-driver-app textarea.form-control {
    min-height: 116px !important;
    resize: vertical;
}

body.mj-owner-app .mj-field,
body.mj-driver-app .mj-field,
body.mj-driver-app .mj-driver-filter-field {
    min-width: 0 !important;
    gap: 7px !important;
}

body.mj-owner-app .mj-field label,
body.mj-driver-app .mj-field label,
body.mj-driver-app .mj-driver-filter-field label,
body.mj-driver-app .mj-driver-filter-field > span {
    font-size: 10px !important;
    line-height: 1.7 !important;
}

body.mj-owner-app .mj-hint,
body.mj-driver-app .mj-hint {
    font-size: 8.5px !important;
    line-height: 1.9 !important;
}

body.mj-owner-app .mj-btn,
body.mj-driver-app .mj-btn {
    min-height: 44px !important;
    padding: 10px 13px !important;
    border-radius: 12px !important;
    font-size: 10px !important;
    line-height: 1.6 !important;
    white-space: normal;
}

/* ---------- Force phone-layout breakpoints inside desktop phone canvas ---------- */
body.mj-owner-app .mj-grid-2,
body.mj-driver-app .mj-grid-2,
body.mj-owner-app .mj-grid-equal,
body.mj-driver-app .mj-grid-equal,
body.mj-owner-app .mj-owner-profile-grid,
body.mj-owner-app .mj-owner-profile-form,
body.mj-owner-app .mj-form-grid,
body.mj-driver-app .mj-form-grid,
body.mj-driver-app .mj-driver-filter-grid,
body.mj-driver-app .mj-driver-load-detail-grid {
    grid-template-columns: 1fr !important;
}

/* Summary cards remain compact but readable: two per row. */
body.mj-owner-app .mj-stats,
body.mj-driver-app .mj-stats,
body.mj-owner-app .mj-owner-summary-grid,
body.mj-driver-app .mj-driver-dashboard-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
}

body.mj-owner-app .mj-stat,
body.mj-driver-app .mj-stat {
    min-width: 0 !important;
    padding: 13px !important;
}

body.mj-owner-app .mj-stat-value,
body.mj-driver-app .mj-stat-value {
    font-size: 18px !important;
}

body.mj-owner-app .mj-stat-label,
body.mj-driver-app .mj-stat-label,
body.mj-owner-app .mj-stat-note,
body.mj-driver-app .mj-stat-note {
    overflow-wrap: anywhere;
}

/* ---------- Owner app ---------- */
body.mj-owner-app .mj-owner-profile-grid {
    gap: 12px !important;
}

body.mj-owner-app .mj-owner-profile-form {
    gap: 12px !important;
}

body.mj-owner-app .mj-owner-account-summary {
    align-items: flex-start !important;
    flex-wrap: wrap !important;
}

body.mj-owner-app .mj-owner-profile-summary-main {
    flex: 1 1 190px;
}

body.mj-owner-app .mj-owner-verification {
    margin-inline-start: auto;
}

body.mj-owner-app .mj-owner-business-state {
    align-items: flex-start !important;
    flex-direction: column !important;
}

body.mj-owner-app .mj-contact-intro {
    padding: 17px 16px !important;
    border-radius: 16px !important;
}

body.mj-owner-app .mj-package-grid,
body.mj-owner-app .mj-step-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
}

body.mj-owner-app .mj-package-card {
    min-width: 0 !important;
    min-height: 245px !important;
    padding: 14px !important;
}

body.mj-owner-app .mj-package-card h3 {
    font-size: 13px !important;
    line-height: 1.8 !important;
}

body.mj-owner-app .mj-package-price strong {
    font-size: 18px !important;
}

/* Loads/tabs/list cards must not inherit wide desktop spacing. */
body.mj-owner-app .mj-owner-load-card,
body.mj-owner-app .mj-owner-contact-card,
body.mj-owner-app .mj-list-item {
    min-width: 0 !important;
}

body.mj-owner-app .mj-owner-load-card {
    padding: 14px !important;
}

/* ---------- Driver filter and cards ---------- */
body.mj-driver-app .mj-driver-filter-card {
    margin-bottom: 12px !important;
}

body.mj-driver-app .mj-driver-filter-title {
    padding: 14px !important;
    align-items: flex-start !important;
}

body.mj-driver-app .mj-driver-filter-title h3 {
    font-size: 14px !important;
    line-height: 1.7 !important;
}

body.mj-driver-app .mj-driver-filter-title p {
    font-size: 9.5px !important;
    line-height: 1.9 !important;
}

/* The phone frame is mobile UI even when browser viewport is desktop. */
body.mj-driver-app .mj-driver-filter-toggle {
    display: inline-flex !important;
    flex: 0 0 auto;
}

body.mj-driver-app .mj-driver-filter-body {
    display: block !important;
    padding: 0 14px 14px !important;
}

body.mj-driver-app .mj-driver-filter-grid {
    gap: 11px !important;
}

body.mj-driver-app .mj-driver-filter-actions {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 8px !important;
    margin-top: 12px !important;
}

body.mj-driver-app .mj-driver-filter-actions .mj-btn {
    width: 100% !important;
}

body.mj-driver-app .mj-driver-load-card summary {
    padding: 14px !important;
}

body.mj-driver-app .mj-driver-load-route {
    grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 1fr) !important;
    gap: 7px !important;
}

body.mj-driver-app .mj-driver-load-route strong {
    font-size: 12px !important;
    overflow-wrap: anywhere;
}

body.mj-driver-app .mj-driver-load-detail-grid > div {
    min-width: 0 !important;
}

body.mj-driver-app .mj-driver-load-detail-grid strong,
body.mj-driver-app .mj-driver-load-detail-grid span {
    overflow-wrap: anywhere;
}

/* ---------- Bottom navigation: same balanced app pattern for Owner + Driver ---------- */
body.mj-owner-app .mjv3-bottom-nav,
body.mj-driver-app .mj-mobile-nav {
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    gap: 2px !important;
    height: 64px !important;
    padding: 5px !important;
    border-radius: 18px !important;
}

body.mj-driver-app .mj-mobile-nav a,
body.mj-owner-app .mjv3-bottom-nav a {
    min-width: 0 !important;
    min-height: 52px !important;
    padding: 4px 2px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 3px !important;
    border-radius: 12px !important;
    font-size: 8px !important;
    font-weight: 700 !important;
    line-height: 1.25 !important;
    text-align: center !important;
    white-space: nowrap !important;
    overflow: hidden;
}

body.mj-driver-app .mj-mobile-nav a i,
body.mj-owner-app .mjv3-bottom-nav-icon {
    width: 28px !important;
    height: 25px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 !important;
    font-size: 14px !important;
    line-height: 1 !important;
}

body.mj-driver-app .mj-mobile-nav a span,
body.mj-owner-app .mjv3-bottom-nav-label {
    display: block !important;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.mj-driver-app .mj-mobile-nav a.active,
body.mj-owner-app .mjv3-bottom-nav a.active:not(.primary) {
    background: rgba(255,255,255,.08) !important;
    color: #fff !important;
}

body.mj-driver-app .mj-mobile-nav a.active i,
body.mj-owner-app .mjv3-bottom-nav a.active:not(.primary) .mjv3-bottom-nav-icon {
    color: #f58220 !important;
}

/* Keep Owner's primary create-load button intentionally raised. */
body.mj-owner-app .mjv3-bottom-nav a.primary .mjv3-bottom-nav-icon {
    width: 40px !important;
    height: 40px !important;
    margin-top: -20px !important;
    border-width: 4px !important;
}

/* ---------- Mobile authentication / OTP ---------- */
body.mj-auth-mobile {
    font-family: 'IRANSansWeb', Tahoma, Arial, sans-serif !important;
}

body.mj-auth-mobile .mobile-auth-shell {
    font-family: inherit !important;
}

body.mj-auth-mobile .auth-wrap,
body.mj-auth-mobile .auth-card,
body.mj-auth-mobile .auth-side,
body.mj-auth-mobile .auth-head,
body.mj-auth-mobile .auth-field,
body.mj-auth-mobile .auth-note,
body.mj-auth-mobile .auth-help {
    font-family: inherit !important;
}

body.mj-auth-mobile .auth-head h1 {
    font-size: 19px !important;
    line-height: 1.8 !important;
}

body.mj-auth-mobile .auth-head p,
body.mj-auth-mobile .auth-note,
body.mj-auth-mobile .auth-help {
    line-height: 2 !important;
}

body.mj-auth-mobile .auth-control {
    min-height: 48px !important;
    font-size: 12px !important;
}

body.mj-auth-mobile .otp-control {
    font-size: 20px !important;
    letter-spacing: 8px !important;
}

body.mj-auth-mobile .auth-submit {
    min-height: 48px !important;
    font-size: 11px !important;
}

/* Narrow phones: preserve usability instead of squeezing two-column cards. */
@media (max-width: 380px) {
    body.mj-owner-app .mj-stats,
    body.mj-driver-app .mj-stats,
    body.mj-owner-app .mj-owner-summary-grid,
    body.mj-driver-app .mj-driver-dashboard-stats,
    body.mj-owner-app .mj-package-grid,
    body.mj-owner-app .mj-step-grid {
        grid-template-columns: 1fr !important;
    }

    body.mj-owner-app .mjv3-app-content,
    body.mj-driver-app .mj-driver-content {
        padding-right: 9px !important;
        padding-left: 9px !important;
    }
}
