/* ============================
   Pearl Spy — Style Sheet
   ============================ */

:root {
  --gold: #D4AF37;
  --gold-light: #F5E6A3;
  --gold-dark: #A8891A;
  --pearl-white: #F8F6F0;
  --dark: #1A1A2E;
  --dark-card: #16213E;
  --accent: #E8C84A;
  --text: #F0ECD8;
  --text-muted: #A8A08C;
  --shopee: #EE4D2D;
  --tokopedia: #03A84E;
  --lazada: #0F146D;
  --bukalapak: #CC0100;
  --success: #4CAF50;
  --error: #F44336;
  --radius: 16px;
  --shadow: 0 8px 32px rgba(0,0,0,0.3);
}

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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: linear-gradient(135deg, #0D0D1A 0%, #1A1A2E 50%, #16213E 100%);
  color: var(--text);
  min-height: 100vh;
}

/* ---- Header ---- */
header {
  text-align: center;
  padding: 40px 20px 20px;
  border-bottom: 1px solid rgba(212, 175, 55, 0.2);
}

.logo {
  font-size: 2.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--gold), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -1px;
}

.tagline {
  color: var(--text-muted);
  margin-top: 8px;
  font-size: 0.95rem;
}

/* ---- Main ---- */
main {
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 20px;
}

/* ---- Upload Section ---- */
.upload-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(212, 175, 55, 0.25);
  border-radius: var(--radius);
  padding: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.upload-area {
  width: 100%;
  max-width: 500px;
  border: 2px dashed rgba(212, 175, 55, 0.4);
  border-radius: 12px;
  padding: 60px 40px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  background: rgba(212, 175, 55, 0.03);
}

.upload-area:hover,
.upload-area.dragover {
  border-color: var(--gold);
  background: rgba(212, 175, 55, 0.08);
  transform: scale(1.01);
}

.upload-icon {
  font-size: 3rem;
  margin-bottom: 16px;
}

.upload-text {
  font-size: 1rem;
  color: var(--text);
}

.upload-text .link {
  color: var(--gold);
  text-decoration: underline;
  cursor: pointer;
}

.upload-sub {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 8px;
}

/* Preview */
.preview-container {
  width: 100%;
  max-width: 400px;
  position: relative;
}

.preview-container img {
  width: 100%;
  max-height: 350px;
  object-fit: contain;
  border-radius: 12px;
  border: 2px solid rgba(212, 175, 55, 0.3);
}

.btn-remove {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0,0,0,0.7);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: background 0.2s;
}

.btn-remove:hover { background: rgba(0,0,0,0.9); }

/* Analyze Button */
.btn-analyze {
  background: linear-gradient(135deg, var(--gold-dark), var(--gold));
  color: #1A1A2E;
  border: none;
  border-radius: 50px;
  padding: 16px 48px;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  letter-spacing: 0.5px;
}

.btn-analyze:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(212, 175, 55, 0.4);
}

.btn-analyze:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

/* ---- Loading Section ---- */
.loading-card {
  text-align: center;
  padding: 60px 40px;
}

.spinner {
  width: 56px;
  height: 56px;
  border: 4px solid rgba(212, 175, 55, 0.2);
  border-top: 4px solid var(--gold);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 24px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

#loadingText {
  font-size: 1.1rem;
  color: var(--gold);
  margin-bottom: 32px;
}

.loading-steps {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 400px;
  margin: 0 auto;
}

.step {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255,255,255,0.04);
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 0.9rem;
  color: var(--text-muted);
  border: 1px solid transparent;
  transition: all 0.3s ease;
}

.step.active {
  color: var(--text);
  border-color: rgba(212, 175, 55, 0.3);
  background: rgba(212, 175, 55, 0.08);
}

.step.done {
  color: var(--success);
}

/* ---- Results Section ---- */
.jewelry-info-card {
  background: rgba(212, 175, 55, 0.08);
  border: 1px solid rgba(212, 175, 55, 0.3);
  border-radius: var(--radius);
  padding: 24px 28px;
  margin-bottom: 20px;
}

.jewelry-info-card h2 {
  font-size: 1.1rem;
  color: var(--gold);
  margin-bottom: 16px;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.info-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.info-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.info-value {
  font-size: 0.95rem;
  font-weight: 600;
}

/* Market Analysis Card */
.market-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  padding: 24px 28px;
  margin-bottom: 28px;
}

.market-card h2 {
  font-size: 1.1rem;
  color: var(--gold);
  margin-bottom: 16px;
}

.market-summary {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text);
  margin-bottom: 20px;
}

.market-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.stat-box {
  background: rgba(255,255,255,0.05);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
}

.stat-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gold);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.tips-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tips-list li {
  padding: 8px 12px;
  background: rgba(76, 175, 80, 0.1);
  border-left: 3px solid var(--success);
  border-radius: 0 6px 6px 0;
  font-size: 0.88rem;
}

/* Products Grid */
.products-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 16px;
}

.products-header h2 {
  font-size: 1.2rem;
}

.filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-btn {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--text-muted);
  border-radius: 20px;
  padding: 6px 16px;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-btn.active,
.filter-btn:hover {
  background: rgba(212, 175, 55, 0.15);
  border-color: var(--gold);
  color: var(--gold);
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 40px;
}

.product-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.3s ease;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
}

.product-card:hover {
  transform: translateY(-4px);
  border-color: rgba(212, 175, 55, 0.4);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.product-thumb {
  width: 100%;
  height: 180px;
  object-fit: cover;
  background: rgba(255,255,255,0.05);
}

.product-thumb-placeholder {
  width: 100%;
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  background: linear-gradient(135deg, rgba(212,175,55,0.1), rgba(255,255,255,0.03));
}

.product-body {
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.product-marketplace {
  font-size: 0.75rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.marketplace-shopee { color: var(--shopee); }
.marketplace-tokopedia { color: var(--tokopedia); }
.marketplace-lazada { color: #4A90D9; }
.marketplace-bukalapak { color: #f77f00; }
.marketplace-lainnya { color: var(--text-muted); }

.product-title {
  font-size: 0.88rem;
  line-height: 1.4;
  font-weight: 500;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-price {
  font-size: 1rem;
  font-weight: 700;
  color: var(--gold);
  margin-top: auto;
}

.product-snippet {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* New Search Button */
.btn-new-search {
  display: block;
  margin: 0 auto;
  background: transparent;
  border: 2px solid var(--gold);
  color: var(--gold);
  border-radius: 50px;
  padding: 14px 40px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-new-search:hover {
  background: var(--gold);
  color: var(--dark);
}

/* ---- Error Section ---- */
.error-card {
  text-align: center;
  padding: 60px 40px;
}

.error-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: 16px;
}

.btn-retry {
  margin-top: 20px;
  background: var(--gold);
  color: var(--dark);
  border: none;
  border-radius: 50px;
  padding: 12px 32px;
  font-weight: 600;
  cursor: pointer;
}

/* ---- Footer ---- */
footer {
  text-align: center;
  padding: 32px 20px;
  border-top: 1px solid rgba(255,255,255,0.06);
  color: var(--text-muted);
  font-size: 0.82rem;
}

.footer-sub {
  margin-top: 6px;
  font-size: 0.75rem;
  opacity: 0.6;
}

/* ---- Responsive ---- */
@media (max-width: 600px) {
  .upload-card { padding: 24px 16px; }
  .upload-area { padding: 40px 20px; }
  .products-header { flex-direction: column; align-items: flex-start; }
  .market-stats { grid-template-columns: 1fr 1fr; }
}
