/* ==========================================================================
   SKYLAND BATCH IMPORT (Cập nhật nguồn hàng loạt dạng Trang tính Excel)
   - Nhập thủ công dạng bảng tính / Excel
   - Dán dữ liệu từ file Excel / Google Sheets (Ctrl+V)
   - Đọc & sao chép từ link bảng hàng online
   - Theo dõi & cập nhật trạng thái Đã bán, Lock cọc thời gian thực
   - Quét ảnh danh sách bằng AI Vision
   Dành riêng cho Manager & Admin
   ========================================================================== */

.skyland-batch-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(15, 23, 42, 0.78);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  overflow-y: auto;
  box-sizing: border-box;
  animation: skylandBatchFadeIn 0.2s ease-out;
}

@keyframes skylandBatchFadeIn {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

.skyland-batch-modal {
  width: 100%;
  max-width: 1240px;
  max-height: 95vh;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
}

.skyland-batch-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
}

.skyland-batch-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.skyland-batch-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.skyland-batch-badge-admin {
  background: #f59e0b;
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.skyland-batch-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #ffffff;
  font-size: 1.4rem;
  line-height: 1;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.skyland-batch-close:hover {
  background: rgba(255, 255, 255, 0.35);
}

/* Nav Tabs Chính */
.skyland-batch-nav {
  display: flex;
  background: #f1f5f9;
  border-bottom: 1px solid #e2e8f0;
  padding: 8px 16px 0;
  gap: 8px;
  overflow-x: auto;
}

.skyland-batch-nav-btn {
  padding: 10px 18px;
  border: 1px solid transparent;
  border-bottom: none;
  background: transparent;
  color: #475569;
  font-size: 0.92rem;
  font-weight: 700;
  border-radius: 10px 10px 0 0;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.skyland-batch-nav-btn:hover {
  color: #0369a1;
  background: rgba(255, 255, 255, 0.6);
}

.skyland-batch-nav-btn.is-active {
  background: #ffffff;
  color: #0284c7;
  border-color: #e2e8f0;
  box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.03);
}

.skyland-batch-body {
  padding: 16px 20px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: #f8fafc;
}

/* Thanh công cụ nhập link & Excel toolbar */
.skyland-batch-toolbar {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.skyland-batch-link-bar {
  display: flex;
  gap: 10px;
  align-items: center;
}

.skyland-batch-excel-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px dashed #e2e8f0;
}

.skyland-batch-action-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.skyland-batch-btn-sm {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #334155;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}

.skyland-batch-btn-sm:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

.skyland-batch-btn-primary-sm {
  background: #0284c7;
  border-color: #0284c7;
  color: #ffffff;
}

.skyland-batch-btn-primary-sm:hover {
  background: #0369a1;
  border-color: #0369a1;
}

/* Modal Paste Excel Dialog */
.skyland-batch-paste-box {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.skyland-batch-textarea {
  width: 100%;
  box-sizing: border-box;
  font-family: monospace;
  font-size: 0.85rem;
  padding: 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  outline: none;
  resize: vertical;
}

.skyland-batch-textarea:focus {
  border-color: #0284c7;
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.15);
}

/* Loading Spinner - MẶC ĐỊNH DISPLAY: NONE ĐỂ KHÔNG BỊ ĐƠ */
.skyland-batch-loading {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px 20px;
  color: #0369a1;
  gap: 12px;
  text-align: center;
}

.skyland-batch-loading.is-active {
  display: flex !important;
}

.skyland-batch-spinner {
  width: 36px;
  height: 36px;
  border: 4px solid #e0f2fe;
  border-top-color: #0284c7;
  border-radius: 50%;
  animation: skylandBatchSpin 0.7s linear infinite;
}

@keyframes skylandBatchSpin {
  to { transform: rotate(360deg); }
}

/* Cấu hình chung & Loại nguồn */
.skyland-batch-config-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.skyland-batch-card-title {
  font-size: 0.96rem;
  font-weight: 700;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 8px;
}

.skyland-batch-grid3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

@media (max-width: 768px) {
  .skyland-batch-grid3 {
    grid-template-columns: 1fr;
  }
}

.skyland-batch-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.skyland-batch-field label {
  font-size: 0.78rem;
  font-weight: 600;
  color: #475569;
}

.skyland-batch-input,
.skyland-batch-select {
  padding: 8px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.88rem;
  background: #ffffff;
  outline: none;
  box-sizing: border-box;
}

.skyland-batch-input:focus,
.skyland-batch-select:focus {
  border-color: #0284c7;
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.15);
}

/* KHỐI CÂU HỎI TRƯỜNG VỊ TRÍ */
.skyland-batch-geo-decision-box {
  background: #f0fdf4;
  border: 1.5px solid #86efac;
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.skyland-batch-geo-decision-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: #166534;
  display: flex;
  align-items: center;
  gap: 6px;
}

.skyland-batch-geo-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.skyland-batch-geo-option {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  background: #ffffff;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}

.skyland-batch-geo-option:hover {
  border-color: #22c55e;
  background: #f7fee7;
}

.skyland-batch-geo-option input[type="radio"] {
  margin-top: 3px;
  cursor: pointer;
}

.skyland-batch-geo-desc {
  font-size: 0.78rem;
  color: #64748b;
  margin-top: 2px;
}

/* BẢNG LƯỚI TRANG TÍNH EXCEL (SPREADSHEET GRID) */
.skyland-batch-grid-wrap {
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #ffffff;
  overflow: auto;
  max-height: 420px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

.skyland-batch-grid-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  text-align: left;
}

.skyland-batch-grid-table th {
  background: #f1f5f9;
  color: #334155;
  font-weight: 700;
  padding: 8px 10px;
  border-right: 1px solid #e2e8f0;
  border-bottom: 2px solid #cbd5e1;
  position: sticky;
  top: 0;
  z-index: 10;
  white-space: nowrap;
}

.skyland-batch-grid-table td {
  padding: 4px 6px;
  border-right: 1px solid #f1f5f9;
  border-bottom: 1px solid #e2e8f0;
  vertical-align: middle;
}

.skyland-batch-grid-table tr:hover {
  background: #f8fafc;
}

.skyland-batch-grid-table tr.is-selected {
  background: #e0f2fe;
}

.skyland-batch-cell-input {
  width: 100%;
  border: 1px solid transparent;
  padding: 5px 6px;
  border-radius: 4px;
  font-size: 0.85rem;
  background: transparent;
  outline: none;
  box-sizing: border-box;
}

.skyland-batch-cell-input:hover {
  border-color: #cbd5e1;
  background: #ffffff;
}

.skyland-batch-cell-input:focus {
  border-color: #0284c7;
  background: #ffffff;
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.2);
}

.skyland-batch-badge-geo {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
  display: inline-block;
}

.skyland-batch-badge-geo.is-separate {
  background: #dcfce7;
  color: #15803d;
}

.skyland-batch-badge-geo.is-common {
  background: #fef3c7;
  color: #b45309;
}

.skyland-batch-status-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
  display: inline-block;
}

.skyland-batch-status-badge.is-sold {
  background: #fee2e2;
  color: #b91c1c;
}

.skyland-batch-status-badge.is-locked {
  background: #fef3c7;
  color: #b45309;
}

.skyland-batch-status-badge.is-selling {
  background: #dcfce7;
  color: #15803d;
}

/* Ảnh riêng từng lô */
.skyland-batch-lot-photo-cell {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 110px;
}

.skyland-batch-lot-thumb {
  width: 30px;
  height: 30px;
  border-radius: 4px;
  object-fit: cover;
  border: 1px solid #cbd5e1;
}

.skyland-batch-lot-upload-btn {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  white-space: nowrap;
}

.skyland-batch-lot-upload-btn:hover {
  background: #e2e8f0;
}

.skyland-batch-row-remove {
  background: transparent;
  border: none;
  color: #ef4444;
  font-size: 1rem;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}

.skyland-batch-row-remove:hover {
  background: #fee2e2;
}

/* Khu vực theo dõi bảng hàng online (Online Trackers Tab) */
.skyland-batch-trackers-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.skyland-batch-tracker-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.skyland-batch-tracker-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.skyland-batch-tracker-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #0f172a;
}

.skyland-batch-tracker-meta {
  font-size: 0.8rem;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Footer & Actions */
.skyland-batch-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  gap: 12px;
}

.skyland-batch-stat {
  font-size: 0.88rem;
  color: #475569;
}

.skyland-batch-stat b {
  color: #0369a1;
}

.skyland-batch-foot-btns {
  display: flex;
  align-items: center;
  gap: 10px;
}

.skyland-batch-btn-cancel {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #475569;
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}

.skyland-batch-btn-commit {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border: none;
  color: #ffffff;
  padding: 9px 20px;
  border-radius: 8px;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.3);
  transition: all 0.2s;
}

.skyland-batch-btn-commit:hover {
  filter: brightness(1.08);
}

.skyland-batch-btn-commit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Dropzone Quét Ảnh */
.skyland-batch-dropzone {
  border: 2px dashed #93c5fd;
  background: #f0f9ff;
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.skyland-batch-dropzone:hover {
  border-color: #0284c7;
  background: #e0f2fe;
}

.skyland-batch-dropzone-ico {
  font-size: 2.2rem;
  margin-bottom: 8px;
}

.skyland-batch-dropzone-text {
  font-size: 0.95rem;
  color: #0369a1;
  font-weight: 600;
  margin-bottom: 4px;
}

.skyland-batch-dropzone-hint {
  font-size: 0.8rem;
  color: #64748b;
}

.skyland-batch-image-previews {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.skyland-batch-image-thumb {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #cbd5e1;
}

.skyland-batch-image-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.skyland-batch-thumb-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  background: rgba(239, 68, 68, 0.9);
  color: #ffffff;
  border: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Launch Buttons */
.skyland-batch-launch-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff !important;
  border: none;
  padding: 7px 13px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.25);
  transition: all 0.15s;
}

.skyland-batch-launch-btn:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}
