/* 포장 모드 - 태블릿 최적화 스타일 */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: '맑은 고딕', 'Malgun Gothic', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #f5f5f5;
  min-height: 100vh;
  font-size: 16px;
  line-height: 1.4;
  padding-bottom: 60px;
}

/* 큰 글씨 모드 */
body.large-mode {
  font-size: 20px;
}

body.large-mode .customer-name {
  font-size: 1.4em;
}

body.large-mode .product-name {
  font-size: 1.2em;
}

body.large-mode .product-qty {
  font-size: 1.3em;
}

/* 요약 정보 */
.order-summary {
  font-size: 0.95em;
  font-weight: 600;
  color: #555;
}

/* 탭 바 */
.tab-bar {
  display: flex;
  background: white;
  border-bottom: 2px solid #eee;
}

.tab-btn {
  flex: 1;
  padding: 14px 20px;
  font-size: 1.05em;
  font-weight: 600;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  color: #888;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.tab-btn:active {
  background: #f5f5f5;
}

.tab-btn.active {
  color: #2c3e50;
  border-bottom-color: #3498db;
}

.tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 8px;
  border-radius: 12px;
  font-size: 0.8em;
  font-weight: 700;
  background: #eee;
  color: #666;
}

.tab-btn.active .tab-count {
  background: #3498db;
  color: white;
}

/* 필터 바 */
.filter-bar {
  background: white;
  padding: 12px 20px;
  display: flex;
  gap: 24px;
  align-items: center;
  flex-wrap: wrap;
  border-bottom: 1px solid #ddd;
}

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

.filter-group label {
  font-size: 0.95em;
  color: #555;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.filter-group select {
  padding: 10px 16px;
  font-size: 1em;
  border: 2px solid #ddd;
  border-radius: 8px;
  background: white;
  min-width: 140px;
}

.filter-group input[type="checkbox"] {
  width: 22px;
  height: 22px;
  cursor: pointer;
}

.filter-group input[type="date"] {
  padding: 10px 12px;
  font-size: 1em;
  border: 2px solid #ddd;
  border-radius: 8px;
  background: white;
}

.time-input {
  padding: 10px 12px;
  font-size: 1em;
  border: 2px solid #ddd;
  border-radius: 8px;
  background: white;
  width: 70px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.time-input:focus {
  border-color: #3498db;
  outline: none;
}

.filter-group span {
  color: #666;
  font-weight: 500;
}

.btn-today {
  padding: 10px 16px;
  font-size: 0.95em;
  font-weight: 600;
  background: #3498db;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-today:active {
  transform: scale(0.95);
  background: #2980b9;
}

/* 결제상태 프리셋 필터 */
.payment-filter-group {
  gap: 4px !important;
}

/* 정렬 그룹 (결제 필터와 시각적 분리) */
.sort-group {
  gap: 4px !important;
  padding-left: 16px;
  border-left: 2px solid #ddd;
}

.btn-filter {
  padding: 8px 14px;
  font-size: 0.9em;
  font-weight: 600;
  border: 2px solid #ddd;
  border-radius: 8px;
  background: white;
  color: #666;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-filter:active {
  transform: scale(0.95);
}

.btn-filter.active {
  background: #2c3e50;
  border-color: #2c3e50;
  color: white;
}

.btn-filter.unpaid:not(.active):hover {
  border-color: #e74c3c;
  color: #e74c3c;
}

.btn-filter.paid:not(.active):hover {
  border-color: #27ae60;
  color: #27ae60;
}

/* 포장 액션 버튼 */
.card-actions {
  padding: 12px 20px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  background: #f8f9fa;
  border-top: 1px solid #eee;
}

.btn-packing-complete {
  padding: 10px 20px;
  font-size: 0.95em;
  font-weight: 700;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(39, 174, 96, 0.3);
}

.btn-packing-complete:active {
  transform: scale(0.95);
}

.btn-packing-undo {
  padding: 10px 20px;
  font-size: 0.95em;
  font-weight: 600;
  border: 2px solid #bbb;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  background: white;
  color: #666;
}

.btn-packing-undo:active {
  transform: scale(0.95);
  background: #f0f0f0;
}

/* 개별 주문 결제상태 뱃지 (상품 아이템 내) */
.payment-badge {
  font-size: 0.75em;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.payment-badge.badge-unpaid {
  background: #ffeaea;
  color: #e74c3c;
}

.payment-badge.badge-paid {
  background: #e8f5e9;
  color: #27ae60;
}

/* 메인 컨테이너 */
.packing-container {
  padding: 16px;
  max-width: 1200px;
  margin: 0 auto;
}

.loading-message {
  text-align: center;
  padding: 60px 20px;
  font-size: 1.2em;
  color: #888;
}

.empty-message {
  text-align: center;
  padding: 60px 20px;
  font-size: 1.2em;
  color: #888;
  background: white;
  border-radius: 12px;
  margin: 20px 0;
}

/* 고객 카드 */
.customer-card {
  background: white;
  border-radius: 12px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  overflow: hidden;
  transition: all 0.3s;
}

.customer-card.all-checked {
  opacity: 0.6;
  transform: scale(0.98);
}

.customer-card.all-checked .customer-header {
  background: #27ae60;
}

/* 고객 헤더 */
.customer-header {
  background: linear-gradient(135deg, #34495e 0%, #2c3e50 100%);
  color: white;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.customer-info {
  flex: 1;
}

.customer-name {
  font-size: 1.3em;
  font-weight: 700;
  margin-bottom: 4px;
}

.customer-name .nickname {
  font-weight: 400;
  opacity: 0.85;
  font-size: 0.85em;
}

.customer-phone {
  font-size: 0.95em;
  opacity: 0.9;
}

.customer-subtotal {
  font-size: 1.2em;
  font-weight: 700;
  background: rgba(255,255,255,0.2);
  padding: 8px 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.payment-status {
  font-size: 0.75em;
  padding: 4px 10px;
  border-radius: 12px;
  font-weight: 600;
}

.payment-status.paid {
  background: #27ae60;
  color: white;
}

.payment-status.unpaid {
  background: #e74c3c;
  color: white;
}

/* 고객 주소 */
.customer-address {
  background: #f8f9fa;
  padding: 12px 20px;
  font-size: 0.95em;
  color: #555;
  border-bottom: 1px solid #eee;
}

/* 상품 목록 */
.product-list {
  padding: 0;
}

.product-item {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #eee;
  gap: 12px;
}

.packing-check {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  cursor: pointer;
  accent-color: #0066cc;
}

.product-item:last-child {
  border-bottom: none;
}

.product-item:active {
  background: #f0f0f0;
}

/* 상품 정보 */
.product-info {
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.product-name {
  font-size: 1.1em;
  font-weight: 500;
  color: #333;
}

.product-details {
  display: flex;
  align-items: center;
  gap: 16px;
}

.product-qty {
  font-size: 1.2em;
  font-weight: 700;
  color: #e74c3c;
  min-width: 60px;
  text-align: center;
}

.product-amount {
  font-size: 1em;
  color: #666;
  min-width: 90px;
  text-align: right;
}

/* 완료 배지 */
.complete-badge {
  display: none;
  background: #27ae60;
  color: white;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.85em;
  font-weight: 600;
}

.customer-card.all-checked .complete-badge {
  display: inline-block;
}

/* 연결 상태 표시 (필터바 오른쪽) */
.connection-status {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85em;
  padding: 6px 12px;
  border-radius: 16px;
  background: #f0f0f0;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #f39c12;
  animation: pulse 1.5s infinite;
}

.connection-status.connected {
  background: #e8f5e9;
}

.connection-status.connected .status-dot {
  background: #27ae60;
  animation: none;
}

.connection-status.disconnected {
  background: #ffebee;
}

.connection-status.disconnected .status-dot {
  background: #e74c3c;
  animation: none;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* 토스트 알림 */
.toast-container {
  position: fixed;
  bottom: 80px;
  right: 20px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 350px;
}

.toast {
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  padding: 16px 20px;
  cursor: pointer;
  animation: slideIn 0.3s ease-out;
  border-left: 4px solid #27ae60;
  transition: transform 0.2s, opacity 0.3s;
}

.toast:hover {
  transform: translateX(-5px);
}

.toast.hiding {
  opacity: 0;
  transform: translateX(100%);
}

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

.toast-title {
  font-weight: 700;
  font-size: 1em;
  color: #27ae60;
}

.toast-close {
  background: none;
  border: none;
  font-size: 1.2em;
  color: #999;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.toast-close:hover {
  color: #333;
}

.toast-body {
  font-size: 0.95em;
  color: #333;
}

.toast-body .customer-name {
  font-weight: 600;
}

.toast-hint {
  font-size: 0.8em;
  color: #888;
  margin-top: 8px;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* 하이라이트 효과 */
.customer-card.highlight {
  animation: highlightPulse 2s ease-out;
}

@keyframes highlightPulse {
  0% { box-shadow: 0 0 0 4px #3498db; }
  100% { box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
}

/* 스크롤바 스타일 (태블릿) */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
  background: #bbb;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #999;
}

/* 반응형 - 작은 태블릿/큰 폰 */
@media (max-width: 768px) {
  .filter-bar {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }

  .customer-header {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }

  .customer-subtotal {
    align-self: flex-end;
  }

  .product-info {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .product-details {
    width: 100%;
    justify-content: space-between;
  }
}

/* ========== 플로팅 검색 버튼 ========== */
.floating-search {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 500;
}

.fab-search {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
  border: none;
  box-shadow: 0 4px 16px rgba(52, 152, 219, 0.4);
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fab-search:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 24px rgba(52, 152, 219, 0.5);
}

.fab-search:active {
  transform: scale(0.95);
}

.fab-icon {
  font-size: 24px;
}

.floating-search.active .fab-search {
  background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
}

.floating-search.active .fab-icon {
  display: none;
}

.floating-search.active .fab-search::after {
  content: '✕';
  font-size: 24px;
  color: white;
}

/* 검색 패널 */
.search-panel {
  position: absolute;
  bottom: 70px;
  right: 0;
  width: 320px;
  background: white;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.9);
  transition: all 0.3s ease;
}

.floating-search.active .search-panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.search-input-wrapper {
  position: relative;
  padding: 16px;
  background: #f8f9fa;
  border-bottom: 1px solid #eee;
}

.search-input-wrapper input {
  width: 100%;
  padding: 14px 40px 14px 16px;
  font-size: 16px;
  border: 2px solid #ddd;
  border-radius: 12px;
  outline: none;
  transition: border-color 0.2s;
}

.search-input-wrapper input:focus {
  border-color: #3498db;
}

.search-input-wrapper input::placeholder {
  color: #aaa;
}

.search-clear {
  position: absolute;
  right: 26px;
  top: 50%;
  transform: translateY(-50%);
  background: #ddd;
  border: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 14px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  color: #666;
}

.search-clear.visible {
  display: flex;
}

.search-clear:hover {
  background: #ccc;
}

/* 검색 결과 */
.search-results {
  max-height: 350px;
  overflow-y: auto;
}

.search-results:empty::after {
  content: '검색어를 입력하세요';
  display: block;
  padding: 30px 20px;
  text-align: center;
  color: #999;
  font-size: 14px;
}

.search-result-item {
  padding: 14px 16px;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
  transition: background 0.15s;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover {
  background: #f8f9fa;
}

.search-result-item:active {
  background: #e8f4fc;
}

.result-name {
  font-weight: 600;
  font-size: 15px;
  color: #333;
  margin-bottom: 4px;
}

.result-name .nickname {
  font-weight: 400;
  color: #666;
  font-size: 13px;
}

.result-phone {
  font-size: 13px;
  color: #666;
  margin-bottom: 4px;
}

.result-items {
  font-size: 12px;
  color: #888;
}

.result-highlight {
  background: #fff59d;
  padding: 1px 2px;
  border-radius: 2px;
}

.search-no-result {
  padding: 30px 20px;
  text-align: center;
  color: #999;
  font-size: 14px;
}

/* 모바일에서 검색 패널 더 크게 */
@media (max-width: 480px) {
  .search-panel {
    width: calc(100vw - 48px);
    right: -12px;
  }
}
