/*
 * Call center sur carte.
 * Maquette validee : mockups/admin-11-callcenter-carte.html.
 * Proprietes logiques partout : l'arabe passe en miroir sans regle a part.
 */

.cc {
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  height: calc(100vh - 150px);
  min-height: 600px;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  background: var(--surface);
}

.cc-side {
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--surface-alt);
  border-inline-end: 1px solid var(--ink-100);
}

.cc-side .card {
  padding: 16px;
}

.cc-side .field {
  margin-bottom: 10px;
}

.cc-side textarea {
  width: 100%;
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--ink-100);
  border-radius: 10px;
  background: var(--surface-alt);
  resize: vertical;
}

.cc-step {
  margin: 0 0 10px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-500);
  display: flex;
  align-items: center;
  gap: 8px;
}

body[dir='rtl'] .cc-step {
  letter-spacing: 0;
}

.cc-step .n {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-600);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 11px;
}

.cc-step .n.ok {
  background: var(--success);
}

.cc-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.cc-row input {
  flex: 1;
  min-width: 0;
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--ink-100);
  border-radius: 10px;
  background: var(--surface-alt);
}

.cc-client {
  display: flex;
  gap: 12px;
  align-items: center;
}

.cc-client .avatar {
  width: 40px;
  height: 40px;
}

.cc-client .meta {
  flex: 1;
  min-width: 0;
  line-height: 1.35;
}

.cc-client .meta b {
  display: block;
}

.btn-link {
  background: none;
  border: 0;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--brand-700);
  cursor: pointer;
  padding: 0;
}

.cc-note {
  margin-top: 10px;
  background: var(--brand-100);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 13px;
  color: var(--brand-900);
  white-space: pre-wrap;
}

.cc-new {
  border: 1px dashed var(--brand-300);
  background: var(--brand-100);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--brand-900);
  margin-bottom: 10px;
}

.cc-trip {
  position: relative;
}

.cc-trip .line {
  position: absolute;
  inset-inline-start: 11px;
  top: 26px;
  bottom: 26px;
  border-inline-start: 2px dotted var(--ink-300);
}

.cc-stop {
  display: flex;
  gap: 10px;
  align-items: center;
  cursor: pointer;
}

.cc-stop + .cc-stop {
  margin-top: 8px;
}

.cc-stop .dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-inline: 6px;
  position: relative;
}

.cc-field {
  flex: 1;
  position: relative;
  min-width: 0;
}

.cc-field input {
  width: 100%;
  font: inherit;
  padding-block: 10px;
  padding-inline: 12px 34px;
  border: 1px solid var(--ink-100);
  border-radius: 10px;
  background: var(--surface-alt);
  cursor: pointer;
}

.cc-stop.active .cc-field input {
  border-color: var(--brand-500);
  outline: 2px solid var(--brand-300);
  background: #fff;
}

.cc-field .x {
  position: absolute;
  inset-inline-end: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: none;
  color: var(--ink-500);
  cursor: pointer;
  font-size: 13px;
}

.cc-save {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  padding-inline-start: 34px;
}

.cc-save input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 13px;
  padding: 6px 10px;
  border: 1px solid var(--ink-100);
  border-radius: 8px;
}

.cc-saved-ok {
  margin-top: 8px;
  padding-inline-start: 34px;
  font-size: 12.5px;
  color: var(--success);
  font-weight: 600;
}

.cc-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.cc-chip {
  border: 1px solid var(--ink-100);
  background: var(--surface);
  border-radius: var(--radius-pill);
  padding-block: 4px;
  padding-inline: 11px 6px;
  font-size: 12.5px;
  font-weight: 600;
  display: inline-flex;
  gap: 4px;
  align-items: center;
  cursor: pointer;
}

.cc-chip button {
  border: 0;
  background: none;
  color: var(--ink-300);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0 3px;
}

.cc-chip button:hover {
  color: var(--danger);
}

.cc-chip.on-start {
  border-color: var(--success);
  background: #e3f3ea;
  color: var(--success);
}

.cc-chip.on-end {
  border-color: var(--danger);
  background: #fde8e8;
  color: #c22d33;
}

.cc-types {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.cc-type {
  border: 1.5px solid var(--ink-100);
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
  background: var(--surface);
  font: inherit;
  text-align: start;
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: inherit;
}

.cc-type .price {
  font-weight: 800;
  font-size: var(--text-md);
}

.cc-type .muted {
  font-size: 12px;
}

.cc-type.on {
  border-color: var(--brand-500);
  background: var(--brand-100);
}

/* Course ouverte : toute la largeur, sous privee et partagee. */
.cc-type[data-type='open'] {
  grid-column: 1 / -1;
}

.cc-type:disabled {
  cursor: default;
}

.cc-map {
  position: relative;
  min-width: 0;
}

#cc-map-canvas {
  position: absolute;
  inset: 0;
}

.cc-search {
  position: absolute;
  top: 16px;
  inset-inline-start: 16px;
  width: min(480px, calc(100% - 32px));
  z-index: 600;
}

.cc-search input {
  width: 100%;
  font: inherit;
  font-size: 15px;
  background: #fff;
  border: 0;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
  padding: 13px 16px;
  border-radius: 12px;
}

.cc-results {
  margin-top: 6px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  max-height: 380px;
  overflow-y: auto;
}

.cc-res {
  display: flex;
  gap: 10px;
  padding: 10px 14px;
  border: 0;
  border-top: 1px solid var(--ink-100);
  align-items: center;
  width: 100%;
  background: none;
  font: inherit;
  text-align: start;
  cursor: pointer;
  color: inherit;
}

.cc-res:first-child {
  border-top: 0;
}

.cc-res:hover {
  background: var(--surface-alt);
}

.cc-res .ic {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--surface-sunk);
  color: var(--ink-500);
  flex-shrink: 0;
  font-size: 12px;
}

.cc-res .ic.google {
  background: #e8f0fe;
  color: #1a73e8;
  font-weight: 800;
}

.cc-res .ic.saved {
  background: var(--brand-100);
  color: var(--brand-700);
}

.cc-res .txt {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.cc-res .txt span {
  color: var(--ink-500);
  font-size: 12px;
}

.cc-res .src {
  margin-inline-start: auto;
  font-size: 11px;
  color: var(--ink-500);
  white-space: nowrap;
}

.empty-res {
  color: var(--ink-500);
  cursor: default;
}

.cc-mode {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent-600);
  color: #fff;
  border-radius: var(--radius-pill);
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
  display: flex;
  gap: 10px;
  align-items: center;
  z-index: 600;
  white-space: nowrap;
  pointer-events: none;
}

.cc-mode .d {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.cc-sms {
  position: absolute;
  top: 16px;
  inset-inline-end: 16px;
  width: 330px;
  max-height: calc(100% - 32px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 600;
}

.cc-smshead,
.cc-bubble {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
  padding: 10px 12px;
  font-size: 13px;
}

.cc-smshead b {
  display: block;
}

.cc-smshead span {
  color: var(--brand-700);
  font-size: 12px;
}

.cc-bubble .top {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--ink-500);
  margin-bottom: 4px;
}

.cc-bubble .txt {
  background: #eef3ee;
  border-radius: 10px;
  padding: 8px 10px;
}

.cc-bubble .stamp {
  font-size: 11px;
  font-weight: 700;
  color: var(--brand-700);
  margin-top: 6px;
}

.cc-bubble.wait {
  color: var(--ink-500);
  font-size: 12.5px;
}

/* Ecran moyen : la colonne des SMS descend pour laisser la recherche lisible. */
@media (max-width: 1250px) {
  .cc-sms {
    top: auto;
    bottom: 70px;
    max-height: 45%;
  }
}

@media (max-width: 900px) {
  .cc {
    grid-template-columns: minmax(0, 1fr);
    height: auto;
  }

  .cc-map {
    height: 60vh;
  }

  .cc-sms {
    width: auto;
    inset-inline-start: 16px;
  }
}

/* Anciennes courses du client : un clic reprend le trajet. */
.cc-history {
  margin-top: 12px;
  display: grid;
  gap: 6px;
}

.cc-history-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-500);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.cc-past {
  display: grid;
  gap: 2px;
  text-align: start;
  padding: 8px 10px;
  border: 0;
  border-radius: 12px;
  background: var(--neu-base, var(--surface));
  box-shadow: var(--neu-raise-sm, var(--shadow-card));
  font: inherit;
  color: var(--ink-900);
  cursor: pointer;
}

.cc-past:hover {
  color: var(--brand-700);
}

.cc-past:active {
  box-shadow: var(--neu-press-sm, none);
}

.cc-past .when,
.cc-past .fare {
  font-size: 11.5px;
  color: var(--ink-500);
}

.cc-past .trip {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Inverser le trajet : pose entre le depart et l'arrivee. */
.cc-swap {
  position: absolute;
  inset-inline-end: -6px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--neu-base, var(--surface));
  box-shadow: var(--neu-raise-sm, var(--shadow-card));
  color: var(--brand-700);
  cursor: pointer;
}

.cc-swap .icon {
  width: 16px;
  height: 16px;
}

.cc-swap:active {
  box-shadow: var(--neu-press-sm, none);
}

.cc-trip:has(.cc-swap) .cc-field {
  margin-inline-end: 34px;
}

/* Prix modifie par l'operateur. */
.cc-fare-open {
  margin-top: 10px;
}

.cc-fare-set {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
}

.cc-fare-form {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.cc-fare-form .cc-row .btn {
  flex: 1;
}
