/* Candidate journey responsive layer.
 * Loaded after the shared inline theme so these rules can improve phone and
 * tablet ergonomics without changing desktop/print rendering. */

@media screen and (max-width: 1024px) {
  html,
  body {
    max-width: 100%;
    overflow-x: hidden;
  }

  main.app-main-shell:has(.p-candidate-dashboard),
  main.app-main-shell:has(.p-candidate-profile),
  main.app-main-shell:has(.p-exam-card-print),
  main.app-main-shell:has(.p-attempts-result-page),
  main.app-main-shell:has(.p-attempts-certificate-page),
  main.app-main-shell:has(.p-attempts-consent-page) {
    width: 100%;
    max-width: 100%;
    margin-block: 1rem !important;
    padding-inline: clamp(.75rem, 2.5vw, 1.5rem);
  }

  .p-record-page .p-candidate-quicknav-links,
  .p-candidate-profile .p-candidate-quicknav-links {
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: thin;
    scroll-snap-type: inline proximity;
    padding-bottom: .35rem;
  }

  .p-record-page .p-candidate-quicklink,
  .p-candidate-profile .p-candidate-quicklink {
    flex: 0 0 auto;
    min-height: 44px;
    scroll-snap-align: start;
  }

  .p-candidate-dashboard .svc-btn,
  .p-candidate-dashboard .ptpi-tab,
  .p-candidate-profile .btn-action,
  .p-candidate-profile .btn-save,
  .p-candidate-profile .btn-reset,
  .p-candidate-profile .btn-submit-verif,
  .p-exam-card-print .btn,
  .p-attempts-result-page .btn,
  .p-attempts-certificate-page .btn,
  .p-attempts-consent-page .btn {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .p-candidate-profile input:not([type="checkbox"]):not([type="radio"]),
  .p-candidate-profile select,
  .p-candidate-profile textarea,
  .p-attempts-consent-page input:not([type="checkbox"]):not([type="radio"]),
  .p-attempts-consent-page select,
  .p-attempts-consent-page textarea {
    min-height: 44px;
    font-size: 1rem;
  }

  .p-attempts-certificate-page .certificate-wrapper {
    width: 100%;
    min-height: auto;
  }

  .p-attempts-certificate-page .section-table,
  .p-attempts-certificate-page .review-block {
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
  }

  .p-attempts-certificate-page .section-table .tbl {
    min-width: 620px;
  }
}

@media screen and (max-width: 767.98px) {
  .navbar.bg-dark {
    min-height: 60px;
  }

  .navbar.bg-dark .container {
    flex-wrap: nowrap;
    gap: .45rem;
    padding-inline: .75rem;
  }

  .navbar.bg-dark .btn-dark,
  .navbar.bg-dark .topbar-action-btn {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
  }

  .navbar.bg-dark .navbar-brand {
    min-width: 0;
    max-width: min(42vw, 220px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: .94rem;
  }

  .navbar-user-actions {
    margin-left: auto;
    gap: .3rem;
  }

  .navbar-user-greeting {
    display: none;
  }

  main.app-main-shell:has(.p-candidate-dashboard),
  main.app-main-shell:has(.p-candidate-profile),
  main.app-main-shell:has(.p-exam-card-print),
  main.app-main-shell:has(.p-attempts-result-page),
  main.app-main-shell:has(.p-attempts-certificate-page),
  main.app-main-shell:has(.p-attempts-consent-page) {
    margin-block: .75rem 1.5rem !important;
    padding-inline: .65rem;
  }

  .p-candidate-dashboard .ptpi-hero,
  .p-candidate-profile .prof-hero {
    padding: 1.25rem 1.05rem;
    border-radius: 1rem;
    margin-bottom: 1rem;
  }

  .p-candidate-dashboard .ptpi-hero h1,
  .p-candidate-profile .prof-hero h1 {
    font-size: clamp(1.3rem, 6vw, 1.6rem);
    overflow-wrap: anywhere;
  }

  .p-candidate-dashboard .ptpi-hero-inner > .d-flex,
  .p-candidate-profile .prof-hero-inner > .d-flex {
    width: 100%;
  }

  .p-candidate-dashboard .btn-hero-ghost,
  .p-candidate-dashboard .btn-hero-gold,
  .p-candidate-profile .btn-hero-ghost,
  .p-candidate-profile .btn-hero-gold {
    flex: 1 1 145px;
    min-height: 44px;
    justify-content: center;
    text-align: center;
  }

  .p-record-page .p-candidate-quicknav,
  .p-candidate-profile .p-candidate-quicknav {
    border-radius: .9rem;
  }

  .p-record-page .p-candidate-quicknav-head,
  .p-candidate-profile .p-candidate-quicknav-head {
    display: block;
    padding: .85rem .9rem .55rem;
  }

  .p-record-page .p-candidate-quicknav-title,
  .p-candidate-profile .p-candidate-quicknav-title {
    margin-bottom: .55rem;
  }

  .p-candidate-dashboard .id-card {
    padding: 1.1rem;
    margin-bottom: 1rem;
  }

  .p-candidate-dashboard .id-photo-wrap {
    width: 104px;
    height: 136px;
    margin-inline: auto;
  }

  .p-candidate-dashboard .id-name {
    font-size: 1.2rem;
    overflow-wrap: anywhere;
  }

  .p-candidate-dashboard .id-grid-value.text-truncate {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
  }

  .p-candidate-dashboard .id-loc-box {
    padding: .8rem .9rem;
  }

  .p-candidate-dashboard .id-foot,
  .p-candidate-dashboard .ptpi-card-header {
    align-items: flex-start;
  }

  .p-candidate-dashboard .id-status-pill {
    max-width: 100%;
    white-space: normal;
  }

  .p-candidate-dashboard .svc-card,
  .p-candidate-dashboard .asem-tile {
    padding: 1rem;
  }

  .p-candidate-dashboard .svc-actions,
  .p-candidate-dashboard .asem-tile > .d-flex,
  .p-candidate-dashboard .list-group-item .d-flex.flex-wrap.gap-2 {
    width: 100%;
  }

  .p-candidate-dashboard .svc-actions .svc-btn,
  .p-candidate-dashboard .asem-tile > .d-flex .svc-btn,
  .p-candidate-dashboard .list-group-item .d-flex.flex-wrap.gap-2 > .btn {
    flex: 1 1 135px;
  }

  .p-candidate-dashboard .ptpi-card-header {
    padding: 1rem;
  }

  .p-candidate-dashboard .ptpi-card-titles {
    min-width: 0;
  }

  .p-candidate-dashboard .ptpi-tabs.nav {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .p-candidate-dashboard .ptpi-tab {
    width: 100%;
    justify-content: center;
  }

  .p-candidate-dashboard .list-group-item {
    padding: 1rem !important;
  }

  .p-candidate-dashboard .list-group-item > .d-flex > div,
  .p-candidate-dashboard .list-group-item .align-items-md-end {
    width: 100%;
  }

  .p-candidate-dashboard .list-group-item h6,
  .p-candidate-dashboard .list-group-item .small {
    overflow-wrap: anywhere;
  }

  .p-candidate-profile .stat-card,
  .p-candidate-profile .step-box {
    min-height: auto;
  }

  .p-candidate-profile .action-bar,
  .p-candidate-profile .form-actions,
  .p-candidate-profile .d-flex.flex-wrap.gap-2 {
    width: 100%;
  }

  .p-candidate-profile .action-bar .btn-action,
  .p-candidate-profile .form-actions > *,
  .p-candidate-profile .d-flex.flex-wrap.gap-2 > .btn-action {
    flex: 1 1 145px;
  }

  .p-candidate-profile .case-card-header,
  .p-candidate-profile .form-card-header,
  .p-candidate-profile .case-body,
  .p-candidate-profile .form-card-body,
  .p-candidate-profile .side-card-body {
    padding-inline: .95rem;
  }

  .p-exam-card-print .card-shell {
    padding: .5rem 0 1.5rem;
  }

  .p-exam-card-print .text-center.mb-4.no-print {
    margin-bottom: 1rem !important;
  }

  .p-exam-card-print .text-center.mb-4.no-print h2 {
    font-size: 1.35rem;
  }

  .p-exam-card-print .text-center.mb-4.no-print .btn {
    width: 100%;
    border-radius: .8rem !important;
  }

  .p-exam-card-print .exam-card {
    border-width: 1px;
    border-radius: .9rem;
  }

  .p-exam-card-print .ec-header {
    padding: 1rem;
    gap: .75rem;
    align-items: flex-start;
  }

  .p-exam-card-print .ec-header h3 {
    font-size: 1.05rem;
    overflow-wrap: anywhere;
  }

  .p-exam-card-print .ec-body {
    padding: 1rem;
  }

  .p-exam-card-print .ec-body > .row {
    display: flex;
    flex-direction: column-reverse;
    gap: 1rem;
  }

  .p-exam-card-print .ec-body .col-8,
  .p-exam-card-print .ec-body .col-4 {
    width: 100%;
  }

  .p-exam-card-print .ec-body .col-4 {
    flex-direction: row !important;
    justify-content: center;
    align-items: center !important;
  }

  .p-exam-card-print .candidate-photo {
    width: 92px;
    height: 118px;
  }

  .p-exam-card-print .qr-box {
    padding: 6px;
  }

  .p-exam-card-print .qr-box img {
    width: 88px;
    height: 88px;
  }

  .p-exam-card-print .info-table {
    border-spacing: 0;
  }

  .p-exam-card-print .info-table tr {
    display: block;
    padding: .65rem 0;
    border-bottom: 1px solid #e8eee9;
  }

  .p-exam-card-print .info-table tr:last-child {
    border-bottom: 0;
  }

  .p-exam-card-print .info-table th,
  .p-exam-card-print .info-table td {
    display: block;
    width: 100%;
    padding: 0;
  }

  .p-exam-card-print .info-table th {
    margin-bottom: .2rem;
    font-size: .67rem;
  }

  .p-exam-card-print .info-table td {
    font-size: .92rem;
    overflow-wrap: anywhere;
  }

  .p-exam-card-print .ec-footer {
    display: block;
    padding: .85rem 1rem;
    line-height: 1.5;
  }

  .p-exam-card-print .ec-footer .text-end {
    margin-top: .5rem;
    text-align: left !important;
  }

  .p-attempts-result-page .result-item-card {
    flex-direction: column;
  }

  .p-attempts-result-page .result-item-card .text-end {
    width: 100%;
    text-align: left !important;
  }

  .p-attempts-certificate-page .d-print-none.d-flex {
    align-items: stretch !important;
    flex-direction: column;
    gap: .75rem;
  }

  .p-attempts-certificate-page .d-print-none .btn {
    width: 100%;
  }

  .p-attempts-certificate-page .certificate-card {
    border-radius: 1rem;
  }

  .p-attempts-certificate-page .hero,
  .p-attempts-certificate-page .body,
  .p-attempts-certificate-page .footer {
    padding: 1.1rem;
  }

  .p-attempts-certificate-page .hero {
    display: flex;
    flex-direction: column;
  }

  .p-attempts-certificate-page .recipient-label {
    margin-top: 1.5rem;
  }

  .p-attempts-certificate-page .recipient-name {
    font-size: clamp(1.55rem, 8vw, 2.3rem);
    overflow-wrap: anywhere;
  }

  .p-attempts-certificate-page .qr-box {
    align-self: center;
    margin-top: .5rem;
  }

  .p-attempts-certificate-page .body {
    display: grid;
    grid-template-columns: 1fr;
  }

  .p-attempts-certificate-page .kv {
    grid-template-columns: 1fr;
    gap: .15rem;
  }

  .p-attempts-certificate-page .kv .sep {
    display: none;
  }

  .p-attempts-certificate-page .kv .v {
    margin-bottom: .75rem;
    overflow-wrap: anywhere;
  }

  .p-attempts-certificate-page .footer {
    display: block;
  }

  .p-attempts-certificate-page .footer .text-end {
    margin-top: .75rem;
    text-align: left !important;
  }
}

@media screen and (max-width: 390px) {
  .navbar.bg-dark .navbar-brand {
    max-width: 34vw;
  }

  .p-candidate-dashboard .ptpi-hero,
  .p-candidate-profile .prof-hero,
  .p-candidate-dashboard .id-card,
  .p-candidate-dashboard .svc-card {
    border-radius: .85rem;
  }

  .p-exam-card-print .ec-header .badge {
    font-size: .62rem;
  }
}
