/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

html {
  /* Enable smooth scrolling for anchor links */
  scroll-behavior: smooth;
}

.header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: #fff;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.menu-toggle {
  display: none;
}

@media (max-width: 768px) {
  .nav-menu {
    display: none;
    flex-direction: column;
  }
  .menu-toggle {
    display: block;
  }
  .nav-menu.open {
    display: flex;
  }
}

/* Better form layout constraints */
.section-header {
  display: inline-block;
  width: auto;
  max-width: 90%;
  box-sizing: border-box;
}

fieldset {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  position: relative;
  overflow: hidden;
}

/* Override legend styling to fix horizontal line width */
legend {
  width: auto;
  max-width: 95%;
}

legend::before, legend::after {
  content: none !important;
}

fieldset::before, fieldset::after {
  content: "";
  position: absolute;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

/* Form constraints */
.form-wrapper,
.section-container,
.section-fieldset,
.section-legend,
legend,
form {
  max-width: 100% !important;
  width: 100% !important;
  box-sizing: border-box !important;
  overflow-x: hidden !important;
}

/* Entry field styling */
.field-container {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  flex-wrap: wrap;
}

.field-container > div:first-child {
  min-width: 100px;
  max-width: 120px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}

.field-container > div.flex-1, 
.field-container > div:nth-child(2) {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  max-width: calc(100% - 150px);
}

.field-container button {
  flex-shrink: 0;
}

/* RDD field container styles */
.rdd-field-container {
  padding: 0 !important;
  margin-bottom: 12px !important;
  width: 100% !important;
  overflow: hidden !important;
  display: block !important;
}

.rdd-field-container input[type="text"] {
  display: block !important;
  width: 100% !important;
  min-width: 100px !important;
  box-sizing: border-box !important;
}

.rdd-field-container .flex-1 {
  flex: 1 1 auto !important;
  min-width: 150px !important;
  width: auto !important;
}

/* Fix for input fields in RDD section */
#monitoring-section-wrapper input[type="text"] {
  width: 100% !important;
  min-width: 150px !important;
  box-sizing: border-box !important;
  display: block !important;
  margin: 0 !important;
  flex: 1 !important;
}

#monitoring-section-wrapper .grid-cols-\[120px_1fr_auto\] {
  display: grid !important;
  grid-template-columns: 120px 1fr auto !important;
  width: 100% !important;
}

#monitoring-section-wrapper .grid-cols-\[120px_1fr_auto\] > div:nth-child(2) {
  min-width: 150px !important;
  width: 100% !important;
}

/* Fix for collapsible section content */
[data-collapsible-section-target="content"] {
  transition: max-height 0.3s ease-in-out;
}

/* Fix for General Section */
#general-section-wrapper fieldset,
#general-section-wrapper div,
#general-section-wrapper form {
  max-width: 100%;
  box-sizing: border-box;
}

/* Form input styling */
input, select, textarea {
  max-width: 100%;
  box-sizing: border-box;
}

/* Table layout styles */
.table-full-width {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}

.td-label {
  width: 100px;
  padding-right: 10px;
  white-space: nowrap;
}

.td-input {
  width: auto;
  min-width: 100px;
  padding-right: 10px;
}

.td-action {
  width: 40px;
  text-align: right;
  vertical-align: middle;
}

.block-container {
  display: block;
  width: 100%;
}

.full-width-input {
  width: 100%;
  box-sizing: border-box;
  min-width: 100px;
}

.overflow-visible {
  overflow: visible !important;
}