/* =========================================================
   Create-shipment page additions on top of style.css (the design):
   OTP / profile panels, field errors, Leaflet map sheet, image remove
   buttons, schedule fields, success screen, toast, LTR mirroring and
   entrance animations.
   ========================================================= */

.create-shipment-page [hidden] {
  display: none !important;
}

/* ---- Entrance animations ---- */
@keyframes cs-stage-in {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes cs-pop-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes cs-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes cs-mark-in {
  0% {
    opacity: 0;
    transform: scale(0.6);
  }
  70% {
    opacity: 1;
    transform: scale(1.06);
  }
  100% {
    transform: scale(1);
  }
}

.create-shipment-page .phone-stage.active > .app-phone {
  animation: cs-stage-in 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.create-shipment-page [data-auth-panel]:not([hidden]) {
  animation: cs-fade-in 0.35s ease both;
}

.create-shipment-page .address-modal:not([hidden]),
.create-shipment-page .location-modal:not([hidden]) {
  animation: cs-fade-in 0.25s ease both;
}

.create-shipment-page .address-modal:not([hidden]) .address-dialog,
.create-shipment-page .location-modal:not([hidden]) .app-phone {
  animation: cs-pop-in 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.create-shipment-page .success-mark {
  animation: cs-mark-in 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* ---- Step 1: OTP / profile panels ---- */
.create-shipment-page .cs-panel-title {
  margin: 0 0 8px;
  color: #0d0d0d;
  font-size: 22px;
  font-weight: 900;
}

.create-shipment-page .cs-panel-hint {
  margin: 0 0 22px;
  color: var(--create-muted, rgba(13, 13, 13, 0.63));
  font-size: 15px;
  line-height: 1.7;
}

.create-shipment-page .cs-panel-hint bdi,
.create-shipment-page .cs-account-text bdi {
  font-weight: 800;
  color: #0d0d0d;
}

.create-shipment-page .cs-otp-wrap input {
  padding: 0 20px;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 8px;
  text-align: center;
}

.create-shipment-page .cs-attempts {
  margin: 6px 4px 0;
  color: var(--accent-gold-deep, #a8732f);
  font-size: 14px;
  font-weight: 700;
}

.create-shipment-page .cs-otp-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
}

.create-shipment-page .cs-link-btn {
  padding: 6px 2px;
  border: 0;
  background: none;
  color: var(--accent-gold-deep, #a8732f);
  font-family: inherit;
  font-size: 15px;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}

.create-shipment-page .cs-link-btn:disabled {
  color: rgba(13, 13, 13, 0.45);
  text-decoration: none;
  cursor: default;
}

.create-shipment-page .cs-profile-form .cs-field {
  margin-bottom: 16px;
}

/* ".phone-form label" of the design would stack the soft inputs. */
.create-shipment-page .cs-profile-form .soft-input {
  display: flex;
  margin-bottom: 0;
}

.create-shipment-page .cs-profile-form .primary-mobile-btn {
  width: 100%;
  margin-top: 8px;
}

.create-shipment-page .soft-input select {
  flex: 1 1 auto;
  min-width: 120px;
  border: 0;
  outline: 0;
  background: transparent;
  color: #0d0d0d;
  font-family: inherit;
  font-size: 17px;
}

/* ---- Signed-in bar ---- */
.create-shipment-page .cs-account-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 18px;
  padding: 12px 16px;
  border: 1px solid var(--create-line-strong, rgba(232, 200, 130, 0.36));
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(232, 200, 130, 0.14), rgba(205, 152, 83, 0.06));
  color: rgba(13, 13, 13, 0.72);
  font-size: 15px;
}

.create-shipment-page .shipment-form .cs-account-bar {
  margin-bottom: 0;
}

/* ---- Fields and errors ---- */
.create-shipment-page .cs-field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.create-shipment-page .shipment-form .cs-field--full {
  grid-column: 1 / -1;
}

.create-shipment-page .cs-field .soft-input,
.create-shipment-page .cs-field .soft-textarea,
.create-shipment-page .cs-field .upload-box,
.create-shipment-page .cs-field .location-card {
  margin-bottom: 0;
}

.create-shipment-page .cs-field-error {
  min-height: 0;
  margin: 0;
  padding-inline: 6px;
  color: #d0281e;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
}

.create-shipment-page .phone-form .cs-field-error {
  margin-top: 8px;
}

.create-shipment-page .is-invalid {
  border-color: rgba(208, 40, 30, 0.6) !important;
  box-shadow: 0 0 0 3px rgba(208, 40, 30, 0.08);
}

.create-shipment-page .cs-empty {
  grid-column: 1 / -1;
  color: var(--create-muted, rgba(13, 13, 13, 0.63));
}

.create-shipment-page .vehicle-card img {
  width: 80px;
  height: 80px;
  object-fit: contain;
}

.create-shipment-page .vehicle-picker input:focus-visible + .vehicle-card,
.create-shipment-page .location-row:focus-visible,
.create-shipment-page .upload-box:focus-within,
.create-shipment-page .toggle-switch input:focus-visible + span {
  outline: 3px solid rgba(200, 155, 90, 0.55);
  outline-offset: 3px;
}

.create-shipment-page .location-row span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.create-shipment-page .location-row.is-selected span {
  color: #0d0d0d;
  font-weight: 800;
}

.create-shipment-page .location-row {
  cursor: pointer;
  background: none;
  border-top: 0;
  border-inline: 0;
}

/* ---- Images ---- */
.create-shipment-page .uploaded-image-thumb {
  animation: cs-pop-in 0.3s ease both;
}

.create-shipment-page .cs-thumb-remove {
  position: absolute;
  top: 8px;
  inset-inline-end: 8px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(208, 40, 30, 0.3);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.94);
  color: #d0281e;
  font-family: Arial, sans-serif;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(11, 31, 51, 0.12);
}

.create-shipment-page .cs-thumb-remove:hover {
  background: #d0281e;
  color: #fff;
}

/* ---- Schedule ---- */
.create-shipment-page .toggle-switch {
  position: relative;
  cursor: pointer;
}

.create-shipment-page .cs-schedule-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  animation: cs-fade-in 0.3s ease both;
}

.create-shipment-page .cs-schedule-fields input {
  min-width: 0;
}

/* ---- Summary ---- */
.create-shipment-page .summary-vehicle img {
  width: 200px;
  max-width: 40%;
  height: 100px;
  object-fit: contain;
}

.create-shipment-page .summary-line strong,
.create-shipment-page .summary-route strong {
  overflow-wrap: anywhere;
}

.create-shipment-page .cs-summary-error {
  margin: 0 34px 16px;
}

.create-shipment-page .summary-actions .primary-mobile-btn[aria-busy="true"] {
  opacity: 0.8;
  cursor: progress;
}

/* ---- Success screen ---- */
.create-shipment-page .cs-success-body {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 18px;
  padding: 48px 34px 54px;
  text-align: center;
}

.create-shipment-page .cs-success-body h3 {
  margin: 8px 0 0;
  color: #0d0d0d;
  font-size: clamp(22px, 2.6vw, 30px);
  font-weight: 900;
}

.create-shipment-page .cs-success-body > p {
  max-width: 560px;
  margin: 0;
  color: var(--create-muted, rgba(13, 13, 13, 0.63));
  font-size: 17px;
  line-height: 1.8;
}

.create-shipment-page .cs-shipment-number {
  display: grid;
  gap: 6px;
  min-width: min(100%, 320px);
  padding: 16px 26px;
  border: 1px dashed var(--create-line-strong, rgba(232, 200, 130, 0.36));
  border-radius: 16px;
  background: rgba(11, 31, 51, 0.03);
}

.create-shipment-page .cs-shipment-number span {
  color: var(--create-muted, rgba(13, 13, 13, 0.63));
  font-size: 14px;
}

.create-shipment-page .cs-shipment-number strong {
  color: #0d0d0d;
  font-family: Arial, sans-serif;
  font-size: 26px;
  letter-spacing: 2px;
}

.create-shipment-page .cs-success-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  width: min(100%, 620px);
}

.create-shipment-page .cs-success-actions .primary-mobile-btn,
.create-shipment-page .cs-success-actions .secondary-mobile-btn {
  width: 100%;
  padding: 0 16px;
  font-size: 18px;
  text-decoration: none;
}

.create-shipment-page .cs-success-apps {
  display: grid;
  justify-items: center;
  gap: 12px;
  margin-top: 8px;
}

.create-shipment-page .cs-success-apps p {
  margin: 0;
  color: #0d0d0d;
  font-weight: 800;
}

.create-shipment-page .cs-store-badges {
  justify-content: center;
}

/* ---- Map sheet ---- */
.create-shipment-page .location-modal .cs-map-screen {
  display: flex;
  flex-direction: column;
}

.create-shipment-page .location-modal .cs-map-screen .map-topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 14px;
}

.create-shipment-page .location-modal .cs-map-canvas {
  position: relative;
  flex: 1 1 auto;
  height: auto;
  min-height: 220px;
  overflow: hidden;
}

.create-shipment-page .cs-map {
  position: absolute;
  inset: 0;
  z-index: 0;
  direction: ltr;
  background: #eef0ec;
  font-family: inherit;
}

.create-shipment-page .cs-map .leaflet-bottom {
  bottom: 20px;
}

.create-shipment-page .cs-map .leaflet-control-attribution {
  font-size: 10px;
}

/* The pin marks the centre of the map: the point that is chosen. */
.create-shipment-page .location-modal .cs-map-canvas .map-target {
  top: 50%;
  z-index: 2;
}

.create-shipment-page .cs-locate-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--create-line-strong, rgba(232, 200, 130, 0.36));
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.95);
  color: #0d0d0d;
  font-family: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(11, 31, 51, 0.12);
}

.create-shipment-page .cs-locate-btn:disabled {
  opacity: 0.7;
  cursor: progress;
}

.create-shipment-page .cs-locate-icon {
  position: relative;
  width: 16px;
  height: 16px;
  border: 2px solid var(--accent-gold, #c89b5a);
  border-radius: 50%;
}

.create-shipment-page .cs-locate-icon::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--accent-gold, #c89b5a);
}

.create-shipment-page .location-modal .cs-map-screen .address-sheet {
  position: relative;
  inset: auto;
  z-index: 3;
  flex: 0 0 auto;
  max-height: 58%;
  margin: -20px 12px 12px;
  overflow-y: auto;
}

.create-shipment-page .location-modal .cs-sheet-input {
  height: 54px;
  margin: 0 0 6px;
}

.create-shipment-page .location-modal .cs-sheet-input input {
  font-size: 15px;
}

.create-shipment-page .location-modal #cs-location-title {
  direction: inherit;
  text-align: start;
}

.create-shipment-page .location-modal #cs-national-address {
  direction: ltr;
  text-align: start;
  letter-spacing: 2px;
  font-weight: 800;
}

.create-shipment-page .cs-sheet-label {
  display: block;
  margin: 8px 2px 6px;
  color: rgba(13, 13, 13, 0.7);
  font-size: 13px;
  font-weight: 800;
}

.create-shipment-page .cs-sheet-status {
  min-height: 18px;
  margin: 2px 2px 8px;
  color: rgba(13, 13, 13, 0.55);
  font-size: 12px;
}

/* ---- Saved addresses dialogs ---- */
.create-shipment-page .cs-dialog-status:empty {
  display: none;
}

.create-shipment-page .cs-dialog-status {
  margin: 0 0 12px;
  color: rgba(13, 13, 13, 0.6);
  font-size: 14px;
}

.create-shipment-page .cs-dialog-hint {
  margin: -12px 0 18px;
  color: rgba(13, 13, 13, 0.6);
  font-size: 14px;
  line-height: 1.6;
}

.create-shipment-page .address-form-dialog .cs-field-error {
  margin: -8px 0 12px;
}

.create-shipment-page .address-delete-dialog .cs-field-error {
  margin-top: 12px;
}

.create-shipment-page .saved-address-main {
  border: 0;
  background: none;
  font-family: inherit;
  cursor: pointer;
}

.create-shipment-page .address-icon-btn,
.create-shipment-page .add-saved-address-btn,
.create-shipment-page .address-dialog-close {
  cursor: pointer;
}

.create-shipment-page .add-saved-address-btn {
  border: 0;
  background: none;
  font-family: inherit;
}

/* ---- Toast ---- */
.cs-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 10050;
  max-width: min(92vw, 520px);
  padding: 14px 20px;
  border-radius: 14px;
  background: #0b1f33;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.6;
  text-align: center;
  box-shadow: 0 18px 44px rgba(11, 31, 51, 0.25);
  opacity: 0;
  transform: translate(-50%, 12px);
  transition:
    opacity 0.25s ease,
    transform 0.25s ease;
}

.cs-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.cs-toast.is-error {
  background: #9f1d16;
}

.cs-toast.is-success {
  background: #0b1f33;
  border-bottom: 3px solid var(--accent-gold, #c89b5a);
}

/* ---- LTR (English): the design is written for RTL ---- */
[dir="ltr"] .create-shipment-page .app-topbar h2,
[dir="ltr"].create-shipment-page .app-topbar h2 {
  text-align: left;
}

[dir="ltr"].create-shipment-page .back-square::before {
  transform: rotate(-45deg);
}

[dir="ltr"].create-shipment-page .location-row {
  direction: ltr;
  text-align: left;
}

[dir="ltr"].create-shipment-page .location-row span {
  text-align: left;
}

[dir="ltr"].create-shipment-page .route-line {
  inset: 28px auto 28px 19px;
}

[dir="ltr"].create-shipment-page .shipment-form .soft-input,
[dir="ltr"].create-shipment-page .shipment-form .soft-input input,
[dir="ltr"].create-shipment-page .shipment-form .soft-textarea textarea,
[dir="ltr"].create-shipment-page .soft-input.filled input {
  direction: ltr;
  text-align: left;
}

[dir="ltr"].create-shipment-page .shipment-form .soft-input span {
  text-align: left;
}

[dir="ltr"].create-shipment-page .summary-route {
  padding: 22px 0 22px 30px;
}

[dir="ltr"].create-shipment-page .summary-route-line {
  right: auto;
  left: 4px;
}

[dir="ltr"].create-shipment-page .address-modal {
  direction: ltr;
}

[dir="ltr"].create-shipment-page .address-dialog h3 {
  text-align: left;
}

[dir="ltr"].create-shipment-page .address-success-dialog h3,
[dir="ltr"].create-shipment-page .address-delete-dialog h3 {
  text-align: center;
}

[dir="ltr"].create-shipment-page .address-dialog-close {
  left: auto;
  right: 24px;
}

[dir="ltr"].create-shipment-page .address-form-dialog input {
  direction: ltr;
  text-align: left;
}

[dir="ltr"].create-shipment-page .saved-address-main,
[dir="ltr"].create-shipment-page .add-saved-address-btn {
  direction: ltr;
  text-align: left;
}

[dir="ltr"].create-shipment-page .phone-input-wrap select {
  border-left: 0;
  border-right: 1px solid rgba(232, 200, 130, 0.18);
}

/* Phone numbers and codes are always written left to right. */
.create-shipment-page input[type="tel"],
.create-shipment-page input[dir="ltr"] {
  direction: ltr;
}

[dir="rtl"].create-shipment-page input[type="tel"],
[dir="rtl"].create-shipment-page .shipment-form input[dir="ltr"] {
  text-align: right;
}

/* ---- Responsive ---- */
@media (max-width: 760px) {
  .create-shipment-page .cs-schedule-fields,
  .create-shipment-page .cs-success-actions {
    grid-template-columns: 1fr;
  }

  .create-shipment-page .cs-success-body {
    padding: 34px 18px 40px;
  }

  .create-shipment-page .cs-summary-error {
    margin: 0 18px 14px;
  }

  .create-shipment-page .location-modal .cs-map-screen .address-sheet {
    max-height: 62%;
    margin: -18px 8px 8px;
  }

  .create-shipment-page .location-modal .cs-map-screen .sheet-title-row {
    flex-direction: row;
    align-items: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .create-shipment-page .phone-stage.active > .app-phone,
  .create-shipment-page [data-auth-panel]:not([hidden]),
  .create-shipment-page .address-modal:not([hidden]),
  .create-shipment-page .location-modal:not([hidden]),
  .create-shipment-page .address-modal:not([hidden]) .address-dialog,
  .create-shipment-page .location-modal:not([hidden]) .app-phone,
  .create-shipment-page .success-mark,
  .create-shipment-page .uploaded-image-thumb,
  .create-shipment-page .cs-schedule-fields {
    animation: none;
  }

  .cs-toast {
    transition: none;
  }
}
