/* ==========================================================
   FreelanceToolkit UK — shared stylesheet
   ========================================================== */

:root {
  --c-bg: #f7f8fb;
  --c-surface: #ffffff;
  --c-surface-2: #f1f3f8;
  --c-border: #e3e6ef;
  --c-text: #1a1f2e;
  --c-text-muted: #5b6478;
  --c-primary: #1f5fff;
  --c-primary-dark: #1647c4;
  --c-primary-soft: #e7efff;
  --c-success: #18a957;
  --c-warning: #d97706;
  --c-danger: #dc2626;
  --shadow-sm: 0 1px 2px rgba(20, 30, 60, .06);
  --shadow-md: 0 4px 14px rgba(20, 30, 60, .08);
  --radius: 10px;
  --radius-sm: 6px;
  --max-w: 1180px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  color: var(--c-text);
  background: var(--c-bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--c-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }

h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 2rem; letter-spacing: -.01em; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.15rem; }
p  { margin: 0 0 1em; }

.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------------- header / nav ---------------- */
.site-header {
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--c-text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.brand .logo {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--c-primary), #6f6cff);
  color: #fff;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .9rem;
}
.nav-links {
  display: flex;
  gap: 22px;
  align-items: center;
  list-style: none;
  padding: 0; margin: 0;
}
.nav-links a {
  color: var(--c-text-muted);
  font-size: .95rem;
  font-weight: 500;
}
.nav-links a:hover, .nav-links a.active {
  color: var(--c-text);
  text-decoration: none;
}
.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--c-border);
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
}
@media (max-width: 760px) {
  .nav-links {
    position: absolute;
    top: 64px; left: 0; right: 0;
    background: var(--c-surface);
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    border-bottom: 1px solid var(--c-border);
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links a {
    padding: 14px 20px;
    border-top: 1px solid var(--c-border);
  }
  .nav-toggle { display: inline-block; }
}

/* ---------------- hero ---------------- */
.hero {
  padding: 60px 0 40px;
  text-align: center;
}
.hero h1 { font-size: 2.4rem; max-width: 720px; margin: 0 auto .4em; }
.hero p.lead {
  font-size: 1.1rem;
  color: var(--c-text-muted);
  max-width: 640px;
  margin: 0 auto 1.4em;
}

/* ---------------- buttons ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  background: var(--c-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: .95rem;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s;
}
.btn:hover { background: var(--c-primary-dark); text-decoration: none; }
.btn.secondary {
  background: var(--c-surface);
  color: var(--c-text);
  border: 1px solid var(--c-border);
}
.btn.secondary:hover { background: var(--c-surface-2); }
.btn.danger { background: var(--c-danger); }
.btn.danger:hover { background: #b91c1c; }
.btn.sm { padding: 6px 12px; font-size: .85rem; }

/* ---------------- tool cards (homepage) ---------------- */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
  margin: 30px 0;
}
.tool-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 22px;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: var(--c-text);
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.tool-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--c-primary);
  text-decoration: none;
}
.tool-card .icon {
  width: 42px; height: 42px;
  border-radius: 10px;
  background: var(--c-primary-soft);
  color: var(--c-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  font-size: 1.2rem;
}
.tool-card h3 { margin: 0 0 6px; }
.tool-card p { color: var(--c-text-muted); font-size: .95rem; margin: 0; }

/* ---------------- generic surface card ---------------- */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
}
.card h2 { margin-top: 0; }

/* ---------------- form controls ---------------- */
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: .85rem;
  font-weight: 600;
  color: var(--c-text-muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 10px 12px;
  font-size: 1rem;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  background: var(--c-surface);
  color: var(--c-text);
  font-family: inherit;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 2px solid var(--c-primary-soft);
  border-color: var(--c-primary);
}
.field textarea { min-height: 70px; resize: vertical; }
.field-row {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr 1fr;
}
@media (max-width: 600px) { .field-row { grid-template-columns: 1fr; } }
.help {
  font-size: .8rem;
  color: var(--c-text-muted);
  margin-top: 4px;
}

/* ---------------- tool layout (form on left, output on right) ---------------- */
.tool-layout {
  display: grid;
  gap: 24px;
  grid-template-columns: 1fr 1fr;
  align-items: start;
}
@media (max-width: 900px) { .tool-layout { grid-template-columns: 1fr; } }

/* ---------------- tables ---------------- */
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: .95rem;
}
table.data th, table.data td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--c-border);
}
table.data th {
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--c-text-muted);
  background: var(--c-surface-2);
}
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data tfoot td {
  font-weight: 600;
  border-top: 2px solid var(--c-border);
  border-bottom: none;
}
table.data .icon-btn {
  background: none;
  border: none;
  color: var(--c-text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 4px 8px;
  border-radius: 4px;
}
table.data .icon-btn:hover { color: var(--c-danger); background: var(--c-surface-2); }

/* ---------------- result box ---------------- */
.result-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px dashed var(--c-border);
  font-variant-numeric: tabular-nums;
}
.result-row:last-child { border-bottom: none; }
.result-row.total {
  border-top: 2px solid var(--c-text);
  border-bottom: none;
  margin-top: 6px;
  padding-top: 10px;
  font-size: 1.15rem;
  font-weight: 700;
}
.result-row.muted { color: var(--c-text-muted); }
.result-positive { color: var(--c-success); }
.result-negative { color: var(--c-danger); }

/* ---------------- ad slot placeholder ---------------- */
.ad-slot {
  background: repeating-linear-gradient(
    45deg,
    #f4f6fb,
    #f4f6fb 8px,
    #eaedf6 8px,
    #eaedf6 16px
  );
  border: 1px dashed #c4cad9;
  color: #8b93a8;
  text-align: center;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  padding: 28px 12px;
  border-radius: var(--radius-sm);
  margin: 24px 0;
}
.ad-slot.leaderboard { min-height: 90px; }
.ad-slot.rectangle  { min-height: 250px; }
.ad-slot.skyscraper { min-height: 600px; }

/* ---------------- invoice preview ---------------- */
.invoice-preview {
  background: #fff;
  color: #111;
  padding: 30px;
  border-radius: var(--radius);
  border: 1px solid var(--c-border);
  font-size: .92rem;
  min-height: 600px;
}
.invoice-preview .iv-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 24px;
  border-bottom: 2px solid #111;
  padding-bottom: 12px;
}
.invoice-preview .iv-header h1 { font-size: 1.8rem; margin: 0; }
.invoice-preview .iv-meta { text-align: right; font-size: .85rem; }
.invoice-preview .iv-parties {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  margin-bottom: 24px;
}
.invoice-preview .iv-parties h4 {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: #666;
  margin: 0 0 6px;
}
.invoice-preview table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 16px;
}
.invoice-preview table th,
.invoice-preview table td {
  padding: 8px;
  border-bottom: 1px solid #e3e3e3;
  text-align: left;
}
.invoice-preview table th {
  background: #f4f6fb;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.invoice-preview table td.num,
.invoice-preview table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.invoice-preview .iv-totals {
  margin-left: auto;
  width: 280px;
}
.invoice-preview .iv-totals .row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
}
.invoice-preview .iv-totals .row.grand {
  border-top: 2px solid #111;
  margin-top: 4px;
  padding-top: 8px;
  font-weight: 700;
  font-size: 1.05rem;
}
.invoice-preview .iv-notes {
  margin-top: 30px;
  padding-top: 14px;
  border-top: 1px solid #e3e3e3;
  font-size: .85rem;
  color: #555;
  white-space: pre-wrap;
}

/* ---------------- charts / progress bars ---------------- */
.bar {
  height: 10px;
  background: var(--c-surface-2);
  border-radius: 6px;
  overflow: hidden;
  margin: 6px 0;
}
.bar > span {
  display: block;
  height: 100%;
  background: var(--c-primary);
}

/* ---------------- footer ---------------- */
.site-footer {
  background: #0f1322;
  color: #c5c9d6;
  padding: 40px 0 20px;
  margin-top: 60px;
  font-size: .9rem;
}
.site-footer a { color: #c5c9d6; }
.site-footer a:hover { color: #fff; }
.site-footer .footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 30px;
  margin-bottom: 30px;
}
@media (max-width: 760px) {
  .site-footer .footer-grid { grid-template-columns: 1fr 1fr; }
}
.site-footer h4 { color: #fff; font-size: .9rem; margin-bottom: 10px; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer ul li { margin-bottom: 6px; }
.site-footer .copyright {
  border-top: 1px solid #2a2f44;
  padding-top: 18px;
  text-align: center;
  font-size: .8rem;
  color: #8b93a8;
}

/* ---------------- cookie banner ---------------- */
.cookie-banner {
  position: fixed;
  bottom: 16px; left: 16px; right: 16px;
  max-width: 640px;
  margin: 0 auto;
  background: #0f1322;
  color: #fff;
  padding: 16px 20px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
  z-index: 100;
  font-size: .9rem;
}
.cookie-banner p { margin: 0; flex: 1; }
.cookie-banner a { color: #93b8ff; }
.cookie-banner.hidden { display: none; }
@media (max-width: 600px) {
  .cookie-banner { flex-direction: column; align-items: stretch; text-align: left; }
}

/* ---------------- print (for invoice PDF export) ---------------- */
@media print {
  .site-header, .site-footer, .ad-slot, .cookie-banner,
  .no-print, .tool-layout > .card:first-child { display: none !important; }
  body { background: #fff; }
  .container { max-width: 100%; padding: 0; }
  .invoice-preview { border: none; box-shadow: none; padding: 0; }
}

/* ---------------- utility ---------------- */
.text-muted { color: var(--c-text-muted); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.mb-0 { margin-bottom: 0 !important; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.flex { display: flex; gap: 10px; align-items: center; }
.flex.between { justify-content: space-between; }
.tag {
  display: inline-block;
  background: var(--c-primary-soft);
  color: var(--c-primary);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: .75rem;
  font-weight: 600;
}
