/* CRM Affiliate Shopee + Meta Ads - Responsive Design */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --shopee-orange: #EE6A14;
  --meta-blue: #0866FF;
  --success: #047857;
  --warning: #F59E0B;
  --danger: #DC2626;
  --grey-50: #F9FAFB;
  --grey-100: #F3F4F6;
  --grey-200: #E5E7EB;
  --grey-300: #D1D5DB;
  --grey-400: #9CA3AF;
  --grey-600: #4B5563;
  --grey-900: #111827;
  --white: #FFFFFF;
  --font-heading: 'Bricolage Grotesque', sans-serif;
  --font-body: 'Instrument Sans', sans-serif;
}

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--grey-900);
  background: var(--grey-50);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--font-heading); line-height: 1.3; }
h1 { font-size: clamp(24px, 5vw, 32px); font-weight: 700; }
h2 { font-size: clamp(20px, 4vw, 24px); font-weight: 600; }
h3 { font-size: clamp(16px, 3.5vw, 18px); font-weight: 600; }

/* Top Bar */
.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--grey-200);
  padding: 12px clamp(16px, 3vw, 24px);
  display: flex;
  align-items: center;
  gap: clamp(12px, 2vw, 24px);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-heading);
  font-size: clamp(16px, 3vw, 18px);
  font-weight: 700;
  color: var(--grey-900);
  white-space: nowrap;
}

.logo-icon {
  width: clamp(28px, 6vw, 32px);
  height: clamp(28px, 6vw, 32px);
  background: linear-gradient(135deg, #FF8A3D 0%, #E85D04 100%);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: clamp(16px, 4vw, 20px);
  flex-shrink: 0;
}

/* Progress Stepper */
.progress-stepper {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding: 4px 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.progress-stepper::-webkit-scrollbar { display: none; }

.step {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: clamp(12px, 2.5vw, 14px);
  font-weight: 500;
  transition: all 0.2s;
  flex-shrink: 0;
}

.step.completed {
  background: #ECFDF5;
  color: var(--success);
}

.step.active {
  background: #FFF7ED;
  color: var(--shopee-orange);
  border: 2px solid var(--shopee-orange);
  animation: pulse 2s infinite;
}

.step.upcoming {
  background: transparent;
  color: var(--grey-400);
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(238, 106, 20, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(238, 106, 20, 0); }
}

.step-icon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  flex-shrink: 0;
}

.step.completed .step-icon {
  background: var(--success);
  color: white;
}

.step.active .step-icon {
  background: var(--shopee-orange);
  color: white;
}

.step.upcoming .step-icon {
  background: var(--grey-200);
  color: var(--grey-400);
}

.arrow {
  color: var(--grey-300);
  font-size: 16px;
  flex-shrink: 0;
}

/* User Actions */
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.icon-btn {
  width: clamp(36px, 8vw, 40px);
  height: clamp(36px, 8vw, 40px);
  border-radius: 50%;
  border: none;
  background: var(--grey-100);
  color: var(--grey-600);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  font-size: 18px;
}

.icon-btn:hover {
  background: var(--grey-200);
}

.icon-btn:active {
  transform: scale(0.95);
}

.icon-btn .badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 16px;
  height: 16px;
  background: var(--danger);
  color: white;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar {
  width: clamp(36px, 8vw, 40px);
  height: clamp(36px, 8vw, 40px);
  border-radius: 50%;
  background: linear-gradient(135deg, var(--shopee-orange), #DC2626);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  cursor: pointer;
  font-size: clamp(14px, 3vw, 16px);
}

/* Main Content */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: clamp(16px, 3vw, 32px) clamp(16px, 3vw, 24px) 100px;
}

/* Hero Section */
.hero {
  background: white;
  border-radius: clamp(12px, 2vw, 16px);
  padding: clamp(20px, 4vw, 32px);
  margin-bottom: clamp(16px, 3vw, 24px);
  border: 1px solid var(--grey-200);
}

.hero h1 {
  margin-bottom: 8px;
}

.hero p {
  color: var(--grey-600);
  font-size: clamp(14px, 2.5vw, 15px);
}

/* Info Box */
.info-box {
  background: linear-gradient(135deg, #EFF6FF 0%, #DBEAFE 100%);
  border: 1px solid #93C5FD;
  border-radius: clamp(10px, 2vw, 12px);
  padding: clamp(16px, 3vw, 20px) clamp(16px, 3vw, 24px);
  margin-bottom: clamp(16px, 3vw, 24px);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.info-icon {
  width: clamp(36px, 7vw, 40px);
  height: clamp(36px, 7vw, 40px);
  background: var(--meta-blue);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(18px, 4vw, 20px);
  flex-shrink: 0;
}

.info-content h3 {
  font-size: clamp(14px, 3vw, 16px);
  margin-bottom: 8px;
  color: #1E40AF;
}

.info-content p {
  font-size: clamp(13px, 2.5vw, 14px);
  color: #1E3A8A;
  line-height: 1.6;
  margin-bottom: 8px;
}

.info-list {
  list-style: none;
  margin-top: 8px;
}

.info-list li {
  font-size: clamp(12px, 2.5vw, 14px);
  color: #1E3A8A;
  padding-left: 24px;
  position: relative;
  margin-bottom: 6px;
}

.info-list li:before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--success);
  font-weight: 700;
}

/* Action Cards Grid */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: clamp(12px, 2.5vw, 20px);
  margin-bottom: clamp(20px, 4vw, 32px);
}

.action-card {
  background: white;
  border: 2px solid var(--grey-200);
  border-radius: clamp(10px, 2vw, 12px);
  padding: clamp(18px, 3.5vw, 24px);
  transition: all 0.3s;
  cursor: pointer;
  min-height: 180px;
  display: flex;
  flex-direction: column;
}

.action-card:hover {
  border-color: var(--shopee-orange);
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(0,0,0,0.08);
}

.action-card:active {
  transform: translateY(0);
}

.action-card.primary {
  border-color: var(--shopee-orange);
  background: linear-gradient(to bottom, white, #FFF7ED);
}

.card-icon {
  width: clamp(42px, 8vw, 48px);
  height: clamp(42px, 8vw, 48px);
  border-radius: clamp(10px, 2vw, 12px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(20px, 4vw, 24px);
  margin-bottom: 16px;
  flex-shrink: 0;
}

.action-card.primary .card-icon {
  background: var(--shopee-orange);
  color: white;
}

.action-card .card-icon {
  background: var(--grey-100);
}

.action-card h3 {
  margin-bottom: 8px;
}

.action-card p {
  color: var(--grey-600);
  font-size: clamp(13px, 2.5vw, 14px);
  margin-bottom: 16px;
  flex: 1;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: clamp(8px, 2vw, 10px) clamp(16px, 3vw, 20px);
  border-radius: 8px;
  border: none;
  font-family: var(--font-body);
  font-size: clamp(13px, 2.5vw, 14px);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  min-height: 44px;
}

.btn-primary {
  background: var(--shopee-orange);
  color: white;
}

.btn-primary:hover {
  background: #DC5A0C;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(238, 106, 20, 0.3);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: white;
  color: var(--grey-600);
  border: 1px solid var(--grey-200);
}

.btn-secondary:hover {
  background: var(--grey-50);
  border-color: var(--grey-300);
}

/* Filter Bar */
.filter-bar {
  background: white;
  border: 1px solid var(--grey-200);
  border-radius: clamp(10px, 2vw, 12px);
  padding: clamp(16px, 3vw, 20px) clamp(16px, 3vw, 24px);
  margin-bottom: clamp(16px, 3vw, 20px);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
  gap: clamp(12px, 2.5vw, 16px);
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filter-label {
  font-size: clamp(11px, 2vw, 12px);
  color: var(--grey-600);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.filter-select {
  padding: clamp(8px, 2vw, 10px) clamp(10px, 2.5vw, 14px);
  border-radius: 8px;
  border: 1px solid var(--grey-200);
  background: white;
  color: var(--grey-900);
  font-size: clamp(13px, 2.5vw, 14px);
  font-family: var(--font-body);
  cursor: pointer;
  transition: all 0.2s;
  min-height: 44px;
}

.filter-select:hover {
  border-color: var(--grey-300);
}

.filter-select:focus {
  outline: none;
  border-color: var(--shopee-orange);
  box-shadow: 0 0 0 3px rgba(238, 106, 20, 0.1);
}

/* Table Section */
.table-section {
  background: white;
  border-radius: clamp(10px, 2vw, 12px);
  border: 1px solid var(--grey-200);
  overflow: hidden;
  margin-bottom: 24px;
}

.table-header {
  padding: clamp(16px, 3vw, 20px) clamp(16px, 3vw, 24px);
  border-bottom: 1px solid var(--grey-200);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.table-header h2 {
  font-size: clamp(16px, 3vw, 18px);
}

/* Mobile: Cards instead of table */
@media (max-width: 767px) {
  .product-table {
    display: none;
  }

  .product-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
  }

  .product-card {
    background: white;
    border: 1px solid var(--grey-200);
    border-radius: 10px;
    padding: 16px;
  }

  .product-card-header {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
  }

  .product-card-checkbox {
    flex-shrink: 0;
  }

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

  .product-card-name {
    font-weight: 600;
    margin-bottom: 4px;
    word-wrap: break-word;
  }

  .product-card-meta {
    font-size: 12px;
    color: var(--grey-400);
    margin-bottom: 12px;
  }

  .product-card-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
  }

  .stat-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .stat-label {
    font-size: 11px;
    color: var(--grey-600);
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }

  .stat-value {
    font-weight: 600;
    font-size: 14px;
  }
}

/* Desktop: Table */
@media (min-width: 768px) {
  .product-cards {
    display: none;
  }

  .product-table {
    width: 100%;
    border-collapse: collapse;
  }

  .product-table th {
    text-align: left;
    padding: 12px clamp(16px, 2vw, 24px);
    background: var(--grey-50);
    color: var(--grey-600);
    font-size: clamp(11px, 2vw, 13px);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }

  .product-table td {
    padding: clamp(12px, 2.5vw, 16px) clamp(16px, 2vw, 24px);
    border-top: 1px solid var(--grey-100);
    font-size: clamp(13px, 2.5vw, 14px);
  }

  .product-table tr:hover {
    background: var(--grey-50);
  }
}

.checkbox {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  cursor: pointer;
}

.product-name {
  font-weight: 500;
  color: var(--grey-900);
  margin-bottom: 4px;
}

.score-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 16px;
}

.score-high {
  background: #ECFDF5;
  color: var(--success);
}

.score-medium {
  background: #FEF3C7;
  color: #D97706;
}

.conversion-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
}

.conversion-high {
  background: #ECFDF5;
  color: var(--success);
}

.conversion-medium {
  background: #FEF3C7;
  color: #D97706;
}

.conversion-low {
  background: #FEE2E2;
  color: var(--danger);
}

/* Tooltip */
.tooltip {
  position: relative;
  display: inline-block;
  cursor: help;
}

.tooltip .tooltiptext {
  visibility: hidden;
  width: clamp(240px, 50vw, 280px);
  background-color: var(--grey-900);
  color: white;
  text-align: left;
  border-radius: 8px;
  padding: 12px;
  position: absolute;
  z-index: 1000;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  transition: opacity 0.3s;
  font-size: clamp(12px, 2.5vw, 13px);
  line-height: 1.5;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.tooltip .tooltiptext::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -6px;
  border-width: 6px;
  border-style: solid;
  border-color: var(--grey-900) transparent transparent transparent;
}

.tooltip:hover .tooltiptext {
  visibility: visible;
  opacity: 1;
}

/* Footer Action Bar */
.footer-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-top: 1px solid var(--grey-200);
  padding: clamp(12px, 2.5vw, 16px) clamp(16px, 3vw, 24px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 -4px 12px rgba(0,0,0,0.05);
  z-index: 90;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-info {
  color: var(--grey-600);
  font-size: clamp(13px, 2.5vw, 14px);
  flex: 1;
  min-width: 180px;
}

.footer-info strong {
  color: var(--shopee-orange);
  font-weight: 600;
}

/* Responsive Media Queries */
@media (max-width: 480px) {
  .step span {
    display: none;
  }

  .arrow {
    display: none;
  }

  .info-box {
    flex-direction: column;
    text-align: left;
  }

  .footer-bar {
    flex-direction: column;
    align-items: stretch;
    padding: 12px 16px;
  }

  .footer-info {
    text-align: center;
  }

  .btn {
    width: 100%;
  }
}

@media (min-width: 768px) {
  .info-box {
    flex-direction: row;
  }
}

@media (min-width: 1024px) {
  .container {
    padding-bottom: 32px;
  }
}

/* Loading State */
.loading {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 60px 20px;
  color: var(--grey-400);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 60px 20px;
}

.empty-state svg {
  width: clamp(80px, 15vw, 120px);
  height: clamp(80px, 15vw, 120px);
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state h3 {
  margin-bottom: 8px;
  color: var(--grey-600);
}

.empty-state p {
  color: var(--grey-400);
  font-size: 14px;
  margin-bottom: 20px;
}
