/* ============================================================
   Dubuz Alibaba/Temu UI Components
   Primary: #FF4B33 | 8px grid | Mobile-first
   ============================================================ */

/* ---- Lucide SVG Icon sizing ---- */
.al-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.al-icon--xs { width: 14px; height: 14px; }
.al-icon--sm { width: 16px; height: 16px; }
.al-icon--md { width: 20px; height: 20px; }
.al-icon--lg { width: 24px; height: 24px; }

/* ---- Bottom Sheet / Drawer ---- */
.al-sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(0, 0, 0, 0.5);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

.al-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 81;
  background: var(--al-card);
  border-radius: var(--al-radius-xl) var(--al-radius-xl) 0 0;
  max-height: min(85vh, calc(100dvh - 20px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: var(--al-safe-bottom);
}

.al-sheet-handle {
  width: 36px;
  height: 4px;
  background: var(--al-border);
  border-radius: 2px;
  margin: 8px auto;
  flex-shrink: 0;
}

.al-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 16px 12px;
  border-bottom: 1px solid var(--al-border-light);
  flex-shrink: 0;
}

.al-sheet-header h3 {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
}

.al-sheet-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: var(--al-border-light);
  border-radius: 50%;
  color: var(--al-text-secondary);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.al-sheet-close svg {
  width: 18px;
  height: 18px;
}

.al-sheet-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 16px 16px;
}

.al-sheet-footer {
  flex-shrink: 0;
  padding: 12px 16px calc(12px + var(--al-safe-bottom));
  border-top: 1px solid var(--al-border-light);
}

.al-sheet-option {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 12px 4px;
  border: none;
  background: transparent;
  font-size: 14px;
  font-weight: 500;
  color: var(--al-text);
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  border-bottom: 1px solid var(--al-border-light);
  gap: 8px;
}

.al-sheet-option:last-child {
  border-bottom: none;
}

.al-sheet-option:active {
  background: var(--al-border-light);
}

.al-sheet-option.is-active {
  color: var(--al-primary);
  font-weight: 700;
}

.al-sheet-option .al-check-icon {
  margin-left: auto;
  color: var(--al-primary);
  display: none;
}

.al-sheet-option.is-active .al-check-icon {
  display: block;
}

/* ---- Filter Chips ---- */
.al-filter-bar {
  display: flex;
  gap: 8px;
  padding: 8px 12px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  white-space: nowrap;
  background: var(--al-card);
  border-bottom: 1px solid var(--al-border-light);
}

.al-filter-bar::-webkit-scrollbar { display: none; }

.al-filter-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 14px;
  height: 36px;
  border: 1px solid var(--al-border);
  border-radius: 999px;
  background: var(--al-card);
  color: var(--al-text-secondary);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.al-filter-chip svg {
  width: 16px;
  height: 16px;
}

.al-filter-chip:active {
  transform: scale(0.96);
}

.al-filter-chip.active {
  background: var(--al-primary);
  border-color: var(--al-primary);
  color: #fff;
}

.al-filter-chip.active svg {
  color: #fff;
}

/* ---- Listing Card (List View) ---- */
.al-list-card {
  display: flex;
  gap: 10px;
  padding: 10px;
  background: var(--al-card);
  border-radius: var(--al-radius-md);
  box-shadow: var(--al-shadow-sm);
  text-decoration: none;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

.al-list-card:active {
  box-shadow: var(--al-shadow-md);
}

.al-list-image {
  width: 100px;
  height: 100px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--al-border-light);
}

.al-list-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.al-list-price {
  font-size: 15px;
  font-weight: 700;
  color: var(--al-primary);
}

.al-list-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--al-text);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.al-list-location {
  font-size: 11px;
  color: var(--al-text-muted);
  display: flex;
  align-items: center;
  gap: 3px;
  margin-top: auto;
}

.al-list-location svg {
  width: 12px;
  height: 12px;
}

/* ---- Comment Card ---- */
.al-comment {
  display: flex;
  gap: 8px;
  padding: 10px 0;
}

.al-comment-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--al-border-light);
}

.al-comment-body {
  flex: 1;
  min-width: 0;
  padding: 10px;
  background: var(--al-border-light);
  border-radius: 14px;
}

.al-comment-author {
  font-size: 13px;
  font-weight: 600;
  color: var(--al-text);
}

.al-comment-time {
  font-size: 11px;
  color: var(--al-text-muted);
  margin-left: 6px;
}

.al-comment-text {
  font-size: 13px;
  color: var(--al-text-secondary);
  margin-top: 2px;
  line-height: 1.45;
}

/* ---- Comment Compose ---- */
.al-compose-bar {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px 12px;
  background: var(--al-card);
  border-top: 1px solid var(--al-border-light);
  margin: 8px -12px -12px;
}

.al-compose-input {
  flex: 1;
  height: 40px;
  padding: 0 14px;
  border: none;
  background: var(--al-border-light);
  border-radius: 20px;
  font-size: 14px;
  color: var(--al-text);
  outline: none;
  font-family: inherit;
}

.al-compose-input::placeholder {
  color: var(--al-text-muted);
}

.al-compose-btn {
  height: 36px;
  padding: 0 16px;
  border: none;
  background: var(--al-primary);
  color: #fff;
  border-radius: 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  flex-shrink: 0;
  transition: transform 0.12s ease;
}

.al-compose-btn:active {
  transform: scale(0.97);
}

.al-compose-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

/* ---- Similar Listing Horizontal Scroll ---- */
.al-similar-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  scroll-snap-type: x mandatory;
  padding-bottom: 4px;
}

.al-similar-scroll::-webkit-scrollbar { display: none; }

.al-similar-card {
  flex: 0 0 140px;
  scroll-snap-align: start;
  text-decoration: none;
  color: inherit;
  border-radius: 10px;
  overflow: hidden;
  background: var(--al-card);
  border: 1px solid var(--al-border-light);
}

.al-similar-image {
  aspect-ratio: 4/3;
  object-fit: cover;
  width: 100%;
  display: block;
  background: var(--al-border-light);
}

.al-similar-info {
  padding: 6px 8px 8px;
}

.al-similar-price {
  font-size: 13px;
  font-weight: 700;
  color: var(--al-primary);
}

.al-similar-title {
  font-size: 11px;
  color: var(--al-text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 2px;
}

/* ---- Loading Skeleton (product grid) ---- */
.al-skeleton-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 0 12px;
}

@media (min-width: 640px) {
  .al-skeleton-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1024px) {
  .al-skeleton-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.al-skeleton-grid .al-skeleton-product {
  background: var(--al-card);
  border-radius: var(--al-radius-md);
  overflow: hidden;
}

/* ---- Pull to Refresh indicator ---- */
.al-pull-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  font-size: 13px;
  color: var(--al-text-muted);
  transition: opacity 0.2s ease;
}

.al-pull-indicator svg {
  width: 20px;
  height: 20px;
  animation: al-spin 1s linear infinite;
}

@keyframes al-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ---- Empty State ---- */
.al-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
}

.al-empty-state svg {
  width: 48px;
  height: 48px;
  color: var(--al-border);
  margin-bottom: 12px;
}

.al-empty-state h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--al-text);
  margin: 0 0 4px;
}

.al-empty-state p {
  font-size: 13px;
  color: var(--al-text-muted);
  margin: 0;
}

/* ---- Notification Bell Popover ---- */
.al-notif-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 320px;
  max-width: calc(100vw - 24px);
  background: var(--al-card);
  border-radius: var(--al-radius-lg);
  box-shadow: var(--al-shadow-lg);
  border: 1px solid var(--al-border-light);
  overflow: hidden;
  z-index: 100;
}

.al-notif-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--al-border-light);
}

.al-notif-header h4 {
  font-size: 14px;
  font-weight: 700;
  margin: 0;
}

.al-notif-item {
  display: flex;
  gap: 10px;
  padding: 10px 16px;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid var(--al-border-light);
  transition: background 0.1s ease;
}

.al-notif-item:active {
  background: var(--al-border-light);
}

.al-notif-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 16px;
}

.al-notif-content {
  flex: 1;
  min-width: 0;
}

.al-notif-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--al-text);
}

.al-notif-desc {
  font-size: 12px;
  color: var(--al-text-muted);
  margin-top: 1px;
}

.al-notif-time {
  font-size: 11px;
  color: var(--al-text-muted);
  margin-top: 2px;
}

/* ---- PWA Install Banner ---- */
.al-install-banner {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(var(--al-nav-height) + var(--al-safe-bottom) + 8px);
  z-index: 55;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--al-card);
  border-radius: var(--al-radius-md);
  box-shadow: var(--al-shadow-lg);
  border: 1px solid var(--al-border-light);
  font-size: 13px;
}

.al-install-banner strong {
  display: block;
  font-size: 13px;
  margin-bottom: 2px;
}

.al-install-banner span {
  color: var(--al-text-muted);
  font-size: 12px;
}

.al-install-banner .al-install-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.al-install-banner button {
  border: none;
  border-radius: 10px;
  height: 36px;
  padding: 0 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.al-install-go {
  background: var(--al-primary);
  color: #fff;
}

.al-install-dismiss {
  background: transparent;
  color: var(--al-text-muted);
}

/* ---- Search Input ---- */
.al-search-input {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 12px;
  background: var(--al-border-light);
  border-radius: 10px;
  border: 1px solid transparent;
  transition: border-color 0.15s ease;
}

.al-search-input:focus-within {
  border-color: var(--al-primary);
  background: var(--al-card);
}

.al-search-input svg {
  width: 18px;
  height: 18px;
  color: var(--al-text-muted);
  flex-shrink: 0;
}

.al-search-input input {
  flex: 1;
  height: 100%;
  border: none;
  background: transparent;
  font-size: 14px;
  color: var(--al-text);
  outline: none;
  font-family: inherit;
}

.al-search-input input::placeholder {
  color: var(--al-text-muted);
}

/* ---- Location Pill (topbar) ---- */
.al-location-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--al-border-light);
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  color: var(--al-text-secondary);
  cursor: pointer;
  border: none;
  font-family: inherit;
  white-space: nowrap;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s ease;
}

.al-location-pill:active {
  background: #e0e2e5;
}

.al-location-pill svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* ---- Notification Badge (topbar) ---- */
.al-badge-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background: var(--al-primary);
  border-radius: 50%;
  border: 2px solid var(--al-card);
}

/* ---- Responsive adjustments for larger screens ---- */
@media (min-width: 768px) {
  .al-mobile-bottom-nav { display: none !important; }
  .al-mobile-topbar { display: none !important; }
}
