/* ---------------- INCLUDE VARS-FILE ---------------- */

/* ---------------- RESET ---------------- */

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

body{
  font-family:system-ui;
  background:var(--bg);
}

/* ---------------- LAYOUT ---------------- */

.layout{
  display:grid;
  grid-template-columns:var(--sidebar-width) 1fr;
  min-height:100vh;
  transition:all 0.3s ease;
}

.layout.sidebar-collapsed{
  grid-template-columns:0 1fr;
}

/* ---------------- SIDEBAR ---------------- */

.sidebar{
  background:var(--sidebar-bg-color);
  color:white;
  padding:10px;
  display:flex;
  flex-direction:column;
  gap:20px;
  overflow:hidden;
  transition:all 0.3s ease;
}

.sidebar-toggle{
  font-size:20px;
  position:fixed;
  top:0px;
  left:0px;
  z-index:9000;
  background:#111827;
  color:white;
  border:none;
  padding:8px 10px;
  border-radius:6px;
  cursor:pointer;
  opacity: 1;
}

.layout.sidebar-collapsed .sidebar{
  width:0;
  padding:0;
  overflow:hidden;
}

.layout.sidebar-collapsed .sidebar-toggle {
  opacity: 0.5;
}

/* ---------------- SIDEBAR: TOP ---------------- */

.sidebar-top{
  margin-left: 30px;
  padding-top: 0px;
  font-size: 25px;
  color:var(--sidebar-top-text-color);
  display:flex;
  font-weight: bold;
  flex-direction:column;
}

/* ---------------- SIDEBAR: MENU ---------------- */

.sidebar-menu{
  margin-top:0;  
  display:flex;
  flex-direction:column;
  gap:0px;
  font-size:var(--sidebar-menu-text-size);
  font-weight: 600;
}

.sidebar-menu a{
  color:var(--sidebar-menu-text-color);
  text-decoration:none;
  padding:1px;
  border-radius:3px;
}

.sidebar-menu a:hover{
  background:rgba(255,255,255,0.1);
  color:white;
}

/* ---------------- SIDEBAR: STATUS ---------------- */

.status{
  margin-top:0;
  display:flex;
  flex-direction:column;
  gap:8px;
}

.statusbox{
  border-radius:0px;
  font-size:13px;
  overflow: hidden;
}

.statusbox-headline{
  font-size:12px;
  border-bottom: 1px dashed;
  padding:2px;
}

.statusbox-content{
  font-size:11px;
  padding:2px;
}

.info{
  color:#000000;
  background:#ffffff;
}

.ok{
  background:#16a34a;
}

.warning{
  background:#f59e0b;
}

.alert{
  background:#dc2626;
}



/* ---------------- CONTENT ---------------- */

.content{
  padding-top:0px;
  padding-left:10px;
}

/* ---------------- GRID ---------------- */

.grid{
  display:grid;
  grid-template-columns:repeat(var(--grid-cols),1fr);
  gap:0 var(--content-grid-gap-column);
}


/* ---------------- WIDGET ---------------- */

.widget{
  grid-column:span min(var(--col),var(--grid-cols));
  grid-row:span var(--row,1);
  background:white;
  border:1px solid var(--widget-border);
  border-radius:var(--widget-border-radius);
  /*display:flex;*/
  flex-direction:column;
  box-shadow:0 2px 5px rgba(0,0,0,0.05);
  overflow:transparent;
  margin-bottom: var(--content-grid-gap-row);  
}

.widget-clean{
  background:transparent;
  border:none;
  box-shadow:none;
}

/* ---------------- WIDGET: HEADLINE ---------------- */

.widget-headline{
  grid-column:1 / -1;
  background:transparent;
  color:var(--widget-headline-text-color);
  font-size:30px;
  font-weight:bold;
  padding-bottom: 5px;
  letter-spacing:0.3px;  
  display:flex;
}

/* ---------------- WIDGET: MENU ---------------- */

.widget-menu{
  grid-column:1 / -1;
  background:var(--widget-header-bg-color);
  color:white;
  font-size:14px;
  font-weight:700;
  padding-left: 8px;
  padding-top: 8px;
  padding-bottom: 8px;
  letter-spacing:0.3px;  
  display:flex;
}

.widget-menu .menu{
    font-size:14px;
}

.widget-menu a{
  color:var(--widget-menu-color);
  border-radius:6px;
  text-decoration:none;
  padding:3px 6px;
  margin-right: 5px;
  background:rgba(255,255,255,0.2);
  display:inline-flex;
}

.widget-menu a:hover{
  color:#111827;
  color:var(--widget-menu-linktext-hover-color);
}

/* ---------------- WIDGET: HEADER ---------------- */

.widget h3{
  background:var(--widget-header-bg-color);
  color:var(--widget-header-text-color);
  font-size:var(--widget-headline-text-size);
  font-weight:700;
  border-top-left-radius: var(--widget-border-radius);
  border-top-right-radius: var(--widget-border-radius);
  padding:5px 4px;
  letter-spacing:0.3px;
  overflow: visible;
  
}

.widget-clean h3{
  all:unset;
  color:var(--widget-clean-text-color);
  font-size:var(--widget-headline-text-size);
  font-weight:700;
  padding:5px 4px;
  letter-spacing:0.3px;
  border-bottom:0px solid #ddd;
  display:block;
}

.widget h3 a{
  color:var(--widget-header-text-color);
  text-decoration: none;
}

.widget h3 a:hover{
  text-decoration: none;
  color:var(--widget-header-linktext-hover-color);
}

/* ---------------- WIDGET: CONTENT ---------------- */

.widget-content{
  opacity:1;
  padding: var(--widget-content-padding);
  transition:all 0.2s ease;
  padding-bottom: 1px;
  font-size: var(--widget-content-text-size);
  color:var(--widget-content-text-color);
}

.widget-content.collapsed{
  max-height:0;
  opacity:0;
  padding-top:0;
  padding-bottom:0;
}

.widget-content a{
  color:var(--widget-content-text-color);
  text-decoration: none;
}

.widget-content a:hover{
  text-decoration: none;
  color:var(--widget-content-linktext-hover-color);
}

.widget-toggle {
  font-size: 11px;
  cursor: pointer;
  user-select: none;
  display:inline-block;
}

.widget-toggle:hover {
  text-decoration: underline;
}

/* ---------------- WIDGET: CONTENT: SKJUL SEKTION ---------------- */
.section-content{
    opacity:1;
    overflow:hidden;
    transition:all .2s ease;
}

.section-content.collapsed{
    max-height:0;
    opacity:0;
    overflow:hidden;
    margin:0;
    padding:0;
}

.section-toggle{
    cursor:pointer;
    text-decoration:none;
}

.section-toggle:hover{
    text-decoration:underline;
}

.section-toggle::after{
    content:" (vis)";
    font-size:11px;
}

.section-toggle[data-state="open"]::after{
    content:" (skjul)";
}

/* ---------------- WIDGET: CONTENT: KALENDER ---------------- */
.section-calendar-cal{
  position:relative;
  display:inline-block;
}

.section-calendar-pop{
  position:absolute;
  top:110%;
  left:0;
  background:#fff;
  border:1px solid #bbb;
  padding:8px;
  font-family:sans-serif;
  font-size:12px;
  z-index:9999;
  box-shadow:0 4px 12px rgba(0,0,0,.15);
  transition:.1s;
}

.section-calendar-head{
  display:flex;
  gap:4px;
  margin-bottom:4px;
  justify-content:space-between;
  align-items:center;
}

.section-calendar-nav{
  display:flex;
  gap:5px;
}

.section-calendar-today-btn{
  margin-left:6px;
  font-size:11px;
  padding:2px 6px;
cursor:pointer;
}

.section-calendar-head select{
  font-size:12px;
}

.section-calendar-pop table{
  width:210px;
  border-collapse:collapse
}

.section-calendar-pop th,.section-calendar-pop td{
  width:26px;
  height:22px;
  font-size:11px;
  text-align:center;
  cursor:pointer
}

.section-calendar-pop td:hover{
  background:#eee;
}

.section-calendar-week{
  font-size:10px;
  color:#888;
}

.section-calendar-off{
  color:#ccc;
  pointer-events:none;
}

.section-calendar-today{
  border:1px solid #999;
}

.section-calendar-sel{
  background:#2d6cdf;
  color:#fff;
  font-weight:bold;
  border-radius:4px;
  outline:2px solid #1b4fb3;
}

.section-calendar-time{
  display:flex;
  gap:4px;
  margin-top:6px
}

.section-calendar-invalid{
  /* border:1px solid red; */
}

/* ---------------- WIDGET: CONTENT: MINI WIDGET ---------------- */

.widget-mini-grid{
  display:flex;
  flex-wrap:wrap;
  gap:var(--widget-content-miniwidget-grid-gap);
  padding-top:var(--widget-content-miniwidget-grid-padding-top);
  padding-bottom:var(--widget-content-miniwidget-grid-padding-bottom);
}

/* selve widget-boksen */
.mini-widget{
  width:var(--widget-content-miniwidget-width);
  height:var(--widget-content-miniwidget-height);
  background-color:var(--widget-content-miniwidget-bg-color);
  background-image:var(--widget-content-miniwidget-bg-image);
  border:var(--widget-content-miniwidget-border-size) var(--widget-content-miniwidget-border-type) var(--widget-content-miniwidget-border-color);
  border-radius:0px;
  padding:var(--widget-content-miniwidget-padding);
  display:flex;
  flex-direction:column;
  gap:5px;
  align-items:top;
  justify-content:top;
  box-sizing:border-box;
  background-position: center; /* Center the image */
  background-repeat: no-repeat; /* Do not repeat the image */
  background-size: cover; /* Resize the background image to cover the entire container */
}

/* ---------------- WIDGET: CONTENT: CUSTOM ---------------- */

.big-number{
  font-size:40px;
  font-weight:700;
  text-align:center;
}

.table-widget input{
  width:100%;
  padding:6px;
  margin-bottom:5px;
  font-size: var(--widget-content-text-size);
}
table{
  width:100%;
  border-collapse:collapse;
  font-size: var(--widget-content-text-size);
}
thead{
  position:sticky;
  top:0;
  background: transparent;
}
th{
  color:#ffffff;
  text-align: left;
  padding:5px 1px;
  background: var(--widget-content-table-thead-th-bg-color);  
  cursor:pointer;
  user-select:none;  
  position:relative; 
  padding-right:8px;
}
th::after{
  position:relative;
  margin-left:5px;
  font-size: var(--widget-content-text-size);
}
th.asc::after{
  content:"▲";
  right:6px;
  font-size: var(--widget-content-text-size);
  padding-left:3px;
}

th.desc::after{
  content:"▼";
  right:6px;
  font-size: var(--widget-content-text-size);
  padding-left:3px;
}
th:hover{
  background:var(--widget-content-table-thead-th-bg-color-hover);
}
table.zebra tbody tr:not(.no-zebra):nth-child(odd){
  background:var(--widget-content-table-tbody-tr-bg-color-odd);
}
table.zebra tbody tr:not(.no-zebra):nth-child(even){
  background:var(--widget-content-table-tbody-tr-bg-color-even);
}
tbody td{
  padding:1px;
  border-bottom:0px solid #eee;
}
tbody tr.bg-color-custom td{
  background: var(--widget-content-table-tbody-tr-custom-bg-color);
}
tbody tr.border-dotted td{
  border-bottom: 1px dashed var(--widget-content-border-dotted-color);
}

/* ---------------- WIDGET: BODY ---------------- */

.widget-body{
  padding:16px;
  flex:1;
}

/* ---------------- WIDGET: BREAK ---------------- */

.break-full-row{
  grid-column:1 / -1;
  opacity:0;
  height:0;
  margin:0;
  padding:0;
  border:0;
  line-height:0;
  font-size:0;  
}

/* ---------------- WIDESCREEN ---------------- */

@media(min-width:2500px){
  .grid{ 
    --grid-cols:24; 
  }
}

/* ---------------- TABLET ---------------- */

@media(max-width:1500px){
  .layout{
    grid-template-columns:0 1fr;
  }

  .grid{ 
    --grid-cols:6; 
  }

  .sidebar{
    width:var(--sidebar-width);
    z-index: 1000;
  }  
}

/* ---------------- MOBILE ---------------- */

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

  .grid{ 
    --grid-cols:1; 
  }

  .sidebar{
    width:100%;
    z-index: 1000;
  }
}

/* ---------------- PRINT ---------------- */

@media print{
  .sidebar-toggle{
    opacity: 0;
  }

  body{
    background:white;
  }

  /* skjul sidebar */
  .sidebar{
    display:none;
    transform:translateX(-100%);
  }

  .sidebar-toggle{
    transform:translateX(-100%);
  }

  /* content fylder hele siden */
  .layout{
    grid-template-columns:1fr;
  }

  /* fjern spacing */
  .content{
    padding:0;
  }

  /* widgets mere print venlige */
  .widget{
    box-shadow:none;
    break-inside:avoid;
    border:0px solid var(--widget-border);
    page-break-inside:avoid;
  }
}