/**
 * 8th Pay Commission Salary Calculator — WordPress Plugin Stylesheet
 *
 * All rules are scoped under ".epc-root" to guarantee zero conflicts
 * with any theme or other plugin. The design is pixel-identical to the
 * original Blogger version.
 *
 * @package EighthPayCalculator
 * @version 1.0.2
 */

/* ════════════════════════════════════════════════════════════════════
   1. CSS Custom Properties (design tokens)
   ════════════════════════════════════════════════════════════════════ */
.epc-root {
  --epc-bg:      #ffffff;
  --epc-card:    #ffffff;
  --epc-ink:     #0f172a;
  --epc-muted:   #64748b;
  --epc-line:    #e2e8f0;
  --epc-accent:  #0ea5e9;
  --epc-font:    ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --epc-mono:    'Roboto Mono', 'Noto Sans Mono', 'Liberation Mono', Consolas, monospace;
}

/* ════════════════════════════════════════════════════════════════════
   2. Root / Reset
   ════════════════════════════════════════════════════════════════════ */
.epc-root {
  background: var(--epc-bg);
  color: var(--epc-ink);
  font: 14px/1.5 var(--epc-font);
}

/* Scoped box-sizing reset — only affects children of our widget */
.epc-root *,
.epc-root *::before,
.epc-root *::after {
  box-sizing: border-box;
}

/* ════════════════════════════════════════════════════════════════════
   3. Layout
   ════════════════════════════════════════════════════════════════════ */
.epc-wrap {
  max-width: 1100px;
  margin: 8px auto;
  padding: 0 1px;
}

.epc-header {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 8px 0;
}

.epc-brand {
  font-weight: 700;
  font-size: clamp(1.05rem, 2.2vw, 1.35rem);
}

.epc-tagline {
  color: var(--epc-muted);
  font-size: 0.8rem;
}

.epc-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: 1.1fr 0.9fr;
}

@media (max-width: 920px) {
  .epc-grid {
    display: flex !important;
    flex-direction: column;
  }
  .epc-grid > * {
    flex: 0 0 auto;
  }
}

/* ════════════════════════════════════════════════════════════════════
   4. Cards
   ════════════════════════════════════════════════════════════════════ */
.epc-card {
  background: var(--epc-card);
  border: 1px solid var(--epc-line);
  border-radius: 3px;
  padding: 5px;
}

.epc-subcard {
  margin-top: 10px;
}

.epc-sticky {
  position: sticky;
  top: 8px;
}

@media (max-width: 920px) {
  .epc-sticky {
    position: relative !important;
    top: auto !important;
  }
}

/* ════════════════════════════════════════════════════════════════════
   5. Section title
   ════════════════════════════════════════════════════════════════════ */
.epc-section-title {
  margin: 0 0 8px;
  font-size: 0.95rem;
  font-weight: 700;
}

/* ════════════════════════════════════════════════════════════════════
   6. Form rows / fields
   ════════════════════════════════════════════════════════════════════ */
.epc-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.epc-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.epc-root label {
  font-size: 0.8rem;
  color: var(--epc-muted);
}

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

/* ════════════════════════════════════════════════════════════════════
   7. Inputs & Selects
   ════════════════════════════════════════════════════════════════════ */
.epc-root select,
.epc-root input[type="number"],
.epc-root input[type="text"] {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--epc-line);
  border-radius: 3px;
  background: #fff;
  color: var(--epc-ink);
  outline: none;
  font-size: 0.92rem;
  font-family: var(--epc-font);

  /* Override theme interference */
  box-shadow: none;
  -webkit-appearance: none;
     -moz-appearance: none;
          appearance: auto; /* keep native arrow on selects */
}

.epc-root select {
  appearance: auto; /* restore dropdown arrow */
}

.epc-root select:focus,
.epc-root input[type="number"]:focus,
.epc-root input[type="text"]:focus {
  border-color: var(--epc-accent);
  box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.15);
}

/* ════════════════════════════════════════════════════════════════════
   8. Toggle switches
   ════════════════════════════════════════════════════════════════════ */
.epc-toggles {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 8px;
}

.epc-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* Custom checkbox rendered as a pill toggle */
.epc-switch input[type="checkbox"] {
  position: relative;
  width: 40px;
  height: 22px;
  appearance: none;
  -webkit-appearance: none;
  background: #e5e7eb;
  border: 1px solid #cbd5e1;
  border-radius: 9999px;
  outline: none;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  flex-shrink: 0;
}

.epc-switch input[type="checkbox"]:checked {
  background: var(--epc-accent);
  border-color: var(--epc-accent);
}

.epc-switch input[type="checkbox"]::before {
  content: "";
  position: absolute;
  top: 1px;
  left: 1px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 9999px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  transition: left 0.2s;
}

.epc-switch input[type="checkbox"]:checked::before {
  left: 19px;
}

.epc-switch-label {
  font-size: 0.85rem;
  color: var(--epc-muted);
}

/* ════════════════════════════════════════════════════════════════════
   9. Add / Remove buttons
   ════════════════════════════════════════════════════════════════════ */
.epc-btn-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  margin-top: 8px;
}

.epc-root .epc-btn {
  flex: 1 1 0;
  min-width: 0;
  padding: 7px 8px;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
  font-family: var(--epc-font);
  color: #ffffff;
  background: #16a34a;
  border: 2px solid #15803d;
  border-radius: 4px;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: none;
  line-height: 1.4;
}

.epc-root .epc-btn:hover,
.epc-root .epc-btn:focus {
  background: #ffffff;
  color: #111827;
  border-color: #374151;
  outline: none;
}

@media (max-width: 600px) {
  .epc-btn-row {
    flex-wrap: nowrap;
    gap: 5px;
  }

  .epc-root .epc-btn {
    font-size: 0.72rem;
    padding: 6px 4px;
  }
}

/* ════════════════════════════════════════════════════════════════════
   10. Stack (vertical flex column)
   ════════════════════════════════════════════════════════════════════ */
.epc-stack {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* ════════════════════════════════════════════════════════════════════
   11. KPI summary boxes
   ════════════════════════════════════════════════════════════════════ */
.epc-kpis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.epc-kpi {
  border: 1px dashed var(--epc-line);
  background: #fbfdff;
  border-radius: 3px;
  padding: 5px;
  min-width: 0;
  overflow: hidden;
}

.epc-kpi-title {
  margin: 0;
  color: var(--epc-muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.epc-val {
  margin-top: 4px;
  font-weight: 700;
  font-size: 0.9rem;
}

/* ════════════════════════════════════════════════════════════════════
   12. Result rows
   ════════════════════════════════════════════════════════════════════ */
.epc-list {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px dashed var(--epc-line);
  padding: 6px 0;
  font-size: 0.88rem;
}

.epc-divider {
  border: none;
  border-top: 1px solid var(--epc-line);
  margin: 0;
}

/* ════════════════════════════════════════════════════════════════════
   13. Monospace numbers
   ════════════════════════════════════════════════════════════════════ */
.epc-mono {
  font-family: var(--epc-mono);
  white-space: nowrap;
  letter-spacing: -0.03em;
  font-feature-settings: "tnum" 1; /* tabular numbers — equal width digits */
}

/* ════════════════════════════════════════════════════════════════════
   14. Disclaimer
   ════════════════════════════════════════════════════════════════════ */
.epc-disclaimer {
  display: block;
  margin-top: 8px;
  font-size: 0.78rem;
  color: var(--epc-muted);
}

/* ════════════════════════════════════════════════════════════════════
   15. Mobile overrides  (≤ 600 px)
   ════════════════════════════════════════════════════════════════════ */
@media (max-width: 600px) {
  .epc-root {
    font-size: 13px;
  }

  .epc-root select,
  .epc-root input[type="number"],
  .epc-root input[type="text"] {
    padding: 7px 9px;
  }

  .epc-val {
    font-size: 1rem;
  }

  /* Allow monospace numbers to wrap gracefully */
  .epc-mono {
    white-space: normal;
    overflow-wrap: break-word;
    word-break: break-all;
  }

  .epc-kpis {
    gap: 3px;
  }

  .epc-kpi {
    padding: 6px 5px;
  }

  /* Slightly shrink large mono values in KPI boxes */
  .epc-kpi .epc-val.epc-mono {
    font-size: 0.95rem;
    letter-spacing: -0.3px;
  }
}
