/* PaiyaHub Marketplace - Style v1 */

:root {
  --primary: #D42A2A;
  --primary-dark: #B71C1C;
  --secondary: #222222;
  --accent: #FF4444;
  --bg: #FFFFFF;
  --card: #FFFFFF;
  --text: #1A1A1A;
  --text-light: #666666;
  --border: #E8E8E8;
  --danger: #D42A2A;
  --success: #2E7D32;
  --warning: #F9A825;
  --shadow: 0 2px 8px rgba(0,0,0,0.06);
  --radius: 12px;
  --max-w: 1200px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* Ensure [hidden] always wins over component display rules (e.g. .navbar-user{display:flex}) */
[hidden] { display: none !important; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

/* ---- Layout ---- */
.container { max-width: var(--max-w); margin: 0 auto; padding: 0 16px; }

/* ---- Header / Navbar ---- */
.navbar {
  background: #1A1A1A;
  border-bottom: 2px solid var(--primary);
  padding: 10px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}
.navbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.navbar-brand {
  font-size: 1.4rem;
  font-weight: 800;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  gap: 8px;
}
.navbar-brand:hover { text-decoration: none; color: var(--primary); }
.navbar-brand img { height: 36px; width: auto; }
.navbar-search {
  flex: 1;
  max-width: 400px;
}
.navbar-search input {
  width: 100%;
  padding: 8px 16px;
  border: 2px solid #444;
  border-radius: 24px;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
  background: #2D2D2D;
  color: #fff;
}
.navbar-search input::placeholder { color: #999; }
.navbar-search input:focus {
  border-color: var(--primary);
  background: #333;
}
.navbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.navbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.navbar-user img {
  width: 32px; height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 20px;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}
.btn:hover { text-decoration: none; opacity: 0.9; transform: translateY(-1px); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-secondary { background: var(--secondary); color: #fff; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-outline {
  background: transparent;
  border: 2px solid var(--primary);
  color: var(--primary);
}
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 4px 12px; font-size: 0.8rem; }
.btn-lg { padding: 12px 32px; font-size: 1rem; }
.btn-google {
  background: #fff;
  color: #333;
  border: 2px solid var(--border);
  font-weight: 500;
}
.btn-google:hover { background: #f1f1f1; }

/* ---- Cards ---- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(212,42,42,0.15);
  border-bottom: 2px solid var(--primary);
}
.card-img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: #eee;
}
.card-body { padding: 12px 16px; }
.card-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-shop {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-bottom: 8px;
}
.card-price {
  font-size: 1.1rem;
  font-weight: 700;
  color: #D42A2A;
}
.card-price .original {
  font-size: 0.8rem;
  color: var(--text-light);
  text-decoration: line-through;
  margin-left: 6px;
  font-weight: 400;
}

/* ---- Product Grid ---- */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  padding: 20px 0;
}

/* ---- Shop Header ---- */
.shop-header {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  margin: 20px 0;
  display: flex;
  align-items: center;
  gap: 20px;
  box-shadow: var(--shadow);
}
.shop-logo {
  width: 80px; height: 80px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--border);
}
.shop-info h1 { font-size: 1.5rem; margin-bottom: 4px; }
.shop-info p { color: var(--text-light); font-size: 0.9rem; }

/* ---- Product Detail ---- */
.product-detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  padding: 24px 0;
}
.product-gallery {
  position: relative;
}
.product-gallery .main-img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  background: #f5f5f5;
  border-radius: var(--radius);
  cursor: zoom-in;
}
.product-thumbs {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  overflow-x: auto;
}
.product-thumbs img {
  width: 64px; height: 64px;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.2s;
}
.product-thumbs img.active,
.product-thumbs img:hover {
  border-color: var(--primary);
}
.product-info { padding: 8px 0; }
.product-info h1 { font-size: 1.5rem; margin-bottom: 12px; }
.product-info .price-block {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--danger);
  margin-bottom: 16px;
}
.product-info .price-block .original {
  font-size: 1rem;
  color: var(--text-light);
  text-decoration: line-through;
  font-weight: 400;
}
.product-info .description {
  color: var(--text-light);
  margin-bottom: 20px;
  white-space: pre-line;
}

/* ---- Affiliate Link Buttons ---- */
.affiliate-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.affiliate-links .btn {
  font-size: 0.85rem;
}
.btn-shopee { background: #EE4D2D; color: #fff; }
.btn-lazada { background: #0F146D; color: #fff; }
.btn-tiktok { background: #000; color: #fff; }

/* ---- Promo Code Badge ---- */
.promo-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #FFF3E0;
  border: 1px dashed #FF9800;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  color: #E65100;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 16px;
}
.promo-badge:hover { background: #FFE0B2; }

/* ---- Comments ---- */
.comments-section { margin-top: 32px; }
.comments-section h2 { margin-bottom: 16px; }
.comment {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.comment-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.comment-body { flex: 1; }
.comment-meta {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-bottom: 4px;
}
.comment-meta strong { color: var(--text); }
.comment-text { font-size: 0.9rem; }
.comment-reply { margin-left: 48px; }
.comment-form {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}
.comment-form input {
  flex: 1;
  padding: 8px 16px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
  outline: none;
}
.comment-form input:focus { border-color: var(--primary); }

/* ---- Lightbox ---- */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.9);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}
.lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
}
.lightbox-close {
  position: absolute;
  top: 16px; right: 16px;
  color: #fff;
  font-size: 2rem;
  cursor: pointer;
  background: none;
  border: none;
  line-height: 1;
}
.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: #fff;
  font-size: 2.5rem;
  cursor: pointer;
  background: rgba(255,255,255,0.1);
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
}
.lightbox-nav.prev { left: 16px; }
.lightbox-nav.next { right: 16px; }

/* ---- Hero ---- */
.hero {
  background: linear-gradient(135deg, #1A1A1A 0%, #2D2D2D 50%, #D42A2A 100%);
  color: #fff;
  padding: 40px 0;
  text-align: center;
  margin-bottom: 8px;
  position: relative;
  overflow: hidden;
}
.hero .container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
}
.hero-mascot {
  width: 160px;
  height: auto;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.3));
  flex-shrink: 0;
}
.hero-text { text-align: left; }
.hero h1 { font-size: 2rem; margin-bottom: 8px; text-shadow: 0 2px 4px rgba(0,0,0,0.3); }
.hero p { font-size: 1.1rem; opacity: 0.9; }
.hero .tagline { font-size: 0.9rem; opacity: 0.7; margin-top: 4px; }

/* ---- Footer ---- */
.footer {
  background: #1A1A1A;
  border-top: 2px solid var(--primary);
  padding: 24px 0;
  margin-top: 40px;
  text-align: center;
  color: #999;
  font-size: 0.85rem;
}
.footer a { color: var(--primary); }

/* ---- Section Titles ---- */
.section-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 24px 0 12px;
  padding-bottom: 8px;
  border-bottom: 3px solid #D42A2A;
  display: inline-block;
}

/* ---- Forms ---- */
.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 4px;
  font-size: 0.9rem;
}
.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--primary);
}
.form-group textarea { resize: vertical; min-height: 100px; }

/* ---- Toast Notification ---- */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 24px;
  border-radius: 8px;
  color: #fff;
  font-weight: 500;
  z-index: 2000;
  animation: slideIn 0.3s ease;
}
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ---- Loading Spinner ---- */
.spinner {
  width: 40px; height: 40px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Empty State ---- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-light);
}
.empty-state .icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state img { margin: 0 auto 16px; max-width: 150px; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .product-detail { grid-template-columns: 1fr; gap: 20px; }
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .navbar .container { flex-wrap: wrap; }
  .navbar-search { order: 3; max-width: 100%; flex-basis: 100%; }
  .shop-header { flex-direction: column; text-align: center; }
  .hero .container { flex-direction: column; }
  .hero-mascot { width: 120px; }
  .hero-text { text-align: center; }
  .hero h1 { font-size: 1.5rem; }
  .hero p { font-size: 0.95rem; }
}

@media (max-width: 480px) {
  .product-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .card-body { padding: 8px 10px; }
  .card-title { font-size: 0.85rem; }
  .card-price { font-size: 0.95rem; }
}
