/**
 * FiberGo Address & Infrastructure Checker - Frontend Styles
 */

#tr-address-form {
  max-width: 700px;
}

#tr-address-form .field-wrap {
  margin-bottom: 16px;
}

#tr-address-form label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
}

#tr-address-form select,
#tr-address-form input {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid #d7d7d7;
  border-radius: 8px;
  box-sizing: border-box;
}

/* Searchable select: native select remains data source, visually replaced with combobox */
#tr-address-form .tr-select {
  position: relative;
  width: 100%;
}

#tr-address-form .tr-native-select {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

#tr-address-form .tr-select-input-wrap {
  position: relative;
}

#tr-address-form .tr-select-input-wrap::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 14px;
  width: 14px;
  height: 14px;
  border: 1.8px solid #64748b;
  border-radius: 50%;
  transform: translateY(-60%);
  pointer-events: none;
  box-sizing: border-box;
}

#tr-address-form .tr-select-input-wrap::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 26px;
  width: 6px;
  height: 1.8px;
  background: #64748b;
  transform: translateY(5px) rotate(45deg);
  transform-origin: left center;
  pointer-events: none;
}

#tr-address-form .tr-select-input {
  padding-left: 42px;
  background: #fff;
}

#tr-address-form .tr-select-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .14);
}

#tr-address-form .tr-select-input:disabled {
  background: #f5f5f5;
  color: #888;
  cursor: not-allowed;
}

.tr-select-options {
  position: fixed;
  z-index: 2147483647;
  max-height: 224px;
  margin: 0;
  padding: 4px;
  overflow-y: auto;
  list-style: none;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 22px rgba(15, 23, 42, .14);
}

.tr-select-options[hidden] {
  display: none;
}

.tr-select-option {
  padding: 11px 12px;
  border-radius: 5px;
  cursor: pointer;
  line-height: 1.35;
}

.tr-select-option:hover,
.tr-select-option.is-active {
  background: #eff6ff;
}

.tr-select-option[aria-selected="true"] {
  font-weight: 600;
}

.tr-select-empty {
  padding: 11px 12px;
  color: #64748b;
}

#tr-address-form .hidden {
  display: none;
}

#tr-address-form button {
  background: #111;
  color: #fff;
  border: 0;
  padding: 12px 18px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}

#tr-address-form button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#tr-result {
  margin-top: 20px;
  padding: 20px;
  border: 1px solid #d7d7d7;
  border-radius: 8px;
  background: #f9f9f9;
}

#tr-result h3,
#tr-result-popup h3 {
  margin-top: 0;
}

#tr-result .services-grid,
#tr-result-popup .services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

#tr-result .service-card,
#tr-result-popup .service-card {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  background: #fff;
}

#tr-result .service-card.available,
#tr-result-popup .service-card.available {
  border-color: #16a34a;
  background: #f0fdf4;
}

#tr-result .service-card.unavailable,
#tr-result-popup .service-card.unavailable {
  border-color: #e5e7eb;
  background: #f9fafb;
  opacity: 0.7;
}

#tr-result .service-name,
#tr-result-popup .service-name {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 8px;
}

#tr-result .service-name.fiber,
#tr-result-popup .service-name.fiber { color: #16a34a; }
#tr-result .service-name.metro,
#tr-result-popup .service-name.metro { color: #2563eb; }
#tr-result .service-name.wifi,
#tr-result-popup .service-name.wifi   { color: #d97706; }

#tr-result .service-status,
#tr-result-popup .service-status {
  font-size: 13px;
  font-weight: 600;
}

#tr-result .service-status.yes,
#tr-result-popup .service-status.yes { color: #16a34a; }
#tr-result .service-status.no,
#tr-result-popup .service-status.no   { color: #dc2626; }

#tr-result .service-speed,
#tr-result-popup .service-speed {
  font-size: 12px;
  color: #666;
  margin-top: 4px;
}

#tr-result-popup.tr-popup {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.58);
  box-sizing: border-box;
}

#tr-result-popup.tr-popup.hidden {
  display: none;
}

#tr-result-popup .tr-popup-panel {
  position: relative;
  width: min(620px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  padding: 32px 26px 26px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  text-align: center;
}

#tr-result-popup .tr-popup-close {
  position: absolute;
  top: 8px;
  right: 12px;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #555;
  font-size: 30px;
  line-height: 38px;
  cursor: pointer;
}

#tr-result-popup .tr-popup-message {
  margin: 0 0 18px;
  color: #444;
  line-height: 1.7;
}

#tr-result-popup .tr-popup-action {
  display: inline-block;
  margin-top: 20px;
  padding: 13px 24px;
  border-radius: 8px;
  background: #111;
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}

#tr-result-popup .tr-popup-action:hover {
  color: #fff;
  opacity: 0.88;
}

#tr-loading {
  margin-top: 16px;
  color: #666;
}
