html,
body,
button,
#viewDiv {
  margin: 0;
  padding: 0;
  width: 100%;
  overflow: hidden;
  font-family: Helvetica, Arial, sans-serif;
}

html,
body {
  height: 100dvh;
  display: flex;
  flex-direction: column;
}

#app {
  display: flex;
  width: 100%;
  flex: 1;
  min-height: 0;
}

#sidebar {
  width: 380px;
  background: #fff;
  border-right: 1px solid #d9d9d9;
  padding: 0;
  box-sizing: border-box;
  overflow-y: auto;
  z-index: 10;
  display: flex;
  flex-direction: column;
}

.btn-open-sidebar {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 10px;
  color: #666;
  font-size: 24px;
  margin: 0;
}

.web-only {
  display: block;
}
.mobile-only {
  display: none;
}

#sectionVue {
  margin-top: auto;
}

#sidebar .section {
  padding: 15px;
}

#sidebar .section p {
  padding: 0;
  margin: 0;
}

/* Back button on the top of the sidebar */
header {
  background-color: #f7f7f7;
  border-bottom: 1px solid #ddd;
  padding: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0;
  height: auto;
}

.btn-back {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  color: #666;
  text-decoration: none;
  font-size: 14px;
  margin: 0;
  flex-shrink: 0;
}

header .app-title {
  display: block;
  padding: 8px 16px;
  text-align: center;
  flex: 1;
}

#viewDiv {
  flex: 1;
}

h1 {
  margin-top: 0;
  margin-bottom: 0;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
h1 img {
  height: 40px;
  width: auto;
}

.btn-back:hover .text {
  text-decoration: underline;
}
.btn-back .back-icon {
  font-size: 16px;
  vertical-align: middle;
}

.section.cel-subtitle {
  font-size: 14px;
  color: #666;
  padding-bottom: 30px;
}

.section-title {
  font-weight: bold;
  margin-bottom: 10px;
  font-size: 16px;
}
.section-text {
  font-size: 14px;
  margin-bottom: 10px;
}

.btn {
  background-color: #eee;
  border: 0;
  color: #000;
  padding: 10px 20px;
  cursor: pointer;
  font-size: 14px;
  letter-spacing: 0.01em;
  text-align: left;
  border-radius: 999px;
}
.btn.active {
  outline: none;
  background: #f6d425;
  color: #000;
  font-weight: bold;
}
.btn .material-icons {
  margin-right: 5px;
}

.btn-group {
  border-radius: 999px;
  background-color: #eee;
  display: flex;
}
.btn-group .btn {
  display: inline-grid;
  align-items: center;
  text-align: center;
}

.input-with-icon {
  display: flex;
  align-items: center;
  background-color: #eee;
  border-radius: 999px;
  padding: 0 12px;
  width: 100%;
  box-sizing: border-box;
}
.input-with-icon .material-icons {
  font-size: 18px;
  color: #888;
  flex-shrink: 0;
  margin-right: 6px;
}

#searchInput {
  background-color: transparent;
  border: 0;
  width: 100%;
  padding: 18px 0;
  font-size: 14px;
  outline: none;
}

.icon-paragraph {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin: 6px 0;
}
.icon-paragraph .material-icons {
  font-size: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}

.download-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background-color: #eee;
  border-radius: 999px;
  padding: 10px 16px;
  text-decoration: none;
  color: #333;
  font-size: 14px;
}
.download-link:hover {
  background-color: #e0e0e0;
}

.search-container {
  position: relative;
}

#searchResults {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 220px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #d9d9d9;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  z-index: 200;
  overflow-x: hidden;
}

#searchResults:empty {
  display: none;
}

#searchResults .search-item {
  padding: 10px 14px;
  cursor: pointer;
  font-size: 14px;
  border-bottom: 1px solid #f0f0f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background-color 0.12s ease;
}

#searchResults .search-item:last-child {
  border-bottom: none;
}

#searchResults .search-item:hover {
  background: #f9f5d0;
}

.selected-address-card {
  position: fixed;
  bottom: calc(25px + env(safe-area-inset-bottom));
  left: calc(380px + 2px);
  background-color: white;
  border: 1px solid #d9d9d9;
  border: 4px solid #07d800;
  border-radius: 10px;
  padding: 8px 14px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  z-index: 50;
  font-size: 14px;
  color: #333;
  white-space: nowrap;
  line-height: 20px;
}

.selected-address-card.hidden {
  display: none;
}

.selected-address-card.ineligible {
  border-color: #8c8c8c;
}

#selectedAddressDot {
  background-color: #07d800;
}

.selected-address-card.ineligible #selectedAddressDot {
  background-color: #8c8c8c;
}

.selected-address-card:not(.hidden) {
  animation: cardSlideIn 0.25s ease-out;
}

.selected-address-details {
  margin-left: 20px;
}

@keyframes cardSlideIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.selected-address-header {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 2px;
}

.selected-address-header .material-icons-outlined {
  font-size: 16px;
  color: #07d800;
  flex-shrink: 0;
}

.link-btn {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
  color: #0066cc;
  cursor: pointer;
  text-decoration: underline;
}

.link-btn:hover {
  color: #004499;
}

.address-list {
  max-height: 340px;
  overflow-y: auto;
  border: 1px solid #eee;
  border-radius: 4px;
  margin: 8px 0 0;
  counter-reset: address-counter;
}

.address-list-item {
  counter-increment: address-counter;
  padding: 4px;
  display: flex;
  gap: 10px;
  font-size: 14px;
  border-bottom: 1px solid #f0f0f0;
  color: #333;
}

.address-list-item::before {
  content: counter(address-counter);
  color: #999;
  font-size: 12px;
  min-width: 15px;
  text-align: right;
  flex-shrink: 0;
  padding-top: 1px;
}

.address-list-item:last-child {
  border-bottom: none;
}

#loader {
  position: absolute;
  inset: 57px 0 25px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-bottom: 100px;
  background: rgba(255, 255, 255, 0.85);
  z-index: 100;
  gap: 16px;
}
#loader p {
  margin: 0;
  font-size: 15px;
  color: #444;
}
.loader-spinner {
  width: 48px;
  height: 48px;
  border: 5px solid #e0e0e0;
  border-top-color: #f6d425;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Modal styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-overlay:not(.hidden) {
  display: flex;
}

.modal-content {
  background-color: white;
  border-radius: 8px;
  padding: 32px;
  margin: 16px;
  max-width: 500px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  animation: slideIn 0.3s ease-out;
  display: flex;
  flex-direction: column;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-content h2 {
  margin-top: 0;
  margin-bottom: 16px;
  font-size: 20px;
  color: #000;
}

.modal-content p {
  margin: 12px 0;
  font-size: 14px;
  line-height: 1.6;
  color: #000;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 16px;
}

.modal-btn {
  background-color: #f6d425;
  color: #000;
  border: none;
  padding: 10px 24px;
  font-size: 14px;
  font-weight: bold;
  border-radius: 999px;
  cursor: pointer;
  margin-top: 16px;
  margin-left: auto;
  width: auto;
  transition: background-color 0.2s ease;
}

.modal-actions .modal-btn {
  margin-top: 0;
  margin-left: 0;
}

.modal-btn:hover {
  background-color: #e6c41a;
}

/* Footer styles */
footer {
  width: 100%;
  background-color: #f7f7f7;
  border-top: 1px solid #ddd;
  padding: 5px 16px;
  padding-bottom: calc(5px + env(safe-area-inset-bottom));
  display: flex;
  justify-content: flex-end;
  gap: 20px;
  font-size: 12px;
  color: #666;
  flex-shrink: 0;
  box-sizing: border-box;
  overflow: hidden;
}

/* Help button styles */
.btn-help {
  position: fixed;
  top: 60px;
  right: 3px;
  width: 48px;
  height: 48px;
  background-color: #f6d425;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition:
    background-color 0.2s ease,
    transform 0.2s ease;
}

.btn-help:hover {
  background-color: #e6c41a;
  transform: scale(1.1);
}

.btn-help img {
  width: 24px;
  height: 24px;
}

.btn-help-inline {
  background: none;
  border: none;
  width: 24px;
  height: 24px;
}

.btn-help-inline img {
  margin-top: 5px;
  width: 20px;
  height: 20px;
}

.sig-links-section {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.sig-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  max-width: 220px;
  padding: 8px 14px;
  border-radius: 999px;
  background-color: #fff;
  color: #333;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition:
    background-color 0.15s,
    color 0.15s;
}

.sig-link-btn .material-icons {
  font-size: 16px;
}

.sig-link-btn:hover span.text {
  color: #111;
  text-decoration: underline;
}

/* Legend styles */
.legend {
  position: fixed;
  bottom: calc(25px + env(safe-area-inset-bottom));
  right: 1px;
  width: 120px;
  height: 85px;
  background-color: white;
  border: 1px solid #d9d9d9;
  border-radius: 4px;
  padding: 8px 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  z-index: 50;
  font-size: 13px;
  color: #333;
  white-space: nowrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.legend-item:last-child {
  margin-bottom: 0;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid white;
  flex-shrink: 0;
  display: inline-block;
}

@media (max-width: 768px) {
  #sectionVue {
    margin-top: auto;
    display: none;
  }

  .web-only {
    display: none;
  }

  .mobile-only {
    display: block;
  }

  #app {
    flex-direction: column;
  }

  header .app-title h1 {
    justify-content: start;
  }

  #sidebar {
    position: static;
    width: 100%;
    height: 40vh;
    border-right: none;
    border-top: 1px solid #d9d9d9;
    flex-shrink: 0;
    order: 1;
  }

  #viewDiv {
    flex: 1;
    min-height: 0;
    order: -1;
  }

  .btn-open-sidebar {
    display: flex;
    align-items: center;
    order: -1;
  }

  .btn-close-sidebar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    background: #f7f7f7;
    border: none;
    border-bottom: 1px solid #ddd;
    padding: 12px;
    cursor: pointer;
    color: #666;
    font-size: 20px;
  }

  header {
    padding-left: 0;
  }

  .btn-back {
    position: fixed;
    top: 10px;
    right: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    z-index: 100;
  }

  .btn-back span {
    display: none;
  }

  .btn-back::before {
    content: "✕";
    font-size: 24px;
    color: #000;
    font-weight: 800;
  }

  .legend {
    bottom: auto;
    top: 60px;
    right: auto;
    height: 60px;
    left: 5px;
    padding: 6px 8px;
    font-size: 11px;
    max-width: calc(100vw - 50px);
    white-space: normal;
    width: auto;
  }

  .legend-item {
    margin-bottom: 3px;
    white-space: nowrap;
  }

  .legend-item:last-child {
    margin-bottom: 0;
  }

  .legend-dot {
    width: 8px;
    height: 8px;
  }

  .selected-address-card {
    left: 10px;
    bottom: calc(40vh + 50px);
    max-width: calc(100vw - 10px);
    white-space: normal;
  }
}
