@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap');

:root {
  --primary: #4f4c43;
  --success: #3cb04a;
  --error: #e74c3c;
  --pending: #d4a017;
  --border: #e9e7e1;
  --bg: #fafbfb;
  --white: #fff;
  --grey: #8f8f8f;
  --grey-light: #e8e8e8;
  --shadow: 0 2px 8px rgba(0,0,0,0.04);
  --gap: 26px;
  --radius: 6px;
  --font-main: 'Roboto', Arial, sans-serif;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-main);
  background: var(--bg);
  color: #232323;
}

.tracker-header {
  background: var(--primary);
  color: var(--white);
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  box-sizing: border-box;
}
.tracker-logo {
  display: flex;
  align-items: center;
}
.tracker-logo img {
  height: 32px;
  margin-right: 12px;
  filter: brightness(0) invert(1);
}
.tracker-title {
  font-size: 1.25rem;
  font-weight: 500;
  letter-spacing: 0.5px;
}
.tracker-search {
  display: flex;
  align-items: center;
  gap: 16px;
}
.tracker-search input {
  background: #fff;
  color: #232323;
  border: none;
  border-radius: var(--radius);
  padding: 8px 14px;
  font-size: 1rem;
  outline: none;
  min-width: 120px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.04);
}
.tracker-user {
  font-size: 1rem;
  font-weight: 400;
  cursor: pointer;
  user-select: none;
}
.tracker-user .arrow {
  font-size: 0.9em;
  margin-left: 7px;
}

.tracker-status-wrapper {
  max-width: 100vw;
  min-width: 350px;
  background: #fff;
  padding: 18px 18px 8px 18px;
  box-sizing: border-box;
}
.tracker-status-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.back-link {
  color: #0093b1;
  text-decoration: none;
  font-size: 1.01rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 3px;
}
.arrow {
  font-size: 1.08em;
}
.localtime-toggle {
  color: #908c88;
  font-size: 0.98rem;
  display: flex;
  align-items: center;
  gap: 7px;
  user-select: none;
}
.switch {
  position: relative;
  display: inline-block;
  width: 32px;
  height: 16px;
  margin-left: 2px;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #e1dfd9;
  border-radius: 16px;
  transition: .4s;
}
.slider:before {
  position: absolute;
  content: "";
  height: 12px;
  width: 12px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  border-radius: 50%;
  transition: .4s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.07);
}
.switch input:checked + .slider {
  background-color: var(--success);
}
.switch input:checked + .slider:before {
  transform: translateX(16px);
}

.tracker-status-bar {
  display: flex;
  align-items: stretch;
  background: #fcfbf8;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1.5px solid var(--border);
  padding: 10px 10px 6px 16px;
  gap: 12px;
  flex-wrap: wrap;
}
.status-col {
  display: flex;
  flex-direction: column;
  min-width: 130px;
  padding: 2px 14px 2px 0;
  margin-right: 0;
  font-size: 0.97rem;
  border-right: 1px solid var(--grey-light);
  justify-content: center;
}
.status-col:last-child {
  border-right: none;
}
.status-label {
  color: #88857c;
  font-size: 0.97rem;
  font-weight: 400;
  margin-bottom: 2px;
  letter-spacing: 0.01em;
}
.status-value {
  font-weight: 600;
  font-size: 1.07rem;
  color: #222;
  margin-top: 1px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.status-info {
  font-size: 0.92em;
  margin-left: 3px;
  color: #b2b2b2;
  vertical-align: middle;
  cursor: pointer;
}
.deduct-type {
  color: #b3b3b3;
  font-size: 0.93em;
  font-weight: 500;
  margin-left: 2px;
}
.status-success {
  min-width: 200px;
  border-right: 1px solid var(--grey-light);
}
.status-success .status-label {
  margin-bottom: 0px;
}
.status-success .status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1.13rem;
  margin-bottom: 0px;
}
.status-completed {
  font-weight: 700;
  font-size: 1.12em;
}
.status-desc {
  font-size: 0.97rem;
  color: #726e67;
  font-weight: 500;
  margin-top: 0px;
  margin-left: 27px;
}
.status-date {
  min-width: 155px;
  justify-content: center;
}
.status-date-value {
  color: #726e67;
  font-size: 1.04rem;
  font-weight: 500;
  margin-top: 18px;
}
.status-col .clock {
  font-size: 1.1em;
  margin-right: 2px;
}
.status-col .small {
  font-size: 0.86rem;
  word-break: break-all;
  color: #9c998f;
}
.tracking-number {
  min-width: 250px;
}

/* Timeline labels & spacing (ajustement demandé) */
.timeline-labels-row {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin: 34px auto 6px auto;
  max-width: 1200px;
  min-width: 350px;
}
.timeline-bar-outer.timeline-bar-margin-top {
  margin-top: 30px !important;
}

/* Timeline horizontale */
.tracker-main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 32px 18px 60px 18px;
}
.tracker-timeline-header {
  display: flex;
  justify-content: space-between;
  margin: 34px 0 12px 0;
}
.timeline-label {
  background: #fff;
  border-radius: var(--radius);
  padding: 10px 34px;
  font-size: 1.12rem;
  font-weight: 500;
  box-shadow: var(--shadow);
  color: #333;
}
.timeline-label.right {
  text-align: right;
}
/* Nouvelle timeline-bar-outer */
.timeline-bar-outer {
  margin: 0 auto 36px auto;
  max-width: 1200px;
  min-width: 350px;
  width: 100%;
  position: relative;
}
.timeline-bar-bg {
  background: #e1e1e1;
  border-radius: 8px;
  height: 14px;
  width: 100%;
  position: relative;
  overflow: hidden;
}
.timeline-bar-fg {
  background: #3cb04a;
  height: 100%;
  border-radius: 8px;
  transition: width 0.6s cubic-bezier(.4,1.7,.3,.8);
}
.timeline-points {
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  height: 0;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
  z-index: 2;
}
.timeline-point {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #e1e1e1;
  border: 3px solid #fff;
  box-shadow: 0 2px 5px rgba(0,0,0,0.07);
  transform: translateY(-50%);
  transition: background .6s;
}
.timeline-point.active {
  background: #3cb04a;
  border: 3px solid #99e4a6;
}
.timeline-point:first-child,
.timeline-point:last-child {
  width: 24px;
  height: 24px;
  border-radius: 5px;
  background: #2980b9;
  border: 3px solid #3cb04a;
  box-shadow: 0 2px 5px rgba(0,0,0,0.07);
  transition: background .6s;
}
.timeline-point.active:first-child,
.timeline-point.active:last-child {
  background: #3cb04a;
  border: 3px solid #2980b9;
}
@media (max-width:1200px) {
  .timeline-bar-outer,
  .timeline-labels-row { max-width: 99vw; min-width: 0; }
}
@media (max-width:700px) {
  .timeline-bar-bg { height: 11px; }
  .timeline-point { width: 16px; height: 16px; }
  .timeline-point:first-child, .timeline-point:last-child { width: 18px; height: 18px; }
  .timeline-label { padding: 10px 6vw; font-size: 1em;}
}

/* Etapes PRINCIPALES en horizontal */
.tracker-steps-horizontal {
  display: flex;
  gap: 32px;
  justify-content: space-between;
  margin-top: 12px;
  flex-wrap: wrap;
}
.tracker-steps-horizontal .step-card {
  min-width: 230px;
  max-width: 290px;
  flex: 1 1 235px;
  margin-bottom: 0;
  position: relative;
  background: #fff;
}

/* Sous-étapes immédiatement sous la principale */
.sub-steps {
  margin-top: 18px;
  margin-bottom: 0;
}
.sub-steps .step-card.sub {
  margin-bottom: 10px;
  margin-top: 0;
  margin-left: 18px;
  border-left: 4px solid #d7d7d7;
  background: #f9f9f9;
  box-shadow: none;
}

/* Cartes étapes */
.step-card {
  background: #fff;
  border: 1.8px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 23px 22px 14px 22px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: margin-left 0.2s;
}
.step-title {
  font-weight: 700;
  text-transform: uppercase;
  font-size: 1.07rem;
  margin-bottom: 6px;
  letter-spacing: 0.01em;
  color: #2a2a2a;
  display: flex;
  align-items: center;
  gap: 7px;
}
.step-bic {
  font-weight: 500;
  font-size: 0.97em;
  margin-bottom: 1px;
}
.step-label {
  color: #8e8e8e;
  font-weight: 500;
  font-size: 0.96em;
}
.step-location {
  color: #444;
  font-size: 0.96em;
  margin-bottom: 6px;
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 4px;
  line-height: 1.25;
}
.step-icon {
  font-size: 1.05em;
  color: #bbb;
  margin-right: 2px;
}
.step-dates {
  display: flex;
  gap: 8px;
  margin-bottom: 2px;
}
.step-date-row {
  background: #f2f2f2;
  border-radius: 4px;
  padding: 6px 10px;
  font-size: 0.96em;
  color: #353535;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
}
.step-detail {
  border-top: 1px solid var(--grey-light);
  margin-top: 10px;
  padding-top: 8px;
  font-size: 0.95em;
  color: #666;
  line-height: 1.3;
  word-break: break-all;
}

/* Table admin */
.step-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 30px;
}
.step-table th, .step-table td {
  border: 1px solid #e8e8e8;
  padding: 5px 10px;
}
.step-table th {
  background: #f8f8f7;
}

.admin-form {
  display: flex;
  flex-wrap: wrap;
  gap: 18px 36px;
  margin-bottom: 24px;
}
.admin-form label { display: flex; flex-direction: column; font-weight: 500; margin-bottom: 7px; }
.admin-form input, .admin-form select {
  font-size: 1em;
  padding: 6px 8px;
  border-radius: 4px;
  border: 1px solid #ccc;
  margin-top: 3px;
}
.admin-form button {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 5px;
  padding: 8px 18px;
  font-size: 1em;
  cursor: pointer;
  margin-top: 18px;
}

/* Responsive */
@media (max-width: 1100px) {
  .tracker-steps-horizontal {
    flex-wrap: wrap;
    gap: 18px;
  }
  .tracker-steps-horizontal .step-card {
    min-width: 220px;
    max-width: 100%;
    flex: 1 1 100%;
  }
}
@media (max-width: 700px) {
  .tracker-status-bar {
    flex-direction: column;
    gap: 0;
    padding: 8px 3vw;
  }
  .status-col, .status-success, .status-date, .tracking-number {
    min-width: 0;
    border-right: none;
    border-bottom: 1px solid var(--grey-light);
    margin-bottom: 3px;
    padding: 4px 0;
  }
  .status-col:last-child, .tracking-number {
    border-bottom: none;
  }
  .tracker-steps-horizontal {
    flex-direction: column;
    gap: 10px;
  }
  .tracker-steps-horizontal .step-card {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }
  .timeline-bar-outer {
    margin: 36px auto 30px auto;
    max-width: 540px;
    position: relative;
    width: 100%;
  }
  .timeline-bar-bg {
    background: #e1e1e1;
    border-radius: 8px;
    height: 14px;
    width: 100%;
    position: relative;
    overflow: hidden;
  }
  .timeline-bar-fg {
    background: #3cb04a;
    height: 100%;
    border-radius: 8px;
    transition: width 0.6s cubic-bezier(.4,1.7,.3,.8);
  }
  .timeline-points {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 0;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
  }
  .timeline-point {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #e1e1e1;
    border: 3px solid #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.07);
    transform: translateY(-50%);
    transition: background .6s;
  }
  .timeline-point.active {
    background: #3cb04a;
    border: 3px solid #99e4a6;
  }
}