/* ===========================================
   PONY POWER EXPLORER - Quiet UI Styles
   =========================================== */

/* Sharp corners throughout */
.btn,
.card,
.form-control,
.form-select,
.input-group-text,
.badge,
.alert,
.modal-content,
.dropdown-menu,
.nav-tabs .nav-link {
  border-radius: 3px;
}

/* Remove Bootstrap's rounded utilities if used */
.rounded,
.rounded-pill {
  border-radius: 3px !important;
}

/* -------------------------------------------
   Buttons - Stable hover states
   ------------------------------------------- */
.btn {
  transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn:active {
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.btn-primary:hover {
  filter: brightness(0.9);
}

.btn-outline-primary:hover,
.btn-outline-secondary:hover {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* -------------------------------------------
   Form Inputs - Crisp and clear
   ------------------------------------------- */
.form-control,
.form-select {
  border: 1px solid #ced4da;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  box-sizing: border-box;
}

.form-control:focus,
.form-select:focus {
  border-color: #86b7fe;
  box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.15);
  outline: none;
}

.form-control::placeholder {
  color: #8898a8;
  font-style: normal;
  opacity: 1;
}

/* Input groups */
.input-group .form-control,
.input-group .input-group-text {
  border-radius: 3px;
}

.input-group > :not(:first-child) {
  margin-left: -1px;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

.input-group > :not(:last-child) {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

/* -------------------------------------------
   Cards - Flat with subtle lift on hover
   ------------------------------------------- */
.card {
  border: 1px solid #e5e7eb;
  box-shadow: none;
  transition: box-shadow 0.15s ease;
}

.card.card-hover:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.card-header {
  background-color: #f8f9fa;
  border-bottom: 1px solid #e5e7eb;
  font-weight: 500;
}

/* -------------------------------------------
   Tables - Clean row hover
   ------------------------------------------- */
.table > tbody > tr {
  transition: background-color 0.1s ease;
}

.table-hover > tbody > tr:hover {
  background-color: rgba(0, 0, 0, 0.02);
}

tr.clickable {
  cursor: pointer;
}

tr.clickable:hover {
  background-color: rgba(0, 0, 0, 0.03);
}

tr.clickable:active {
  background-color: rgba(0, 0, 0, 0.05);
}

/* -------------------------------------------
   Links - Underline on hover only
   ------------------------------------------- */
a:not(.btn):not(.nav-link):not(.navbar-brand) {
  text-decoration: none;
  transition: color 0.1s ease;
}

a:not(.btn):not(.nav-link):not(.navbar-brand):hover {
  text-decoration: underline;
}

/* -------------------------------------------
   Nav/Tabs - Subtle active states
   ------------------------------------------- */
.nav-tabs .nav-link {
  border: 1px solid transparent;
  transition: background-color 0.1s ease, border-color 0.1s ease;
}

.nav-tabs .nav-link:hover:not(.active) {
  background-color: rgba(0, 0, 0, 0.03);
  border-color: transparent;
}

.nav-tabs .nav-link.active {
  border-color: #dee2e6 #dee2e6 #fff;
}

.navbar-nav .nav-link {
  transition: background-color 0.1s ease;
}

.navbar-dark .navbar-nav .nav-link:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

/* -------------------------------------------
   Dropdowns - Clean appearance
   ------------------------------------------- */
.dropdown-menu {
  border: 1px solid #e5e7eb;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.dropdown-item {
  transition: background-color 0.1s ease;
}

.dropdown-item:hover,
.dropdown-item:focus {
  background-color: #f8f9fa;
}

.dropdown-item:active {
  background-color: #e9ecef;
  color: inherit;
}

/* -------------------------------------------
   Badges
   ------------------------------------------- */
.badge {
  font-weight: 500;
}

/* -------------------------------------------
   Alerts
   ------------------------------------------- */
.alert {
  border-width: 1px;
  border-left-width: 4px;
}

/* -------------------------------------------
   HTMX Loading Indicators
   ------------------------------------------- */
.htmx-indicator {
  display: none;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  display: inline-block;
}

.htmx-added {
  animation: quietFadeIn 0.2s ease-out;
}

@keyframes quietFadeIn {
  from { opacity: 0.6; }
  to { opacity: 1; }
}

/* -------------------------------------------
   Disable Unwanted Animations
   ------------------------------------------- */
.btn:hover,
.btn:active,
.card:hover,
.nav-link:hover,
a:hover {
  transform: none !important;
}

.accordion-button:not(.collapsed) {
  box-shadow: none;
}

.modal.fade .modal-dialog {
  transition: opacity 0.15s ease;
  transform: none;
}

/* -------------------------------------------
   Filter Panel
   ------------------------------------------- */
.filter-panel {
  background: #f8f9fa;
  border: 1px solid #e5e7eb;
  padding: 1rem;
}

.filter-panel .form-label {
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.filter-group {
  margin-bottom: 1rem;
}

.filter-group:last-child {
  margin-bottom: 0;
}

/* Checkbox/radio groups */
.checkbox-group {
  max-height: 150px;
  overflow-y: auto;
  border: 1px solid #dee2e6;
  padding: 0.5rem;
  background: white;
}

.checkbox-group .form-check {
  margin-bottom: 0.25rem;
}

.checkbox-group .form-check:last-child {
  margin-bottom: 0;
}

/* -------------------------------------------
   Charts
   ------------------------------------------- */
.chart-container {
  position: relative;
  height: 300px;
}

.chart-container.chart-tall {
  height: 400px;
}

/* -------------------------------------------
   Stats Cards
   ------------------------------------------- */
.stat-card {
  text-align: center;
}

.stat-card .stat-value {
  font-size: 2rem;
  font-weight: 600;
  color: #333;
}

.stat-card .stat-label {
  color: #6c757d;
  font-size: 0.875rem;
}

/* -------------------------------------------
   Map
   ------------------------------------------- */
#map {
  height: 600px;
  width: 100%;
}

.map-legend {
  background: white;
  padding: 10px;
  border-radius: 3px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.map-legend h6 {
  margin: 0 0 8px 0;
  font-size: 0.875rem;
}

.legend-item {
  display: flex;
  align-items: center;
  margin-bottom: 4px;
}

.legend-color {
  width: 20px;
  height: 12px;
  margin-right: 8px;
}

/* -------------------------------------------
   Cross-tab Table
   ------------------------------------------- */
.crosstab-table th {
  background: #f8f9fa;
  font-weight: 500;
}

.crosstab-table td {
  text-align: center;
}

.crosstab-table .row-header {
  text-align: left;
  font-weight: 500;
  background: #f8f9fa;
}

/* -------------------------------------------
   Question/Form Tables
   ------------------------------------------- */
.field-type-badge {
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
}

.field-type-text { background-color: #e3f2fd; color: #1565c0; }
.field-type-textarea { background-color: #e8f5e9; color: #2e7d32; }
.field-type-select { background-color: #fff3e0; color: #ef6c00; }
.field-type-radio { background-color: #fce4ec; color: #c2185b; }
.field-type-checkbox { background-color: #f3e5f5; color: #7b1fa2; }
.field-type-email { background-color: #e0f7fa; color: #00838f; }
.field-type-hidden { background-color: #eceff1; color: #546e7a; }

/* -------------------------------------------
   Footer
   ------------------------------------------- */
.footer-logo {
  height: 50px;
  width: auto;
  object-fit: contain;
  vertical-align: middle;
}

/* -------------------------------------------
   Responsive adjustments
   ------------------------------------------- */
@media (max-width: 768px) {
  .filter-panel {
    margin-bottom: 1rem;
  }

  .chart-container {
    height: 250px;
  }

  #map {
    height: 400px;
  }
}
