/* static/css/checklist.css */

/* Checklist Item Styling */
.checklist-item {
  background-color: #f8f9fa;
  border-radius: 6px;
  padding: 10px;
  margin-bottom: 10px;
  border: 1px solid #e9ecef;
}

/* Question Column Styling - Make wider and more visible */
.question-col {
  background-color: rgba(13, 110, 253, 0.05);
  border-radius: 4px;
  padding: 8px 12px;
}

/* Question labels styling */
.question-label {
  font-weight: 600;
  color: #0d6efd;
  font-size: 1rem;
  line-height: 1.4;
}

/* Hide the default crispy-forms legend */
.question-col legend {
  display: none;  /* Hide the legend that crispy forms adds */
}

/* Radio Button Styling */
.form-check-inline {
  margin-right: 15px;
  display: inline-block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.form-check-inline .form-check-input {
  margin-right: 5px;
}

/* Make radio labels bold */
.form-check-inline .form-check-label {
  font-weight: 500;
}

/* Yes/No Radio Button Colors */
.form-check-input:checked {
  background-color: #0d6efd;
  border-color: #0d6efd;
}

/* Clearer focus states */
.form-check-input:focus {
  border-color: #86b7fe;
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Notes Field Styling - CRITICAL FIX */
.notes-field {
  background-color: #fff;
  border-radius: 4px;
  padding: 8px 12px;
  transition: all 0.3s ease;
  display: none; /* No !important flag to allow JS to override */
}

/* Add a class for forced display */
.notes-field.force-show {
  display: block !important;
}

/* Add specific styling for EV charging and Limited Common Elements */
.ev-charging-field,
.limited-common-field {
  display: none;
}

/* Make special note fields more visible */
.ev-charging-item .notes-field,
.limited-common-item .notes-field {
  background-color: #f0f7ff;
  border-left: 3px solid #0d6efd;
}

/* Money field styling */
.money-field {
  font-family: 'Courier New', Courier, monospace;
  font-weight: 600;
  text-align: right;
  padding-right: 10px;
  position: relative;
}

/* Add dollar sign visually but not in the value */
.money-field-container {
  position: relative;
}

.money-field-container::before {
  content: '$';
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  font-weight: normal;
  color: #495057;
  z-index: 1;
}

/* Date field styling */
input[type="date"].form-control {
  border: 1px solid #0d6efd;
  padding: 0.375rem 0.75rem;
  background-color: #f0f7ff;
}

/* Make fieldset legends more prominent */
fieldset > legend {
  font-size: 1.1rem;
  font-weight: 600;
  color: #0d6efd;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #e9ecef;
  width: 100%;
  margin-bottom: 1rem;
}

/* Progress Bar */
.checklist-progress {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.progress {
  margin-bottom: 0.25rem;
  background-color: #e9ecef;
  border-radius: 0.25rem;
  height: 8px;
}

/* Customized progress bar colors */
.progress-bar {
  transition: width 0.3s ease;
}

.progress-bar.bg-success {
  background-color: #28a745 !important;
}

.progress-bar.bg-warning {
  background-color: #ffc107 !important;
}

.progress-bar.bg-danger {
  background-color: #dc3545 !important;
}

/* Accordion Styling */
.accordion-button:not(.collapsed) {
  background-color: rgba(13, 110, 253, 0.1);
  color: #0d6efd;
}

.accordion-button:focus {
  box-shadow: none;
  border-color: rgba(13, 110, 253, 0.25);
}

.accordion-item {
  border-radius: 0;
  border-left: none;
  border-right: none;
}

/* Document List Styling */
.list-group-item-action {
  padding: 0.5rem 0.75rem;
  transition: all 0.2s ease;
}

.list-group-item-action:hover {
  background-color: rgba(13, 110, 253, 0.05);
}

.list-group-item-action.document-referenced {
  background-color: rgba(25, 135, 84, 0.05);
  border-left: 3px solid #198754;
}

/* Card styling */
.card {
  border: none;
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
  margin-bottom: 1.5rem;
}

.card-header {
  background-color: #fff;
  border-bottom: 1px solid rgba(0, 0, 0, 0.125);
  padding: 0.75rem 1rem;
}

/* Form controls */
.form-control:focus, .form-select:focus {
  border-color: #86b7fe;
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Make text areas smaller */
textarea.form-control {
  min-height: 2.5rem;
}

/* Input field labels */
.form-group label {
  font-weight: 500;
  color: #495057;
  margin-bottom: 0.25rem;
}

/* Responsive adjustments */
@media (max-width: 992px) {
  .checklist-progress {
    margin-top: 0.5rem;
    align-items: flex-start;
  }
  
  .question-col {
    padding: 6px 10px;
  }
  
  .question-label {
    font-size: 0.95rem;
  }
}

/* Preview Page Specific Styles */
.preview-section {
  margin-bottom: 2rem;
}

.preview-item {
  padding: 1rem;
  background-color: #f8f9fa;
  border-radius: 0.25rem;
  margin-bottom: 1rem;
  border-left: 3px solid #0d6efd;
}

.preview-item h4 {
  color: #0d6efd;
  margin-bottom: 0.75rem;
}

.preview-item .badge {
  font-size: 0.85rem;
  padding: 0.35rem 0.65rem;
}

.preview-label {
  font-weight: 500;
  color: #6c757d;
}

.preview-value {
  font-weight: 400;
}

/* Badge colors */
.badge.bg-primary {
  background-color: #0d6efd !important;
}

.badge.bg-success {
  background-color: #198754 !important;
}

.badge.bg-secondary {
  background-color: #6c757d !important;
}

.badge.bg-warning {
  background-color: #ffc107 !important;
}

.badge.bg-danger {
  background-color: #dc3545 !important;
}

/* Improve section headings */
.h5.border-bottom {
  padding-bottom: 0.5rem;
  color: #0d6efd;
  font-weight: 600;
}

/* Special highlight for unit_checklist fields */
#unit-resale-checklist-form .form-group {
  position: relative;
}

/* Add visual indicator for required fields */
#unit-resale-checklist-form .required-field::after {
  content: "*";
  color: #dc3545;
  position: absolute;
  right: 5px;
  top: 5px;
}

/* Highlight fields that should be visible */
.should-be-visible {
  border: 2px solid #ffc107 !important;
  background-color: rgba(255, 193, 7, 0.1) !important;
}

/* Fix for radio buttons - ensure they are always visible */
.form-check-input[type="radio"] {
  opacity: 1 !important;
  position: static !important;
  margin-right: 5px !important;
  display: inline-block !important;
}

/* Make field containers and controls more visible */
.question-col div,
.controls,
.form-check,
.radio {
  opacity: 1 !important;
  visibility: visible !important;
  display: block !important;
}

/* Fix specifically for problematic radio button containers */
div[id*="div_id_has_ev_charging"],
div[id*="div_id_has_limited_common_elements"],
div[id*="div_id_has_warranty"],
div[id*="div_id_has_warranty_claims"],
div[id*="div_id_has_pending_limited_common_sales"],
div[id*="div_id_has_governing_violations"],
div[id*="div_id_has_code_violations"],
div[id*="div_id_has_sale_amount_restrictions"],
div[id*="div_id_has_use_restrictions"],
div[id*="div_id_has_lease_restrictions"] {
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
}

/* Ensure inline radio elements display properly */
.radio.inline,
.checkbox.inline {
  display: inline-block !important;
}

/* Fix radio button appearance */
input[name^="has_"] {
  display: inline-block !important;
  visibility: visible !important;
  opacity: 1 !important;
  position: relative !important;
  margin-top: 0 !important;
  vertical-align: middle !important;
}

/* Special handling for ALL sections' notes fields */
.checklist-item input[name^="has_"][value="True"]:checked ~ .row .notes-field,
input[name="has_current_special_assessments"][value="True"]:checked ~ .row .notes-field,
input[name="has_unpaid_special_assessments"][value="True"]:checked ~ .row .notes-field,
input[name="has_future_assessments"][value="True"]:checked ~ .row .notes-field,
input[name="has_other_assessments"][value="True"]:checked ~ .row .notes-field,
input[name="has_transfer_fees"][value="True"]:checked ~ .row .notes-field,
input[name="has_governing_violations"][value="True"]:checked ~ .row .notes-field,
input[name="has_code_violations"][value="True"]:checked ~ .row .notes-field,
input[name="has_sale_amount_restrictions"][value="True"]:checked ~ .row .notes-field,
input[name="has_use_restrictions"][value="True"]:checked ~ .row .notes-field,
input[name="has_lease_restrictions"][value="True"]:checked ~ .row .notes-field {
  display: block !important;
}

/* Fix for compliance and restrictions sections */
.checklist-item[id*="governing_violations"],
.checklist-item[id*="code_violations"],
.checklist-item[id*="sale_amount_restrictions"],
.checklist-item[id*="use_restrictions"],
.checklist-item[id*="lease_restrictions"] {
  display: block !important;
}

/* Force show fields when editing */
.assessment-info-active .notes-field {
  display: block !important;
}

/* Add this to your static/css/checklist.css or create inline styles */

/* Direct fix for problematic fieldsets */
fieldset:has(> legend:contains("Unit Compliance Status")),
fieldset:has(> legend:contains("Unit Restrictions")) {
  display: block !important;
}

/* Make the legends and content visible */
fieldset legend {
  display: block !important;
}

/* Ultra-specific selectors for the problem fields */
#div_id_has_governing_violations,
#div_id_has_code_violations,
#div_id_has_sale_amount_restrictions,
#div_id_has_use_restrictions,
#div_id_has_lease_restrictions {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

#id_governing_violations_notes,
#id_code_violations_notes,
#id_sale_amount_restrictions_notes,
#id_use_restrictions_notes,
#id_lease_restrictions_notes {
  display: block;
}

/* Force visibility of radio inputs in these sections */
input[name="has_governing_violations"],
input[name="has_code_violations"],
input[name="has_sale_amount_restrictions"],
input[name="has_use_restrictions"],
input[name="has_lease_restrictions"] {
  visibility: visible !important;
  opacity: 1 !important;
  display: inline-block !important;
  position: static !important;
}

/* Force rows to be visible */
#unit-resale-checklist-form .row {
  display: flex !important;
}

/* Ensure the question column is visible */
.question-col {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* Force notes fields to show when Yes is selected */
input[name="has_governing_violations"][value="True"]:checked ~ * .notes-field,
input[name="has_code_violations"][value="True"]:checked ~ * .notes-field,
input[name="has_sale_amount_restrictions"][value="True"]:checked ~ * .notes-field,
input[name="has_use_restrictions"][value="True"]:checked ~ * .notes-field,
input[name="has_lease_restrictions"][value="True"]:checked ~ * .notes-field {
  display: block !important;
}