/* Global variables and reset */
:root{
  --w:1120px;
  --head:#111; /* top header bg */
  --headText:#fff;
  --green:#0a7a0a;
  --sidebar-w:220px;
  --header-h:64px;
  --footer-h:60px; /* min height for the global footer */
  --content-offset: 80px; /* how much to pull content toward the sidebar */
}
*{box-sizing:border-box}
body{font-family:Arial,Helvetica,sans-serif;margin:0;color:#111;background:#fff}

/* Top full-width header */
.topHeader{
  position:fixed;
  top:0;left:0;right:0;
  height:var(--header-h);
  background:var(--head);
  color:var(--headText);
  z-index:1200;
  display:flex;align-items:center;box-shadow:0 2px 8px rgba(0,0,0,.12);
}
.topHeader .topInner{
    width:100%;
    max-width:var(--w);
    /* Left-align header content to match sidebar text start (12px left + 8px padding = 20px) */
    margin:0; /* start from viewport left */
    padding-left:20px;
    padding-right:10px;
  position:relative;
  display:flex;align-items:center;justify-content:space-between;
}
.topHeader h1{font-size:30px;margin:0;font-weight:700}

/* Header right-aligned live date/time */
.topHeader .topInner .headerRight{
  position:fixed;
  right:12px;
  top:0;
  height:var(--header-h);
  display:flex;
  align-items:center;
  gap:12px;
  color:var(--headText);
  font-size:14px;
  padding-right:12px;
  z-index:1400;
}

@media (max-width:760px){
  .topHeader .topInner .headerRight{ position:static; margin-left:auto; padding-right:0; }
}

/* Fixed left sidebar under the top header */
.leftPane{
  position:fixed;
  left:12px;
  top:calc(var(--header-h) + 12px);
  width:var(--sidebar-w);
  z-index:1100;
}
.leftPane .sideNav{
  background:#f6f6f6;
  border-radius:8px;
  padding:4px;
  box-shadow: 0 2px 6px rgba(0,0,0,.04);
}
.leftPane .sideNav ul{list-style:none;padding:3px;margin:0}
.leftPane .sideNav li{margin:2px 0}
.leftPane .sideNav a{color:#111;text-decoration:none;padding:5px 8px;display:block;border-radius:6px}
.leftPane .sideNav a:hover{background:#eee}
.leftPane .sideNav a.active{background:rgba(0,0,0,0.06);border-radius:6px;font-weight:700}

/* Page wrapper and main content need space for header and sidebar */
.wrap{max-width:var(--w);margin:12px auto;padding:0 10px}
.main{
  /* Move content closer to sidebar without changing sidebar width */
  margin-left: calc(var(--sidebar-w) - var(--content-offset));
  margin-top: calc(var(--header-h) + 18px);
  padding:18px 12px 30px 12px;
  min-height: 60vh;
  /* reserve space for fixed footer so content is not covered */
  padding-bottom: calc(var(--footer-h) + 24px);
}

/* App-style square buttons on index page (right side) */
.main{position:relative}
.appGrid{display:grid;grid-template-columns:repeat(4,220px);gap:20px;align-items:start;margin:14px auto 0;max-width:934px}
.appBtn{width:220px;display:block;text-decoration:none;background:transparent;padding:0;box-shadow:none;border-radius:0;overflow:visible;line-height:0;cursor:pointer}
.appBtn:hover{transform:none;box-shadow:none}
.appBtn:active{transform:none}
.appLabel{display:none}

/* Make the image itself act as the button (shadow follows PNG transparency) */
.appGrid .appBtn{border-radius:40px;overflow:visible;transition:transform .18s ease}
.appGrid .appBtn > img{width:100% !important;height:auto !important;display:block !important;border-radius:40px;filter:drop-shadow(0 12px 18px rgba(0,0,0,0.22));transition:filter .18s ease}
.appGrid .appBtn:hover{transform:translateY(-6px)}
.appGrid .appBtn:hover > img{filter:drop-shadow(0 22px 28px rgba(0,0,0,0.30))}
.appGrid .appBtn:active{transform:translateY(-4px)}
.appGrid .appBtn:active > img{filter:drop-shadow(0 18px 22px rgba(0,0,0,0.26))}

/* gradients for variety; red-tinted variant fades earlier to transparent */
.appBtn--orange{background:transparent}
.appBtn--blue{background:transparent}
.appBtn--green{background:transparent}

/* Rulleringsknapp: bruk samme bilde-stil som de andre kortene */
.appBtn--purple{background:transparent}

@media (max-width:1280px){
  .appGrid{grid-template-columns:repeat(3,220px);justify-content:center}
}
@media (max-width:980px){
  .appGrid{grid-template-columns:repeat(2,220px);justify-content:center}
}
@media (max-width:560px){
  .appGrid{grid-template-columns:repeat(1,1fr);grid-auto-rows:220px}
  .appBtn{width:100%}
}

/* Global fixed footer across bottom of viewport */
.siteFooter{
  position:fixed;
  left:0;right:0;bottom:0;
  min-height:var(--footer-h);
  display:flex;align-items:center;z-index:1300;
  background:var(--head);color:var(--headText);
}
.siteFooter > div{
  width:100%;max-width:var(--w);margin:0 auto;padding:8px 10px;box-sizing:border-box;display:flex;flex-direction:column;align-items:center;justify-content:center;font-size:12px;line-height:1.15;text-align:center;gap:1px
}
.siteFooter a{color:var(--headText)}
.siteFooter .siteDisclaimer{font-size:11px;color:#ddd;margin-top:6px;max-width:var(--w);}
.siteFooter .siteCredit{white-space:nowrap;display:inline-block}
.siteFooter .siteVersion{margin-top:4px;font-size:11px;color:#ccc}

/* Shared button styles */
.btnRow{display:flex;gap:8px;align-items:center}
.btn{background:#2c2c2c;color:#fff;border:1px solid #444;border-radius:6px;padding:7px 10px;font-size:12px;cursor:pointer;user-select:none}
.btn:hover{background:#3a3a3a}
.btn:active{transform:translateY(1px)}

/* Small screens: sidebar flows above content, header remains top */
@media (max-width:760px){
  .leftPane{position:static;width:auto;top:auto;left:auto;margin:12px}
  .main{margin-left:0;margin-top: calc(var(--header-h) + 12px)}
  /* On small screens remove offset to avoid overlap */
  :root{ --content-offset: 0px; }
}

/* Logout button in header */
.logoutBtn {
  display: inline-block;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.15);
  color: var(--headText);
  text-decoration: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.25);
  transition: background 0.2s ease;
}

.logoutBtn:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.35);
}

.desktopProfileModal{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,0.45);
  display:none;
  align-items:center;
  justify-content:center;
  z-index:3000;
  padding:20px;
}

.desktopProfileModal.open{
  display:flex;
}

.desktopProfileDialog{
  width:min(760px, 100%);
  max-height:85vh;
  overflow:auto;
  background:#fff;
  border-radius:10px;
  box-shadow:0 16px 36px rgba(0,0,0,0.3);
  border:1px solid #ddd;
}

.desktopProfileHeader{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:14px 16px;
  border-bottom:1px solid #eee;
}

.desktopProfileHeader h3{
  margin:0;
  font-size:20px;
}

.desktopProfileCloseBtn{
  background:transparent;
  border:none;
  font-size:28px;
  line-height:1;
  cursor:pointer;
  color:#666;
  padding:0 4px;
}

.desktopProfileBody{
  padding:14px 16px 18px;
}

.desktopProfileSection{
  background:#f7f7f7;
  border:1px solid #e5e5e5;
  border-radius:8px;
  padding:12px;
  margin-bottom:12px;
}

.desktopProfileSection h4{
  margin:0 0 10px;
  font-size:16px;
}

.desktopProfileSection.pin{
  border-color:#f1c3c3;
  background:#fff6f6;
}

.desktopProfileGrid{
  display:grid;
  grid-template-columns:repeat(2,minmax(180px,1fr));
  gap:10px;
}

.desktopProfileGrid span{
  display:block;
  font-size:12px;
  color:#666;
  margin-bottom:3px;
}

.desktopProfileGrid strong{
  font-size:14px;
}

.desktopProfileLabel{
  display:block;
  margin:8px 0 5px;
  font-size:12px;
  color:#555;
}

.desktopProfileInput{
  width:100%;
  height:36px;
  padding:7px 10px;
  border:1px solid #ccc;
  border-radius:6px;
  font-size:14px;
}

.desktopProfileStatus{
  min-height:20px;
  margin-top:8px;
  font-size:13px;
}

.desktopProfileStatus.ok{
  color:#0a7a0a;
}

.desktopProfileStatus.error{
  color:#a10000;
}

.desktopProfileLoading{
  padding:20px;
  color:#555;
}

@media (max-width:760px){
  .desktopProfileGrid{
    grid-template-columns:1fr;
  }
}

/* Admin: card, form rows, table and select styling */
.card{
  background:#f6f6f6;
  border-radius:8px;
  padding:12px;
  box-shadow:0 2px 6px rgba(0,0,0,.04);
  margin:12px 0;
}
.card .row{display:flex;flex-wrap:wrap;gap:12px;align-items:center}
.card label{display:flex;align-items:center;gap:6px;font-weight:600}
.card input[type="date"],
.card select{
  height:34px;
  padding:6px 8px;
  border:1px solid #ccc;
  border-radius:6px;
  background:#fff;
  font-size:14px;
}

.dataTable{width:100%;border-collapse:collapse}
.dataTable th,.dataTable td{padding:6px 8px;text-align:left;border-bottom:1px solid #eee}
.dataTable thead th{font-size:12px;text-transform:uppercase;letter-spacing:.02em;color:#555;background:#fafafa;border-bottom:1px solid #e6e6e6}
.dataTable tbody tr:hover td{background:#fdfdfd}
.dataTable td:nth-child(2){width:260px}
.dataTable td:nth-child(3){width:220px}
.dataTable td:nth-child(3){width:220px}

.empSelect{
  width:220px;
  max-width:100%;
  height:32px;
  padding:4px 8px;
  border:1px solid #ccc;
  border-radius:6px;
  background:#fff;
  font-size:14px;
}

.assignCell{display:flex;flex-direction:column;gap:4px}
.recentCell{display:flex;flex-direction:column;gap:2px;font-size:12px;font-style:italic;color:#555;min-width:200px}
.recentLine{white-space:nowrap;font-family:"Courier New",monospace;letter-spacing:0.02em}
.recentNames{font-weight:600}

#status{font-size:13px;color:#333}
#status, #qualStatus{min-height:20px;line-height:20px;display:block}

/* Admin two-column layout */
.adminGrid{display:grid;grid-template-columns:1fr 360px;gap:16px;align-items:start}
.adminSide h2{margin-top:0}
.qualRow{display:flex;align-items:center;gap:8px;padding:6px 8px;border-bottom:1px solid #eee}
.qualHeader{padding:6px 8px;font-weight:700;border-bottom:1px solid #eee;background:#fafafa}
.qualRow input[type="checkbox"]{width:16px;height:16px}

@media (max-width:980px){
  .adminGrid{grid-template-columns:1fr}
}

/* Admin top navigation bar */
.adminTopNav{
  position:fixed;
  top:var(--header-h);
  left:calc(var(--sidebar-w) + 24px);
  right:0;
  height:44px;
  background:#f6f6f6;
  border-bottom:1px solid #ddd;
  z-index:1150;
  display:flex;
  align-items:center;
  padding:0 12px;
  gap:6px;
  overflow:visible;
}

/* Dropdown menu container */
.adminTopNav .menuGroup {
  position: relative;
  display: flex;
  align-items: center;
}

/* Dropdown toggle button */
.adminTopNav .dropdownToggle {
  color:#111;
  background: transparent;
  border: none;
  padding:6px 10px;
  border-radius:6px;
  font-weight:600;
  font-size:14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: background 0.2s;
  user-select: none;
}

.adminTopNav .dropdownToggle:hover {
  background:#eee;
}

.adminTopNav .dropdownToggle::after {
  content: '▼';
  font-size: 9px;
  transition: transform 0.2s;
}

.adminTopNav .dropdownToggle[aria-expanded="true"]::after {
  transform: rotate(180deg);
}

/* Dropdown menu */
.adminTopNav .dropdownMenu {
  position: fixed;
  top: 0;
  left: 0;
  background: white;
  border: 1px solid #ddd;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  min-width: 200px;
  display: none;
  flex-direction: column;
  z-index: 3000;
}

.adminTopNav .dropdownMenu[aria-hidden="false"] {
  display: flex;
}

.adminTopNav .dropdownMenu a {
  color:#111;
  text-decoration:none;
  padding:10px 14px;
  font-weight:500;
  font-size:13px;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: background 0.2s;
}

.adminTopNav .dropdownMenu a:hover {
  background:#f0f0f0;
}

.adminTopNav .dropdownMenu a[aria-current="page"] {
  background:#e8f0ff;
  color:#0066cc;
  font-weight:600;
}

/* Overview link (always visible, not in dropdown) */
.adminTopNav .overviewLink {
  color:#111;
  text-decoration:none;
  padding:6px 10px;
  border-radius:6px;
  font-weight:600;
  font-size:14px;
}

.adminTopNav .overviewLink:hover {
  background:#eee;
}

.adminTopNav .overviewLink[aria-current="page"] {
  background:rgba(0,0,0,0.08);
}

/* Admin pages need extra top margin for the admin nav */
.adminPage .main{
  margin-top:calc(var(--header-h) + 44px + 18px);
}

@media (max-width:760px){
  .adminTopNav{
    left:0;
  }
}
/* Market data tabs */
.market-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  border-bottom: 2px solid #e0e0e0;
  padding-bottom: 0;
}

.market-tab {
  background: transparent;
  border: none;
  padding: 12px 24px;
  font-size: 16px;
  font-weight: 600;
  color: #666;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s ease;
  position: relative;
}

.market-tab:hover {
  color: #0a7a0a;
  background: rgba(10, 122, 10, 0.05);
}

.market-tab.active {
  color: #0a7a0a;
  border-bottom-color: #0a7a0a;
}

.market-tab-content {
  display: none;
}

.market-tab-content.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 760px) {
  .market-tabs {
    flex-wrap: wrap;
    gap: 4px;
  }
  
  .market-tab {
    padding: 10px 16px;
    font-size: 14px;
  }
}

/* Commodities (Råvarer) styling */
.commodities-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin: 20px 0;
}

.commodity-card {
  background: #f9f9f9;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 16px;
  transition: all 0.2s ease;
}

.commodity-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.commodity-icon {
  font-size: 36px;
  margin-bottom: 8px;
  text-align: center;
}

.commodity-card h4 {
  margin: 0 0 12px 0;
  font-size: 18px;
  color: #111;
  text-align: center;
}

.commodity-price {
  background: #fff;
  padding: 12px;
  border-radius: 6px;
  margin-bottom: 12px;
  text-align: center;
  border: 1px solid #e8e8e8;
}

.commodity-price .price-label {
  display: block;
  font-size: 12px;
  color: #666;
  margin-bottom: 4px;
}

.commodity-price .price-value {
  display: block;
  font-size: 22px;
  font-weight: 700;
  color: #0a7a0a;
}

.commodity-desc {
  font-size: 13px;
  color: #555;
  line-height: 1.5;
  margin: 0 0 8px 0;
}

.commodity-trend {
  font-size: 12px;
  color: #666;
  font-style: italic;
  text-align: center;
  min-height: 18px;
}

.newsGrid {
  display: grid;
  gap: 12px;
}

.news-item {
  padding: 12px;
  background: #f9f9f9;
  border-left: 3px solid #0a7a0a;
  border-radius: 4px;
}

.news-item h5 {
  margin: 0 0 6px 0;
  font-size: 15px;
  color: #111;
}

.news-item p {
  margin: 0;
  font-size: 13px;
  color: #666;
  line-height: 1.4;
}

.news-item .news-meta {
  font-size: 11px;
  color: #999;
  margin-top: 6px;
}

.news-placeholder {
  text-align: center;
  padding: 40px 20px;
}

@media (max-width: 760px) {
  .commodities-grid {
    grid-template-columns: 1fr;
  }
}
