/*
 * 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.
 */

.grid-wrapper {
  background: #fff;
  border-radius: 4px;
}

.grid-header {
  padding: 10px;
  border-bottom: 1px solid #eee;
}

.super-search input {
  width: 100%;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.grid-table {
  width: 100%;
  border-collapse: collapse;
}

.grid-table th {
  background: #f8f9fa;
  padding: 10px;
  text-align: left;
  border-bottom: 2px solid #dee2e6;
  cursor: pointer;
}

.grid-table th:hover {
  background: #e9ecef;
}

.filter-row th {
  padding: 5px 10px;
  background: #fff;
}

.filter-row input {
  width: 100%;
  padding: 4px;
  font-size: 0.9em;
  border: 1px solid #ddd;
}

.grid-row {
  cursor: pointer;
  border-bottom: 1px solid #eee;
}

.grid-row:hover {
  background: #f1f3f5;
}

.grid-row.selected {
  background: #e7f5ff;
}

.grid-row td {
  padding: 10px;
}

.prototype-container {
  padding: 20px;
}

.prototype-container-full {
  height: calc(100vh - 110px); /* 40px main-header + 40px nav-bar + 30px sub-nav-bar (approx) */
  display: flex;
  flex-direction: column;
}

.split-view {
  display: flex;
  gap: 0;
  flex: 1;
  height: 100%;
}

.split-pane {
  flex: 1;
  border: 1px solid #ccc;
  overflow: auto;
  background: #fff;
}

.split-view.no-selection .visits-pane {
  display: none;
}

/* Fly-in Prototype Styles */
.fly-in-layout {
  display: flex;
  flex: 1;
  height: 100%;
  position: relative;
  overflow: hidden;
}

/* Market Search UI */
.search-results {
  list-style: none;
  padding: 0;
  margin: 10px 0;
  border: 1px solid #ddd;
  border-radius: 4px;
  max-height: 300px;
  overflow-y: auto;
  background: white;
}

.result-header {
  background: #f8f9fa;
  padding: 5px 10px;
  font-weight: bold;
  font-size: 0.8em;
  color: #6c757d;
  text-transform: uppercase;
  border-bottom: 1px solid #eee;
}

.result-item {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-bottom: 1px solid #eee;
  padding: 10px;
  cursor: pointer;
  display: block;
  color: inherit;
}

.result-item:hover {
  background: #f1f3f5;
}

.result-item strong {
  display: block;
}

.result-item small {
  color: #6c757d;
}

.no-results {
  padding: 10px;
  color: #6c757d;
  font-style: italic;
}

.info-box {
  background: #e7f5ff;
  border: 1px solid #a5d8ff;
  padding: 10px;
  margin-bottom: 20px;
  border-radius: 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.hidden {
  display: none !important;
}

#address_fields:not(.editing) input {
  background-color: #f8f9fa;
  pointer-events: none;
  border-color: #e9ecef;
}

.market-section {
  flex: 1;
  border: 1px solid #ccc;
  overflow: auto;
  background: #fff;
  transition: flex 0.3s ease-in-out;
  z-index: 1;
}

.market-section.expanded {
  flex: 0 0 90% !important;
}

.visits-fly-in-section {
  position: absolute;
  top: 0;
  right: -100%;
  width: 95%;
  height: 100%;
  background: #fff;
  border-left: 2px solid #3498db;
  box-shadow: -5px 0 15px rgba(0,0,0,0.1);
  transition: right 0.4s ease-in-out;
  z-index: 2;
  display: flex;
  flex-direction: column;
}

.visits-frame {
  display: block;
  height: 100%;
  overflow: auto;
}

.visits-fly-in-section.visible {
  right: 0;
}

.visits-fly-in-section.shrunk {
  width: 10% !important;
}

.visits-fly-in-header {
  padding: 10px 15px;
  background: #f8f9fa;
  border-bottom: 1px solid #dee2e6;
  display: flex;
  justify-content: flex-end;
}

.close-button {
  background: #e74c3c;
  color: white;
  border: none;
  padding: 5px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
}

.close-button:hover {
  background: #c0392b;
}

.empty-state {
  padding: 40px;
  text-align: center;
  color: #777;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  margin: 0;
  padding: 0;
  background-color: #f4f7f6;
  color: #333;
}

.main-header {
  background-color: #2c3e50;
  color: white;
  padding: 0;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  height: 40px;
  margin: 0;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 15px;
  padding-right: 20px;
}

.user-info {
  font-size: 0.9rem;
}

.logout-button {
  color: #ecf0f1;
  text-decoration: none;
  font-size: 0.9rem;
  padding: 5px 10px;
  border: 1px solid #ecf0f1;
  border-radius: 4px;
  transition: all 0.2s;
}

.logout-button:hover {
  background-color: #ecf0f1;
  color: #2c3e50;
}

.nav-bar {
  background-color: white;
  border-bottom: 1px solid #ddd;
  padding: 0;
  margin: 0;
}

.nav-bar ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
}

.nav-bar li {
  margin: 0;
}

.nav-bar a {
  display: block;
  padding: 8px 20px;
  color: #555;
  text-decoration: none;
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
}

.nav-bar a:hover {
  background-color: #f9f9f9;
  color: #2c3e50;
}

.nav-bar a.active {
  border-bottom-color: #3498db;
  color: #2c3e50;
  font-weight: bold;
}

.sub-nav-bar {
  background-color: #f8f9fa;
  border-bottom: 1px solid #eee;
  padding: 0;
  margin: 0;
}

.sub-nav-bar ul {
  list-style: none;
  margin: 0;
  padding: 0 10px;
  display: flex;
}

.sub-nav-bar li {
  margin: 0;
}

.sub-nav-bar a {
  display: block;
  padding: 5px 15px;
  color: #777;
  text-decoration: none;
  font-size: 0.85rem;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.sub-nav-bar a:hover {
  color: #333;
  background-color: #f1f3f5;
}

.sub-nav-bar a.active {
  color: #2c3e50;
  border-bottom-color: #95a5a6;
  font-weight: 600;
}

.content {
  padding: 20px;
}

.rich-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
  background-color: white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.rich-table th, .rich-table td {
  padding: 12px 15px;
  text-align: left;
  border-bottom: 1px solid #eee;
}

.rich-table th {
  background-color: #f8f9fa;
  font-weight: bold;
  color: #2c3e50;
}

.rich-table th a {
  color: inherit;
  text-decoration: none;
  display: flex;
  align-items: center;
}

.rich-table tr:hover {
  background-color: #f1f4f6;
}

.filter-form {
  margin-bottom: 20px;
  background-color: white;
  padding: 15px;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.filter-group label {
  font-weight: bold;
}

.filter-group input[type="text"] {
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  flex-grow: 1;
  max-width: 300px;
}

.index-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.index-header h1 {
  margin: 0;
}

.button {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 4px;
  text-decoration: none;
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.2s;
  border: none;
}

.button.primary {
  background-color: #3498db;
  color: white;
}

.button.primary:hover {
  background-color: #2980b9;
}

.button.secondary {
  background-color: #95a5a6;
  color: white;
}

.button.secondary:hover {
  background-color: #7f8c8d;
}

.form-container {
  background-color: white;
  padding: 30px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  max-width: 600px;
  margin: 0 auto;
}

.client-form .field {
  margin-bottom: 15px;
}

.client-form label {
  display: block;
  margin-bottom: 5px;
  font-weight: bold;
}

.client-form input[type="text"] {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  box-sizing: border-box;
}

.client-form .actions {
  margin-top: 20px;
}

.form-actions {
  margin-top: 20px;
  text-align: center;
}

.error-messages {
  background-color: #f8d7da;
  color: #721c24;
  padding: 15px;
  border-radius: 4px;
  margin-bottom: 20px;
  border: 1px solid #f5c6cb;
}

.error-messages h2 {
  font-size: 1.1rem;
  margin-top: 0;
}

.error-messages ul {
  margin-bottom: 0;
}

.flash {
  padding: 10px 15px;
  margin-bottom: 20px;
  border-radius: 4px;
}

.flash.notice {
  background-color: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.flash.alert {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.assignment-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.assignment-list li {
  margin-bottom: 4px;
}

.assignment-list li:last-child {
  margin-bottom: 0;
}

.text-muted {
  color: #6c757d;
}

.assignments-section {
  margin-top: 20px;
  padding: 15px;
  background-color: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #dee2e6;
}

.assignments-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.assignments-header h3 {
  margin: 0;
}

.round-button {
  width: 32px;
  height: 32px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 1.2rem;
  line-height: 1;
}

.nested-fields {
  background-color: white;
  padding: 15px;
  margin-bottom: 10px;
  border-radius: 4px;
  border: 1px solid #ddd;
}

.field-row {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  align-items: flex-end;
}

.field-row .field {
  flex: 1;
  min-width: 150px;
  margin-bottom: 0;
}

.field-row .field.actions {
  flex: 0 0 auto;
  min-width: auto;
}

.button.small {
  padding: 5px 10px;
  font-size: 0.8rem;
}

.order-form select, .order-form input[type="date"], .order-form input[type="number"] {
  width: 100%;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  box-sizing: border-box;
}

/* Form Designer Styles */
.form-layout-split {
  display: flex;
  gap: 30px;
  margin-top: 20px;
  height: calc(100vh - 150px); /* Adjust based on your header height */
  overflow: hidden;
}

.form-main {
  flex: 1;
  overflow-y: auto;
  padding-right: 15px; /* Add some space for the scrollbar */
}

.form-preview-sidebar {
  width: 350px;
  flex-shrink: 0;
}

.sticky-preview {
  position: sticky;
  top: 0;
}

.mobile-preview-container {
  border: 12px solid #333;
  border-radius: 36px;
  padding: 20px;
  background: #fff;
  min-height: 500px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

.preview-form .preview-field {
  margin-bottom: 15px;
}

.preview-form label {
  display: block;
  font-weight: bold;
  margin-bottom: 5px;
  font-size: 0.9rem;
}

.preview-form input, .preview-form textarea, .preview-form select {
  width: 100%;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.field-card {
  background: #fdfdfd;
  border: 1px solid #eee;
  border-left: 4px solid #007bff;
  padding: 15px;
  margin-bottom: 15px;
  border-radius: 4px;
  transition: box-shadow 0.15s;
}

.field-card.dragging {
  opacity: 0.5;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.field-card.drag-over {
  border-top: 3px solid #007bff;
}

.field-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.drag-handle {
  cursor: grab;
  color: #aaa;
  font-weight: bold;
  font-size: 1.1rem;
  user-select: none;
}

.sequence-group {
  flex-shrink: 0;
}

.sequence-input {
  width: 52px;
  padding: 4px 6px;
  text-align: center;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.85rem;
}

.toggle-details {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  color: #666;
  padding: 2px 4px;
  line-height: 1;
  margin-left: auto;
}

.toggle-details:hover {
  color: #333;
}

.form-group-inline {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.remove-field {
  color: #dc3545;
  text-decoration: none;
  font-size: 1.5rem;
  line-height: 1;
}

.field-details {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 20px;
  padding-top: 10px;
  border-top: 1px solid #eee;
  margin-top: 10px;
}

.field-details h4 {
  margin: 0 0 10px 0;
  font-size: 0.9rem;
  color: #666;
}

.badge {
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: bold;
  text-transform: uppercase;
}

.badge.success { background: #d4edda; color: #155724; }
.badge.warning { background: #fff3cd; color: #856404; }

/* Condition builder */
.field-conditions {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.condition-group h5 {
  margin: 0 0 8px 0;
  font-size: 0.85rem;
  color: #555;
  font-weight: 600;
}

.condition-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}

.condition-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.condition-row select,
.condition-row .condition-value-input {
  padding: 4px 6px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.85rem;
}

.condition-row .condition-field-select {
  flex: 1 1 120px;
  min-width: 100px;
}

.condition-row .condition-operator-select {
  flex: 1 1 130px;
  min-width: 110px;
}

.condition-value-wrapper {
  flex: 1 1 100px;
  min-width: 80px;
}

.condition-value-wrapper .condition-value-input {
  width: 100%;
  box-sizing: border-box;
}

.condition-remove {
  padding: 3px 8px;
  font-size: 1rem;
  line-height: 1;
  color: #dc3545;
  border-color: #dc3545;
  flex-shrink: 0;
}

.readonly-field {
  background-color: #f0f0f0;
  cursor: not-allowed;
}

.market-fields-container:has(input[readonly]) + .actions {
  display: none;
}
