/**
 * @fileoverview Logic Builder CSS - Styles for the LadderFilterBuilder component
 *
 * Consistent with common.css theme: light background, system fonts,
 * primary color #667eea, secondary #95a5a6, danger #e74c3c
 */

/* ===================================================================
   CONTAINER
   =================================================================== */

.lfb-container {
  max-width: 900px;
  margin: 0 auto;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}

.lfb-container * {
  box-sizing: border-box;
}

.lfb-title {
  font-size: 0.85rem;
  color: #7f8c8d;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 16px;
  font-weight: 600;
}

/* ===================================================================
   INPUT BAR
   =================================================================== */

.lfb-input-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background-color: #f8f9fa;
  border: 1px solid #ddd;
  border-radius: 4px;
  margin-bottom: 16px;
}

.lfb-input-bar select,
.lfb-input-bar input {
  padding: 8px 12px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  font-size: 0.9rem;
  font-family: inherit;
  background-color: white;
  color: #495057;
  outline: none;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
  width: auto;
  flex-shrink: 0;
}

.lfb-input-bar select:focus,
.lfb-input-bar input:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

.lfb-input-bar select {
  cursor: pointer;
}

.lfb-input-bar input[type="text"] {
  min-width: 120px;
}


/* ===================================================================
   INSERT BUTTON
   =================================================================== */

.lfb-insert-btn {
  padding: 8px 16px;
  background-color: #667eea;
  border: none;
  border-radius: 4px;
  color: white;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.lfb-insert-btn:hover {
  background-color: #5568d3;
}

.lfb-insert-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ===================================================================
   ROWS CONTAINER
   =================================================================== */

.lfb-rows-container {
  border: 1px solid #ddd;
  border-radius: 4px;
  overflow: hidden;
  background-color: white;
}

.lfb-row {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  background-color: white;
  border-bottom: 1px solid #e9ecef;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.lfb-row:last-child {
  border-bottom: none;
}

.lfb-row:hover {
  background-color: #f8f9fa;
}

.lfb-row.selected {
  background-color: #f0f3ff;
  border-left: 3px solid #667eea;
  padding-left: 9px;
}

.lfb-row-label {
  color: #667eea;
  font-size: 0.75rem;
  font-weight: 600;
  width: 28px;
  flex-shrink: 0;
  text-transform: uppercase;
}

/* ===================================================================
   CONDITIONS
   =================================================================== */

.lfb-conditions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
  padding: 6px 0;
}

.lfb-condition {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  background-color: #e9ecef;
  border-radius: 4px;
  font-size: 0.85rem;
  color: #495057;
  cursor: pointer;
  position: relative;
  transition: background-color 0.15s ease;
  padding-right: 10px;
}

.lfb-condition:hover {
  background-color: #dee2e6;
}

.lfb-condition .field {
  color: #2c3e50;
  font-weight: 500;
}

.lfb-condition .operator {
  color: #667eea;
  margin: 0 4px;
  font-weight: 600;
}

.lfb-condition .value {
  color: #27ae60;
}

.lfb-condition .delete-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  background-color: #e74c3c;
  border: none;
  border-radius: 3px;
  color: white;
  font-size: 14px;
  cursor: pointer;
  line-height: 1;
  transition: background-color 0.15s ease;
}

.lfb-condition:hover .delete-btn {
  display: flex;
}

.lfb-condition .delete-btn:hover {
  background-color: #c0392b;
}

.lfb-and-separator {
  color: #667eea;
  font-size: 0.7rem;
  font-weight: 600;
  margin: 0 4px;
  text-transform: uppercase;
}

.lfb-empty-row {
  color: #95a5a6;
  font-size: 0.85rem;
  font-style: italic;
}

/* ===================================================================
   ADD ROW BUTTON
   =================================================================== */

.lfb-add-row-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 10px;
  background-color: transparent;
  border: 1px dashed #ced4da;
  border-top: none;
  color: #7f8c8d;
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s ease;
  border-radius: 0 0 4px 4px;
}

.lfb-add-row-btn:hover {
  background-color: #f8f9fa;
  border-color: #667eea;
  color: #667eea;
}

/* ===================================================================
   OUTPUT EXPRESSION
   =================================================================== */

.lfb-output {
  margin-top: 16px;
  padding: 12px 16px;
  background-color: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 4px;
  font-size: 0.85rem;
  color: #555;
}

.lfb-output-label {
  font-size: 0.7rem;
  color: #7f8c8d;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 8px;
  font-weight: 600;
}

.lfb-output-text {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.8rem;
  color: #2c3e50;
  word-break: break-word;
}

.lfb-output-text .kw {
  color: #667eea;
  font-weight: 600;
}

.lfb-no-conditions {
  color: #95a5a6;
  font-style: italic;
}

/* ===================================================================
   MODAL
   =================================================================== */

.lfb-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: lfb-fadeIn 0.2s ease-out;
}

@keyframes lfb-fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.lfb-modal {
  background-color: white;
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  padding: 20px;
  min-width: 320px;
  max-width: 90%;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  animation: lfb-slideUp 0.3s ease-out;
}

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

.lfb-modal-title {
  font-size: 0.8rem;
  color: #7f8c8d;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 16px;
  font-weight: 600;
}

.lfb-modal-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.lfb-modal-row label {
  color: #2c3e50;
  font-size: 0.9rem;
  font-weight: 500;
  width: 70px;
  flex-shrink: 0;
}

.lfb-modal-row select,
.lfb-modal-row input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  font-size: 0.9rem;
  font-family: inherit;
  background-color: white;
  color: #495057;
  outline: none;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.lfb-modal-row select:focus,
.lfb-modal-row input:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

.lfb-modal-row select {
  appearance: none;
  -webkit-appearance: none;
  -moz-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 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
  cursor: pointer;
}

.lfb-modal-buttons {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 20px;
}

.lfb-modal-btn {
  padding: 8px 16px;
  border: none;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: 4px;
  transition: background-color 0.15s ease;
}

.lfb-modal-btn.save {
  background-color: #667eea;
  color: white;
}

.lfb-modal-btn.save:hover {
  background-color: #5568d3;
}

.lfb-modal-btn.cancel {
  background-color: #95a5a6;
  color: white;
}

.lfb-modal-btn.cancel:hover {
  background-color: #7f8c8d;
}

/* ===================================================================
   VALUE INPUT/SELECT
   =================================================================== */

.value-input {
  min-width: 100px;
}

.value-select {
  min-width: 120px;
}

.value-slider-container {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.value-slider {
  width: 100px;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: #dee2e6;
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.value-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  background: #667eea;
  border-radius: 50%;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.value-slider::-webkit-slider-thumb:hover {
  background: #5568d3;
}

.value-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: #667eea;
  border: none;
  border-radius: 50%;
  cursor: pointer;
}

.value-slider-display {
  min-width: 28px;
  font-size: 0.85rem;
  color: #495057;
  font-weight: 500;
  text-align: right;
}
