/* WP Invoice Manager — Shortcode & Dashboard Frontend Styles
   Font: Roboto · Design: Clean, spacious, black & white
*/
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;600;700&family=Roboto+Mono:wght@400;500&display=swap');

/* ── CSS Variables ── */
:root {
  --wpim-f:         'Roboto', -apple-system, sans-serif;
  --wpim-fm:        'Roboto Mono', monospace;
  --wpim-text:      #111827;
  --wpim-muted:     #6b7280;
  --wpim-subtle:    #9ca3af;
  --wpim-border:    #e4e7ec;
  --wpim-border-s:  #c8cdd6;
  --wpim-bg:        #f5f6f8;
  --wpim-surface:   #ffffff;
  --wpim-accent:    #111827;
  --wpim-blue:      #2563eb;
  --wpim-green:     #16a34a;
  --wpim-red:       #dc2626;
  --wpim-r:         8px;
  --wpim-r-sm:      5px;
  --wpim-sh:        0 1px 4px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.04);
}

/* ── Reset scoped to plugin ── */
.wpim-sc-wrap *,
.wpim-dash-sc *  { box-sizing: border-box; }

.wpim-sc-wrap,
.wpim-dash-sc {
  font-family: var(--wpim-f);
  font-size: 14px;
  line-height: 1.6;
  color: var(--wpim-text);
}

/* ── Admin notice (shortcode config error) ── */
.wpim-sc-notice { padding: 14px 18px; border-radius: var(--wpim-r-sm); font-size: 13.5px; }
.wpim-sc-warn   { background: #fffbeb; border: 1px solid #fcd34d; color: #92400e; }

/* ════════════════════════════════════════════
   PROJECT SHORTCODE  [wpim_project_invoices]
   ════════════════════════════════════════════ */

/* Header */
.wpim-sc-wrap         { margin: 32px 0; }
.wpim-sc-header       { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.wpim-sc-title        { display: flex; align-items: center; gap: 14px; }
.wpim-sc-icon         { font-size: 26px; }
.wpim-sc-heading      { font-size: 18px; font-weight: 700; color: var(--wpim-text); letter-spacing: -.2px; line-height: 1.2; }
.wpim-sc-sub          { font-size: 12px; color: var(--wpim-muted); margin-top: 2px; font-weight: 400; }

/* Buttons (shared) */
.wpim-sc-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 10px 20px; border-radius: var(--wpim-r-sm); cursor: pointer;
  font-family: var(--wpim-f); font-size: 13.5px; font-weight: 500;
  border: 1.5px solid var(--wpim-border); background: var(--wpim-surface); color: var(--wpim-text);
  transition: all .15s ease; text-decoration: none; line-height: 1; white-space: nowrap;
}
.wpim-sc-btn:hover          { border-color: var(--wpim-border-s); background: #fafafa; color: var(--wpim-text); text-decoration: none; }
.wpim-sc-btn-primary        { background: var(--wpim-accent); color: #fff; border-color: var(--wpim-accent); }
.wpim-sc-btn-primary:hover  { background: #1f2937; color: #fff; border-color: #1f2937; }
.wpim-sc-btn-send           { background: var(--wpim-blue);  color: #fff; border-color: var(--wpim-blue); }
.wpim-sc-btn-send:hover     { background: #1d4ed8; color: #fff; }
.wpim-sc-btn-success        { background: var(--wpim-green); color: #fff; border-color: var(--wpim-green); }
.wpim-sc-btn-success:hover  { background: #15803d; color: #fff; }

/* Pills */
.wpim-sc-pills      { display: flex; gap: 14px; margin-bottom: 24px; flex-wrap: wrap; }
.wpim-sc-pill       { display: flex; flex-direction: column; padding: 16px 22px; border-radius: var(--wpim-r); min-width: 140px; background: var(--wpim-surface); border: 1px solid var(--wpim-border); box-shadow: var(--wpim-sh); }
.pill-label         { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .8px; color: var(--wpim-muted); }
.pill-val           { font-size: 22px; font-weight: 700; font-family: var(--wpim-fm); margin-top: 5px; color: var(--wpim-text); }

/* Invoice table */
.wpim-sc-table-wrap   { overflow-x: auto; border-radius: var(--wpim-r); border: 1px solid var(--wpim-border); box-shadow: var(--wpim-sh); }
.wpim-sc-table        { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.wpim-sc-table thead th {
  background: var(--wpim-accent); color: #fff; padding: 13px 16px;
  text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: 1px; font-weight: 600;
}
.wpim-sc-table tbody td  { padding: 13px 16px; border-bottom: 1px solid var(--wpim-border); vertical-align: middle; }
.wpim-sc-table tbody tr:last-child td { border-bottom: none; }
.wpim-sc-table tbody tr:hover         { background: #fafafa; }
.wpim-sc-inv-num  { font-family: var(--wpim-fm); font-weight: 600; font-size: 13px; }
.wpim-sc-amount   { font-family: var(--wpim-fm); font-weight: 600; }
.wpim-sc-overdue  { color: var(--wpim-red); font-weight: 600; }
.wpim-sc-empty    { padding: 48px 32px; text-align: center; color: var(--wpim-muted); font-size: 14px; background: #fafafa; border-radius: var(--wpim-r); border: 1px dashed var(--wpim-border); }

/* Badges */
.wpim-sc-badge            { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .6px; }
.wpim-sc-badge-draft      { background: #f3f4f6; color: #4b5563;  border: 1px solid #d1d5db; }
.wpim-sc-badge-sent       { background: #eff6ff; color: #1d4ed8;  border: 1px solid #bfdbfe; }
.wpim-sc-badge-paid       { background: #f0fdf4; color: #15803d;  border: 1px solid #bbf7d0; }
.wpim-sc-badge-cancelled  { background: #fef2f2; color: #b91c1c;  border: 1px solid #fecaca; }

/* Row actions */
.wpim-sc-row-actions { display: flex; gap: 4px; align-items: center; }
.wpim-sc-act {
  background: none; border: none; cursor: pointer; font-size: 15px;
  padding: 5px 7px; border-radius: 5px; opacity: .65;
  transition: opacity .12s, background .12s; text-decoration: none; display: inline-flex;
}
.wpim-sc-act:hover { opacity: 1; background: #f3f4f6; }

/* ── Modal ── */
.wpim-sc-modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  z-index: 99998; display: flex; align-items: flex-start; justify-content: center;
  padding: 48px 16px; overflow-y: auto;
}
.wpim-sc-modal {
  background: var(--wpim-surface); border-radius: 12px; width: 100%; max-width: 860px;
  box-shadow: 0 24px 64px rgba(0,0,0,.22); animation: wpimSlideIn .2s ease;
  overflow: hidden; position: relative;
}
@keyframes wpimSlideIn {
  from { transform: translateY(-20px); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}
.wpim-sc-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 28px; background: var(--wpim-accent); color: #fff;
}
.wpim-sc-modal-title  { font-size: 15px; font-weight: 600; letter-spacing: -.1px; }
.wpim-sc-modal-close  {
  background: none; border: none; color: #fff; font-size: 20px; cursor: pointer;
  opacity: .6; padding: 2px 6px; line-height: 1; transition: opacity .12s; border-radius: 4px;
}
.wpim-sc-modal-close:hover { opacity: 1; background: rgba(255,255,255,.1); }
.wpim-sc-modal-body   { padding: 32px 28px; max-height: 80vh; overflow-y: auto; }

/* Flash */
.wpim-sc-flash {
  position: fixed; bottom: 28px; right: 28px; z-index: 99999;
  padding: 13px 22px; border-radius: var(--wpim-r); font-size: 13.5px; font-weight: 500;
  box-shadow: 0 4px 20px rgba(0,0,0,.15); animation: wpimFadeUp .25s ease; pointer-events: none;
}
@keyframes wpimFadeUp { from { transform: translateY(14px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.wpim-sc-flash-success { background: var(--wpim-accent); color: #fff; }
.wpim-sc-flash-error   { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }

/* ── Form inside modal / dashboard ── */
.wpim-sc-form          { display: flex; flex-direction: column; gap: 28px; }

.wpim-sc-section-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; color: var(--wpim-muted);
  padding-bottom: 10px; border-bottom: 2px solid var(--wpim-border);
  margin-bottom: -8px;
}

.wpim-sc-row2   { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.wpim-sc-row3   { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 18px; }
.wpim-sc-row4   { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 18px; }

.wpim-sc-field  { display: flex; flex-direction: column; gap: 7px; }
.wpim-sc-field label {
  font-size: 11.5px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .7px; color: var(--wpim-muted);
}
.wpim-sc-opt { font-weight: 400; text-transform: none; letter-spacing: 0; font-size: 11px; }

.wpim-sc-field input,
.wpim-sc-field select,
.wpim-sc-field textarea {
  padding: 10px 14px;
  border: 1.5px solid var(--wpim-border); border-radius: var(--wpim-r-sm);
  font-family: var(--wpim-f); font-size: 14px; line-height: 1.5;
  color: var(--wpim-text); background: var(--wpim-surface);
  transition: border-color .15s, box-shadow .15s; width: 100%;
}
.wpim-sc-field input:focus,
.wpim-sc-field select:focus,
.wpim-sc-field textarea:focus {
  border-color: var(--wpim-accent); outline: none;
  box-shadow: 0 0 0 3px rgba(17,24,39,.08);
}
.wpim-sc-field textarea { resize: vertical; min-height: 80px; }

/* Items table */
.wpim-sc-items-wrap { border: 1px solid var(--wpim-border); border-radius: var(--wpim-r-sm); overflow: hidden; }
.wpim-sc-items-tbl  { width: 100%; border-collapse: collapse; }
.wpim-sc-items-tbl thead th {
  background: #f9fafb; padding: 11px 12px; text-align: left;
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .8px;
  color: var(--wpim-muted); font-weight: 600; border-bottom: 1.5px solid var(--wpim-border);
}
.wpim-sc-th-num    { text-align: right !important; width: 110px; }
.wpim-sc-items-tbl td { padding: 7px 7px; border-bottom: 1px solid var(--wpim-border); vertical-align: middle; }
.wpim-sc-items-tbl tbody tr:last-child td { border-bottom: none; }
.wpim-sc-items-tbl input {
  width: 100%; padding: 9px 11px; border: 1.5px solid var(--wpim-border);
  border-radius: var(--wpim-r-sm); font-family: var(--wpim-f); font-size: 13.5px;
  transition: border-color .15s;
}
.wpim-sc-items-tbl input:focus          { outline: none; border-color: var(--wpim-accent); box-shadow: 0 0 0 2px rgba(17,24,39,.07); }
.wpim-sc-items-tbl input[readonly]      { background: #f9fafb; color: var(--wpim-muted); cursor: default; text-align: right; }
.wpim-sc-rm-row {
  background: none; border: none; cursor: pointer; color: var(--wpim-subtle);
  font-size: 14px; padding: 5px 8px; border-radius: 4px; transition: all .12s; font-weight: 400;
}
.wpim-sc-rm-row:hover { color: var(--wpim-red); background: #fef2f2; }
.wpim-sc-add-row {
  display: block; width: 100%; padding: 11px; background: #fafafa;
  border: none; border-top: 1px dashed var(--wpim-border); cursor: pointer;
  color: var(--wpim-blue); font-family: var(--wpim-f); font-size: 13px;
  font-weight: 500; transition: background .12s;
}
.wpim-sc-add-row:hover { background: #eff6ff; }

/* Totals */
.wpim-sc-totals {
  background: #f9fafb; border: 1px solid var(--wpim-border);
  border-radius: var(--wpim-r-sm); overflow: hidden;
  align-self: flex-end; min-width: 280px;
}
.wpim-sc-total-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 11px 18px; border-bottom: 1px solid var(--wpim-border);
  font-family: var(--wpim-fm); font-size: 13px; color: var(--wpim-muted);
}
.wpim-sc-total-row:last-child { border-bottom: none; }
.wpim-sc-disc-row   { color: var(--wpim-red); }
.wpim-sc-grand {
  background: var(--wpim-accent); color: #fff;
  font-size: 15px; font-weight: 700; padding: 14px 18px;
}
.wpim-sc-grand span:first-child {
  font-family: var(--wpim-f); font-size: 11px;
  text-transform: uppercase; letter-spacing: .8px; font-weight: 600;
}

/* Form actions */
.wpim-sc-form-actions {
  display: flex; gap: 12px; flex-wrap: wrap; padding-top: 4px;
  border-top: 1px solid var(--wpim-border); padding-top: 24px;
}

/* Loader */
.wpim-sc-btn.wpim-loading   { opacity: .6; pointer-events: none; }
.wpim-sc-spinner {
  display: inline-block; width: 13px; height: 13px;
  border: 2px solid rgba(255,255,255,.35); border-top-color: #fff;
  border-radius: 50%; animation: wpimSpin .55s linear infinite;
  vertical-align: middle; margin-right: 6px;
}
@keyframes wpimSpin { to { transform: rotate(360deg); } }

/* ════════════════════════════════════════════
   DASHBOARD SHORTCODE  [wpim_dashboard]
   ════════════════════════════════════════════ */

.wpim-dash-sc {
  border: 1px solid var(--wpim-border); border-radius: 12px;
  padding: 32px; background: var(--wpim-surface);
  box-shadow: var(--wpim-sh);
}

/* Nav tabs */
.wpim-dash-nav      {
  display: flex; gap: 2px; margin-bottom: 32px;
  border-bottom: 2px solid var(--wpim-border); flex-wrap: wrap;
}
.wpim-dash-nav-link {
  padding: 10px 20px; font-size: 13.5px; font-weight: 500; text-decoration: none;
  color: var(--wpim-muted); border-radius: 7px 7px 0 0;
  border: 1.5px solid transparent; border-bottom: none;
  margin-bottom: -2px; transition: all .12s;
}
.wpim-dash-nav-link:hover   { color: var(--wpim-text); background: #f9fafb; text-decoration: none; }
.wpim-dash-nav-active       { color: var(--wpim-text) !important; background: var(--wpim-surface) !important; border-color: var(--wpim-border) !important; border-bottom-color: var(--wpim-surface) !important; font-weight: 600 !important; }

/* View header */
.wpim-dash-header  { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; gap: 16px; }
.wpim-dash-title   { font-size: 19px; font-weight: 700; color: var(--wpim-text); margin: 0; letter-spacing: -.2px; }

/* Stat cards */
.wpim-dash-stats   { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; margin-bottom: 32px; }
.wpim-dash-stat    {
  background: var(--wpim-surface); border: 1px solid var(--wpim-border);
  border-radius: var(--wpim-r); padding: 22px 18px; text-align: center;
  box-shadow: var(--wpim-sh);
}
.dstat-icon   { font-size: 22px; margin-bottom: 8px; }
.dstat-num    { font-size: 30px; font-weight: 700; color: var(--wpim-text); line-height: 1; }
.dstat-label  { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .8px; color: var(--wpim-muted); margin: 6px 0 2px; }
.dstat-amt    { font-size: 11.5px; color: var(--wpim-subtle); font-family: var(--wpim-fm); }

/* Section header */
.wpim-dash-section-hdr {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11px; font-weight: 700; color: var(--wpim-muted);
  margin-bottom: 14px; text-transform: uppercase; letter-spacing: 1px;
}
.wpim-dash-section-hdr a { font-weight: 500; color: var(--wpim-blue); text-decoration: none; font-size: 12px; text-transform: none; letter-spacing: 0; }

/* Filters */
.wpim-dash-filters         { margin-bottom: 20px; }
.wpim-dash-filters select  {
  padding: 9px 13px; border-radius: var(--wpim-r-sm); border: 1.5px solid var(--wpim-border);
  font-family: var(--wpim-f); font-size: 13px; margin-right: 8px;
  background: var(--wpim-surface); color: var(--wpim-text); transition: border-color .15s;
}
.wpim-dash-filters select:focus { border-color: var(--wpim-accent); outline: none; }

/* Notices */
.wpim-dash-notice      { padding: 12px 16px; border-radius: var(--wpim-r-sm); margin-bottom: 20px; font-size: 13.5px; font-weight: 500; }
.wpim-dash-notice-ok   { background: #f0fdf4; border: 1px solid #bbf7d0; color: #15803d; }
.wpim-dash-notice-err  { background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; }

/* Inline action links */
.wpim-dash-act-link      { font-size: 12.5px; color: var(--wpim-blue); text-decoration: none; font-weight: 500; padding: 4px 8px; border-radius: 4px; transition: background .12s; }
.wpim-dash-act-link:hover { background: #eff6ff; text-decoration: none; }
.wpim-dash-act-btn       { background: none; border: none; cursor: pointer; font-size: 12.5px; font-family: var(--wpim-f); color: var(--wpim-muted); padding: 4px 8px; border-radius: 4px; font-weight: 500; transition: all .12s; }
.wpim-dash-act-btn:hover { background: #f3f4f6; color: var(--wpim-text); }

/* Form feedback message */
.wpim-dash-msg        { padding: 11px 16px; border-radius: var(--wpim-r-sm); font-size: 13.5px; font-weight: 500; }
.wpim-dash-msg-ok     { background: #f0fdf4; border: 1px solid #bbf7d0; color: #15803d; }
.wpim-dash-msg-err    { background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; }

/* Responsive */
@media (max-width: 860px) {
  .wpim-sc-row3, .wpim-sc-row4 { grid-template-columns: 1fr 1fr; }
  .wpim-dash-stats              { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 700px) {
  .wpim-sc-row2, .wpim-sc-row3, .wpim-sc-row4 { grid-template-columns: 1fr 1fr; }
  .wpim-sc-modal-overlay { padding: 0; align-items: flex-end; }
  .wpim-sc-modal         { border-radius: 12px 12px 0 0; max-height: 95vh; }
  .wpim-sc-pills         { gap: 10px; }
  .wpim-sc-pill          { min-width: 110px; padding: 14px 16px; }
  .wpim-dash-sc          { padding: 20px; }
  .wpim-dash-nav-link    { padding: 8px 14px; font-size: 12.5px; }
}
@media (max-width: 480px) {
  .wpim-sc-row2, .wpim-sc-row3, .wpim-sc-row4 { grid-template-columns: 1fr; }
  .wpim-sc-table  { font-size: 12px; }
  .wpim-sc-table thead th, .wpim-sc-table tbody td { padding: 9px 10px; }
  .wpim-dash-stats { grid-template-columns: 1fr 1fr; }
}
