/* =============================================================
   Salary Slip Generator — salary-slip-generator.css
   Mobile-first. Scoped to .ss-wrap
   ============================================================= */

.ss-wrap *, .ss-wrap *::before, .ss-wrap *::after {
  box-sizing: border-box; margin: 0; padding: 0;
}
.ss-wrap {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px; color: #1e293b;
  max-width: 1060px; margin: 0 auto;
  background: #fff; border: 1px solid #e2e8f0;
  border-radius: 16px; overflow: hidden;
}

/* ── Header ───────────────────────────────────────────────── */
.ss-header {
  padding: 20px 24px 18px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  display: flex; align-items: flex-start;
  justify-content: space-between; gap: 16px;
  flex-wrap: wrap;
}
.ss-title { font-size: 21px; font-weight: 700; color: #1e3a5f; margin-bottom: 3px; }
.ss-subtitle { font-size: 13px; color: #64748b; }

/* Currency selector */
.ss-currency-wrap { display: flex; flex-direction: column; gap: 4px; flex-shrink: 0; }
.ss-currency-label { font-size: 11px; font-weight: 600; color: #64748b; text-transform: uppercase; letter-spacing: .05em; }
.ss-currency-select {
  padding: 8px 32px 8px 12px; border: 1.5px solid #cbd5e1;
  border-radius: 8px; font-size: 14px; font-weight: 600;
  color: #1e3a5f; background: #fff; cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23718096' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
  min-width: 110px; transition: border-color .18s;
}
.ss-currency-select:focus { outline: none; border-color: #4f46e5; }

/* ── Body layout ──────────────────────────────────────────── */
.ss-body { display: flex; flex-direction: column; }
@media (min-width: 740px) {
  .ss-body { flex-direction: row; align-items: flex-start; }
  .ss-form          { width: 50%; border-right: 1px solid #e2e8f0; }
  .ss-preview-panel { width: 50%; position: sticky; top: 0; max-height: 100vh; overflow-y: auto; }
}

/* ── Form ─────────────────────────────────────────────────── */
.ss-form { padding: 20px; display: flex; flex-direction: column; gap: 12px; }

.ss-section-title {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: #64748b;
}

.ss-field { display: flex; flex-direction: column; gap: 5px; }
.ss-label { font-size: 12.5px; font-weight: 600; color: #334155; }
.ss-optional { font-weight: 400; color: #94a3b8; font-size: 11px; }

.ss-input {
  width: 100%; padding: 9px 12px;
  border: 1.5px solid #cbd5e1; border-radius: 8px;
  font-size: 13.5px; color: #1e293b; background: #f8fafc;
  font-family: inherit; outline: none; transition: border-color .18s, background .18s;
  -moz-appearance: textfield;
}
.ss-input::-webkit-outer-spin-button,
.ss-input::-webkit-inner-spin-button { -webkit-appearance: none; }
.ss-input:focus { border-color: #4f46e5; background: #fff; }
.ss-textarea { resize: vertical; min-height: 56px; }

.ss-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 480px) { .ss-row-2 { grid-template-columns: 1fr; } }

/* Logo box */
.ss-logo-box {
  border: 1.5px dashed #cbd5e1; border-radius: 8px;
  padding: 14px; display: flex; align-items: center;
  justify-content: center; cursor: pointer; position: relative;
  background: #f8fafc; min-height: 64px; transition: border-color .18s;
}
.ss-logo-box:hover { border-color: #4f46e5; }
.ss-logo-ph { display: flex; align-items: center; gap: 8px; color: #64748b; font-size: 13px; pointer-events: none; }
.ss-logo-remove {
  position: absolute; top: 6px; right: 6px;
  background: rgba(0,0,0,.4); color: #fff; border: none;
  border-radius: 50%; width: 20px; height: 20px; font-size: 11px;
  cursor: pointer; line-height: 20px; text-align: center; padding: 0;
}

/* Divider */
.ss-divider {
  display: flex; align-items: center; gap: 8px;
  color: #94a3b8; font-size: 11.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
}
.ss-divider::before, .ss-divider::after { content:''; flex:1; height:1px; background:#e2e8f0; }

/* Earning / deduction rows */
.ss-items-header {
  display: grid; grid-template-columns: 1fr 130px 32px;
  gap: 8px; font-size: 11px; font-weight: 700;
  color: #94a3b8; text-transform: uppercase; letter-spacing: .05em;
  padding: 0 4px;
}
.ss-item-row {
  display: grid; grid-template-columns: 1fr 130px 32px;
  gap: 8px; align-items: center; margin-bottom: 6px;
}
.ss-item-prefix-wrap {
  display: flex; align-items: center;
  border: 1.5px solid #cbd5e1; border-radius: 8px;
  overflow: hidden; background: #f8fafc; transition: border-color .18s;
}
.ss-item-prefix-wrap:focus-within { border-color: #4f46e5; background: #fff; }
.ss-item-sym {
  padding: 0 8px; font-size: 13px; font-weight: 600;
  color: #64748b; background: #f1f5f9; height: 40px;
  display: flex; align-items: center; border-right: 1px solid #e2e8f0;
  flex-shrink: 0; min-width: 30px;
}
.ss-item-amount {
  flex: 1; border: none; background: transparent;
  padding: 0 10px; height: 40px; font-size: 13.5px;
  color: #1e293b; outline: none;
  -moz-appearance: textfield; text-align: right;
}
.ss-item-amount::-webkit-outer-spin-button,
.ss-item-amount::-webkit-inner-spin-button { -webkit-appearance: none; }

.ss-item-del {
  background: none; border: none; color: #cbd5e1;
  font-size: 18px; cursor: pointer; padding: 0;
  line-height: 1; transition: color .15s;
}
.ss-item-del:hover { color: #ef4444; }

.ss-add-row-btn {
  width: 100%; padding: 8px; margin-top: 4px;
  border: 1.5px dashed #cbd5e1; border-radius: 8px;
  background: none; color: #64748b; font-size: 13px;
  font-weight: 600; cursor: pointer; transition: all .15s;
}
.ss-add-row-btn:hover { border-color: #4f46e5; color: #4f46e5; }

/* Actions */
.ss-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.ss-btn {
  flex: 1; min-width: 90px; padding: 11px 10px;
  border-radius: 9px; font-size: 13.5px; font-weight: 600;
  cursor: pointer; border: none; transition: opacity .18s;
}
.ss-btn:hover { opacity: .86; }
.ss-btn-pdf   { background: #4f46e5; color: #fff; }
.ss-btn-print { background: #0f766e; color: #fff; }
.ss-btn-reset { background: #f1f5f9; color: #64748b; border: 1px solid #e2e8f0; }

/* ── Preview panel ────────────────────────────────────────── */
.ss-preview-panel { background: #f8fafc; padding: 20px; }
.ss-preview-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: #94a3b8; margin-bottom: 12px;
}
.ss-preview-doc {
  background: #fff; border: 1px solid #e2e8f0;
  border-radius: 10px; padding: 24px; font-size: 13px;
  line-height: 1.6; color: #1e293b; min-height: 300px;
}

/* ── Payslip preview internals ────────────────────────────── */
.sp-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; }
.sp-company-name { font-size: 17px; font-weight: 800; color: #1e3a5f; }
.sp-company-meta { font-size: 11px; color: #64748b; margin-top: 3px; line-height: 1.6; }
.sp-logo { max-width: 120px; max-height: 50px; object-fit: contain; }
.sp-title-block { text-align: right; }
.sp-slip-title { font-size: 20px; font-weight: 800; color: #4f46e5; letter-spacing: .03em; }
.sp-period { font-size: 12px; color: #64748b; margin-top: 3px; }

.sp-emp-box {
  background: #f8fafc; border-radius: 8px; padding: 12px 14px;
  margin-bottom: 16px; display: grid;
  grid-template-columns: 1fr 1fr; gap: 6px 16px;
}
.sp-emp-row { font-size: 12px; }
.sp-emp-lbl { color: #94a3b8; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.sp-emp-val { font-weight: 600; color: #1e293b; }

.sp-table { width: 100%; border-collapse: collapse; margin-bottom: 12px; font-size: 12.5px; }
.sp-table th {
  background: #1e3a5f; color: #fff; padding: 8px 10px;
  text-align: left; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .05em;
}
.sp-table th.r { text-align: right; }
.sp-table td { padding: 8px 10px; border-bottom: 1px solid #f1f5f9; color: #334155; }
.sp-table td.r { text-align: right; }
.sp-table tr:nth-child(even) td { background: #f8fafc; }
.sp-table tr:last-child td { border-bottom: none; }

.sp-totals { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.sp-total-box { border-radius: 8px; padding: 10px 14px; }
.sp-total-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 4px; }
.sp-total-earn { background: #eff6ff; }
.sp-total-earn .sp-total-label { color: #1e40af; }
.sp-total-earn .sp-total-val { font-size: 18px; font-weight: 800; color: #1e40af; }
.sp-total-ded  { background: #fef2f2; }
.sp-total-ded .sp-total-label  { color: #991b1b; }
.sp-total-ded .sp-total-val  { font-size: 18px; font-weight: 800; color: #991b1b; }

.sp-net-box {
  background: #4f46e5; border-radius: 10px; padding: 14px 16px;
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 14px;
}
.sp-net-label { font-size: 12px; font-weight: 700; color: rgba(255,255,255,.75); text-transform: uppercase; letter-spacing: .06em; }
.sp-net-amount { font-size: 24px; font-weight: 800; color: #fff; }

.sp-notes {
  background: #f8fafc; border-left: 3px solid #4f46e5;
  border-radius: 0 6px 6px 0; padding: 10px 12px;
  font-size: 11.5px; color: #64748b; white-space: pre-line;
}
.sp-footer { text-align: center; margin-top: 14px; font-size: 10.5px; color: #cbd5e1; padding-top: 12px; border-top: 1px solid #f1f5f9; }

/* ── Mobile ───────────────────────────────────────────────── */
@media (max-width: 480px) {
  .ss-header  { padding: 16px; flex-direction: column; }
  .ss-form, .ss-preview-panel { padding: 16px; }
  .ss-title   { font-size: 18px; }
  .sp-totals  { grid-template-columns: 1fr; }
  .sp-emp-box { grid-template-columns: 1fr; }
}

/* ── Print ────────────────────────────────────────────────── */
@media print {
  .ss-form, .ss-header, .ss-actions,
  .ss-preview-label { display: none !important; }
  .ss-body  { display: block; }
  .ss-preview-panel { width: 100%; background: #fff; padding: 0; }
  .ss-preview-doc { border: none; padding: 0; }
  .ss-wrap  { border: none; border-radius: 0; }
}
