/*
 * Bab Rizq 1.11.0 — responsive layout polish
 *
 * This final stylesheet owns layout rhythm and mobile composition. Colors stay
 * in theme-system.css, while feature-specific visuals stay in their own files.
 */

:root {
  --app-header-height: 76px;
  --app-mobile-header-height: 64px;
  --app-mobile-nav-height: 72px;
  --app-page-gutter: 20px;
  --app-card-gap: 18px;
}

html {
  scroll-padding-top: calc(var(--app-header-height) + 16px);
}

body,
.site-main,
.listing-content,
.professional-form,
.dashboard-shell,
.dashboard-card,
.dashboard-card-head > div {
  min-width: 0;
}

.site-main {
  overflow: clip;
}

.button,
.icon-button,
.account-menu summary,
.mobile-nav > a,
.dashboard-card-action,
.listing-toolbar select {
  -webkit-tap-highlight-color: transparent;
}

/* Header */
.site-header {
  isolation: isolate;
}

.header-inner {
  height: var(--app-header-height);
}

.brand,
.header-actions {
  min-width: 0;
}

.brand-copy {
  min-width: 0;
}

.brand-copy strong,
.brand-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-menu summary {
  justify-content: center;
}

/* Homepage professions */
.category-section-footer {
  display: flex;
  justify-content: center;
  margin-top: 30px;
}

.category-view-all {
  width: min(100%, 310px);
  min-height: 56px;
  border-radius: 16px;
  font-size: 16px;
  box-shadow: 0 12px 28px rgba(224, 138, 30, 0.24);
}

/* Workers directory */
.profiles-hero .container {
  max-width: 920px;
}

.profiles-hero h1 {
  max-width: 780px;
}

.profiles-hero p {
  max-width: 760px;
  line-height: 1.8;
}

.listing-content {
  container-type: inline-size;
}

.listing-toolbar {
  gap: 16px;
}

.listing-toolbar-main {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.listing-count {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 5px;
  padding: 9px 13px;
  border: 1px solid var(--ui-border, var(--line));
  border-radius: 13px;
  background: var(--ui-surface, var(--surface));
  color: var(--ui-heading, var(--brand-dark));
  font-size: 14px;
  line-height: 1.25;
  white-space: nowrap;
}

.listing-count b {
  font-size: 18px;
}

.sorting-form {
  min-width: 210px;
  margin: 0;
}

.inline-select.sorting-control {
  display: grid;
  min-height: 48px;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 5px 7px 5px 12px;
  border: 1px solid var(--ui-border, var(--line));
  border-radius: 14px;
  background: var(--ui-surface, var(--surface));
  color: var(--ui-muted, var(--muted));
  box-shadow: var(--ui-shadow-sm, var(--shadow-sm));
}

.inline-select.sorting-control > span {
  padding-inline-start: 5px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.inline-select.sorting-control select {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  padding: 5px 9px;
  border: 0;
  border-radius: 10px;
  background: var(--ui-surface-2, #f1f5f2);
  color: var(--ui-heading, var(--ink));
  font-size: 14px;
  font-weight: 800;
  text-align: right;
}

.filter-backdrop {
  position: fixed;
  z-index: 390;
  inset: 0;
  display: none;
  border: 0;
  background: rgba(2, 9, 7, 0.58);
  backdrop-filter: blur(3px);
}

.filters-card.open + .filter-backdrop {
  display: block;
}

.empty-state {
  display: grid;
  min-height: 300px;
  place-content: center;
  justify-items: center;
  padding: 48px 24px;
  border-style: solid;
  border-radius: 24px;
  background:
    radial-gradient(circle at 50% 0, color-mix(in srgb, var(--ui-accent, #d77b16) 9%, transparent), transparent 15rem),
    var(--ui-surface, var(--surface));
}

.empty-state > svg {
  width: 52px;
  height: 52px;
  margin-bottom: 7px;
  padding: 9px;
  border: 1px solid var(--ui-border, var(--line));
  border-radius: 17px;
  background: var(--ui-surface-2, #f1f5f2);
}

.empty-state h2 {
  margin-top: 9px;
  font-size: 27px;
  line-height: 1.4;
}

.empty-state p {
  max-width: 460px;
  font-size: 15px;
  line-height: 1.75;
}

.empty-state .button {
  min-width: 190px;
}

/* Forms */
.form-layout {
  min-width: 0;
}

.form-sidebar {
  scroll-margin-top: calc(var(--app-header-height) + 18px);
}

.form-card {
  min-width: 0;
  scroll-margin-top: calc(var(--app-header-height) + 18px);
}

.form-card-head > span {
  flex: 0 0 auto;
}

.professional-form label,
.professional-form input,
.professional-form select,
.professional-form textarea {
  min-width: 0;
}

.professional-form input,
.professional-form select {
  min-height: 52px;
}

.sticky-submit {
  gap: 18px;
}

.sticky-submit .button {
  flex: 0 0 auto;
}

/* Dashboard */
.dashboard-shell > .container > .dashboard-card {
  margin-bottom: var(--app-card-gap);
}

.dashboard-shell > .container > .dashboard-columns {
  margin-top: 0;
}

.dashboard-card-head {
  min-width: 0;
}

.dashboard-card-head > div {
  flex: 1;
}

.dashboard-card-head h2 {
  line-height: 1.45;
}

.dashboard-card-action {
  display: inline-flex;
  min-height: 42px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 13px;
  border: 1px solid var(--ui-border, var(--line));
  border-radius: 12px;
  background: var(--ui-surface-2, #f1f5f2);
  color: var(--ui-heading, var(--brand-dark));
  font-size: 13px;
  font-weight: 800;
  line-height: 1.25;
}

.dashboard-card-action:hover {
  border-color: var(--ui-border-strong, var(--line));
  background: var(--ui-surface-3, #e8efeb);
  color: var(--ui-heading, var(--brand-dark));
}

.profile-card-footer .text-link,
.dashboard-card-head > .text-link,
.section-heading > .text-link {
  display: inline-flex;
  min-height: 42px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 12px;
  border: 1px solid var(--ui-border, var(--line));
  border-radius: 12px;
  background: var(--ui-surface-2, #f1f5f2);
  color: var(--ui-heading, var(--brand-dark));
  font-size: 13px;
  font-weight: 800;
  line-height: 1.25;
}

.profile-card-footer .text-link:hover,
.dashboard-card-head > .text-link:hover,
.section-heading > .text-link:hover {
  border-color: var(--ui-border-strong, var(--line));
  background: var(--ui-surface-3, #e8efeb);
  color: var(--ui-heading, var(--brand-dark));
}

.photo-profile-summary {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 4px 0 1px;
}

.photo-profile-summary > img {
  width: 72px;
  height: 72px;
  border-radius: 19px;
}

.photo-profile-copy {
  min-width: 0;
}

.photo-profile-copy strong {
  overflow: hidden;
  color: var(--ui-heading, var(--ink));
  font-size: 17px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.photo-profile-copy p {
  display: -webkit-box;
  overflow: hidden;
  margin: 3px 0 5px;
  color: var(--ui-muted, var(--muted));
  font-size: 13px;
  line-height: 1.6;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.photo-profile-copy .photo-profile-meta {
  display: inline-flex;
  align-items: center;
  color: var(--ui-accent, var(--brand));
  font-size: 12px;
  font-weight: 800;
}

.photo-profile-summary > .status-pill {
  display: inline-flex;
  width: auto;
  max-width: 100%;
  align-items: center;
  justify-content: center;
  color: inherit;
  font-size: 12px;
}

.dashboard-empty {
  display: grid;
  min-height: 126px;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--ui-border, var(--line));
  border-radius: 17px;
  background: var(--ui-surface-2, #f1f5f2);
}

.dashboard-empty-icon {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 14px;
  background: var(--ui-accent-soft, #fff0df);
  color: var(--ui-accent, var(--brand));
}

.dashboard-empty strong,
.dashboard-empty p {
  display: block;
  margin: 0;
}

.dashboard-empty strong {
  color: var(--ui-heading, var(--brand-dark));
  font-size: 14px;
}

.dashboard-empty p {
  margin-top: 2px;
  color: var(--ui-muted, var(--muted));
  font-size: 12px;
  line-height: 1.6;
}

/* Tablet */
@media (max-width: 850px) {
  :root {
    --app-header-height: var(--app-mobile-header-height);
  }

  html {
    scroll-padding-top: calc(var(--app-mobile-header-height) + 12px);
  }

  .header-inner {
    height: var(--app-mobile-header-height);
    gap: 12px;
  }

  .brand {
    gap: 9px;
  }

  .brand-mark {
    width: 35px;
    height: 39px;
    border-radius: 18px 18px 6px 6px;
  }

  .brand-mark::before {
    right: 10px;
    bottom: 5px;
    width: 15px;
    height: 23px;
  }

  .door-dot {
    right: 13px;
    bottom: 14px;
  }

  .brand-copy strong {
    font-size: 20px;
  }

  .brand-copy small {
    margin-top: 4px;
    font-size: 10px;
  }

  .header-actions {
    gap: 6px;
  }

  .icon-button,
  .account-menu summary {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    flex-basis: 44px;
    border-radius: 13px;
  }

  .account-menu summary {
    padding: 5px;
  }

  .account-menu summary img {
    width: 32px;
    height: 32px;
    border-radius: 9px;
  }

  .account-dropdown {
    top: calc(100% + 8px);
    width: min(272px, calc(100vw - 24px));
  }

  .filters-card {
    z-index: 400;
    width: min(350px, 92vw);
    padding:
      max(20px, env(safe-area-inset-top))
      18px
      calc(24px + env(safe-area-inset-bottom));
    border: 0;
    border-left: 1px solid var(--ui-border, var(--line));
    border-radius: 0;
  }

  .filter-title {
    position: sticky;
    z-index: 2;
    top: calc(-1 * max(20px, env(safe-area-inset-top)));
    margin: 0 -18px 16px;
    padding: 15px 18px;
    border-bottom: 1px solid var(--ui-border, var(--line));
    background: var(--ui-surface, var(--surface));
  }

  .filter-title button {
    display: inline-grid !important;
    width: 44px;
    height: 44px;
    place-items: center;
    padding: 0;
    border: 1px solid var(--ui-border, var(--line));
    border-radius: 13px;
    background: var(--ui-surface-2, #f1f5f2);
    color: var(--ui-heading, var(--ink));
  }
}

/* Mobile */
@media (max-width: 640px) {
  :root {
    --app-page-gutter: 14px;
    --app-card-gap: 14px;
  }

  body.has-mobile-nav {
    padding-bottom: calc(var(--app-mobile-nav-height) + 18px + env(safe-area-inset-bottom));
  }

  .container {
    width: min(100% - calc(var(--app-page-gutter) * 2), 1180px);
  }

  .site-header .container {
    width: min(100% - 20px, 1180px);
  }

  .category-view-all {
    width: 100%;
  }

  .page-hero.compact {
    padding: 24px 0 27px;
  }

  .page-hero .eyebrow {
    font-size: 13px;
  }

  .page-hero h1 {
    margin-top: 6px;
    font-size: clamp(27px, 8vw, 30px);
    line-height: 1.32;
  }

  .page-hero p {
    margin-top: 8px;
    font-size: 14px;
    line-height: 1.65;
  }

  .listing-section {
    padding: 18px 0 42px;
  }

  .listing-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    gap: 10px;
    margin-bottom: 14px;
  }

  .listing-toolbar-main {
    width: 100%;
    justify-content: space-between;
  }

  .listing-toolbar-main .filter-trigger {
    display: inline-flex !important;
    min-width: 0;
    flex: 1 1 155px;
    justify-content: center;
  }

  .listing-count {
    min-height: 48px;
    flex: 0 0 auto;
    padding-inline: 14px;
    box-shadow: var(--ui-shadow-sm, var(--shadow-sm));
  }

  .sorting-form {
    width: 100%;
    max-width: none !important;
    min-width: 0;
  }

  .inline-select.sorting-control {
    width: 100%;
    min-height: 52px;
    grid-template-columns: auto minmax(0, 1fr);
    box-shadow: var(--ui-shadow-sm, var(--shadow-sm));
  }

  .inline-select.sorting-control select {
    min-height: 40px;
    font-size: 15px;
  }

  .empty-state {
    min-height: 286px;
    padding: 38px 20px;
    border-radius: 21px;
  }

  .empty-state h2 {
    font-size: 25px;
  }

  .empty-state p {
    margin-bottom: 16px;
    font-size: 14.5px;
  }

  .empty-state .button {
    width: min(100%, 240px);
  }

  .form-page {
    padding: 18px 0 28px;
  }

  .form-layout {
    gap: 14px;
  }

  .form-sidebar {
    padding: 18px;
    border: 1px solid var(--ui-border, var(--line));
    border-radius: 20px;
    background:
      radial-gradient(circle at 100% 0, color-mix(in srgb, var(--ui-accent, #d77b16) 9%, transparent), transparent 13rem),
      var(--ui-surface, var(--surface));
    box-shadow: var(--ui-shadow-sm, var(--shadow-sm));
  }

  .form-sidebar .eyebrow {
    font-size: 12px;
  }

  .form-sidebar h1 {
    margin-top: 5px;
    font-size: 27px;
    line-height: 1.4;
  }

  .form-sidebar > p {
    margin: 7px 0 0;
    font-size: 13px;
    line-height: 1.75;
  }

  .professional-form {
    gap: 14px;
  }

  .form-card {
    padding: 18px;
    border-radius: 20px;
  }

  .form-card-head {
    gap: 11px;
    margin-bottom: 18px;
    padding-bottom: 15px;
  }

  .form-card-head > span {
    width: 38px;
    height: 38px;
    border-radius: 12px;
  }

  .form-card-head h2 {
    font-size: 19px;
  }

  .form-card-head p {
    font-size: 12.5px;
    line-height: 1.55;
  }

  .form-grid {
    gap: 16px;
  }

  .professional-form label {
    gap: 7px;
  }

  .professional-form label > span {
    font-size: 14px;
    line-height: 1.45;
  }

  .professional-form input,
  .professional-form select,
  .professional-form textarea {
    min-height: 54px;
    padding: 12px 14px;
    border-radius: 14px;
    font-size: 16px;
  }

  .professional-form textarea {
    min-height: 124px;
  }

  .sticky-submit {
    bottom: calc(var(--app-mobile-nav-height) + 10px + env(safe-area-inset-bottom));
    display: grid;
    width: 100%;
    grid-template-columns: minmax(0, 1fr);
    justify-items: stretch;
    gap: 0;
    padding: 8px;
    border-radius: 18px;
  }

  .sticky-submit > div {
    display: none !important;
  }

  .sticky-submit .button {
    display: inline-flex;
    width: 100% !important;
    max-width: none;
    justify-content: center;
  }

  .dashboard-shell {
    padding: 22px 0 34px;
  }

  .dashboard-welcome {
    margin-bottom: 18px;
  }

  .dashboard-welcome h1 {
    font-size: 29px;
    line-height: 1.4;
  }

  .dashboard-welcome p {
    margin-top: 4px;
    font-size: 13.5px;
  }

  .dashboard-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 9px;
  }

  .dashboard-actions .button {
    width: 100%;
  }

  .dashboard-card {
    padding: 18px;
    border-radius: 20px;
  }

  .dashboard-card-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 10px;
    margin-bottom: 16px;
  }

  .dashboard-card-head h2 {
    font-size: 21px;
    line-height: 1.45;
  }

  .dashboard-card-head p {
    margin-top: 3px;
    font-size: 13px;
    line-height: 1.65;
  }

  .dashboard-card-action {
    min-height: 44px;
    padding-inline: 12px;
    font-size: 13px;
  }

  .photo-profile-summary {
    grid-template-columns: 70px minmax(0, 1fr);
    gap: 11px 12px;
    align-items: center;
  }

  .photo-profile-summary > img {
    width: 70px;
    height: 70px;
    grid-row: 1 / span 2;
  }

  .photo-profile-copy {
    grid-column: 2;
  }

  .photo-profile-summary > .status-pill {
    grid-column: 2;
    justify-self: start;
  }

  .photo-profile-copy strong {
    font-size: 16px;
  }

  .photo-profile-copy p {
    font-size: 13px;
  }

  .dashboard-empty {
    min-height: 0;
    grid-template-columns: 44px minmax(0, 1fr);
    padding: 14px;
  }

  .dashboard-empty-icon {
    width: 44px;
    height: 44px;
  }

  .dashboard-empty .button {
    width: 100%;
    grid-column: 1 / -1;
  }

  .notification-setup-card {
    border-radius: 20px;
  }

  .notification-setup-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .notification-setup-actions .notification-state,
  .notification-setup-actions .button {
    width: 100%;
    justify-content: center;
  }

  .mobile-nav {
    height: calc(var(--app-mobile-nav-height) + env(safe-area-inset-bottom));
    grid-template-columns: repeat(5, minmax(0, 1fr));
    padding: 4px 5px env(safe-area-inset-bottom);
  }

  .mobile-nav > a {
    min-width: 0;
    gap: 3px;
    padding: 5px 2px 4px;
    font-size: 11.5px;
    font-weight: 750;
    line-height: 1.2;
    white-space: nowrap;
  }

  .mobile-nav > a > svg {
    width: 24px;
    height: 24px;
  }

  .mobile-nav .mobile-main-action {
    width: 58px;
    height: 58px;
    min-width: 58px;
    min-height: 58px;
    margin-top: -27px;
    padding: 0;
    border: 4px solid var(--ui-nav, var(--surface));
  }

  .mobile-nav .mobile-main-action > svg {
    width: 29px;
    height: 29px;
  }
}

@media (max-width: 380px) {
  .site-header .container {
    width: min(100% - 16px, 1180px);
  }

  .header-inner {
    gap: 8px;
  }

  .brand {
    gap: 7px;
  }

  .brand-copy strong {
    font-size: 18.5px;
  }

  .brand-copy small {
    display: none;
  }

  .header-actions {
    gap: 4px;
  }

  .icon-button,
  .account-menu summary {
    width: 42px;
    height: 42px;
    min-width: 42px;
    min-height: 42px;
    flex-basis: 42px;
  }

  .page-hero h1 {
    font-size: 27px;
  }

  .listing-toolbar-main {
    gap: 8px;
  }

  .listing-toolbar-main .filter-trigger {
    padding-inline: 12px;
  }

  .listing-count {
    padding-inline: 11px;
  }

  .dashboard-card-head {
    grid-template-columns: 1fr;
  }

  .dashboard-card-action {
    width: 100%;
  }

  .category-section-footer {
    margin-top: 20px;
  }

  .category-view-all {
    min-height: 54px;
    font-size: 15px;
  }
}

@media (max-width: 330px) {
  .brand-mark {
    width: 33px;
    height: 37px;
  }

  .brand-copy strong {
    font-size: 17.5px;
  }

  .icon-button,
  .account-menu summary {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    flex-basis: 40px;
  }

  .listing-toolbar-main .filter-trigger {
    min-width: 0;
    flex: 1 1 auto;
    padding-inline: 11px;
  }

  .listing-count {
    flex: 0 0 auto;
    padding-inline: 10px;
  }

  .mobile-nav > a {
    font-size: 10.5px;
  }
}
