/* Haggling over a price and the driver profile (js/deal.js, order.js,
   driver.js, account.js). */

/* ---------- The driver on an offer card / trip card: opens the profile ---- */

.offer-card__top {
  grid-template-columns: minmax(0, 1fr) auto;
}

.offer-card__driver,
.driver-card__driver {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 0;
  border-radius: 12px;
  text-align: right;
  color: inherit;
}

.offer-card__driver-who,
.driver-card__driver-who {
  min-width: 0;
}

.offer-card__driver-who strong,
.driver-card__driver-who strong {
  display: block;
  overflow: hidden;
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.driver-card__driver-who strong {
  font-size: 14.5px;
}

.driver-card__top {
  grid-template-columns: minmax(0, 1fr) auto;
}

.deal-more {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-top: 2px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--green);
}

.deal-more .icon {
  width: 13px;
  height: 13px;
}

.offer-card__driver:focus-visible,
.driver-card__driver:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 3px;
}

@media (hover: hover) and (min-width: 768px) {
  .offer-card__driver:hover .deal-more,
  .driver-card__driver:hover .deal-more {
    text-decoration: underline;
  }
}

.offer-card__price s {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
}

/* A redrawn card keeps its place without replaying the entrance. */
.offer-card.is-updated {
  animation: none;
}

.offer-card.is-agreed {
  border-color: var(--green);
  box-shadow: 0 0 0 1px var(--green) inset;
}

.offer-card__actions--3 {
  grid-template-columns: minmax(0, 0.75fr) minmax(0, 1.15fr) minmax(0, 1.4fr);
}

.offer-card__actions .btn {
  padding-inline: 10px;
  font-size: 13.5px;
}

/* ---------- Where the haggling stands, inside an offer card ---------- */

.deal-strip {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  animation: rate-rise 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.deal-strip > .icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 1px;
}

.deal-strip > div {
  flex: 1;
  min-width: 0;
}

.deal-strip strong {
  display: block;
  font-size: 13px;
  font-weight: 800;
}

.deal-strip small {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  line-height: 1.7;
  color: var(--text);
  opacity: 0.85;
}

.deal-strip .ld-offer__spinner {
  width: 18px;
  height: 18px;
  margin-top: 1px;
}

.deal-strip--wait {
  background: var(--orange-soft);
  color: #a85a10;
}

.deal-strip--ok {
  background: var(--green-soft);
  color: var(--green-dark);
}

.deal-strip--info {
  background: var(--blue-soft);
  color: var(--blue);
}

.deal-strip--no {
  background: var(--bg-soft);
  color: var(--muted-2);
}

.deal-strip__link {
  flex-shrink: 0;
  align-self: center;
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  font-weight: 800;
  color: inherit;
}

/* "۱۰٫۳ ← ۸٫۷۶ ← ۹٫۸۱ میلیون تومان" */
.deal-ladder {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 6px;
  margin-top: 6px;
  font-size: 12px;
  font-weight: 800;
}

.deal-ladder .is-them {
  color: var(--text);
}

.deal-ladder .is-me {
  color: var(--green-dark);
}

.deal-ladder i {
  font-style: normal;
  color: var(--muted);
}

.deal-ladder small {
  display: inline;
  margin: 0;
  font-weight: 600;
  color: var(--muted-2);
  opacity: 1;
}

/* ---------- The haggling so far, step by step ---------- */

.deal-trail {
  position: relative;
  display: grid;
  gap: 10px;
  margin: 10px 0 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  list-style: none;
}

.deal-trail__row {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  font-size: 12.5px;
  color: var(--muted-2);
}

/* The line joining the dots. */
.deal-trail__row:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 14px;
  right: 3.5px;
  bottom: -12px;
  width: 1px;
  background: var(--line-2);
}

.deal-trail__dot {
  width: 8px;
  height: 8px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--line-2);
}

.deal-trail__row.is-me .deal-trail__dot {
  background: var(--green);
}

.deal-trail__row.is-ok .deal-trail__dot {
  background: var(--green);
  box-shadow: 0 0 0 3px var(--green-soft);
}

.deal-trail__row.is-no .deal-trail__dot {
  background: var(--red);
}

.deal-trail__text b {
  font-weight: 800;
  color: var(--text);
}

.deal-trail__text q {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  line-height: 1.7;
  color: var(--muted-2);
  quotes: "«" "»";
}

.deal-trail__price {
  font-weight: 800;
  color: var(--text);
  white-space: nowrap;
}

.deal-trail__row.is-ok .deal-trail__price {
  color: var(--green-dark);
}

/* ---------- Price sheet ---------- */

.deal-panel .ui-title {
  margin-bottom: 10px;
}

.deal-ctx__row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--bg-soft);
}

.deal-ctx__row .avatar-s {
  width: 38px;
  height: 38px;
  font-size: 15px;
}

.deal-ctx__row > div {
  flex: 1;
  min-width: 0;
}

.deal-ctx__row small {
  display: block;
  font-size: 11.5px;
  color: var(--muted-2);
}

.deal-ctx__row strong {
  display: block;
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}

.deal-panel .offer-price {
  margin-top: 14px;
}

.deal-panel .offer-note {
  min-height: 60px;
  margin: 14px 0 0;
}

.deal-note {
  margin-top: 10px;
}

.deal-note b {
  color: var(--text);
}

.offer-price__hint.is-shake {
  animation: yb-shake 0.4s ease;
}

/* ---------- Driver on the load screen: a shipper's price to answer ------ */

.ld-offer--counter {
  align-items: flex-start;
  background: var(--blue-soft);
  color: var(--blue);
}

.ld-offer--counter > .icon {
  margin-top: 2px;
}

.ld-offer--counter small {
  color: var(--text);
}

.ld-offer__acts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.ld-offer__btn {
  padding: 7px 12px;
  border: 1px solid currentColor;
  border-radius: 999px;
  background: var(--surface);
  font-size: 12.5px;
  font-weight: 800;
  color: inherit;
}

@media (hover: hover) and (min-width: 768px) {
  .ld-offer__btn:hover {
    background: var(--bg-soft);
  }
}

.ld-offer + .deal-trail {
  margin-top: 8px;
}

.drv-offers.is-action {
  background: var(--blue-soft);
  color: var(--blue);
}

.order-card--action {
  border-color: var(--blue);
}

/* ---------- Driver profile sheet ---------- */

.dp-panel {
  padding-top: 12px;
}

.dp-preview {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--bg-soft);
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--muted-2);
}

.dp-preview .icon {
  flex-shrink: 0;
  margin-top: 3px;
  color: var(--green);
}

.dp-head {
  display: grid;
  justify-items: center;
  text-align: center;
}

.dp-head__avatar {
  position: relative;
  display: inline-block;
}

.dp-head__badge {
  position: absolute;
  bottom: -2px;
  left: -2px;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--green);
  color: #fff;
}

.dp-head__badge .icon {
  width: 15px;
  height: 15px;
}

.dp-head__name {
  margin: 10px 0 2px;
  font-size: 18px;
  font-weight: 800;
}

.sheet__panel h3.dp-head__name {
  margin-bottom: 2px;
}

.dp-head__sub {
  font-size: 12.5px;
  color: var(--muted-2);
}

.dp-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.dp-stats > div {
  display: grid;
  gap: 2px;
  padding: 12px 6px;
  text-align: center;
}

.dp-stats > div + div {
  border-right: 1px solid var(--line);
}

.dp-stats strong {
  font-size: 16px;
  font-weight: 800;
}

.dp-stats small {
  font-size: 11.5px;
  color: var(--muted-2);
}

.dp-star {
  color: var(--star);
}

.dp-sec {
  margin-top: 20px;
}

.dp-sec__title {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 10px;
  font-size: 14.5px;
  font-weight: 800;
}

.sheet__panel h4.dp-sec__title {
  margin-bottom: 10px;
}

.dp-sec__title small {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.dp-photos {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  border-radius: 14px;
}

.dp-photos::-webkit-scrollbar {
  display: none;
}

.dp-photos img {
  flex: 0 0 82%;
  height: 170px;
  border-radius: 14px;
  object-fit: cover;
  background: var(--bg-soft);
  scroll-snap-align: start;
}

.dp-photos.is-single img {
  flex-basis: 100%;
}

.dp-art {
  display: grid;
  place-items: center;
  height: 110px;
  padding: 18px 60px;
  border-radius: 14px;
  background: var(--bg-soft);
  color: var(--muted-2);
  --vart-bg: var(--bg-soft);
}

.dp-veh {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
}

.dp-veh > div {
  min-width: 0;
}

.dp-veh strong {
  display: block;
  font-size: 13.5px;
  font-weight: 800;
}

.dp-veh small {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted-2);
}

.dp-docs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.dp-docs li {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--muted-2);
}

.dp-docs li .icon {
  flex-shrink: 0;
  color: var(--muted);
}

.dp-docs li.is-ok {
  color: var(--text);
}

.dp-docs li.is-ok .icon {
  color: var(--green);
}

.dp-hint {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-top: 10px;
  font-size: 12px;
  line-height: 1.7;
  color: var(--muted-2);
}

.dp-hint .icon {
  flex-shrink: 0;
  margin-top: 3px;
  color: var(--green);
}

.dp-rating {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 18px;
}

.dp-rating__big {
  display: grid;
  justify-items: center;
  gap: 4px;
}

.dp-rating__big strong {
  font-size: 34px;
  font-weight: 900;
  line-height: 1;
}

.dp-rating__big small {
  font-size: 11.5px;
  color: var(--muted-2);
}

.dp-bars {
  display: grid;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.dp-bars li {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--muted-2);
}

.dp-bars__track {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--bg-soft);
}

.dp-bars__track b {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--star);
}

.dp-bars small {
  text-align: left;
}

.dp-sub {
  margin: 14px 0 8px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted-2);
}

.dp-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dp-tag {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--green-soft);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--green-dark);
}

.dp-tag b {
  font-weight: 800;
  opacity: 0.75;
}

.dp-reviews {
  display: grid;
  gap: 10px;
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
}

.dp-review {
  padding: 12px;
  border-radius: 14px;
  background: var(--bg-soft);
}

.dp-review__head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dp-review__head strong {
  font-size: 13px;
  font-weight: 800;
}

.dp-review__head time {
  margin-inline-start: auto;
  font-size: 11.5px;
  color: var(--muted);
}

.dp-review p {
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.8;
}

.dp-review__meta {
  display: block;
  margin-top: 6px;
  font-size: 11.5px;
  color: var(--muted-2);
}

.dp-empty {
  padding: 14px;
  border: 1px dashed var(--line-2);
  border-radius: 14px;
  font-size: 12.5px;
  line-height: 1.8;
  text-align: center;
  color: var(--muted-2);
}

/* Actions stay in reach while the profile scrolls. */
.dp-foot {
  position: sticky;
  bottom: calc(-16px - env(safe-area-inset-bottom, 0px));
  z-index: 1;
  display: flex;
  gap: 10px;
  margin: 18px -16px calc(-16px - env(safe-area-inset-bottom, 0px));
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.dp-foot .btn {
  flex: 1;
  min-height: 46px;
}

.dp-foot .btn--primary {
  flex: 1.6;
}

@media (min-width: 768px) {
  .dp-foot {
    bottom: -20px;
    margin: 18px -22px -20px;
    padding: 14px 22px 16px;
    border-radius: 0 0 22px 22px;
  }
}

.dp--loading .dp-head .avatar-s {
  background: var(--skel-a);
}

.dp--loading .dp-stats > div {
  padding: 18px 12px;
}

/* ---------- Truck photos (vehicles page) ---------- */

.pg-card__count {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.veh-photos__hint {
  margin: -4px 0 12px;
}

.veh-photos {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.veh-photo {
  position: relative;
  aspect-ratio: 4 / 3;
  margin: 0;
  overflow: hidden;
  border-radius: 12px;
  background: var(--bg-soft);
}

.veh-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.veh-photo__remove {
  position: absolute;
  top: 6px;
  left: 6px;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
}

.veh-photo__remove .icon {
  width: 14px;
  height: 14px;
}

.veh-photo--add {
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 4px;
  border: 1.5px dashed var(--line-2);
  font-size: 12px;
  font-weight: 700;
  color: var(--green);
}

.veh-photo--add .icon {
  width: 24px;
  height: 24px;
}

@media (hover: hover) and (min-width: 768px) {
  .veh-photo--add:hover {
    border-color: var(--green);
  }
}

.veh-photos__preview {
  margin-top: 12px;
}

/* ---------- Dark theme ---------- */

html[data-theme="dark"] .deal-strip--wait,
html[data-theme="dark"] .ld-offer--wait {
  color: #f0a45c;
}

html[data-theme="dark"] .ld-offer--no {
  color: #f07a7a;
}

/* The dark theme paints .drv-offers orange; keep the other tones. */
html[data-theme="dark"] .drv-offers.is-action {
  color: var(--blue);
}

html[data-theme="dark"] .drv-offers.is-good {
  color: var(--green-dark);
}

html[data-theme="dark"] .deal-strip__link,
html[data-theme="dark"] .ld-offer__link {
  background: rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .dp-photos img {
  filter: brightness(0.9);
}

@media (prefers-reduced-motion: reduce) {
  .deal-strip,
  .offer-price__hint.is-shake {
    animation: none;
  }
}
