@import url('root.css');

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  height: 100vh;
  overflow: hidden;
  color: var(--text-main);
  background-color: var(--routal-neutral-05);
  font-variant-numeric: tabular-nums lining-nums;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

h1 {
  font-size: 52px;
  line-height: 60px;
  font-weight: 500;
  color: var(--text-main);
}

h2 {
  font-size: 28px;
  line-height: 30px;
  font-weight: 500;
  color: var(--text-main);
}

h3 {
  font-size: 24px;
  line-height: 26px;
  font-weight: 500;
  color: var(--text-main);
}

h4 {
  font-size: 22px;
  line-height: 24px;
  font-weight: 500;
  color: var(--text-main);
}

h5 {
  font-size: 20px;
  line-height: 22px;
  font-weight: 500;
  color: var(--text-main);
}

h6 {
  font-size: 18px;
  line-height: 20px;
  font-weight: 500;
  color: var(--text-main);
}

p,
span,
div,
input,
button {
  font-size: 14px;
  line-height: 16px;
}

#app {
  display: flex;
  height: 100%;
}

#sidebar {
  width: 400px;
  background: var(--routal-neutral-02);
  display: flex;
  flex-direction: column;
  z-index: 1000;
}

.routal-promo {
  background-color: var(--routal-primary-60);
  padding: 12px 24px;
  border-top: 1px solid var(--routal-primary-60);
  margin-top: auto;
}

.promo-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.promo-content-logo {
  display: flex;
  align-items: center;
  gap: 8px;
}

.promo-logo {
  margin-bottom: 2px;
}

.promo-claim {
  color: var(--routal-neutral-00);
  font-size: 13px;
  font-weight: 500;
}

.promo-btn {
  background-color: var(--routal-primary-40);
  color: var(--routal-neutral-00);
  text-decoration: none;
  padding: 12px 26px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.promo-btn:hover {
  background-color: var(--routal-primary-20);
  text-decoration: none;
}

.sidebar-header {
  background: var(--routal-neutral-00);
  padding: 16px;
  z-index: 1;
  /* Box shadow at the bottom */
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--primary);
  font-weight: 500;
  margin-bottom: 0.5rem;
  font-size: 18px; /* h6 equivalent */
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

#route-name {
  font-size: 22px; /* h4 */
  line-height: 24px;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

#plan-info {
  color: var(--routal-secondary-00);
  font-size: 14px;
}

.stops-container {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}

#stops-list {
  display: flex;
  flex-direction: column;
  gap: 6px; /* Reduced gap between cards */
}

.stop-card {
  display: flex;
  align-items: flex-start;
  padding: 8px 10px; /* Reduced vertical and horizontal padding */
  background: var(--routal-neutral-00);
  border-radius: 10px;
  border: 1px solid var(--routal-neutral-10);
  margin-bottom: 0; /* Let gap handle spacing */
  transition: all 0.2s;
  cursor: pointer;
  position: relative;
}

.stop-card:hover {
  background-color: var(--routal-neutral-00);
  border-color: var(--routal-neutral-20);
}

.stop-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-right: 8px; /* Reduced margin */
  width: 24px;
  flex-shrink: 0;
}

.stop-circle {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--routal-neutral-20);
  background-color: transparent;
  color: var(--routal-neutral-40);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 4px;
  flex-shrink: 0;
}

.stop-circle.completed {
  background-color: var(--routal-success-light);
  border-color: var(--routal-success-light);
  color: var(--routal-success-medium);
}

.stop-circle.canceled {
  background-color: var(--routal-error-light);
  border-color: var(--routal-error-light);
  color: var(--routal-error-medium);
}

.stop-circle.pending {
  background-color: var(--routal-primary-20n);
  border-width: 2px;
  border-color: var(--routal-primary-40);
  color: var(--routal-primary-40);
}

.stop-circle.incomplete {
  background-color: var(--status-incomplete-light);
  border-color: var(--status-incomplete-light);
  color: var(--status-incomplete-dark);
}

/* Icon below number, e.g. pencil */
.stop-icon-sub {
  width: 14px;
  height: 14px;
  color: var(--status-complete-dark);
  margin-top: -2px;
}

.stop-content {
  flex: 1;
  min-width: 0;
}

.stop-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 2px;
}

.stop-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-main);
  /* Removed white-space: nowrap to allow wrapping */
  line-height: 1.4;
}

.stop-time {
  font-size: 14px;
  font-weight: 500;
  color: var(--routal-secondary-00);
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  margin-left: 8px; /* Ensure spacing from title */
}

.stop-time.completed {
  color: var(--routal-success-medium);
}

.stop-time.canceled {
  color: var(--routal-error-medium);
}

.stop-time.incomplete {
  color: var(--routal-warning-medium);
}

.stop-details {
  display: flex;
  flex-direction: column; /* Stack details vertically for more space */
  align-items: flex-start;
  gap: 4px;
  margin-top: 4px; /* separation from header */
}

.stop-tag {
  background-color: var(--routal-neutral-05);
  color: var(--routal-secondary-00);
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-block;
  line-height: 1.2;
  align-self: flex-start;
}

.stop-subtitle-text {
  font-size: 13px;
  color: var(--routal-secondary-00);
  /* Removed white-space: nowrap to allow wrapping */
  line-height: 1.4;
}

#map-container {
  flex: 1;
  position: relative;
}

#map {
  width: 100%;
  height: 100%;
}

/* Drag Handle (hidden on desktop, visible on mobile) */
.drag-handle {
  display: none;
}

@media (max-width: 768px) {
  #app {
    flex-direction: column;
  }

  #map-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: 1;
  }

  #sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 30vh;
    min-height: 150px;
    max-height: 90vh;
    z-index: 1000;
    transition: height 0.3s ease-out;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    border-radius: 16px 16px 0 0;
    overflow: hidden;
  }

  #sidebar.collapsed {
    height: var(--mobile-sidebar-collapsed);
    padding-bottom: 60px;
  }

  #sidebar.half-expanded {
    height: var(--mobile-sidebar-half);
    padding-bottom: 60px;
  }

  #sidebar.expanded {
    height: var(--mobile-sidebar-expanded);
    padding-bottom: 60px;
  }

  .drag-handle {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 12px 0 8px 0;
    background: var(--routal-neutral-00);
    cursor: grab;
    touch-action: none;
  }

  .drag-handle:active {
    cursor: grabbing;
  }

  .drag-indicator {
    width: 40px;
    height: 4px;
    background-color: var(--routal-neutral-20);
    border-radius: 2px;
  }

  .sidebar-header {
    flex-shrink: 0;
  }

  .stops-container {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .routal-promo {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 999;
    border-top: none;
    border-radius: 0;
  }
}

.stop-label {
  display: inline-block;
  background: var(--routal-neutral-02); /* Grey 6 override for MuiChip */
  color: var(--text-main);
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 16px;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

/* Custom Map Markers removed */

/* Button overrides if added later */
button {
  font-family: var(--font-sans);
  font-size: 12px; /* MuiButton root override */
}

input {
  border: 1px solid var(--routal-neutral-10);
  border-radius: 5px;
  padding: 8px;
  outline: none;
  font-family: var(--font-sans);
  color: var(--text-main);
}
input:hover {
  border: 1px solid var(--routal-neutral-20);
  background-color: var(--routal-neutral-05);
}
input:focus {
  border: 1px solid var(--routal-primary-00);
}
