/* ===== CUSTOMER SALES VIEW ===== */
.customer-sales-page {
  height: calc(var(--app-height, 100vh));
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
  overflow: hidden;
}

/* HEADER */
.customer-sales-header {
  width: 100%;
  background: var(--accent);
  padding: 15px 16px;
  border-radius: 0 0 30px 30px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.12);
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #fff;
  flex-shrink: 0;
}
.customer-sales-header span {
  font-size: 22px;
  font-weight: 700;
}
.customer-sales-back {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,.2);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.customer-sales-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.customer-sales-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.15);
  background: rgba(255,255,255,.22);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .2s;
}
.customer-sales-icon-btn:active {
  background: rgba(255,255,255,.35);
}
@keyframes sales-spin {
  to { transform: rotate(360deg); }
}
.customer-sales-icon-btn.loading svg {
  animation: sales-spin 0.7s linear infinite;
}

/* DROPDOWN HARI */
.customer-sales-hari-wrapper {
  position: relative;
}
.customer-sales-hari-dropdown {
  display: none;
  position: absolute;
  top: 44px;
  right: 0;
  background: var(--bg-secondary);
  border-radius: 14px 0 14px 14px;
  box-shadow: 0 6px 24px rgba(0,0,0,.13);
  overflow: hidden;
  z-index: 999;
  min-width: 150px;
}
.customer-sales-hari-dropdown.open {
  display: block;
}
.customer-sales-hari-item {
  padding: 8px 18px;
  font-size: 14px;
  color: var(--text-primary);
  cursor: pointer;
  transition: background .15s;
}
.customer-sales-hari-item:hover {
  background: var(--bg-hover);
}
.customer-sales-hari-item.active {
  font-weight: 700;
  color: var(--accent);
  background: var(--bg-hover);
}
.customer-sales-filter-bulan-tahun {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--border-color);
  margin-top: 4px;
}
.customer-sales-filter-select {
  width: 100%;
  height: 36px;
  border: 1.5px solid var(--border-color);
  border-radius: 10px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  font-family: "Poppins", sans-serif;
  padding: 0 8px;
  outline: none;
  cursor: pointer;
}

/* BOTTOM BAR */
.customer-sales-bottom-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  background: var(--home-header-bg);
  border-radius: 32px 32px 0 0;
  transition: transform .22s ease;
  overflow: hidden;
  will-change: transform;
}
.customer-sales-bottom-bar.closed {
  transform: translateY(calc(100% - 34px));
}
.customer-sales-bottom-toggle {
  width: 100%;
  height: 34px;
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}
.customer-sales-bottom-line {
  width: 52px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255,255,255,.55);
}
.customer-sales-bottom-content {
  padding: 0 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.customer-sales-stats-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}
.customer-sales-stat-box {
  background: rgba(255,255,255,.1);
  border-radius: 12px;
  padding: 8px 12px;
}
.customer-sales-stat-box.full {
  background: rgba(255,255,255,.15);
}
.customer-sales-stat-label {
  font-size: 10px;
  color: rgba(255,255,255,.7);
  margin-bottom: 2px;
  font-weight: 500;
}
.customer-sales-stat-value {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}
.customer-sales-search-input {
  width: 100%;
  height: 38px;
  outline: none;
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1.5px solid var(--accent-light);
  border-radius: 20px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 600;
  box-sizing: border-box;
  transition: .18s;
}
.customer-sales-search-input::placeholder {
  color: var(--text-muted);
}
.customer-sales-search-input:focus {
  border-color: var(--accent);
}

/* LIST */
.customer-sales-wrapper {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  box-sizing: border-box;
  min-height: 0;
}
.customer-sales-panel {
  width: 100%;
  border-radius: 18px;
  padding: 14px;
  box-sizing: border-box;
}
.customer-sales-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding-bottom: 100px;
}
.customer-sales-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 7px 10px;
  border-radius: 30px;
  background: var(--customer-list);
  margin-bottom: 5px;
  cursor: pointer;
}
.customer-sales-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--popup-handle-bg);
  flex-shrink: 0;
}
.customer-sales-info {
  display: flex;
  flex-direction: column;
  flex: 1;
}
.customer-sales-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-heading);
}
.customer-sales-distance {
  font-size: 12px;
  color: var(--text-muted);
}
.customer-sales-hari-badge {
  font-size: 12px;
  color: var(--text-muted);
}
.customer-sales-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}
.customer-sales-action-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: var(--nav-fab-border);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .2s;
}
.customer-sales-action-btn:active {
  background: var(--bg-hover);
  color: var(--accent);
}
.placeholder {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 14px;
}

/* ── SALES HARI DROPDOWN ── */
.sales-hari-dropdown-wrap {
  position: relative;
}
.sales-hari-dropdown-btn {
  width: 100%;
  height: 50px;
  border: none;
  outline: none;
  background: var(--bg-primary);
  border-radius: 16px;
  padding: 0 16px;
  font-size: 15px;
  color: var(--popup-btn-text);
  font-family: "Poppins", sans-serif;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  text-align: left;
}
.sales-hari-dropdown-list {
  position: absolute;
  top: 54px;
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border-radius: 14px;
  box-shadow: 0 6px 24px rgba(0,0,0,.15);
  overflow: hidden;
  z-index: 999;
  max-height: 0;
  opacity: 0;
  transform: translateY(-8px);
  transition: max-height .3s cubic-bezier(.4,0,.2,1), opacity .25s ease, transform .25s ease;
  pointer-events: none;
}
.sales-hari-dropdown-list.open {
  max-height: 400px;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.sales-hari-dropdown-item {
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  transition: background .15s;
}
.sales-hari-dropdown-item:hover {
  background: var(--bg-hover);
}
.sales-hari-dropdown-item.active {
  font-weight: 700;
  color: var(--accent);
  background: var(--bg-hover);
}

/* ── MODE SELECT HEADER ── */
.customer-sales-header.select-mode {
  padding: 0 16px;
  height: 66px;
}

.cs-select-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 100%;
  gap: 12px;
}

.cs-select-cancel {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,.2);
  color: #fff;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.cs-select-count {
  flex: 1;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
}

.cs-select-hapus {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: 20px;
  background: #fff;
  color: #e53935;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
}

.cs-select-hapus:disabled {
  opacity: 0.4;
}

.cs-select-hapus svg {
  stroke: #e53935;
}
/* ── ANIMASI SELECT MODE ── */
#csSelectBar {
  animation: csBarIn .25s cubic-bezier(.34,1.56,.64,1) both;
}

@keyframes csBarIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.customer-sales-item {
  transition: background .2s ease, border-left .2s ease, transform .15s ease;
  animation: csItemIn .2s ease both;
}

.customer-sales-item.cs-selected {
  background: rgba(229, 57, 53, 0.08) !important;
  border-left: 3px solid #e53935;
  transform: scale(0.98);
}

.cs-check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border-color);
  flex-shrink: 0;
  margin-right: 8px;
  transition: background .2s ease, border-color .2s ease, transform .2s cubic-bezier(.34,1.56,.64,1);
}

.cs-selected .cs-check {
  background: #e53935;
  border-color: #e53935;
  transform: scale(1.1);
}

.cs-selected .cs-check::after {
  content: "✓";
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 13px;
  height: 100%;
}
/* ── ANIMASI POPUP KONFIRMASI ── */
#csKonfirmasiOverlay {
  animation: csOverlayIn .25s ease both;
}

@keyframes csOverlayIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

#csKonfirmasiOverlay > div {
  animation: csModalIn .3s cubic-bezier(.34,1.56,.64,1) both;
}

@keyframes csModalIn {
  from { opacity: 0; transform: scale(.88) translateY(20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* ── ANIMASI TOAST ── */
#csHapusToast {
  animation: csToastIn .3s cubic-bezier(.34,1.56,.64,1) both;
}

@keyframes csToastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── ANIMASI LIST ITEM MASUK ── */
.customer-sales-item {
  animation: csItemIn .2s ease both;
}

@keyframes csItemIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── DETAIL MODAL VARIAN ── */
.cs-varian-title {
  font-size: 11px;
  font-weight: 700;
  color: rgba(255,255,255,.7);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

.cs-varian-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}

.cs-varian-box {
  background: rgba(255,255,255,.1);
  border-radius: 10px;
  padding: 8px 10px;
  text-align: center;
}

.cs-varian-label {
  font-size: 10px;
  color: rgba(255,255,255,.65);
  margin-bottom: 3px;
  font-weight: 500;
}

.cs-varian-value {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
}

.cs-varian-empty {
  font-size: 12px;
  color: rgba(255,255,255,.5);
  text-align: center;
  padding: 8px 0;
}

.cs-badge-catatan {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  background: var(--accent-light);
  color: var(--accent-dark);
  border-radius: 6px;
  padding: 1px 5px;
  margin-left: 4px;
  vertical-align: middle;
  font-weight: 600;
}