/* ================================================
   ACERO SHOP V2 - REUSABLE COMPONENTS
   ================================================
   Shared UI components used across multiple pages.
   Mobile First. Shopee-style Design System.
   ================================================ */

/* ============================================
   HEADER
   ============================================ */

.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background-color: var(--color-primary);
  display: flex;
  align-items: center;
  padding: 0 var(--space-12);
  z-index: var(--z-index-header);
  gap: var(--space-8);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.header-logo {
  height: 32px;
  flex-shrink: 0;
}

.header-logo img {
  height: 100%;
  width: auto;
}

.header-search {
  flex: 1;
  position: relative;
  min-width: 0;
}

.header-search input {
  width: 100%;
  height: 36px;
  padding: 0 var(--space-12) 0 var(--space-36);
  border-radius: 20px;
  border: none;
  background-color: rgba(255, 255, 255, 0.2);
  color: var(--color-text-white);
  font-size: var(--font-size-description);
  transition: background-color var(--transition-fast);
}

.header-search input::placeholder {
  color: rgba(255, 255, 255, 0.7);
}

.header-search input:focus {
  background-color: rgba(255, 255, 255, 0.35);
  outline: none;
}

.header-search-icon {
  position: absolute;
  left: var(--space-12);
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  color: rgba(255, 255, 255, 0.8);
  pointer-events: none;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-shrink: 0;
}

.header-btn {
  position: relative;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  color: var(--color-text-white);
  font-size: 20px;
  transition: background-color var(--transition-fast);
}

.header-btn:hover {
  background-color: rgba(255, 255, 255, 0.15);
}

.header-btn .badge-count {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background-color: var(--color-danger);
  color: var(--color-text-white);
  font-size: 10px;
  font-weight: var(--font-weight-bold);
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* Header - White variant (for non-homepage) */
.header-white {
  background-color: var(--color-card-background);
  box-shadow: var(--shadow-light);
}

.header-white .header-search input {
  background-color: #F5F5F5;
  color: var(--color-text-primary);
}

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

.header-white .header-search-icon {
  color: var(--color-text-muted);
}

.header-white .header-btn {
  color: var(--color-text-primary);
}

.header-white .header-btn:hover {
  background-color: #F5F5F5;
}

/* Header back button */
.header-back {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  color: var(--color-text-white);
  font-size: 22px;
  flex-shrink: 0;
}

.header-white .header-back {
  color: var(--color-text-primary);
}

.header-title {
  font-size: var(--font-size-card-title);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-white);
  flex: 1;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-white .header-title {
  color: var(--color-text-primary);
}

/* ============================================
   BOTTOM NAVIGATION (MOBILE)
   ============================================ */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-height);
  background-color: var(--color-card-background);
  border-top: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: var(--z-index-header);
  padding-bottom: env(safe-area-inset-bottom);
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 60px;
  padding: var(--space-4) var(--space-8);
  color: var(--color-text-muted);
  font-size: 10px;
  font-weight: var(--font-weight-medium);
  transition: color var(--transition-fast);
  cursor: pointer;
  border-radius: var(--radius-small);
}

.bottom-nav-item.active {
  color: var(--color-primary);
}

.bottom-nav-item .nav-icon {
  font-size: 22px;
  position: relative;
}

.bottom-nav-item .badge-count {
  position: absolute;
  top: -6px;
  right: -10px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  background-color: var(--color-danger);
  color: var(--color-text-white);
  font-size: 9px;
  font-weight: var(--font-weight-bold);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* Hide bottom nav on desktop */
@media (min-width: 1024px) {
  .bottom-nav {
    display: none;
  }
}

/* ============================================
   SEARCH SUGGESTIONS DROPDOWN
   ============================================ */

.search-suggestions {
  position: absolute;
  top: calc(100% + var(--space-8));
  left: 0;
  right: 0;
  background-color: var(--color-card-background);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-elevated);
  max-height: 300px;
  overflow-y: auto;
  z-index: var(--z-index-dropdown);
}

.search-suggestion-item {
  padding: var(--space-12) var(--space-16);
  font-size: var(--font-size-description);
  color: var(--color-text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: var(--space-8);
  transition: background-color var(--transition-fast);
}

.search-suggestion-item:hover {
  background-color: #F5F5F5;
}

.search-suggestion-item .suggestion-icon {
  color: var(--color-text-muted);
  font-size: 16px;
}

/* ============================================
   CATEGORY GRID
   ============================================ */

.category-scroll {
  display: flex;
  gap: var(--space-12);
  overflow-x: auto;
  padding: var(--space-12) 0;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

.category-scroll::-webkit-scrollbar {
  display: none;
}

.category-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-8);
  min-width: 72px;
  flex-shrink: 0;
  scroll-snap-align: start;
  cursor: pointer;
  padding: var(--space-8);
  border-radius: var(--radius-card);
  transition: background-color var(--transition-fast);
}

.category-item:hover {
  background-color: #F5F5F5;
}

.category-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-full);
  background-color: #F0FDF9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: var(--color-primary);
}

.category-name {
  font-size: var(--font-size-small);
  color: var(--color-text-primary);
  text-align: center;
  white-space: nowrap;
}

/* ============================================
   PRODUCT CARD (Shopee Style)
   ============================================ */

.product-card {
  background-color: var(--color-card-background);
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: box-shadow var(--transition-normal), transform var(--transition-normal);
  cursor: pointer;
  position: relative;
}

.product-card:hover {
  box-shadow: var(--shadow-hover);
}

.product-card:active {
  transform: scale(0.98);
}

.product-card-image {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background-color: #F5F5F5;
}

.product-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

.product-card:hover .product-card-image img {
  transform: scale(1.03);
}

.product-card-badges {
  position: absolute;
  top: var(--space-8);
  left: var(--space-8);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.product-card-wishlist {
  position: absolute;
  top: var(--space-8);
  right: var(--space-8);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background-color: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--color-text-muted);
  transition: color var(--transition-fast), background-color var(--transition-fast);
  z-index: 2;
}

.product-card-wishlist:hover {
  background-color: var(--color-card-background);
}

.product-card-wishlist.active {
  color: var(--color-danger);
}

.product-card-info {
  padding: var(--space-8) var(--space-12) var(--space-12);
}

.product-card-name {
  font-size: var(--font-size-card-title);
  font-weight: var(--font-weight-regular);
  color: var(--color-text-primary);
  margin-bottom: var(--space-4);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: var(--line-height-tight);
  min-height: 34px;
}

.product-card-price {
  font-size: var(--font-size-price);
  font-weight: var(--font-weight-bold);
  color: var(--color-primary);
  margin-bottom: var(--space-4);
}

.product-card-price .original-price {
  font-size: var(--font-size-small);
  color: var(--color-text-muted);
  text-decoration: line-through;
  font-weight: var(--font-weight-regular);
  margin-left: var(--space-4);
}

.product-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--font-size-small);
  color: var(--color-text-muted);
}

.product-card-rating {
  display: flex;
  align-items: center;
  gap: 2px;
}

.product-card-rating .star {
  color: #F39C12;
  font-size: 11px;
}

.product-card-sold {
  font-size: 10px;
}

.product-card-store {
  font-size: 10px;
  color: var(--color-text-muted);
  margin-top: var(--space-4);
}

/* Discount badge on card */
.product-card-discount {
  position: absolute;
  top: 0;
  right: 0;
  background-color: var(--color-badge-flash);
  color: var(--color-text-white);
  font-size: 10px;
  font-weight: var(--font-weight-bold);
  padding: var(--space-4) var(--space-8);
  border-radius: 0 var(--radius-card) 0 var(--radius-card);
  z-index: 2;
}

/* ============================================
   PRODUCT GRID LAYOUT
   ============================================ */

.product-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--product-grid-gap);
}

@media (min-width: 768px) {
  .product-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--product-grid-gap-tablet);
  }
}

@media (min-width: 1024px) {
  .product-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: var(--product-grid-gap-desktop);
  }
}

@media (min-width: 1280px) {
  .product-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}

/* ============================================
   STORE CARD
   ============================================ */

.store-card {
  display: flex;
  align-items: center;
  gap: var(--space-12);
  padding: var(--space-12) var(--space-16);
  background-color: var(--color-card-background);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: box-shadow var(--transition-fast);
}

.store-card:hover {
  box-shadow: var(--shadow-hover);
}

.store-card-logo {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  overflow: hidden;
  flex-shrink: 0;
  background-color: #F5F5F5;
}

.store-card-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.store-card-info {
  flex: 1;
  min-width: 0;
}

.store-card-name {
  font-size: var(--font-size-card-title);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
  margin-bottom: var(--space-4);
}

.store-card-meta {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  font-size: var(--font-size-small);
  color: var(--color-text-muted);
}

.store-card-rating {
  display: flex;
  align-items: center;
  gap: 2px;
  color: #F39C12;
}

/* ============================================
   FORM GROUP
   ============================================ */

.form-group {
  margin-bottom: var(--space-16);
}

.form-label {
  display: block;
  font-size: var(--font-size-description);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-primary);
  margin-bottom: var(--space-8);
}

.form-label .required {
  color: var(--color-danger);
  margin-left: 2px;
}

.form-hint {
  font-size: var(--font-size-small);
  color: var(--color-text-muted);
  margin-top: var(--space-4);
}

.form-error {
  font-size: var(--font-size-small);
  color: var(--color-danger);
  margin-top: var(--space-4);
  display: none;
}

.form-group.error .form-error {
  display: block;
}

.form-group.error input,
.form-group.error textarea,
.form-group.error select {
  border-color: var(--color-danger);
}

.form-group.error input:focus,
.form-group.error textarea:focus {
  box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
}

/* ============================================
   INPUT WITH ICON
   ============================================ */

.input-icon-wrapper {
  position: relative;
}

.input-icon-wrapper input {
  padding-left: var(--space-40);
}

.input-icon-wrapper .input-icon {
  position: absolute;
  left: var(--space-12);
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  color: var(--color-text-muted);
  pointer-events: none;
}

.input-icon-wrapper .input-icon-right {
  left: auto;
  right: var(--space-12);
  cursor: pointer;
  pointer-events: auto;
}

/* ============================================
   PASSWORD TOGGLE
   ============================================ */

.password-toggle {
  position: absolute;
  right: var(--space-12);
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  color: var(--color-text-muted);
  cursor: pointer;
  background: none;
  border: none;
  padding: var(--space-4);
}

/* ============================================
   CHECKBOX & RADIO
   ============================================ */

.checkbox-group,
.radio-group {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  cursor: pointer;
  font-size: var(--font-size-description);
  color: var(--color-text-primary);
}

.checkbox-group input[type="checkbox"],
.radio-group input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: var(--color-primary);
  cursor: pointer;
  flex-shrink: 0;
}

/* ============================================
   IMAGE UPLOAD AREA
   ============================================ */

.upload-area {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-card);
  padding: var(--space-32) var(--space-16);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition-fast), background-color var(--transition-fast);
}

.upload-area:hover {
  border-color: var(--color-primary);
  background-color: #F0FDF9;
}

.upload-area .upload-icon {
  font-size: 40px;
  color: var(--color-text-muted);
  margin-bottom: var(--space-12);
}

.upload-area .upload-text {
  font-size: var(--font-size-description);
  color: var(--color-text-secondary);
}

.upload-area .upload-hint {
  font-size: var(--font-size-small);
  color: var(--color-text-muted);
  margin-top: var(--space-4);
}

.upload-preview {
  width: 100%;
  max-height: 200px;
  object-fit: contain;
  margin-top: var(--space-12);
  border-radius: var(--radius-card);
}

/* ============================================
   PAGINATION / LOAD MORE
   ============================================ */

.load-more-btn {
  display: block;
  width: 100%;
  padding: var(--space-12);
  text-align: center;
  background-color: var(--color-card-background);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-button);
  color: var(--color-text-secondary);
  font-size: var(--font-size-description);
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-top: var(--space-16);
}

.load-more-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.load-more-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ============================================
   PAGE HEADER (for internal pages)
   ============================================ */

.page-header {
  background-color: var(--color-primary);
  padding: var(--space-16) var(--space-16) var(--space-24);
  color: var(--color-text-white);
}

.page-header-white {
  background-color: var(--color-card-background);
  color: var(--color-text-primary);
  border-bottom: 1px solid var(--color-border);
}

.page-header-title {
  font-size: var(--font-size-heading-2);
  font-weight: var(--font-weight-bold);
  margin-bottom: var(--space-4);
}

.page-header-subtitle {
  font-size: var(--font-size-description);
  opacity: 0.8;
}

/* ============================================
   TAB NAVIGATION
   ============================================ */

.tabs {
  display: flex;
  border-bottom: 1px solid var(--color-border);
  background-color: var(--color-card-background);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab-item {
  padding: var(--space-12) var(--space-16);
  font-size: var(--font-size-description);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-muted);
  white-space: nowrap;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.tab-item.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

.tab-item:hover {
  color: var(--color-primary);
}

/* ============================================
   STAT CARD (Dashboard)
   ============================================ */

.stat-card {
  background-color: var(--color-card-background);
  border-radius: var(--radius-card);
  padding: var(--space-16);
  box-shadow: var(--shadow-card);
}

.stat-card-label {
  font-size: var(--font-size-small);
  color: var(--color-text-muted);
  margin-bottom: var(--space-4);
}

.stat-card-value {
  font-size: var(--font-size-section-title);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-primary);
}

.stat-card-change {
  font-size: var(--font-size-small);
  margin-top: var(--space-4);
}

.stat-card-change.positive {
  color: var(--color-success);
}

.stat-card-change.negative {
  color: var(--color-danger);
}

/* ============================================
   DATA TABLE (Admin/Dashboard)
   ============================================ */

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-description);
}

.data-table th {
  text-align: left;
  padding: var(--space-12) var(--space-16);
  background-color: #F5F5F5;
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-secondary);
  font-size: var(--font-size-small);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.data-table td {
  padding: var(--space-12) var(--space-16);
  border-bottom: 1px solid var(--color-divider);
  color: var(--color-text-primary);
}

.data-table tr:hover td {
  background-color: #FAFAFA;
}

.data-table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  background-color: var(--color-card-background);
}

/* ============================================
   CARD (Generic)
   ============================================ */

.card {
  background-color: var(--color-card-background);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: var(--space-16);
  margin-bottom: var(--space-12);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-12);
}

.card-title {
  font-size: var(--font-size-card-title);
  font-weight: var(--font-weight-semibold);
}

/* ============================================
   DIVIDER WITH TEXT
   ============================================ */

.divider-text {
  display: flex;
  align-items: center;
  gap: var(--space-12);
  margin: var(--space-20) 0;
}

.divider-text::before,
.divider-text::after {
  content: '';
  flex: 1;
  height: 1px;
  background-color: var(--color-border);
}

.divider-text span {
  font-size: var(--font-size-small);
  color: var(--color-text-muted);
  white-space: nowrap;
}

/* ============================================
   CHIP / FILTER TAG
   ============================================ */

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-6) var(--space-12);
  background-color: #F5F5F5;
  border-radius: 20px;
  font-size: var(--font-size-small);
  color: var(--color-text-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.chip.active {
  background-color: var(--color-primary);
  color: var(--color-text-white);
}

.chip:hover {
  background-color: #EAEAEA;
}

.chip.active:hover {
  background-color: var(--color-primary-dark);
}

/* ============================================
   PULSE ANIMATION (Flash Sale etc.)
   ============================================ */

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

.pulse {
  animation: pulse 1.5s infinite;
}

/* ============================================
   COUNTDOWN TIMER (Flash Sale)
   ============================================ */

.countdown {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.countdown-item {
  background-color: var(--color-text-primary);
  color: var(--color-text-white);
  padding: var(--space-4) var(--space-6);
  border-radius: var(--radius-small);
  font-size: var(--font-size-small);
  font-weight: var(--font-weight-bold);
  min-width: 28px;
  text-align: center;
}

.countdown-separator {
  font-weight: var(--font-weight-bold);
  font-size: var(--font-size-small);
}