/* ======================================
   Hellan Montasje – Global lys stil (v3)
   Mål: Lik look på dashboard + /lager/*
   ====================================== */

/* ========== Tokens ========== */
:root{
  --hellan-red:#e42320;
  --hellan-red-dark:#c91f1c;
  --hellan-dark:#222222;

  --bg-main:#f5f5f7;
  --card-bg:#ffffff;

  --border-soft:#e0e0e0;
  --border:#e5e7eb;
  --border2:#eef2f7;

  --text-main:#222222;
  --text:#111827;
  --muted:#6b7280;
  --text-muted:#666666;

  --shadow-sm: 0 2px 8px rgba(0,0,0,0.05);
  --shadow-md: 0 10px 30px rgba(0,0,0,0.08);

  --radius:14px;
  --radius-md:12px;
  --radius-sm:8px;

  --focus: 0 0 0 3px rgba(228,35,32,0.18);

  --container:1200px;
}

/* ========== Reset / base ========== */
*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg-main);
  color: var(--text-main);
  line-height:1.45;
}
img{ max-width:100%; height:auto; }
a{ color: var(--hellan-red); text-decoration:none; }
a:hover{ text-decoration:underline; }

h1,h2,h3,h4{ margin:0 0 12px 0; color: var(--hellan-dark); }

/* ========== Header / footer ========== */
header{
  background:#ffffff;
  color: var(--hellan-red);
  padding:16px;
  text-align:center;
  font-size:22px;
  letter-spacing:1px;
  font-weight:bold;
  border-bottom:2px solid var(--hellan-red);
}
footer{
  text-align:center;
  padding:15px 0 20px;
  font-size:13px;
  color: var(--text-muted);
}

/* ========== Containers ========== */
.page-wrapper{
  padding:20px;
  max-width: var(--container);
  margin: 0 auto;
}

/* Lager bruker .wrap – vi støtter den direkte */
.wrap{
  max-width: var(--container);
  margin: 22px auto;
  padding: 0 14px;
}

/* ========== Cards ========== */
.card,
.panel,
.box,
.widget{
  background: var(--card-bg);
  padding: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  border-top: 4px solid var(--hellan-red);
}

.card-title{
  font-size:18px;
  margin:0 0 8px 0;
  color: var(--hellan-red);
  font-weight:bold;
}

.card-body-text{
  font-size:14px;
  color: var(--text-muted);
}

/* ========== Topbar (lager) ========== */
.topbar{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
}
.topbar h1{
  margin:0;
  font-size:22px;
  color: var(--hellan-dark);
}
.subtitle{
  margin-top:6px;
  color: var(--text-muted);
  font-size:13px;
}

/* ========== Tabs (lager navigasjon) ========== */
.tabs{
  display:flex;
  gap:10px;
  margin:14px 0;
  flex-wrap:nowrap;
  overflow:auto;
  -webkit-overflow-scrolling:touch;
  padding-bottom:6px;
}
.tabs a{
  color: var(--hellan-red);
  text-decoration:none;
  padding:9px 12px;
  border-radius:999px;
  background:#fff;
  border:1px solid rgba(228,35,32,0.20);
  white-space:nowrap;
  flex:0 0 auto;
  font-size:14px;
}
.tabs a:hover{
  background:#fff5f5;
  border-color: rgba(228,35,32,0.35);
}

/* ========== Forms ========== */
label{
  display:block;
  margin-bottom:6px;
  font-size:14px;
  font-weight:bold;
  color: var(--hellan-dark);
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"],
input[type="date"],
input[type="search"],
select,
textarea{
  width:100%;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid var(--border);
  font-size:14px;
  outline:none;
  background:#fff;
  color: var(--text);
}

input::placeholder,
textarea::placeholder{ color:#9aa3af; }

input:focus,
select:focus,
textarea:focus{
  border-color: rgba(228,35,32,0.35);
  box-shadow: var(--focus);
}

textarea{ min-height: 100px; resize: vertical; }

/* Søkebar (lager) */
.search{
  display:flex;
  gap:10px;
  align-items:center;
  flex-wrap:wrap;
  width:100%;
  max-width:520px;
}
.search input{ flex:1 1 240px; }

/* ========== Buttons ========== */
.btn,
button,
input[type="submit"],
input[type="button"]{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid #d1d5db;
  background:#fff;
  color: var(--text);
  text-decoration:none;
  font-size:14px;
  white-space:nowrap;
  cursor:pointer;
}
.btn:hover,
button:hover,
input[type="submit"]:hover,
input[type="button"]:hover{
  background:#f9fafb;
}

/* Lager bruker .btn.primary */
.btn.primary{
  border-color: rgba(228,35,32,0.30);
  background:#fff5f5;
  color:#991b1b;
  font-weight:700;
}
.btn.primary:hover{
  border-color: rgba(228,35,32,0.45);
  background:#ffecec;
}

/* Standard “Hellan primary” (andre sider) */
.btn-primary{
  background: var(--hellan-red);
  color:#fff;
  border-color: transparent;
  font-weight:bold;
  border-radius: 10px;
  padding: 10px 14px;
}
.btn-primary:hover{ background: var(--hellan-red-dark); }

/* ========== Messages ========== */
.err{
  white-space:pre-wrap;
  background:#fff1f2;
  border:1px solid #fecaca;
  padding:12px;
  border-radius:12px;
  color:#991b1b;
  font-size:14px;
}
.error{
  color:#d83030;
  font-size:14px;
  margin-bottom:10px;
  text-align:center;
}
.success{
  color:#2f9e44;
  font-size:14px;
  margin-bottom:10px;
  text-align:center;
}
.hint{
  font-size:12px;
  color: var(--text-muted);
  text-align:center;
  margin-top:10px;
}
.muted{
  color: var(--text-muted);
  font-size:13px;
}

/* ========== Badges (lager status) ========== */
.badge{
  display:inline-block;
  padding:4px 10px;
  border-radius:999px;
  font-size:12px;
  border:1px solid transparent;
  font-weight:700;
}
.badge.ok{
  background:#ecfdf5;
  border-color:#a7f3d0;
  color:#065f46;
}
.badge.empty{
  background:#fff1f2;
  border-color:#fecaca;
  color:#991b1b;
}

/* ========== Tables (lager desktop) ========== */
.table-wrap{
  width:100%;
  overflow:auto;
  border-radius:12px;
}
table{
  width:100%;
  border-collapse:collapse;
  background:#fff;
  min-width: 980px;
}
th,td{
  padding:12px 10px;
  border-bottom:1px solid var(--border2);
  vertical-align:top;
  text-align:left;
}
th{
  font-size:13px;
  color: var(--text);
  position:sticky;
  top:0;
  background:#fff;
  z-index:1;
}
td{ font-size:14px; }

/* Kolonne-bredder (lager) */
.col-sku{width:140px;}
.col-enhet{width:90px;}
.col-antall{width:95px;}
.col-status{width:95px;}
.col-actions{width:140px;}

/* Lokasjon-boks i mobilkort */
.lokasjoner-box{}

/* ========== Mobile layout for lager-tabell ========== */
@media (max-width: 900px){
  .wrap{ margin:14px auto; }
  .card{ padding:12px; }
  .topbar h1{ font-size:20px; }

  table{
    min-width:0;
    width:100%;
  }
  thead{ display:none; }
  tbody{ display:block; }
  tr{
    display:block;
    border:1px solid var(--border);
    border-radius:14px;
    padding:10px 12px;
    margin-bottom:10px;
    background:#fff;
  }
  td{
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:12px;
    border-bottom:0;
    padding:8px 0;
  }
  td::before{
    content: attr(data-label);
    font-size:12px;
    color: var(--text-muted);
    min-width: 92px;
    flex: 0 0 92px;
    padding-top:2px;
  }

  td[data-key="navn"]{
    font-weight:800;
    font-size:15px;
  }

  td[data-key="lokasjoner"] .lokasjoner-box{
    max-height:80px;
    overflow:auto;
    padding-right:6px;
  }

  td[data-key="actions"]{
    justify-content:flex-end;
    padding-top:10px;
  }
  td[data-key="actions"]::before{ content:""; }

  .btn{ width:100%; text-align:center; }
  .table-wrap{ overflow:visible; }
}

/* ========== Small screen polish ========== */
@media (max-width: 480px){
  .tabs{ margin:12px 0; }
  .tabs a{ font-size:13px; padding:8px 11px; }

  /* Hvis du ønsker horizontal scroll i tabeller andre steder */
  .table-wrap{ -webkit-overflow-scrolling: touch; }
}

/* ========== Login (bevarer fra tidligere) ========== */
.login-wrapper{
  min-height: calc(100vh - 80px);
  display:flex;
  justify-content:center;
  align-items:center;
  padding:20px;
}
.login-card{
  background:#ffffff;
  padding:28px 22px 24px;
  border-radius:12px;
  width:100%;
  max-width:380px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  border:1px solid var(--border-soft);
  border-top:5px solid var(--hellan-red);
  position:relative;
}
.logo-wrapper{ text-align:center; margin-bottom:18px; }
.logo-wrapper img{ max-width:220px; height:auto; }
.login-card h2{
  margin:0 0 18px 0;
  text-align:center;
  font-size:20px;
  color: var(--hellan-red);
}
/* Lager tabs (responsive, proff) */
.lager-tabs{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  align-items:center;
  margin:14px 0 10px;
}

.lager-tab{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:10px 14px;
  border-radius:999px;
  border:1px solid rgba(0,0,0,.12);
  background:#fff;
  color:#111827;
  text-decoration:none;
  font-weight:600;
  font-size:14px;
  line-height:1;
  transition: background .15s ease, border-color .15s ease, transform .05s ease;
  user-select:none;
  -webkit-tap-highlight-color: transparent;
}

.lager-tab:hover{
  background:rgba(0,0,0,.03);
  border-color:rgba(0,0,0,.18);
}

.lager-tab:active{
  transform:translateY(1px);
}

.lager-tab.is-active{
  background:#111827;
  border-color:#111827;
  color:#fff;
}

.lager-tabs-spacer{
  flex:1 1 auto;
  min-width:0;
}

/* "Hjem" litt mer tydelig som tilbake-knapp, men fortsatt proff */
.lager-tab-home{
  border-color: rgba(17,24,39,.25);
}

/* Mobil: større trykkflater og litt mer luft */
@media (max-width: 520px){
  .lager-tabs{ gap:8px; }
  .lager-tab{
    padding:12px 14px;
    font-size:14px;
  }
}

/* Top navbar */
.topnav{
  width:100%;
  background:#fff;
  border-bottom:1px solid rgba(0,0,0,.08);
}

.topnav-inner{
  max-width:1040px;              /* match .wrap */
  margin:0 auto;
  padding:10px 14px;
  display:flex;
  gap:14px;
  align-items:center;
  flex-wrap:wrap;
}

.topnav-item{
  display:inline-flex;
  align-items:center;
  gap:8px;
  text-decoration:none;
  color:#111827;
  padding:8px 12px;
  border-radius:999px;
  border:1px solid transparent;
  font-weight:700;
  font-size:14px;
  line-height:1;
}

.topnav-item:hover{
  background:rgba(0,0,0,.04);
  border-color:rgba(0,0,0,.08);
}

.topnav-item.active{
  background:#ef4444; /* rød “pill” (tilpass om du vil) */
  border-color:#ef4444;
  color:#fff;
}

/* Mobil: litt tighter */
@media (max-width: 520px){
  .topnav-inner{ gap:10px; }
  .topnav-item{ padding:8px 10px; font-size:13px; }
}
/* Top navbar (main-nav) – felles for hele portalen */
.main-nav {
  background: #ffffff;
  border-bottom: 1px solid var(--border-soft);
}

.main-nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 8px 20px;
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scrollbar-width: none;
}

.main-nav-inner::-webkit-scrollbar {
  display: none;
}

.nav-item {
  font-size: 14px;
  padding: 6px 10px;
  border-radius: 16px;
  border: 1px solid var(--border-soft);
  color: var(--text-muted);
  text-decoration: none;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ffffff;
}

.nav-item.active {
  background: var(--hellan-red);
  border-color: var(--hellan-red);
  color: #ffffff;
}

.nav-item span.icon {
  font-size: 14px;
}

/* ===== Main top navbar (shared) ===== */
.main-nav {
  background: #ffffff;
  border-bottom: 1px solid var(--border-soft);
}

.main-nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 8px 20px;
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scrollbar-width: none;
}

.main-nav-inner::-webkit-scrollbar {
  display: none;
}

.nav-item {
  font-size: 14px;
  padding: 6px 10px;
  border-radius: 16px;
  border: 1px solid var(--border-soft);
  color: var(--text-muted);
  text-decoration: none;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ffffff;
}

.nav-item.active {
  background: var(--hellan-red);
  border-color: var(--hellan-red);
  color: #ffffff;
}

.nav-item span.icon {
  font-size: 14px;
}

