/* ============================================================
   eCommerce Profit Calculator Pro — Stylesheet
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600;700&family=Space+Grotesk:wght@400;500;600;700&display=swap');

/* ── RESET & BASE ─────────────────────────────────────────── */
#epc-calculator-wrap *,
#epc-calculator-wrap *::before,
#epc-calculator-wrap *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

#epc-calculator-wrap {
  --epc-primary:   #6C47FF;
  --epc-accent:    #00D4AA;
  --epc-danger:    #FF4D6D;
  --epc-warning:   #FFB800;
  --epc-success:   #00C896;
  --epc-bg:        #F0EFF8;
  --epc-surface:   #FFFFFF;
  --epc-border:    #E2E0F0;
  --epc-text:      #1A1730;
  --epc-muted:     #7B7A8E;
  --epc-radius:    14px;
  --epc-shadow:    0 4px 20px rgba(108,71,255,.08);
  --epc-shadow-lg: 0 12px 40px rgba(108,71,255,.14);

  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  color: var(--epc-text);
  background: var(--epc-bg);
  padding: 0 0 40px;
  line-height: 1.5;
}

/* ── HEADER ───────────────────────────────────────────────── */
.epc-header {
  background: linear-gradient(135deg, #6C47FF 0%, #3B1FA8 50%, #0D0D2B 100%);
  padding: 56px 24px 64px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.epc-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(0,212,170,.2) 0%, transparent 70%);
  pointer-events: none;
}

.epc-header-inner { position: relative; z-index: 1; }

.epc-badge {
  display: inline-block;
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.25);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 4px 14px;
  border-radius: 100px;
  margin-bottom: 16px;
  backdrop-filter: blur(8px);
}

.epc-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(26px, 5vw, 42px);
  font-weight: 700;
  color: #fff;
  line-height: 1.15;
  margin-bottom: 12px;
}

.epc-subtitle {
  color: rgba(255,255,255,.75);
  font-size: 16px;
  max-width: 500px;
  margin: 0 auto;
}

/* ── LAYOUT ───────────────────────────────────────────────── */
.epc-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 24px;
  max-width: 1300px;
  margin: -32px auto 0;
  padding: 0 24px;
  align-items: start;
}

@media (max-width: 900px) {
  .epc-layout { grid-template-columns: 1fr; }
}

/* ── CARDS ────────────────────────────────────────────────── */
.epc-card {
  background: var(--epc-surface);
  border: 1px solid var(--epc-border);
  border-radius: var(--epc-radius);
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: var(--epc-shadow);
}

.epc-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--epc-border);
}

.epc-card-icon { font-size: 20px; }

.epc-card-header h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 17px;
  font-weight: 600;
  color: var(--epc-text);
}

.epc-card-desc {
  font-size: 13px;
  color: var(--epc-muted);
  margin-bottom: 14px;
}

/* ── FORM FIELDS ──────────────────────────────────────────── */
.epc-field-group {
  margin-bottom: 16px;
}

.epc-field-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--epc-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.epc-input-wrapper {
  display: flex;
  align-items: center;
  background: var(--epc-bg);
  border: 2px solid var(--epc-border);
  border-radius: 10px;
  overflow: hidden;
  transition: border-color .2s;
}

.epc-input-wrapper:focus-within {
  border-color: var(--epc-primary);
  box-shadow: 0 0 0 3px rgba(108,71,255,.12);
}

.epc-prefix {
  padding: 0 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--epc-muted);
  background: rgba(108,71,255,.06);
  border-right: 2px solid var(--epc-border);
  height: 44px;
  display: flex;
  align-items: center;
}

.epc-input-wrapper input,
.epc-input-wrapper select {
  border: none;
  outline: none;
  background: transparent;
  padding: 0 14px;
  height: 44px;
  font-size: 15px;
  font-family: inherit;
  color: var(--epc-text);
  width: 100%;
  -webkit-appearance: none;
}

#epc-calculator-wrap select {
  background: var(--epc-bg);
  border: 2px solid var(--epc-border);
  border-radius: 10px;
  padding: 0 14px;
  height: 46px;
  font-size: 15px;
  font-family: inherit;
  color: var(--epc-text);
  width: 100%;
  outline: none;
  transition: border-color .2s;
  cursor: pointer;
}

#epc-calculator-wrap select:focus {
  border-color: var(--epc-primary);
  box-shadow: 0 0 0 3px rgba(108,71,255,.12);
}

/* ── PLATFORM SELECTOR ────────────────────────────────────── */
.epc-platform-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.epc-ctrl-btn {
  padding: 6px 14px;
  border-radius: 100px;
  border: 1.5px solid var(--epc-border);
  background: var(--epc-bg);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  font-family: inherit;
  color: var(--epc-text);
}

.epc-ctrl-btn:hover { border-color: var(--epc-primary); color: var(--epc-primary); }
.epc-ctrl-danger:hover { border-color: var(--epc-danger); color: var(--epc-danger); }

.epc-platform-group-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--epc-muted);
  padding: 8px 0 4px;
  border-bottom: 1px solid var(--epc-border);
  margin-bottom: 6px;
}

.epc-platform-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 340px;
  overflow-y: auto;
  padding-right: 4px;
}

.epc-platform-grid::-webkit-scrollbar { width: 4px; }
.epc-platform-grid::-webkit-scrollbar-track { background: var(--epc-bg); border-radius: 4px; }
.epc-platform-grid::-webkit-scrollbar-thumb { background: var(--epc-border); border-radius: 4px; }

.epc-platform-check {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s;
  border: 1.5px solid transparent;
}

.epc-platform-check:hover { background: var(--epc-bg); }

.epc-platform-check input[type="checkbox"] { display: none; }

.epc-check-box {
  width: 18px;
  height: 18px;
  border: 2px solid var(--epc-border);
  border-radius: 5px;
  flex-shrink: 0;
  transition: all .2s;
  position: relative;
}

.epc-platform-check input:checked ~ .epc-check-box {
  background: var(--epc-primary);
  border-color: var(--epc-primary);
}

.epc-platform-check input:checked ~ .epc-check-box::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.epc-platform-logo {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.epc-platform-name { font-size: 13px; font-weight: 500; }

/* ── CALCULATE BUTTON ─────────────────────────────────────── */
.epc-calculate-btn {
  width: 100%;
  padding: 16px;
  background: linear-gradient(135deg, #6C47FF, #4A2FD4);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  transition: all .25s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 6px 24px rgba(108,71,255,.35);
}

.epc-calculate-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 32px rgba(108,71,255,.45);
}

.epc-calculate-btn:active { transform: translateY(0); }
.epc-btn-icon { font-size: 20px; }

/* ── RESULTS PANEL ────────────────────────────────────────── */
.epc-results-panel {
  min-height: 400px;
}

/* Empty state */
.epc-empty-state {
  background: var(--epc-surface);
  border-radius: var(--epc-radius);
  border: 2px dashed var(--epc-border);
  padding: 64px 32px;
  text-align: center;
  box-shadow: var(--epc-shadow);
}

.epc-empty-icon { font-size: 56px; margin-bottom: 16px; }
.epc-empty-state h3 { font-family: 'Space Grotesk',sans-serif; font-size: 20px; margin-bottom: 8px; }
.epc-empty-state p { color: var(--epc-muted); }

/* Loading */
.epc-loading {
  background: var(--epc-surface);
  border-radius: var(--epc-radius);
  padding: 64px 32px;
  text-align: center;
  box-shadow: var(--epc-shadow);
}

.epc-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--epc-border);
  border-top-color: var(--epc-primary);
  border-radius: 50%;
  animation: epc-spin 0.8s linear infinite;
  margin: 0 auto 20px;
}

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

/* Summary Bar */
.epc-summary-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.epc-summary-card {
  background: var(--epc-surface);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  box-shadow: var(--epc-shadow);
  border: 1px solid var(--epc-border);
}

.epc-summary-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--epc-muted);
  margin-bottom: 4px;
}

.epc-summary-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--epc-primary);
}

.epc-summary-card.best { background: linear-gradient(135deg, #6C47FF, #4A2FD4); }
.epc-summary-card.best .epc-summary-label { color: rgba(255,255,255,.7); }
.epc-summary-card.best .epc-summary-value { color: #fff; font-size: 16px; }

/* Tabs */
.epc-tabs {
  display: flex;
  gap: 4px;
  background: var(--epc-surface);
  border: 1px solid var(--epc-border);
  border-radius: 12px;
  padding: 5px;
  margin-bottom: 16px;
  box-shadow: var(--epc-shadow);
}

.epc-tab {
  flex: 1;
  padding: 10px;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--epc-muted);
  transition: all .2s;
}

.epc-tab.active {
  background: var(--epc-primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(108,71,255,.3);
}

.epc-tab-content { display: none; }
.epc-tab-content.active { display: block; }

/* Results Grid */
.epc-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

/* Result Card */
.epc-result-card {
  background: var(--epc-surface);
  border: 1.5px solid var(--epc-border);
  border-radius: var(--epc-radius);
  overflow: hidden;
  box-shadow: var(--epc-shadow);
  transition: transform .2s, box-shadow .2s;
  position: relative;
}

.epc-result-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--epc-shadow-lg);
}

.epc-result-card.best-card {
  border-color: var(--epc-primary);
  box-shadow: 0 0 0 2px var(--epc-primary), var(--epc-shadow-lg);
}

.epc-result-card.loss-card { opacity: .75; }

.epc-best-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--epc-primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 100px;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.epc-card-top {
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--epc-border);
}

.epc-result-logo {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.epc-result-name {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 15px;
  font-weight: 600;
}

.epc-result-country {
  font-size: 11px;
  color: var(--epc-muted);
  margin-top: 2px;
}

.epc-card-body { padding: 16px; }

.epc-metric-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid var(--epc-bg);
  font-size: 13px;
}

.epc-metric-row:last-child { border-bottom: none; }

.epc-metric-label { color: var(--epc-muted); }

.epc-metric-value {
  font-weight: 600;
  font-family: 'Space Grotesk', sans-serif;
}

.epc-metric-value.positive { color: var(--epc-success); }
.epc-metric-value.negative { color: var(--epc-danger); }
.epc-metric-value.neutral  { color: var(--epc-text); }

.epc-profit-big {
  text-align: center;
  padding: 14px 0 8px;
}

.epc-profit-big .amount {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 28px;
  font-weight: 700;
}

.epc-profit-big .label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--epc-muted);
  margin-top: 2px;
}

.epc-profit-bar-wrap {
  background: var(--epc-bg);
  border-radius: 100px;
  height: 6px;
  margin: 10px 0 0;
  overflow: hidden;
}

.epc-profit-bar {
  height: 100%;
  border-radius: 100px;
  transition: width .6s ease;
}

.epc-card-note {
  font-size: 11px;
  color: var(--epc-primary);
  background: rgba(108,71,255,.06);
  border-radius: 6px;
  padding: 6px 10px;
  margin-top: 10px;
  text-align: center;
  font-weight: 500;
}

/* ── TABLE ────────────────────────────────────────────────── */
.epc-table-wrap {
  background: var(--epc-surface);
  border-radius: var(--epc-radius);
  overflow-x: auto;
  box-shadow: var(--epc-shadow);
  border: 1px solid var(--epc-border);
}

.epc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.epc-table thead th {
  background: var(--epc-text);
  color: #fff;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: 14px 16px;
  text-align: left;
  white-space: nowrap;
}

.epc-table tbody tr {
  border-bottom: 1px solid var(--epc-bg);
  transition: background .15s;
}

.epc-table tbody tr:hover { background: var(--epc-bg); }
.epc-table tbody tr.best-row { background: rgba(108,71,255,.05); }

.epc-table td {
  padding: 12px 16px;
  vertical-align: middle;
}

.epc-table-platform {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  white-space: nowrap;
}

.epc-table-logo {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.epc-rank-badge {
  display: inline-flex;
  width: 24px;
  height: 24px;
  background: var(--epc-bg);
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--epc-muted);
}

.epc-rank-badge.rank-1 { background: #FFD700; color: #7a5a00; }
.epc-rank-badge.rank-2 { background: #C0C0C0; color: #4a4a4a; }
.epc-rank-badge.rank-3 { background: #CD7F32; color: #fff; }

.epc-status-pill {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.epc-status-pill.profit  { background: rgba(0,200,150,.12); color: #00875A; }
.epc-status-pill.loss    { background: rgba(255,77,109,.12); color: #c0003f; }

/* ── CHART ────────────────────────────────────────────────── */
.epc-chart-container {
  background: var(--epc-surface);
  border-radius: var(--epc-radius);
  padding: 24px;
  box-shadow: var(--epc-shadow);
  border: 1px solid var(--epc-border);
  max-height: 460px;
}

/* ── DISCLAIMER ───────────────────────────────────────────── */
.epc-disclaimer {
  max-width: 1300px;
  margin: 24px auto 0;
  padding: 14px 24px;
  background: rgba(255,184,0,.1);
  border: 1px solid rgba(255,184,0,.3);
  border-radius: 10px;
  font-size: 12.5px;
  color: #6b5700;
  line-height: 1.6;
  margin-left: 24px;
  margin-right: 24px;
}

/* ── RESPONSIVE ───────────────────────────────────────────── */
@media (max-width: 600px) {
  .epc-header { padding: 40px 16px 50px; }
  .epc-layout  { padding: 0 12px; gap: 16px; }
  .epc-results-grid { grid-template-columns: 1fr; }
  .epc-tabs { flex-direction: column; }
  .epc-summary-bar { grid-template-columns: repeat(2, 1fr); }
  .epc-disclaimer { margin: 16px 12px 0; }
}
