/*
 * 검색영역 공용 컴포넌트 (.sa-*) — 2026-07-15 신설
 * 실적리스트/DB리스트/사은품관리 상단 검색영역의 공통 시각 규격을 클래스화.
 * 동작(모바일 토글·날짜 빠른선택)은 Stimulus search-area 컨트롤러와 짝.
 * 첫 소비자: 설정 > 정산기간설정 "정산대상 검색". 기존 화면(ol-/gm-/dbl-)은 추후 화면별 이관.
 */

/* 모바일 검색 토글 버튼 — PC 에서는 숨김 */
.sa-toggle {
  display: none;
  width: 100%;
  padding: 10px 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  margin-bottom: 10px;
  cursor: pointer;
  align-items: center;
  justify-content: space-between;
}
.sa-toggle .sa-toggle-arrow { transition: transform 0.2s; }

/* 접힘형 변형 — PC 에서도 기본 접힘(토글 버튼 상시 노출 + 본체 숨김). 예: 정산기간설정 정산대상 검색 */
.sa-toggle--always { display: flex; }
.sa-body--collapsed { display: none; }

/* 기간 박스(1차/2차) — 정산기간 등록 폼과 동일 골격의 날짜 그룹 컨테이너 */
.sa-period-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 12px;
}
.sa-period-box {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 11px 13px;
  background: #f9fafb;
}
.sa-period-title {
  font-size: 12px;
  font-weight: 700;
  color: #334155;
  margin-bottom: 9px;
}
@media (max-width: 640px) {
  .sa-period-grid { grid-template-columns: 1fr; }
}

/* 검색 본체 카드 */
.sa-body {
  margin-bottom: 16px;
  padding: 14px 16px;
  background: white;
  border: 1px solid #d1d5db;
  border-radius: 10px;
}

/* select/필터 행 */
.sa-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.sa-select {
  padding: 5px 8px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 11px;
  background: white;
}
.sa-select:disabled { background: #f1f5f9; color: #94a3b8; }

/* 섹션 구분(윗줄) */
.sa-divider {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #e2e8f0;
}

/* 날짜 범위 행 — 라벨 + from~to + 빠른선택 */
.sa-date-section {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.sa-date-label {
  font-size: 11px;
  font-weight: 500;
  color: #334155;
  min-width: 56px;
}
.sa-date-input {
  padding: 4px 8px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 11px;
  background: white;
}
.sa-date-btns {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.sa-quick {
  font-size: 11px;
  color: #6b7280;
  cursor: pointer;
}
.sa-quick.sa-quick-active {
  color: #059669;
  font-weight: 600;
  text-decoration: underline;
  padding: 0 2px;
  border-radius: 3px;
  background: #ecfdf5;
}

/* 검색바(오렌지) 행 */
.sa-bar-row {
  display: flex;
  align-items: stretch;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #e2e8f0;
}
.sa-bar {
  background: #fe5500;
  border-radius: 8px;
  padding: 4px;
  display: flex;
  align-items: stretch;
  width: 100%;
  max-width: 400px;
}
.sa-bar-fill {
  display: flex;
  align-items: center;
  flex: 1;
  background: white;
  border-radius: 6px 0 0 6px;
  overflow: hidden;
  padding: 0 10px;
  min-width: 0;
}
.sa-bar-hint {
  font-size: 11px;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sa-bar-btn {
  padding: 6px 14px;
  background: #fe5500;
  color: white;
  border: none;
  border-radius: 0 6px 6px 0;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.sa-bar-reset {
  align-self: center;
  margin-left: 12px;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  white-space: nowrap;
  background: none;
  border: none;
  padding: 0;
}
.sa-bar-reset:hover { text-decoration: underline; }

/* 모바일 닫기 버튼 */
.sa-close-row {
  display: none;
  justify-content: center;
  margin-top: -17px;
  margin-bottom: 8px;
}
.sa-close-btn {
  padding: 2px 16px;
  background: #e2e8f0;
  border: none;
  border-radius: 0 0 8px 8px;
  cursor: pointer;
  color: #64748b;
  line-height: 1;
}

@media (max-width: 768px) {
  .sa-toggle { display: flex; }
  .sa-body { display: none; }
  .sa-date-section { flex-direction: column; align-items: flex-start; }
  .sa-date-btns { gap: 6px; }
}
