/*
 * China City Footprint UI patch.
 * Loaded after the compiled stylesheet so the original application and data
 * model remain untouched.
 */

/* Right-hand city detail panel */
[data-cf-detail-panel] h2[data-cf-city-name] {
  font-size: 22px !important;
  font-weight: 700 !important;
  line-height: 1.3 !important;
}

[data-cf-detail-panel] [data-cf-city-code] {
  font-size: 13px !important;
  line-height: 1.5 !important;
}

[data-cf-detail-panel] [data-cf-section] {
  position: relative;
}

[data-cf-detail-panel] [data-cf-section-title] {
  margin-bottom: 10px !important;
  font-size: 16px !important;
  font-weight: 600 !important;
  line-height: 1.4 !important;
}

[data-cf-detail-panel] [data-cf-status-button] {
  min-height: 36px !important;
  padding: 7px 8px !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  line-height: 1.3 !important;
}

[data-cf-detail-panel] [data-cf-current-status] {
  font-size: 14px !important;
  line-height: 1.5 !important;
}

[data-cf-detail-panel] [data-cf-section="rating"] {
  font-size: 14px !important;
  line-height: 1.5 !important;
}

[data-cf-detail-panel] [data-cf-rating-label] {
  font-size: 14px !important;
  line-height: 1.5 !important;
}

[data-cf-detail-panel] [data-cf-star] {
  min-width: 30px;
  min-height: 30px;
}

[data-cf-detail-panel] textarea,
[data-cf-detail-panel] input {
  box-sizing: border-box;
  padding-right: 12px !important;
  padding-left: 12px !important;
  font-size: 14px !important;
}

[data-cf-detail-panel] textarea::placeholder,
[data-cf-detail-panel] input::placeholder {
  font-size: 14px !important;
}

[data-cf-detail-panel] textarea {
  min-height: 110px !important;
  line-height: 1.6 !important;
}

[data-cf-detail-panel] input[type="date"] {
  height: 42px !important;
  min-height: 42px !important;
}

[data-cf-detail-content] {
  padding-top: 18px !important;
  padding-bottom: 12px !important;
}

/* Reference standards: the toggle sits beside the existing status title. */
#cf-reference-toggle {
  position: absolute;
  top: -2px;
  right: 0;
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border: 1px solid #d6cfc4;
  border-radius: 8px;
  background: #fffdf8;
  color: #6b6258;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  cursor: pointer;
  transition:
    border-color 150ms ease,
    background-color 150ms ease,
    color 150ms ease;
}

#cf-reference-toggle::after {
  content: "▾";
  font-size: 12px;
  line-height: 1;
}

#cf-reference-toggle[aria-expanded="true"]::after {
  content: "▴";
}

#cf-reference-toggle:hover {
  border-color: #b9aa98;
  background: #f8f2e8;
  color: #4f463d;
}

#cf-reference-toggle:focus-visible {
  outline: 3px solid rgba(196, 62, 50, 0.3);
  outline-offset: 2px;
}

#cf-reference-standards {
  box-sizing: border-box;
  max-height: min(270px, 42vh);
  margin-top: 12px;
  padding: 12px;
  overflow-y: auto;
  border: 1px solid #e3ddd3;
  border-radius: 8px;
  background: #f8f5ee;
  color: #514b44;
  font-size: 14px;
  line-height: 1.6;
  overscroll-behavior: contain;
}

#cf-reference-standards[hidden] {
  display: none !important;
}

.cf-reference-item + .cf-reference-item {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #e7e0d6;
}

.cf-reference-item strong {
  display: block;
  margin-bottom: 2px;
  color: #3f3933;
  font-weight: 700;
}

.cf-reference-item p {
  margin: 0;
}

.cf-reference-time {
  color: #655d54;
}

.cf-reference-note {
  margin: 14px 0 0;
  padding-top: 10px;
  border-top: 1px solid #d9d1c6;
  color: #5f554c;
  font-weight: 600;
}

/* Bottom actions retain the application's real click handlers. */
[data-cf-actions] {
  position: relative;
  z-index: 10000;
  box-sizing: border-box;
  min-height: 60px;
  margin-bottom: 20px;
  padding: 10px 16px 0 !important;
  align-items: stretch !important;
}

[data-cf-save] {
  height: 50px !important;
  min-height: 50px !important;
  border-radius: 10px !important;
  font-size: 16px !important;
  font-weight: 600 !important;
  line-height: 1.2 !important;
}

[data-cf-delete] {
  min-height: 42px !important;
  align-self: center;
  padding: 0 14px !important;
  border-width: 1px !important;
  background: #fffdf9 !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  box-shadow: none !important;
}

/* Left-hand statistics and management area */
[data-cf-stats-panel] {
  font-size: 13px;
}

[data-cf-stats-panel] .text-xs {
  font-size: 13px !important;
  line-height: 1.4 !important;
}

[data-cf-stats-panel] [data-cf-stats-title] {
  font-size: 14px !important;
  font-weight: 600 !important;
  line-height: 1.4 !important;
}

[data-cf-stats-panel] [data-cf-stat-card] {
  min-width: 0;
  padding: 12px 10px !important;
}

[data-cf-stats-panel] [data-cf-stat-card] > :first-child {
  font-size: 22px !important;
  line-height: 1.2 !important;
}

[data-cf-stats-panel] [data-cf-major-number] {
  font-size: 18px !important;
  line-height: 1.2 !important;
}

[data-cf-stats-panel] button {
  line-height: 1.35;
}

@media (max-width: 767px) {
  #cf-reference-toggle {
    right: 2px;
  }

  #cf-reference-standards {
    max-height: min(240px, 34vh);
  }

  [data-cf-actions] {
    margin-bottom: 20px;
  }
}
