* { box-sizing: border-box; }
html, body { background: transparent; margin: 0; padding: 0; }

body {
  font-family: Roboto, Helvetica, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

#form-container {
  width: 100%;
  max-width: 760px;
  padding: 20px;
  background: #fff;
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,0.06);
  box-shadow: 0 10px 25px rgba(0,0,0,0.10);
  background-clip: padding-box;
  position: relative;
  overflow: visible;
  margin: 0 auto;
}

@media (min-width: 600px) {
  #form-container {
    padding: 30px;
  }
}

/* Typography */
h1 {
  font-size: 22px;
  font-weight: 600;
  line-height: 1.25;
  margin: 0 0 8px;
}

h2 {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
  margin: 0 0 12px;
}

.subhead {
  font-size: 14px;
  line-height: 1.5;
  color: #1a1a1a;
  margin: 0 0 24px;
}

.helper-text {
  font-size: 12px;
  line-height: 1.4;
  color: #6b6b6b;
  margin-top: 4px;
}

.subtle {
  font-size: 12px;
  line-height: 1.4;
  color: #6b6b6b;
}

/* Grid Layout */
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 8px;
}

@media (max-width: 720px) {
  .grid { grid-template-columns: 1fr; }
}

.field {
  display: flex;
  flex-direction: column;
  position: relative;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 6px;
}

/* Filters Section */
.filters {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 16px;
  align-items: end;
}

@media (max-width: 599px) {
  .filters { grid-template-columns: 1fr; }
}

.filters .field {
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Court field spans full width on its own row */
.filters .court-field {
  grid-column: 1 / -1;
}

/* Optional filters label spans full width */
.filters .optional-filters-label {
  grid-column: 1 / -1;
  margin-bottom: -8px;
  margin-top: 8px;
}

.filters .optional-filters-label .helper-text {
  display: block;
  font-size: 13px;
  font-style: italic;
  color: #4a4a4a;
}

/* Toggle Switch Styling */
.toggle-field {
  display: flex;
  flex-direction: column;
}

.toggle-field > label {
  font-size: 13px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 6px;
}

.toggle-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 44px;
}

.toggle-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-label {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 28px;
  background-color: #dc3545;
  border-radius: 28px;
  cursor: pointer;
  transition: background-color 0.3s;
  margin: 0;
}

.toggle-slider {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  background-color: white;
  border-radius: 50%;
  transition: transform 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toggle-slider::after {
  content: "✕";
  color: #dc3545;
  font-size: 14px;
  font-weight: bold;
}

.toggle-input:checked + .toggle-label {
  background-color: #5a8f3a;
}

.toggle-input:checked + .toggle-label .toggle-slider {
  transform: translateX(24px);
}

.toggle-input:checked + .toggle-label .toggle-slider::after {
  content: "✓";
  color: #5a8f3a;
}

.toggle-status {
  font-size: 14px;
  font-weight: 500;
  color: #6b6b6b;
  min-width: 60px;
}

.toggle-input:checked ~ .toggle-status::before {
  content: "Include";
}

.toggle-input:not(:checked) ~ .toggle-status::before {
  content: "Exclude";
}

.toggle-status {
  font-size: 0;
}

.toggle-status::before {
  font-size: 14px;
}

/* Reset Link */
.reset-link {
  grid-column: 1 / -1;
  text-align: left;
  font-size: 12px;
  color: #008ab0;
  text-decoration: underline;
  cursor: pointer;
  align-self: start;
  margin-top: 4px;
  padding: 0;
  background: none;
  border: none;
  font-weight: 400;
}

.reset-link:hover {
  color: #006a85;
  text-decoration: none;
}

/* Select Styling */
select {
  height: 44px;
  padding: 0 36px 0 14px;
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  background: #fff;
  font-family: Roboto, Helvetica, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L2 4h8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
}

select:focus {
  outline: none;
  border-color: #008ab0;
  box-shadow: 0 0 0 3px rgba(0,138,176,0.15);
}

select:disabled {
  background-color: #f6f6f6;
  color: #9a9a9a;
  cursor: not-allowed;
}

/* Custom Select Dropdown */
.custom-select {
  position: relative;
  width: 100%;
}

.custom-select-input {
  width: 100%;
  height: 44px;
  padding: 0 36px 0 14px;
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  background: #fff;
  font-family: Roboto, Helvetica, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  cursor: pointer;
  color: #1a1a1a;
}

.custom-select-input::placeholder {
  color: #999;
}

.custom-select-input:focus {
  outline: none;
  border-color: #008ab0;
  box-shadow: 0 0 0 3px rgba(0,138,176,0.15);
}

.custom-select-input:disabled {
  background-color: #f6f6f6;
  color: #9a9a9a;
  cursor: not-allowed;
}

/* Locked state for court selection */
.custom-select-input.locked {
  background-color: #f0f8ff;
  border-color: #b3d9e8;
  color: #1a5a7a;
  cursor: not-allowed;
  font-weight: 500;
}

.custom-select.locked .custom-select-arrow {
  opacity: 0.4;
}

.custom-select-arrow {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  transition: transform 0.2s;
}

.custom-select.open .custom-select-arrow {
  transform: translateY(-50%) rotate(180deg);
}

.custom-select-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 300px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  list-style: none;
  margin: 0;
  padding: 0;
  z-index: 1000;
  display: none;
}

.custom-select.open .custom-select-dropdown {
  display: block;
}

.custom-select-dropdown li {
  padding: 10px 14px;
  font-size: 14px;
  color: #1a1a1a;
  cursor: pointer;
  transition: background-color 0.15s;
}

.custom-select-dropdown li:hover {
  background-color: #f0f8ff;
}

.custom-select-dropdown li.selected {
  background-color: #e8f4f8;
  font-weight: 500;
}

.custom-select-dropdown li.no-results {
  color: #999;
  cursor: default;
  font-style: italic;
}

.custom-select-dropdown li.no-results:hover {
  background-color: transparent;
}

/* Scrollbar styling for dropdown */
.custom-select-dropdown::-webkit-scrollbar {
  width: 8px;
}

.custom-select-dropdown::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 0 6px 6px 0;
}

.custom-select-dropdown::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}

.custom-select-dropdown::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* Buttons */
button {
  height: 44px;
  padding: 0 20px;
  border: none;
  border-radius: 6px;
  font-family: Roboto, Helvetica, sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

button:active {
  transform: translateY(1px);
}


/* Summary Section */
.summary {
  padding: 16px;
  border-radius: 8px;
  background: #f7fbfe;
  border: 1px solid #d8e5ee;
  margin-bottom: 24px;
}

.summary div {
  font-size: 14px;
  color: #1a1a1a;
}

.summary strong {
  font-weight: 600;
}

/* Table */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
}

th {
  background: #f7fbfe;
  border-bottom: 2px solid #d8e5ee;
  padding: 12px 12px;
  text-align: left;
  font-size: 13px;
  font-weight: 700;
  color: #1a1a1a;
}

td {
  border-bottom: 1px solid #e6e6e6;
  padding: 12px 12px;
  font-size: 14px;
  color: #1a1a1a;
}

th:nth-child(2), td:nth-child(2),
th:nth-child(3), td:nth-child(3) {
  text-align: right;
}

tr.clickable {
  cursor: pointer;
  transition: background 0.15s;
}

tr.clickable:hover {
  background: #eef5ff;
}

tr.primary-row {
  font-weight: 500;
}

tr.subcategory-row {
  background: #fafafa;
  font-size: 13px;
  color: #444;
}

tr.subcategory-row:hover {
  background: #f0f0f0;
}

.expand-arrow {
  display: inline-block;
  width: 16px;
  font-size: 11px;
  color: #666;
  margin-right: 4px;
}

.subcategory-indent {
  display: inline-block;
  width: 32px;
}

/* Hint */
.hint {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 6px;
  background: #e8f4f8;
  border: 1px solid #b3d9e8;
  font-size: 13px;
  color: #1a5a7a;
  line-height: 1.5;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.hint-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: #0078a0;
  margin-top: 1px;
}

/* Footer */
footer {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid #e6e6e6;
  color: #6b6b6b;
  font-size: 12px;
  line-height: 1.4;
}

footer .disclaimer {
  margin-top: 8px;
  font-size: 11px;
  color: #888;
  font-style: italic;
}

/* Section spacing */
section {
  margin-bottom: 24px;
}

section:last-of-type {
  margin-bottom: 0;
}

/* Error Container */
.error-container {
  background-color: #fee;
  border: 1px solid #fcc;
  border-left: 4px solid #c33;
  border-radius: 4px;
  padding: 16px;
  margin-bottom: 20px;
  animation: slideDown 0.3s ease-out;
}

.error-content {
  color: #c33;
  font-size: 14px;
  line-height: 1.5;
}

.error-content strong {
  display: block;
  margin-bottom: 4px;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Loading Container */
.loading-container {
  background-color: #f0f8ff;
  border: 1px solid #b3d9ff;
  border-left: 4px solid #0066cc;
  border-radius: 4px;
  padding: 16px;
  margin-bottom: 20px;
  text-align: center;
}

.loading-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: #0066cc;
  font-size: 14px;
  font-weight: 500;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 3px solid #b3d9ff;
  border-top-color: #0066cc;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Learn More Link */
.learn-more-link {
  font-size: 12px;
  color: #008ab0;
  text-decoration: underline;
  cursor: pointer;
  margin-left: 8px;
  font-weight: 500;
}

.learn-more-link:hover {
  color: #006a85;
  text-decoration: none;
}

/* Modal Styles */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1;
}

.modal-content {
  position: relative;
  background: white;
  border-radius: 10px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  z-index: 2;
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid #e6e6e6;
}

.modal-header h2 {
  font-size: 20px;
  font-weight: 600;
  margin: 0;
  color: #1a1a1a;
}

.modal-close {
  background: none;
  border: none;
  font-size: 32px;
  line-height: 1;
  color: #666;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background-color 0.2s, color 0.2s;
}

.modal-close:hover {
  background-color: #f0f0f0;
  color: #333;
}

.modal-body {
  padding: 24px;
}

.modal-field {
  margin-bottom: 20px;
}

.modal-field:last-child {
  margin-bottom: 0;
}

.modal-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 6px;
}

.modal-value {
  font-size: 14px;
  line-height: 1.6;
  color: #1a1a1a;
  margin: 0;
  padding: 12px;
  background-color: #f7fbfe;
  border: 1px solid #d8e5ee;
  border-radius: 6px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid #e6e6e6;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.modal-btn-close {
  background-color: #008ab0;
  color: white;
  border: none;
  padding: 10px 24px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s;
}

.modal-btn-close:hover {
  background-color: #006a85;
}

.modal-btn-close:active {
  transform: translateY(1px);
}

/* Print Styles */
@media print {
  html, body {
    background: white;
  }

  #form-container {
    max-width: 100%;
    width: 100%;
    padding: 0.5in;
    margin: 0;
    box-shadow: none;
    border: none;
    border-radius: 0;
  }

  h1 {
    font-size: 20px;
    margin-bottom: 16px;
  }

  h2 {
    font-size: 16px;
    page-break-after: avoid;
  }

  .filters,
  .hint,
  button {
    display: none !important;
  }

  section {
    page-break-inside: avoid;
  }

  table {
    page-break-inside: avoid;
  }

  .summary {
    background: #f5f5f5 !important;
    border: 1px solid #666 !important;
    page-break-inside: avoid;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  footer {
    margin-top: 24px;
    font-size: 10px;
    page-break-inside: avoid;
  }
}
