/**
 * 7th Pay Commission Salary Calculator — WordPress Plugin Stylesheet
 * All rules scoped under .spc-root — zero conflict with themes or other plugins.
 *
 * @package SeventhPayCalculator
 * @version 1.0.0
 */

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

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

.spc-root *,
.spc-root *::before,
.spc-root *::after {
  box-sizing: border-box;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

/* Disabled fitment factor — visually distinct */
.spc-root input[disabled] {
  background: #f1f5f9;
  color: var(--spc-muted);
  cursor: not-allowed;
}

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

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

.spc-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;
}

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

.spc-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;
}

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

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

/* ══════════════════════════════════════════════════════
   9. Buttons — green default, white hover
   ══════════════════════════════════════════════════════ */
.spc-btn-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  margin-top: 8px;
}

.spc-root .spc-btn {
  flex: 1 1 0;
  min-width: 0;
  padding: 7px 8px;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
  font-family: var(--spc-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;
}

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

/* ══════════════════════════════════════════════════════
   10. Stack
   ══════════════════════════════════════════════════════ */
.spc-stack {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

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

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

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

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

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

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

/* ══════════════════════════════════════════════════════
   13. Mono numbers — Roboto Mono, tight spacing
   ══════════════════════════════════════════════════════ */
.spc-mono {
  font-family: var(--spc-mono);
  white-space: nowrap;
  letter-spacing: -0.03em;
  font-feature-settings: "tnum" 1;
}

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

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

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

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

  .spc-mono {
    white-space: normal;
    overflow-wrap: break-word;
    word-break: break-all;
  }

  /* KPI boxes — tighter gap on mobile */
  .spc-kpis {
    gap: 3px;
  }

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

  .spc-kpi .spc-val.spc-mono {
    font-size: 0.95rem;
    letter-spacing: -0.3px;
  }

  /* Buttons — always same row, compact */
  .spc-btn-row {
    flex-wrap: nowrap;
    gap: 5px;
  }

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