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

:root {
  /* Brand Colors - TQOI.net */
  --color-primary-dark: #000000;
  --color-primary-blue: #287CBB;
  --color-primary-blue-hover: #1e5e8f;
  --color-accent-gold: #FFCC00;
  --color-sage-green: #A1B8B4;
  --color-white: #FFFFFF;
  --color-dark-gray: #333333;
  --color-light-gray: #F5F5F5;
  --color-border: #E0E0E0;
  
  /* System Colors */
  --color-success: #10B981;
  --color-danger: #EF4444;
  --color-warning: #F59E0B;
  --color-info: #3B82F6;
  
  /* Platform Colors */
  --color-tiktok: #010101;
  --color-tiktok-accent: #69C9D0;
  --color-shopee: #EE4D2D;
  --color-lazada: #0F146D;
  --color-lazada-accent: #F85606;
  --active-platform-color: #69C9D0;

  /* Typography */
  --font-family-base: 'Inter', system-ui, -apple-system, sans-serif;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  
  /* Border Radius */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 9999px;
  
  /* Transitions */
  --transition-fast: 150ms ease-in-out;
  --transition-normal: 300ms ease-in-out;
}

/* =========================================
   RESET & BASE
   ========================================= */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family-base);
  background-color: var(--color-light-gray);
  color: var(--color-dark-gray);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

/* =========================================
   LAYOUT
   ========================================= */
.container {
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* =========================================
   HEADER
   ========================================= */
.header {
  background-color: var(--color-primary-dark);
  color: var(--color-white);
  padding: 0.75rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-lg);
}

.header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1100px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-logo-img {
  height: 36px;
  width: auto;
  object-fit: contain;
  display: block;
}

.header-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-white);
}

.header-subtitle {
  font-size: 0.75rem;
  opacity: 0.7;
}
.header-subtitle a {
  color: var(--color-accent-gold);
}

.header-actions {
  display: flex;
  gap: 0.5rem;
}

/* =========================================
   HERO
   ========================================= */
.hero {
  background: linear-gradient(135deg, var(--color-primary-dark) 0%, var(--color-primary-blue) 100%);
  color: var(--color-white);
  padding: 2.5rem 0;
  text-align: center;
}

.hero h2 {
  color: var(--color-white);
  font-size: 1.75rem;
  margin-bottom: 0.75rem;
  font-weight: 700;
}

.hero h2 em {
  color: var(--color-accent-gold);
  font-style: normal;
}

.hero p {
  font-size: 0.95rem;
  max-width: 600px;
  margin: 0 auto;
  opacity: 0.9;
  line-height: 1.6;
}

/* =========================================
   MAIN CONTENT
   ========================================= */
.main-content {
  padding: 1.5rem 0;
}

.main-content .container {
  max-width: 860px;
}

/* =========================================
   SECTION CARDS
   ========================================= */
.section-card {
  background-color: var(--color-white);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
  animation: slideUp 0.4s ease-out forwards;
  opacity: 0;
}

.section-card:nth-child(1) { animation-delay: 0.05s; }
.section-card:nth-child(2) { animation-delay: 0.10s; }
.section-card:nth-child(3) { animation-delay: 0.15s; }
.section-card:nth-child(4) { animation-delay: 0.20s; }
.section-card:nth-child(5) { animation-delay: 0.25s; }
.section-card:nth-child(6) { animation-delay: 0.30s; }

.section-title {
  font-size: 1.1rem;
  font-weight: 700;
  border-bottom: 2px solid var(--color-light-gray);
  padding-bottom: 0.75rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-icon {
  font-size: 1.2rem;
}

.section-badge {
  margin-left: auto;
  font-size: 0.7rem;
  font-weight: 600;
  background: var(--active-platform-color);
  color: var(--color-white);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.section-desc {
  font-size: 0.85rem;
  color: #666;
  margin-bottom: 1.25rem;
}

/* =========================================
   PLATFORM SELECTOR TABS
   ========================================= */
.platform-selector {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.platform-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-white);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-dark-gray);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.platform-tab:hover {
  border-color: #999;
  background: var(--color-light-gray);
}

.platform-tab.active {
  border-color: var(--active-platform-color);
  background: rgba(40, 124, 187, 0.05);
  box-shadow: 0 0 0 1px var(--active-platform-color);
}

.platform-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.platform-dot-sm {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 4px;
}

/* =========================================
   FORM INPUTS
   ========================================= */
.input-group {
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
}

.input-group label {
  font-weight: 500;
  margin-bottom: 0.4rem;
  font-size: 0.85rem;
  color: var(--color-dark-gray);
}

.input-group input[type="number"],
.input-group select {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  background-color: #fafafa;
}

.input-group input:focus,
.input-group select:focus {
  outline: none;
  border-color: var(--color-primary-blue);
  box-shadow: 0 0 0 3px rgba(40, 124, 187, 0.15);
  background-color: var(--color-white);
}

.input-group input[readonly] {
  background-color: #f0f0f0;
  color: #888;
  cursor: not-allowed;
}

.input-hint {
  font-size: 0.75rem;
  color: #999;
  margin-top: 0.25rem;
}

.range-indicator {
  font-size: 0.75rem;
  color: var(--color-primary-blue);
  margin-top: 0.25rem;
  font-weight: 500;
}

.input-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

/* Radio Groups */
.radio-group {
  display: flex;
  gap: 1rem;
  padding: 0.5rem 0;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  cursor: pointer;
  font-weight: 400;
}

.radio-label input[type="radio"] {
  accent-color: var(--color-primary-blue);
}

/* =========================================
   TOGGLE SWITCH
   ========================================= */
.toggle-row {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--color-light-gray);
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: var(--transition-normal);
  border-radius: var(--radius-full);
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: var(--transition-normal);
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
}

input:checked + .toggle-slider {
  background-color: var(--color-primary-blue);
}

input:checked + .toggle-slider:before {
  transform: translateX(20px);
}

/* Conditional sections */
.conditional-section {
  padding: 0.75rem 0 0.25rem 0;
  margin-left: 0.5rem;
  border-left: 3px solid var(--color-primary-blue);
  padding-left: 1rem;
}

/* Subsection divider */
.subsection-divider {
  height: 1px;
  background: var(--color-border);
  margin: 1.25rem 0;
}

.subsection-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--color-dark-gray);
}

/* Tooltips */
.tooltip {
  cursor: help;
  font-size: 0.8rem;
  position: relative;
}

.tooltip:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--color-dark-gray);
  color: var(--color-white);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  white-space: normal;
  min-width: 200px;
  max-width: 280px;
  z-index: 20;
  box-shadow: var(--shadow-md);
  font-weight: 400;
  line-height: 1.4;
}

/* =========================================
   LIVE SALE SECTION
   ========================================= */
.live-sale-section {
  position: relative;
  border: 2px solid transparent;
  background: linear-gradient(var(--color-white), var(--color-white)) padding-box,
              linear-gradient(135deg, #EF4444, var(--color-accent-gold)) border-box;
}

/* =========================================
   RESULTS CARD
   ========================================= */
.results-card {
  background-color: var(--color-primary-dark);
  color: var(--color-white);
  box-shadow: var(--shadow-lg);
}

.results-card .section-title {
  color: var(--color-white);
  border-bottom-color: rgba(255, 255, 255, 0.2);
}

.results-placeholder {
  text-align: center;
  opacity: 0.5;
  padding: 2rem;
  font-size: 0.9rem;
}

/* Results Header */
.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  font-size: 1rem;
}

.results-price {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--color-accent-gold);
}

/* Results Divider */
.results-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.15);
  margin: 0.75rem 0;
}

.results-divider.thick {
  height: 2px;
  background: rgba(255, 255, 255, 0.3);
  margin: 1rem 0;
}

/* Results Section Labels */
.results-card h4.results-section-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-sage-green);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 1rem 0 0.4rem 0;
  padding: 0;
}

.results-card h4.results-section-label small {
  font-weight: 400;
  opacity: 0.7;
  text-transform: none;
}

/* Results Line Items */
.results-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.3rem 0;
  font-size: 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.results-line:last-of-type {
  border-bottom: none;
}

/* Subtotal lines */
.subtotal-line {
  font-weight: 600;
  font-size: 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15) !important;
  padding: 0.4rem 0;
  margin-top: 0.2rem;
  color: var(--color-sage-green);
}

/* Total Deductions */
.total-line {
  font-size: 1rem;
  font-weight: 700;
  padding: 0.5rem 0;
}

.deduction-amount {
  color: var(--color-danger);
}

/* Net Profit */
.profit-line {
  font-size: 1.4rem;
  font-weight: 700;
  padding: 0.75rem 0 0.25rem 0;
  border-bottom: none !important;
}

.profit-positive {
  color: var(--color-success) !important;
}

.profit-negative {
  color: var(--color-danger) !important;
}

/* Margin line */
.margin-line {
  font-size: 1rem;
  font-weight: 600;
  padding: 0.25rem 0;
}

/* Target line */
.target-line {
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.5rem 0;
  margin-top: 0.5rem;
  border-radius: var(--radius-sm);
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

.target-met {
  background: rgba(16, 185, 129, 0.15);
  color: var(--color-success) !important;
}

.target-missed {
  background: rgba(239, 68, 68, 0.15);
  color: var(--color-danger) !important;
}

/* Min Price Suggestion */
.min-price-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(40, 124, 187, 0.15);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  margin-top: 1rem;
  font-size: 0.85rem;
  border: 1px solid rgba(40, 124, 187, 0.3);
}

.min-price-box.error {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
}

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

/* =========================================
   BAR CHART
   ========================================= */
.bar-chart-container {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.bar-chart-container .subsection-title {
  color: var(--color-white);
  font-size: 0.85rem;
  opacity: 0.8;
}

.bar-chart {
  display: flex;
  height: 28px;
  width: 100%;
  border-radius: var(--radius-full);
  overflow: hidden;
  background-color: rgba(255, 255, 255, 0.1);
}

.bar-segment {
  height: 100%;
  transition: width 0.5s ease-in-out;
  min-width: 2px;
}

.bar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  opacity: 0.85;
}

.legend-color {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

.legend-label {
  white-space: nowrap;
}

/* =========================================
   COMPARISON TABLE
   ========================================= */
.comparison-container {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.comparison-container .subsection-title {
  color: var(--color-white);
}

.comparison-table-inner {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.comparison-table-inner th,
.comparison-table-inner td {
  padding: 0.6rem 0.5rem;
  text-align: right;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--color-white);
}

.comparison-table-inner th:first-child,
.comparison-table-inner td:first-child {
  text-align: left;
}

.comparison-table-inner th {
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-sage-green);
  border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

.best-row {
  background: rgba(16, 185, 129, 0.1);
}

.best-badge {
  font-size: 0.7rem;
  margin-left: 0.25rem;
  color: var(--color-accent-gold);
}

/* =========================================
   BUTTONS
   ========================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.8rem;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
  gap: 0.35rem;
  white-space: nowrap;
}

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

.btn-primary:hover {
  background-color: var(--color-primary-blue-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--color-white);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

.btn-full {
  width: 100%;
  padding: 0.65rem 1rem;
  background-color: var(--color-light-gray);
  color: var(--color-dark-gray);
  border: 1.5px solid var(--color-border);
  font-size: 0.85rem;
}

.btn-full:hover {
  background-color: var(--color-border);
  border-color: #c0c0c0;
}

/* =========================================
   FOOTER
   ========================================= */
.footer {
  background-color: var(--color-primary-dark);
  color: var(--color-white);
  padding: 2rem 0;
  text-align: center;
  margin-top: 2rem;
}

.footer p {
  opacity: 0.7;
  font-size: 0.8rem;
  margin-bottom: 0.5rem;
}

.footer-brand {
  opacity: 0.9 !important;
}

.footer a {
  color: var(--color-accent-gold);
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

.footer-copyright {
  font-size: 0.7rem !important;
  margin-top: 0.5rem;
  opacity: 0.5 !important;
}

/* =========================================
   ANIMATIONS
   ========================================= */
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(15px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =========================================
   RESPONSIVE DESIGN
   ========================================= */

@media (min-width: 480px) {
  .input-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 768px) {
  .hero h2 {
    font-size: 2.25rem;
  }
  
  .hero p {
    font-size: 1.05rem;
  }
  
  .header-title {
    font-size: 1.1rem;
  }
}

@media (max-width: 480px) {
  .platform-selector {
    flex-direction: column;
  }
  
  .platform-tab {
    justify-content: flex-start;
  }
  
  .header-actions {
    flex-direction: column;
    gap: 0.25rem;
  }
  
  .btn {
    font-size: 0.72rem;
    padding: 0.4rem 0.6rem;
  }
  
  .hero {
    padding: 1.5rem 0;
  }
  
  .hero h2 {
    font-size: 1.35rem;
  }
  
  .results-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }
  
  .min-price-box {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
  }
  
  .comparison-table-inner {
    font-size: 0.75rem;
  }
  
  .comparison-table-inner th,
  .comparison-table-inner td {
    padding: 0.4rem 0.25rem;
  }
}

/* =========================================
   PRINT STYLES
   ========================================= */
@media print {
  body {
    background-color: #fff;
    color: #000;
  }
  
  .header,
  .hero,
  .platform-selector,
  .footer,
  .btn,
  .toggle-row,
  .header-actions,
  #section-platform,
  #section-product,
  #section-fees,
  #section-vouchers,
  #section-live {
    display: none !important;
  }
  
  .main-content {
    padding: 0;
  }
  
  .results-card {
    background-color: #fff !important;
    color: #000 !important;
    box-shadow: none;
    border: 1px solid #ccc;
    padding: 1.5rem;
  }
  
  .results-card .section-title {
    color: #000;
    border-bottom-color: #ccc;
  }
  
  .results-card h4.results-section-label {
    color: #333;
  }
  
  .results-line {
    color: #000;
    border-bottom-color: #eee;
  }
  
  .subtotal-line {
    color: #555;
  }
  
  .results-price {
    color: #000;
  }
  
  .min-price-box {
    background: #f5f5f5;
    border-color: #ccc;
    color: #000;
  }
  
  .min-price-value {
    color: #000;
  }
  
  .comparison-table-inner th,
  .comparison-table-inner td {
    color: #000;
    border-bottom-color: #ddd;
  }
  
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
}
