/* public/css/style.css — Sales Suite: global stil (login, topnav, dashboard). */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --error-bg: #fef2f2;
  --error-text: #b91c1c;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ---------- Auth ---------- */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-card {
  background: var(--card);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  padding: 40px;
  width: 100%;
  max-width: 400px;
}

.brand { text-align: center; margin-bottom: 24px; }
.brand h1 { font-size: 24px; margin-top: 12px; }
.brand-sub { color: var(--muted); font-size: 14px; margin-top: 4px; }

.brand-mark {
  width: 52px; height: 52px;
  margin: 0 auto;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 700;
}
.brand-mark.sm { width: 32px; height: 32px; font-size: 17px; border-radius: 8px; display: inline-flex; margin: 0; vertical-align: middle; }

label { display: block; font-size: 13px; font-weight: 600; margin: 14px 0 6px; }

input[type="email"], input[type="password"], input[type="text"] {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
}
input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15); }

.input-wrap { position: relative; }
.input-wrap input { padding-right: 42px; }
.toggle-password {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 6px;
  cursor: pointer;
  color: var(--muted);
  display: flex;
  align-items: center;
}
.toggle-password:hover { color: var(--text); }

.btn {
  display: inline-block;
  padding: 11px 18px;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-block { width: 100%; margin-top: 20px; }
.btn-ghost { background: transparent; color: var(--muted); padding: 8px 12px; }
.btn-ghost:hover { color: var(--text); }

.alert { padding: 10px 14px; border-radius: 8px; font-size: 14px; margin-bottom: 8px; }
.alert-error { background: var(--error-bg); color: var(--error-text); }

/* ---------- Topnav ---------- */
.topnav {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 12px 24px;
}
.topnav-brand { font-weight: 700; font-size: 17px; display: flex; align-items: center; gap: 10px; }
.topnav-links { display: flex; gap: 4px; flex: 1; }
.topnav-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: 6px;
}
.topnav-links a:hover { color: var(--text); background: var(--bg); }
.topnav-links a.active { color: var(--primary); background: rgba(37, 99, 235, 0.08); }
.topnav-user { display: flex; align-items: center; gap: 12px; font-size: 14px; }

/* ---------- Dashboard ---------- */
.container { max-width: 1100px; margin: 0 auto; padding: 32px 24px; }
.container h1 { font-size: 26px; margin-bottom: 6px; }
.muted { color: var(--muted); }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
  margin-top: 28px;
}
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px;
}
.card h3 { font-size: 14px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; }
.card .big { font-size: 32px; font-weight: 700; margin: 8px 0 4px; }
.card-link { display: block; text-decoration: none; color: var(--text); transition: box-shadow 0.15s, transform 0.15s; }
.card-link:hover { box-shadow: 0 6px 18px rgba(15, 23, 42, 0.1); transform: translateY(-2px); }

/* ---------- Modulsidor ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
}
.panel h3 { font-size: 15px; margin-bottom: 14px; }

.empty-state { text-align: center; padding: 40px 20px; }
.empty-state p { margin: 4px 0; }

.detail-table { border-collapse: collapse; width: 100%; max-width: 480px; }
.detail-table td { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.detail-table td:first-child { color: var(--muted); width: 140px; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--border); margin-top: 40px; }
.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted);
}
body { display: flex; flex-direction: column; }
main.container { flex: 1; width: 100%; }

/* ---------- Generella hjälpklasser ---------- */
.sm { font-size: 13px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.nowrap { white-space: nowrap; }
.section-title { font-size: 20px; margin: 28px 0 14px; }
.alert-success { background: #f0fdf4; color: #15803d; }
.form-title { margin: 22px 0 4px; font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-grey { background: #f1f5f9; color: #475569; }
.badge-blue { background: #dbeafe; color: #1d4ed8; }
.badge-green { background: #dcfce7; color: #15803d; }
.badge-red { background: #fee2e2; color: #b91c1c; }
.badge-orange { background: #ffedd5; color: #c2410c; }

/* ---------- Flikar ---------- */
.tabs { display: flex; gap: 6px; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.tab {
  padding: 10px 18px; font-size: 14px; font-weight: 600; color: var(--muted);
  text-decoration: none; background: none; border: none; border-bottom: 2px solid transparent;
  cursor: pointer; margin-bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ---------- Kategorikort (kalkylbyggaren steg 1) ---------- */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.cat-card {
  border: 2px solid var(--border); border-radius: 12px; overflow: hidden;
  cursor: pointer; background: var(--card); transition: box-shadow 0.15s, border-color 0.15s;
}
.cat-card:hover { box-shadow: 0 6px 18px rgba(15,23,42,0.12); }
.cat-card.selected { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(37,99,235,0.25); }
.cat-img { height: 130px; background: #f8fafc; display: flex; align-items: center; justify-content: center; }
.cat-img img { width: 100%; height: 100%; object-fit: cover; }
.cat-label { padding: 12px 14px; font-weight: 700; font-size: 15px; text-align: center; }
.cat-card.selected .cat-label { color: var(--primary); }

/* ---------- Produktkort ---------- */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; margin-bottom: 24px; }
.product-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.product-card.inactive { opacity: 0.55; }
.product-card.selectable { cursor: pointer; transition: box-shadow 0.15s, border-color 0.15s; }
.product-card.selectable:hover { box-shadow: 0 6px 18px rgba(15,23,42,0.1); }
.product-card.selected { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(37,99,235,0.25); }
.product-img { height: 140px; background: #f8fafc; display: flex; align-items: center; justify-content: center; }
.product-img img { width: 100%; height: 100%; object-fit: cover; }
.img-placeholder { font-size: 40px; opacity: 0.4; }
.product-body { padding: 14px; }
.product-body h3 { font-size: 15px; margin-bottom: 4px; }
.product-body .price { font-weight: 700; margin-top: 8px; }

/* ---------- Datatabeller ---------- */
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th { text-align: left; padding: 9px 10px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; border-bottom: 2px solid var(--border); }
.data-table td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table .num { text-align: right; }
.data-table tfoot td { border-bottom: none; font-size: 15px; }
.row-link { cursor: pointer; }
.row-link:hover { background: #f8fafc; }
.table-scroll { overflow-x: auto; }

/* ---------- Formulär ---------- */
.form-row { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 6px; }
.form-row > div { flex: 1; min-width: 160px; }
select { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 15px; background: #fff; }
.inline-form { display: inline-flex; gap: 8px; align-items: center; }
.inline-form input[type="text"] { width: 320px; max-width: 60vw; }
.check-label { font-size: 14px; color: var(--muted); display: flex; align-items: center; gap: 6px; cursor: pointer; }

/* ---------- Kalkylbyggare ---------- */
.builder-layout { display: grid; grid-template-columns: 1fr 340px; gap: 20px; align-items: start; }
@media (max-width: 900px) { .builder-layout { grid-template-columns: 1fr; } }
.builder-sidebar { position: sticky; top: 16px; }
.config-price { margin: 12px 0; font-size: 17px; }
.config-price-label { color: var(--muted); font-size: 14px; }
.summary-row { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.summary-row-info { display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.summary-row-right { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 6px; }
.row-remove { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 13px; padding: 2px 5px; }
.row-remove:hover { color: var(--error-text); }
.summary-total { display: flex; justify-content: space-between; padding: 14px 0; font-size: 17px; }

/* ---------- Projekt ---------- */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 700px) { .two-col { grid-template-columns: 1fr; } }
.progress { background: var(--border); border-radius: 6px; height: 8px; width: 120px; overflow: hidden; margin-bottom: 3px; }
.progress-bar { background: var(--primary); height: 100%; border-radius: 6px; }
.activity-panel { border-left: 4px solid var(--border); }
.activity-panel.status-pagaende { border-left-color: #f97316; }
.activity-panel.status-klar { border-left-color: #16a34a; }
.activity-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.activity-head h3 { margin-bottom: 0; }
.activity-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--border); margin-right: 6px; }
.status-pagaende .activity-dot { background: #f97316; }
.status-klar .activity-dot { background: #16a34a; }
