/**
 * Raja Emas - Live Price Sync & Tabbed Table Stylesheet
 * Brand colors: Royal Purple (#421A40), Gold (#D4AF37), Slate (#1E293B)
 */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
  --rei-primary: #421A40;
  --rei-primary-dark: #2F102D;
  --rei-primary-light: #5A2757;
  --rei-gold: #D4AF37;
  --rei-gold-light: #F7F1DF;
  --rei-gold-hover: #B8860B;
  --rei-accent-bg: #FAF9F6;
  --rei-border: #E5E7EB;
  --rei-text-dark: #1E293B;
  --rei-text-muted: #64748B;
  --rei-text-light: #94A3B8;
  --rei-success: #10B981;
  --rei-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
  --rei-shadow-md: 0 10px 25px -5px rgba(66, 26, 64, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  --rei-radius-sm: 8px;
  --rei-radius-md: 14px;
  --rei-radius-lg: 20px;
}

/* Base Widget Container */
.rei-price-widget {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  max-width: 960px;
  margin: 30px auto;
  background: #FFFFFF;
  border: 1px solid var(--rei-border);
  border-radius: var(--rei-radius-lg);
  box-shadow: var(--rei-shadow-md);
  padding: 32px 28px;
  box-sizing: border-box;
  color: var(--rei-text-dark);
  line-height: 1.5;
  transition: all 0.3s ease;
}

.rei-price-widget * {
  box-sizing: border-box;
}

/* Header Section */
.rei-widget-header {
  text-align: center;
  margin-bottom: 28px;
}

.rei-header-top {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.rei-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(16, 185, 129, 0.1);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 4px 12px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.rei-pulse-dot {
  width: 8px;
  height: 8px;
  background-color: var(--rei-success);
  border-radius: 50%;
  position: relative;
  display: inline-block;
}

.rei-pulse-dot::after {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border-radius: 50%;
  background-color: var(--rei-success);
  opacity: 0.7;
  animation: reiPulse 2s infinite;
}

@keyframes reiPulse {
  0% {
    transform: scale(0.9);
    opacity: 0.8;
  }
  70% {
    transform: scale(2);
    opacity: 0;
  }
  100% {
    transform: scale(2);
    opacity: 0;
  }
}

.rei-sync-time {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--rei-text-muted);
  font-size: 12px;
  font-weight: 500;
}

.rei-title {
  font-size: 26px;
  font-weight: 800;
  color: var(--rei-primary);
  margin: 0 0 8px 0;
  letter-spacing: -0.5px;
  line-height: 1.25;
}

.rei-subtitle {
  font-size: 14px;
  color: var(--rei-text-muted);
  margin: 0;
}

/* Modern Segmented Navigation Tabs */
.rei-tabs-container {
  display: flex;
  justify-content: center;
  margin-bottom: 24px;
}

.rei-tabs-nav {
  display: inline-flex;
  background: #F1F5F9;
  padding: 6px;
  border-radius: 9999px;
  gap: 6px;
  width: 100%;
  max-width: 800px;
  border: 1px solid #E2E8F0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.rei-region-select {
  display: none;
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--rei-border);
  border-radius: var(--rei-radius-sm);
  background: #FFFFFF;
  color: var(--rei-text-dark);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 8L1 3h10z' fill='%2364748B'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.rei-region-select:focus {
  border-color: var(--rei-primary);
  box-shadow: 0 0 0 3px rgba(66, 26, 64, 0.1);
}

.rei-tab-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border: none;
  background: transparent;
  color: var(--rei-text-muted);
  font-size: 14px;
  font-weight: 600;
  border-radius: 9999px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
}

.rei-tab-btn:hover {
  color: var(--rei-primary);
  background: rgba(255, 255, 255, 0.6);
}

.rei-tab-btn.is-active {
  background: var(--rei-primary);
  color: #FFFFFF;
  box-shadow: 0 4px 12px rgba(66, 26, 64, 0.25);
}

.rei-tab-btn.is-active .rei-tab-icon svg {
  stroke: var(--rei-gold);
}

.rei-tab-icon {
  display: inline-flex;
  align-items: center;
}

.rei-tab-icon svg {
  stroke: currentColor;
  transition: stroke 0.2s;
}

/* Toolbar & Real-time Search */
.rei-toolbar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
  background: var(--rei-accent-bg);
  padding: 16px 20px;
  border-radius: var(--rei-radius-md);
  border: 1px solid #F1E9DA;
}

.rei-search-box {
  position: relative;
  width: 100%;
}

.rei-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--rei-text-light);
  display: flex;
  align-items: center;
  pointer-events: none;
}

.rei-search-input {
  width: 100%;
  padding: 11px 40px 11px 40px;
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: var(--rei-radius-sm);
  font-size: 14px;
  color: var(--rei-text-dark);
  outline: none;
  transition: all 0.2s ease;
}

.rei-search-input:focus {
  border-color: var(--rei-primary);
  box-shadow: 0 0 0 3px rgba(66, 26, 64, 0.1);
}

.rei-search-clear {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: #E2E8F0;
  border: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  color: #64748B;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
}

.rei-search-clear:hover {
  background: #CBD5E1;
  color: #1E293B;
}

.rei-quick-chips {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 13px;
}

.rei-chip-title {
  font-weight: 600;
  color: var(--rei-text-muted);
}

.rei-chip {
  padding: 4px 12px;
  border-radius: 9999px;
  border: 1px solid #E2E8F0;
  background: #FFFFFF;
  color: var(--rei-text-dark);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.rei-chip:hover {
  border-color: var(--rei-primary);
  color: var(--rei-primary);
}

.rei-chip.is-active {
  background: var(--rei-gold-light);
  border-color: var(--rei-gold);
  color: #855800;
}

/* Tab Panes */
.rei-tab-pane {
  display: none;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.rei-tab-pane.is-active {
  display: block;
  opacity: 1;
}

/* Table Top Meta & Date Display (Persis Desain Referensi) */
.rei-table-top-meta {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-bottom: 14px;
  padding: 0 4px;
}

.rei-table-date {
  font-size: 22px;
  font-weight: 700;
  color: #1A1A1A;
  letter-spacing: -0.3px;
  text-align: right;
  line-height: 1.2;
}

/* Modern Card Table */
.rei-table-card {
  background: #FFFFFF;
  border: 1px solid rgba(66, 26, 64, 0.08);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(66, 26, 64, 0.04), 0 1px 4px rgba(0, 0, 0, 0.03);
}

.rei-table-responsive {
  width: 100%;
  overflow-x: auto;
}

.rei-table {
  width: 100%;
  border-collapse: collapse;
  text-align: center;
  margin: 0;
}

.rei-table thead {
  background: var(--rei-primary);
  color: #FFFFFF;
}

.rei-table th {
  padding: 22px 20px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.2px;
  text-transform: none;
  border: none;
  text-align: center;
  color: #FFFFFF;
  line-height: 1.3;
}

.rei-th-product {
  width: 50%;
  text-align: center;
}

.rei-th-price {
  width: 50%;
  text-align: center;
}

.rei-th-action {
  width: 25%;
  text-align: center;
}

/* Penyesuaian lebar kolom jika show_cta aktif */
.rei-table.has-action .rei-th-product {
  width: 38%;
}
.rei-table.has-action .rei-th-price {
  width: 38%;
}

/* Rows & Cells */
.rei-table tbody tr {
  background-color: #FFFFFF;
  border-bottom: none;
  transition: background-color 0.15s ease;
}

.rei-table tbody tr:nth-child(even) {
  background-color: #FFFFFF;
}

.rei-table tbody tr:hover {
  background-color: #FAF5FA;
}

/* Highlighted top row (K24*) */
.rei-table tbody tr.rei-row-top {
  background-color: #FFFFFF;
  border-left: none;
}

.rei-table tbody tr.rei-row-top:hover {
  background-color: #FAF5FA;
}

.rei-table td {
  padding: 22px 20px;
  font-size: 20px;
  font-weight: 600;
  color: #1A1A1A;
  vertical-align: middle;
  border: none;
  text-align: center;
  line-height: 1.3;
}

.rei-td-product {
  text-align: center;
}

.rei-td-price {
  text-align: center;
}

.rei-product-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.rei-product-name {
  font-weight: 600;
  color: #1A1A1A;
  font-size: 20px;
  letter-spacing: -0.2px;
}

.rei-price-value {
  font-weight: 600;
  color: #1A1A1A;
  font-size: 20px;
  letter-spacing: -0.2px;
}

.rei-td-action {
  text-align: center;
}

.rei-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: #25D366;
  color: #FFFFFF !important;
  text-decoration: none !important;
  font-size: 13px;
  font-weight: 700;
  border-radius: 8px;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(37, 211, 102, 0.2);
}

.rei-cta-btn:hover {
  background: #1EBE5D;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(37, 211, 102, 0.3);
  color: #FFFFFF !important;
}

/* No Match State */
.rei-no-match {
  padding: 40px 20px;
  text-align: center;
  color: var(--rei-text-muted);
}

.rei-no-match svg {
  margin-bottom: 12px;
}

.rei-no-match p {
  margin: 0;
  font-size: 14px;
}

/* Footer & Disclaimers */
.rei-widget-footer {
  margin-top: 26px;
  padding-top: 22px;
  border-top: 1px solid var(--rei-border);
}

.rei-footer-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.rei-info-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--rei-text-muted);
  font-weight: 500;
}

.rei-info-item svg {
  flex-shrink: 0;
}

.rei-footer-cta-wrap {
  text-align: center;
}

.rei-big-wa-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 28px;
  background: #25D366;
  color: #FFFFFF !important;
  text-decoration: none !important;
  font-size: 15px;
  font-weight: 700;
  border-radius: 9999px;
  box-shadow: 0 4px 14px rgba(37, 211, 102, 0.35);
  transition: all 0.25s ease;
  width: 100%;
  max-width: 480px;
}

.rei-big-wa-btn:hover {
  background: #1EBE5D;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(37, 211, 102, 0.45);
  color: #FFFFFF !important;
}

/* Responsive Breakpoints */
@media (max-width: 550px) {
  .rei-price-widget {
    padding: 20px 14px;
    margin: 15px auto;
    border-radius: var(--rei-radius-md);
  }

  .rei-title {
    font-size: 20px;
  }

  .rei-tabs-nav {
    display: none;
  }

  .rei-region-select {
    display: block;
  }

  .rei-table-date {
    font-size: 18px;
    margin-bottom: 10px;
  }

  .rei-table th {
    padding: 16px 10px;
    font-size: 16px;
  }

  .rei-table td {
    padding: 16px 10px;
    font-size: 16px;
  }

  .rei-product-name {
    font-size: 16px;
  }

  .rei-price-value {
    font-size: 16px;
  }

  .rei-cta-btn {
    padding: 6px 10px;
    font-size: 11px;
  }

  .rei-cta-btn span {
    display: none;
  }

  .rei-cta-btn::after {
    content: "WA";
  }

  .rei-big-wa-btn {
    font-size: 13px;
    padding: 12px 18px;
  }
}
