* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #e5e5ea;
  color: #1d1d1f;
  overflow-x: hidden;
}

.page {
  display: none;
  min-height: 100vh;
  padding-bottom: 20px;
}

.page.active {
  display: block;
}

/* Header */
header {
  padding: 8px 12px;
  background: transparent;
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.admin-btn {
  width: 36px;
  height: 36px;
  background: #2a2a2a;
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
}

/* Search */
.search-container {
  padding: 12px 16px;
  background: #f2f2f7;
}

.search-box {
  position: relative;
  width: 100%;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  opacity: 0.4;
  color: #86868b;
}

.search-box input {
  width: 100%;
  padding: 9px 16px 9px 38px;
  border-radius: 8px;
  border: none;
  background: #e5e5ea;
  color: #1d1d1f;
  font-size: 14px;
}

.search-box input::placeholder {
  color: #86868b;
}

/* Profile */
.profile-container {
  padding: 0 16px 12px;
  background: #f2f2f7;
}

.profile-card {
  padding: 10px 12px;
  background: #e5e5ea;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: background 0.2s;
}

.profile-card:active {
  background: #d1d1d6;
}

.profile-avatar {
  width: 36px;
  height: 36px;
  background: #c5c5ca;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 600;
  color: #1d1d1f;
  flex-shrink: 0;
  overflow: hidden;
}

.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.profile-name {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  color: #1d1d1f;
}

.profile-link {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #86868b;
  font-size: 13px;
}

/* Banners */
.banners {
  padding: 0 16px 16px;
  overflow-x: auto;
  display: flex;
  gap: 10px;
  scrollbar-width: none;
}

.banners::-webkit-scrollbar {
  display: none;
}

.banner {
  min-width: 240px;
  height: 120px;
  border-radius: 10px;
  background-size: cover;
  background-position: center;
  position: relative;
  overflow: hidden;
}

.banner-text {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px;
  background: linear-gradient(transparent, rgba(0,0,0,0.8));
  font-weight: 600;
  font-size: 12px;
}

/* Categories */
.categories {
  padding: 0 16px 16px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.category-card {
  height: 130px;
  border-radius: 10px;
  background-size: cover;
  background-position: center;
  position: relative;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.2s;
}

.category-card:active {
  transform: scale(0.98);
}

.category-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, transparent 50%);
}

.category-name {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 14px;
  font-weight: 700;
  z-index: 1;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,0.9), 0 0 20px rgba(0,0,0,0.7);
  text-align: center;
  white-space: nowrap;
}

/* Products */
.products-grid {
  padding: 12px 16px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  background: #f2f2f7;
}

.product-card {
  background: #f2f2f7;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
  transition: transform 0.2s;
}

.product-card:active {
  transform: scale(0.98);
}

.product-image {
  width: 100%;
  height: 160px;
  object-fit: cover;
}

.product-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  background: #ff3b30;
  color: #fff;
  padding: 3px 6px;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 600;
}

.product-info {
  padding: 10px;
}

.product-name {
  font-size: 13px;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #1d1d1f;
  font-weight: 500;
}

.product-price {
  font-size: 16px;
  font-weight: 600;
  color: #1d1d1f;
}

.product-old-price {
  font-size: 12px;
  color: #86868b;
  text-decoration: line-through;
  margin-left: 4px;
}

.add-to-cart-btn {
  width: 100%;
  padding: 8px;
  background: #1d1d1f;
  border: none;
  border-radius: 7px;
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  margin-top: 6px;
  transition: background 0.2s;
}

.add-to-cart-btn:active {
  background: #000;
}

/* Page Header */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #2c2c2e;
  position: sticky;
  top: 0;
  z-index: 100;
}

.back-btn, .fav-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  font-size: 20px;
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.back-btn {
  background: #3a3a3c;
  color: #fff;
}

.back-btn:active {
  background: #4a4a4c;
}

.fav-btn {
  background: rgba(255, 255, 255, 0.9);
}

.fav-btn:active {
  background: rgba(255, 255, 255, 1);
}

.page-header h2 {
  flex: 1;
  text-align: center;
  font-size: 16px;
  color: #fff;
  font-weight: 600;
}

/* Product Detail */
#product-details {
  padding: 12px 16px;
}

.product-detail-image {
  width: 100%;
  height: 320px;
  object-fit: cover;
  border-radius: 10px;
  margin-bottom: 16px;
}

.product-detail-name {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 8px;
  color: #1d1d1f;
}

.product-detail-description {
  color: #86868b;
  margin-bottom: 16px;
  line-height: 1.5;
  font-size: 14px;
}

.product-detail-price {
  font-size: 26px;
  font-weight: 600;
  color: #1d1d1f;
  margin-bottom: 16px;
}

/* Profile Page */
.profile-content {
  padding: 0;
  background: #1c1c1e;
  min-height: 100vh;
  max-width: 500px;
  margin: 0 auto;
  overflow-x: hidden;
}

.profile-content::-webkit-scrollbar {
  display: none;
}

.profile-info {
  text-align: center;
  padding: 30px 16px 24px;
  background: #2c2c2e;
}

.avatar {
  width: 80px;
  height: 80px;
  background: #3a3a3c;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  margin: 0 auto 12px;
  overflow: hidden;
  border: 3px solid #4a4a4c;
  box-shadow: 0 3px 10px rgba(0,0,0,0.3);
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.profile-info h3 {
  font-size: 18px;
  font-weight: 600;
  color: #fff;
}

.profile-menu {
  padding: 16px;
  background: #1c1c1e;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  max-width: 500px;
  margin: 0 auto;
}

.menu-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  padding: 14px;
  background: #2c2c2e;
  border-radius: 12px;
  cursor: pointer;
  min-height: 100px;
  transition: background 0.2s;
}

.menu-item:active {
  background: #3a3a3c;
}

.menu-item-icon {
  width: 38px;
  height: 38px;
  background: #3a3a3c;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-bottom: 12px;
}

.menu-item-text {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  font-weight: 500;
  color: #fff;
  width: 100%;
  justify-content: space-between;
}

.menu-item-text span:last-child {
  color: #666;
  font-size: 16px;
}
