/**
 * Nearest Office Selector Styles
 * Compact header dropdown for utility navigation
 */

/* Main container - should be positioned relative for absolute dropdown */
[data-component="nearest-office-selector"] {
  position: relative;
  display: inline-block;
}

/* Toggle link - styled as a white text link for dark backgrounds */
[data-component="nearest-office-selector"] .location-toggle-link {
  background: var(--asc-secondary-accent);
  border: none;
  border-radius: 12px;
  border-top-right-radius: 0;
  padding: 10px 15px;
  margin: 0;
  font-family: "Biko", sans-serif;
  font-size: inherit;
  color: #000;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: opacity 0.15s ease;
  text-transform: uppercase;
}

[data-component="nearest-office-selector"] .location-toggle-link:hover {
  opacity: 0.85;
  text-decoration: underline;
}

[data-component="nearest-office-selector"] .location-toggle-link:focus {
  outline: none;
}

[data-component="nearest-office-selector"] .location-toggle-link:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.5);
  outline-offset: 2px;
  border-radius: 2px;
}

@media (max-width: 600px) {
  [data-component="nearest-office-selector"] .js-location-toggle-text {
    display: none;
  }
}

@media (max-width: 767px) {
  [data-component="nearest-office-selector"] .js-location-toggle-label {
    display: none;
  }
}

[data-component="nearest-office-selector"]
  .location-toggle-link[aria-expanded="true"]
  .location-toggle-icon {
  transform: rotate(180deg);
}

[data-component="nearest-office-selector"] .location-toggle-icon {
  transition: transform 0.2s ease;
  width: 0.75rem;
  height: 0.75rem;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}

/* Compact office info panel */
[data-component="nearest-office-selector"] .compact-office-info {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: auto;
  right: 0;
  background: #ffffff;
  z-index: 1000;
  min-width: 320px;
  max-width: 400px;
  width: 360px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1),
    0 10px 10px -5px rgba(0, 0, 0, 0.04);
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 1.75rem;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

[data-component="nearest-office-selector"] .compact-office-info[hidden] {
  display: none !important;
}

[data-component="nearest-office-selector"] .compact-office-content {
  display: flex;
  flex-direction: column;
  gap: 0;
}

[data-component="nearest-office-selector"] .compact-office-name {
  font-weight: 600;
  font-size: 1.125rem;
  line-height: 1.3;
  margin: 0;
  color: var(--ast-global-color-0);
  letter-spacing: -0.01em;
}

[data-component="nearest-office-selector"] .compact-office-name-link,
[data-component="nearest-office-selector"] .js-compact-office-name-link {
  display: block !important;
  text-decoration: none !important;
  color: var(--ast-global-color-0) !important;
  transition: all 0.2s ease !important;
  margin-bottom: 1.75rem !important;
  outline: none !important;
  box-shadow: none !important;
  border: none !important;
}

[data-component="nearest-office-selector"] .compact-office-name-link:hover,
[data-component="nearest-office-selector"] .js-compact-office-name-link:hover {
  color: var(--ast-global-color-1) !important;
}

[data-component="nearest-office-selector"] .compact-office-name-link:active,
[data-component="nearest-office-selector"] .js-compact-office-name-link:active {
  transform: translateX(2px) !important;
  outline: none !important;
  box-shadow: none !important;
  border: none !important;
}

[data-component="nearest-office-selector"] .compact-office-name-link:focus,
[data-component="nearest-office-selector"] .js-compact-office-name-link:focus {
  outline: none !important;
  box-shadow: none !important;
  border: none !important;
}

[data-component="nearest-office-selector"]
  .compact-office-name-link:focus-visible,
[data-component="nearest-office-selector"]
  .js-compact-office-name-link:focus-visible {
  outline: 2px solid rgba(59, 130, 246, 0.5) !important;
  outline-offset: 2px !important;
  border-radius: 2px !important;
}

[data-component="nearest-office-selector"] .compact-office-details {
  margin-bottom: 0 !important;
  padding-bottom: 1rem !important;
  border-bottom: 1px solid #f3f4f6 !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 0.75rem !important;
}

[data-component="nearest-office-selector"] .compact-office-detail-item {
  display: flex !important;
  align-items: flex-start !important;
  gap: 0.75rem !important;
  margin: 0 !important;
  width: 100% !important;
}

[data-component="nearest-office-selector"] .compact-office-icon {
  width: 1rem !important;
  height: 1rem !important;
  min-width: 1rem !important;
  flex-shrink: 0 !important;
  margin-top: 0.25rem !important;
  display: block !important;
  color: #6b7280 !important;
}

[data-component="nearest-office-selector"] .compact-office-address {
  font-style: normal !important;
  font-size: 0.875rem !important;
  line-height: 1.6 !important;
  color: #374151 !important;
  margin: 0 !important;
  flex: 1 !important;
  font-family: inherit !important;
}

[data-component="nearest-office-selector"] .compact-office-address span {
  display: block !important;
}

[data-component="nearest-office-selector"]
  .compact-office-address
  span:first-child {
  font-weight: 400 !important;
  margin-bottom: 0 !important;
}

[data-component="nearest-office-selector"] .compact-office-address-link {
  color: #374151 !important;
  text-decoration: none !important;
  transition: color 0.15s ease !important;
  font-size: 0.875rem !important;
  line-height: 1.6 !important;
  flex: 1 !important;
  text-align: left !important;
  font-family: inherit !important;
}

[data-component="nearest-office-selector"] .compact-office-address-link:hover {
  color: var(--ast-global-color-0) !important;
  text-decoration: underline !important;
}

[data-component="nearest-office-selector"] .compact-office-phone {
  color: #374151 !important;
  text-decoration: none !important;
  transition: color 0.15s ease !important;
  font-size: 0.875rem !important;
  line-height: 1.6 !important;
  font-family: inherit !important;
  letter-spacing: normal !important;
  text-align: left !important;
  flex: 1 !important;
}

[data-component="nearest-office-selector"] .compact-office-phone:hover {
  color: var(--ast-global-color-0) !important;
  text-decoration: underline !important;
}

[data-component="nearest-office-selector"] .compact-office-appt-btn {
  margin-top: 0.5rem !important;
  padding: 0.5rem 1rem !important;
  font-size: 0.8125rem !important;
  font-weight: 500 !important;
  border-radius: 0.375rem !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  gap: 0.5rem !important;
  background: var(--asc-secondary-accent) !important;
  color: #000 !important;
  text-decoration: none !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  width: 100% !important;
  border: none !important;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05) !important;
}

[data-component="nearest-office-selector"] .compact-office-appt-btn:hover {
  background: var(--asc-secondary-hover) !important;
  box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.1) !important;
  transform: translateY(-1px) !important;
}

[data-component="nearest-office-selector"] .compact-office-appt-btn:active {
  transform: translateY(0) !important;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05) !important;
}

[data-component="nearest-office-selector"] .location-change-link {
  background: none;
  border: none;
  padding: 0;
  margin: 1rem 0 0 0;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--ast-global-color-1);
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  width: 100%;
  line-height: 1.5;
  white-space: nowrap;
  box-shadow: none;
  outline: none;
}

[data-component="nearest-office-selector"] .location-change-link:hover {
  color: var(--ast-global-color-0);
}

[data-component="nearest-office-selector"] .location-change-link:active {
  opacity: 0.8;
}

[data-component="nearest-office-selector"] .location-change-link .icon {
  width: 0.875rem;
  height: 0.875rem;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

[data-component="nearest-office-selector"] .location-change-link:hover .icon {
  transform: translateX(2px);
}

/* Full search panel - hidden by default, positioned absolutely */
[data-component="nearest-office-selector"] .find-a-location {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: auto;
  right: 0;
  background: #ffffff;
  z-index: 1000;
  min-width: 420px;
  max-width: 520px;
  width: 480px;
  max-height: 85vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1),
    0 10px 10px -5px rgba(0, 0, 0, 0.04);
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

@media (max-width: 600px) {
  [data-component="nearest-office-selector"] .find-a-location {
    min-width: 100%;
    width: 100%;
  }
}

[data-component="nearest-office-selector"] .find-a-location[hidden] {
  display: none !important;
}

/* Search header section */
[data-component="nearest-office-selector"] .location-panel-header {
  padding: 1.75rem;
  border-bottom: 1px solid #e5e7eb;
  background: linear-gradient(to bottom, #f9fafb, #ffffff);
  flex-shrink: 0;
}

[data-component="nearest-office-selector"] .location-panel-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

[data-component="nearest-office-selector"] .location-panel-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: #111827;
  letter-spacing: -0.01em;
}

/* Close button */
[data-component="nearest-office-selector"] .location-close-button {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.375rem;
  transition: all 0.15s ease;
  color: #6b7280;
  margin: -0.25rem -0.25rem 0 0;
}

[data-component="nearest-office-selector"] .location-close-button:hover {
  background-color: #f3f4f6;
  color: #111827;
}

[data-component="nearest-office-selector"] .location-close-button:active {
  background-color: #e5e7eb;
  transform: scale(0.95);
}

[data-component="nearest-office-selector"] .location-close-button svg {
  width: 1.125rem;
  height: 1.125rem;
}

/* Search form styling - improved */
[data-component="nearest-office-selector"] .location-search {
  display: flex !important;
  align-items: stretch !important;
  gap: 0 !important;
  background: #ffffff !important;
  border: 1px solid #d1d5db !important;
  border-radius: 0.5rem !important;
  overflow: hidden !important;
  transition: all 0.2s ease !important;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05) !important;
  margin: 0 !important;
  width: 100% !important;
}

[data-component="nearest-office-selector"] .location-search:focus-within {
  border-color: var(--ast-global-color-1) !important;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.05) !important;
}

[data-component="nearest-office-selector"] .location-search-input,
[data-component="nearest-office-selector"] .location-search input {
  flex: 1 !important;
  padding: 0.75rem 1rem !important;
  border: none !important;
  background: transparent !important;
  font-size: 0.875rem !important;
  color: #111827 !important;
  outline: none !important;
  font-weight: 400 !important;
  box-shadow: none !important;
}

[data-component="nearest-office-selector"] .location-search-input::placeholder,
[data-component="nearest-office-selector"] .location-search input::placeholder {
  color: #9ca3af !important;
}

[data-component="nearest-office-selector"] .location-search-button,
[data-component="nearest-office-selector"] .location-search button {
  padding: 0.75rem 1.25rem !important;
  background: var(--ast-global-color-1) !important;
  border: none !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  color: #ffffff !important;
  transition: all 0.2s ease !important;
  flex-shrink: 0 !important;
  box-shadow: none !important;
  outline: none !important;
}

[data-component="nearest-office-selector"] .location-search-button:hover,
[data-component="nearest-office-selector"] .location-search button:hover {
  background: var(--ast-global-color-0) !important;
}

[data-component="nearest-office-selector"] .location-search-button:active,
[data-component="nearest-office-selector"] .location-search button:active {
  background: var(--ast-global-color-1) !important;
  transform: scale(0.98) !important;
}

[data-component="nearest-office-selector"] .location-search-button svg,
[data-component="nearest-office-selector"] .location-search button svg {
  width: 1rem !important;
  height: 1rem !important;
}

/* Use current location button */
[data-component="nearest-office-selector"] .location-current-btn {
  background: none;
  border: 1px solid #e5e7eb;
  border-radius: 0.625rem;
  padding: 0.75rem 1rem;
  margin: 1.25rem 0 0 0;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--ast-global-color-1);
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

[data-component="nearest-office-selector"] .location-current-btn:hover {
  background: #eff6ff;
  border-color: var(--ast-global-color-1);
  color: var(--ast-global-color-0);
}

[data-component="nearest-office-selector"] .location-current-btn:active {
  background: #dbeafe;
  transform: scale(0.98);
}

[data-component="nearest-office-selector"] .location-current-btn svg {
  width: 1rem;
  height: 1rem;
}

/* Location list container */
[data-component="nearest-office-selector"] .locations-list {
  flex: 1;
  overflow-y: auto;
  padding: 0;
  max-height: calc(85vh - 240px);
  min-height: 200px;
}

[data-component="nearest-office-selector"] .locations-list::-webkit-scrollbar {
  width: 10px;
}

[data-component="nearest-office-selector"]
  .locations-list::-webkit-scrollbar-track {
  background: #ffffff;
  border-left: 1px solid #f3f4f6;
}

[data-component="nearest-office-selector"]
  .locations-list::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 5px;
  border: 2px solid #ffffff;
}

[data-component="nearest-office-selector"]
  .locations-list::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

/* Location card styling - significantly improved */
[data-component="nearest-office-selector"] .nav-location {
  padding: 1.5rem 1.75rem;
  border-bottom: 1px solid #f3f4f6;
  transition: all 0.2s ease;
  background: #ffffff;
  cursor: pointer;
  position: relative;
}

[data-component="nearest-office-selector"] .nav-location:last-child {
  border-bottom: none;
}

[data-component="nearest-office-selector"] .nav-location:hover {
  background-color: #f9fafb;
}

[data-component="nearest-office-selector"] .nav-location.current-location {
  background-color: #eff6ff;
  border-left: 4px solid var(--ast-global-color-1);
  padding-left: calc(1.75rem - 4px);
}

[data-component="nearest-office-selector"]
  .nav-location.current-location::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(
    to bottom,
    var(--ast-global-color-1),
    var(--ast-global-color-0)
  );
}

/* Nearest indicator */
[data-component="nearest-office-selector"] .nav-location .nearest,
[data-component="nearest-office-selector"] .nearest {
  display: inline-block !important;
  margin: 0 0 0.875rem 0 !important;
  padding: 0.375rem 0.75rem !important;
  background: #dcfce7 !important;
  border: 1px solid #bbf7d0 !important;
  border-radius: 0.375rem !important;
  width: fit-content !important;
  box-shadow: none !important;
  font-size: 0.6875rem !important;
  font-weight: 600 !important;
  color: #166534 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.05em !important;
  line-height: 1.2 !important;
}

/* Location card title row */
[data-component="nearest-office-selector"] .nav-location > div:first-of-type {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1rem;
  gap: 1.25rem;
}

[data-component="nearest-office-selector"] .nav-location .title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--ast-global-color-0);
  text-decoration: none;
  line-height: 1.4;
  flex: 1;
  letter-spacing: -0.01em;
  transition: color 0.2s ease;
}

[data-component="nearest-office-selector"] .nav-location .title:hover {
  color: var(--ast-global-color-1);
}

[data-component="nearest-office-selector"] .nav-location > div:first-of-type p {
  font-size: 0.75rem;
  font-weight: 600;
  color: #6b7280;
  margin: 0;
  white-space: nowrap;
}

/* Location address */
[data-component="nearest-office-selector"] .nav-location address {
  font-style: normal;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: #4b5563;
  margin-bottom: 0.875rem;
}

[data-component="nearest-office-selector"] .nav-location address .street {
  display: block;
  margin-bottom: 0.25rem;
  color: #374151;
}

/* Location phone */
[data-component="nearest-office-selector"] .nav-location .phone {
  font-size: 0.875rem;
  color: #6b7280;
  margin-bottom: 1.125rem;
}

[data-component="nearest-office-selector"] .nav-location .phone a {
  color: #374151;
  text-decoration: none;
  transition: color 0.2s ease;
}

[data-component="nearest-office-selector"] .nav-location .phone a:hover {
  color: var(--ast-global-color-1);
}

/* Location actions */
[data-component="nearest-office-selector"] .nav-location > div:last-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

[data-component="nearest-office-selector"] .nav-location .select-location {
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ast-global-color-1);
  text-decoration: underline;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}

[data-component="nearest-office-selector"]
  .nav-location
  .select-location:hover {
  color: var(--ast-global-color-0);
  text-decoration: none;
}

[data-component="nearest-office-selector"] .nav-location .btn-appointment {
  padding: 0.5rem 0.875rem;
  font-size: 0.8125rem;
  border-radius: 0.375rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  transition: all 0.2s ease;
  font-weight: 500;
  background: var(--asc-secondary-accent);
  color: #000;
  border: none;
  white-space: nowrap;
}

[data-component="nearest-office-selector"]
  .nav-location
  .btn-appointment:hover {
  background: var(--asc-secondary-hover);
  transform: translateY(-1px);
}

[data-component="nearest-office-selector"]
  .nav-location
  .btn-appointment:active {
  transform: translateY(0);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  [data-component="nearest-office-selector"] .compact-office-info,
  [data-component="nearest-office-selector"] .find-a-location {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    max-height: 100vh;
    min-width: auto;
    max-width: none;
    z-index: 9999;
    border-radius: 0;
    margin-top: 0;
  }
}

/* Loading state */
[data-component="nearest-office-selector"] .locations-list.loading {
  opacity: 0.5;
  pointer-events: none;
  position: relative;
  min-height: 200px;
}

[data-component="nearest-office-selector"] .locations-list.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  border: 3px solid #f3f4f6;
  border-top-color: var(--ast-global-color-1);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

/* Empty state */
[data-component="nearest-office-selector"] .locations-list-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
  text-align: center;
  color: #6b7280;
  min-height: 200px;
}

[data-component="nearest-office-selector"] .locations-list-empty .icon {
  width: 3rem;
  height: 3rem;
  color: #d1d5db;
  margin-bottom: 1rem;
}

[data-component="nearest-office-selector"] .locations-list-empty h4 {
  margin: 0 0 0.5rem 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: #374151;
}

[data-component="nearest-office-selector"] .locations-list-empty p {
  margin: 0;
  font-size: 0.875rem;
  color: #6b7280;
  max-width: 320px;
}

@media (min-width: 1024px) {
  .js-location-toggle-mobile-icon {
    display: none;
  }
}
