/*
 * eSIM Data Calculator — Widget Styles
 * Colors are driven by CSS variables injected inline by PHP.
 * Partners customize via Settings → eSIM Calculator.
 */

.esim-calc {
  /* Brand tokens — priority: plugin override → Elementor global primary → Elementor accent → sensible fallback */
  --c-accent:   var(--ec-accent,
                  var(--e-global-color-primary,
                    var(--e-global-color-accent,
                      var(--accent-color, #1CBC62))));
  --c-btn-text: var(--ec-btn-text,
                  var(--e-global-color-text,
                    var(--buttonTextColor, #ffffff)));

  /* Neutral palette — inherits from site or falls back */
  --c-text:        var(--e-global-color-text, var(--main-font-color, #070403));
  --c-muted:       var(--gray-600, #646C7B);
  --c-bg:          var(--bodyBackgroundColor, #ffffff);
  --c-soft:        var(--cardBackgroundColor, #f3f6fa);
  --c-border:      var(--gray-100, #eff0f5);
  --c-white:       var(--white, #ffffff);
  --c-input-bg:    var(--searchInputBackgroundColor, #eef2f8);

  /* Derived */
  --c-accent-light: color-mix(in srgb, var(--c-accent) 12%, transparent);
  --c-accent-mid:   color-mix(in srgb, var(--c-accent) 35%, transparent);
  --shadow-accent:  0 4px 20px color-mix(in srgb, var(--c-accent) 25%, transparent);

  --r-full: 999px;
  --r-card: 16px;
  --shadow: 0 1px 12px rgba(0,0,0,.06);

  font-family: var(--e-global-typography-primary-font-family), -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  width: 100%;
  margin: 0 auto;
  padding: 36px 20px;
  box-sizing: border-box;
}

.esim-calc *, .esim-calc *::before, .esim-calc *::after {
  box-sizing: border-box; margin: 0; padding: 0;
}

.esim-calc .ec-header h2,
.esim-calc .ec-header p,
.esim-calc .days-text,
.esim-calc .days-sub,
.esim-calc .days-count,
.esim-calc .chip,
.esim-calc .cat-head,
.esim-calc .s-name,
.esim-calc .s-val,
.esim-calc .res-label,
.esim-calc .res-number,
.esim-calc .res-unit,
.esim-calc .res-sub,
.esim-calc .res-toggle button,
.esim-calc .bk-title,
.esim-calc .bk-row,
.esim-calc .cta-note,
.esim-calc .cta-btn,
.esim-calc .days-stepper button {
  font-family: var(--e-global-typography-primary-font-family), -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ── Header ── */
.esim-calc .ec-header { text-align: center; margin-bottom: 28px; }
.esim-calc .ec-header h2 {
  font-size: var(--e-global-typography-primary-font-size, 48px);
  font-weight: var(--e-global-typography-primary-font-weight, 700);
  font-style: var(--e-global-typography-primary-font-style, normal);
  line-height: var(--e-global-typography-primary-line-height, 1.1);
  color: var(--c-text);
  margin-bottom: 6px;
}
.esim-calc .ec-header p {
  font-size: var(--e-global-typography-text-font-size, 18px);
  font-weight: var(--e-global-typography-text-font-weight, 700);
  color: var(--c-text);
}

/* ── Two-column grid ── */
.esim-calc .ec-grid {
  display: grid; grid-template-columns: 1fr 256px;
  gap: 16px; align-items: start;
}

@media (max-width: 660px) {
  .esim-calc .ec-grid { grid-template-columns: 1fr; }
  .esim-calc .ec-right { position: static !important; }
  .esim-calc .ec-header h2 { font-size: 32px; }
  .esim-calc .ec-left { padding: 16px; }
  .esim-calc .days-row { flex-direction: column; align-items: flex-start; gap: 10px; }
  .esim-calc .days-text,
  .esim-calc .days-sub { text-align: left; }
  .esim-calc .days-stepper { align-self: stretch; }
  .esim-calc .days-count { flex: 1; }
}

/* ── Left card ── */
.esim-calc .ec-left {
  background: var(--c-white); border-radius: var(--r-card);
  border: 1px solid var(--c-border); padding: 22px; box-shadow: var(--shadow);
  text-align: left;
}

/* ── Days stepper ── */
.esim-calc .days-row {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding-bottom: 18px; margin-bottom: 18px;
  border-bottom: 1px solid var(--c-border); gap: 12px;
}
.esim-calc .days-text { font-size: 14px; font-weight: 700; color: var(--c-text); }
.esim-calc .days-sub  { font-size: 12px; font-weight: 500; color: var(--c-muted); margin-top: 2px; }
.esim-calc .days-stepper {
  display: flex; align-items: center; flex-shrink: 0;
  background: var(--c-input-bg); border-radius: var(--r-full);
  border: 1px solid var(--c-border); overflow: hidden;
}
.esim-calc .days-stepper button {
  width: 34px; height: 34px; border: none; background: transparent;
  font-size: 17px; cursor: pointer; color: var(--c-muted);
  display: flex; align-items: center; justify-content: center;
  transition: color .15s, background .15s;
}
.esim-calc .days-stepper button:hover {
  color: var(--c-accent);
  background: var(--c-accent-light);
}
.esim-calc .days-count {
  padding: 0 14px; font-size: 14px; font-weight: 700; color: var(--c-text);
  border-left: 1px solid var(--c-border); border-right: 1px solid var(--c-border);
  height: 34px; display: flex; align-items: center; justify-content: center;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ── Preset chips ── */
.esim-calc .preset-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 20px; }
.esim-calc .chip {
  flex: 1; padding: 7px 10px; border: 1.5px solid var(--c-border);
  border-radius: var(--r-full); background: transparent;
  font-family: var(--e-global-typography-primary-font-family), -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; font-size: 12px; font-weight: 600;
  color: var(--c-muted); cursor: pointer; transition: all .15s; text-align: center;
}
.esim-calc .chip:hover {
  border-color: var(--c-accent); color: var(--c-accent);
  background: var(--c-accent-light);
}
.esim-calc .chip.active {
  border-color: var(--c-accent); background: var(--c-accent-light); color: var(--c-accent);
}

/* ── Category blocks ── */
.esim-calc .cat { margin-bottom: 20px; }
.esim-calc .cat:last-child { margin-bottom: 0; }
.esim-calc .cat-head {
  display: flex; align-items: center; gap: 8px; font-size: 10px;
  font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--c-muted); margin-bottom: 12px;
}
.esim-calc .cat-icon {
  width: 24px; height: 24px; border-radius: 7px;
  background: var(--c-accent-light);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.esim-calc .cat-icon svg { width: 13px; height: 13px; color: var(--c-accent); }

/* ── Slider rows ── */
.esim-calc .s-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.esim-calc .s-row:last-child { margin-bottom: 0; }
.esim-calc .s-name { font-size: 13px; font-weight: 500; color: var(--c-text); flex-shrink: 0; }
.esim-calc .s-track { flex: 1; }

.esim-calc input[type=range] {
  -webkit-appearance: none; width: 100%; height: 3px;
  border-radius: var(--r-full); outline: none; cursor: pointer;
  background: var(--c-border);   /* JS overrides with gradient */
}
.esim-calc input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 15px; height: 15px; border-radius: 50%;
  background: var(--c-accent); border: 2.5px solid var(--c-white);
  box-shadow: 0 1px 5px var(--c-accent-mid); cursor: pointer;
}
.esim-calc input[type=range]::-moz-range-thumb {
  width: 15px; height: 15px; border-radius: 50%;
  background: var(--c-accent); border: 2.5px solid var(--c-white); cursor: pointer;
}
.esim-calc .s-val {
  font-size: 12px; font-weight: 700; color: var(--c-accent);
  min-width: 50px; text-align: right; flex-shrink: 0;
}

/* ── Right column ── */
.esim-calc .ec-right {
  position: sticky; top: 20px;
  display: flex; flex-direction: column; gap: 12px;
}

/* ── Result card ── */
.esim-calc .result-card {
  background: var(--c-accent); border-radius: var(--r-card);
  padding: 22px 20px 18px; color: var(--c-white);
  box-shadow: var(--shadow-accent);
}
.esim-calc .res-label {
  font-size: 10px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; opacity: .8; margin-bottom: 4px;
}
.esim-calc .res-number { font-size: 52px; font-weight: 800; line-height: 1; letter-spacing: -.04em; }
.esim-calc .res-unit   { font-size: 21px; font-weight: 600; opacity: .85; margin-left: 2px; }
.esim-calc .res-sub    { font-size: 12px; font-weight: 500; opacity: .75; margin-top: 5px; margin-bottom: 14px; }
.esim-calc .res-toggle {
  display: flex; background: rgba(255,255,255,.18);
  border-radius: var(--r-full); padding: 3px; gap: 2px;
}
.esim-calc .res-toggle button {
  flex: 1; padding: 6px 0; border: none; background: transparent;
  color: var(--c-white); font-family: var(--e-global-typography-primary-font-family), -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; font-size: 11px;
  font-weight: 600; border-radius: var(--r-full); cursor: pointer; transition: background .15s;
}
.esim-calc .res-toggle button.active { background: rgba(255,255,255,.28); }

/* ── Breakdown card ── */
.esim-calc .breakdown-card { background: var(--c-soft); border-radius: var(--r-card); padding: 16px; }
.esim-calc .bk-title {
  font-size: 10px; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; color: var(--c-muted); margin-bottom: 11px;
}
.esim-calc .bk-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px; font-size: 12px; font-weight: 500;
}
.esim-calc .bk-row:last-child { margin-bottom: 0; }
.esim-calc .bk-left { display: flex; align-items: center; gap: 7px; color: var(--c-muted); }
.esim-calc .bk-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--c-accent-mid); flex-shrink: 0;
}
.esim-calc .bk-right { font-weight: 700; color: var(--c-text); }

/* ── CTA card ── */
.esim-calc .cta-card {
  background: var(--c-white); border-radius: var(--r-card);
  border: 1px solid var(--c-border); padding: 16px;
  box-shadow: var(--shadow); text-align: center;
}
.esim-calc .cta-note {
  font-size: 12px; font-weight: 500; color: var(--c-muted);
  line-height: 1.55; margin-bottom: 11px;
}
.esim-calc .cta-note strong { color: var(--c-text); font-weight: 700; }
.esim-calc .cta-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; background: var(--c-accent); color: var(--c-btn-text);
  font-family: var(--e-global-typography-primary-font-family), -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; font-size: 13px; font-weight: 700;
  border: none; border-radius: var(--r-full); padding: 12px 16px;
  cursor: pointer; text-decoration: none; transition: opacity .15s, transform .1s;
}
.esim-calc .cta-btn:hover { opacity: .88; transform: translateY(-1px); }
.esim-calc .cta-btn svg { width: 14px; height: 14px; flex-shrink: 0; }
