/**
 * @Author: Sebastian O.A
 * @Date:   2025-04-04 14:18:12
 * @Last Modified by:   Sebastian O.A
 * @Last Modified time: 2025-05-26 13:29:05
 */
/*----------- Generelle innstillinger ------------*/
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  transition: background-color 0.3s ease, color 0.3s ease,
    border-color 0.3s ease;
}

html {
  font-size: 16px;
}

body {
  background: var(--background-color);
  color: var(--text-color);
  font-family: Arial, sans-serif;
  display: flex;
  justify-content: center;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

a {
  color: var(--link-color);
}

/*-------------- Variabler (Tema)-----------*/

:root {
  --sidebar-width: 15rem;
  --border-radius: 15px;

  /* Dark mode */
  --background-color: #202123;
  --card-color: #393939;
  --content-color: #212121;
  --text-color: white;
  --link-color: rgb(73, 166, 209);
  --border-color: #ddd;
  --input-bg: white;
  --input-text: black;
  --btn-bg: #464646;
  --btn-hover: #5a5a5a;
}

/* Light mode */
:root.light-mode {
  --background-color: #e4e4e4;
  --card-color: #ededed;
  --content-color: #e8e8e8;
  --text-color: #333333;
  --link-color: #0066cc;
  --border-color: #2b2b2b;
  --input-bg: #f9f9f9;
  --input-text: #333;
  --btn-bg: #e0e0e0;
  --btn-hover: #d0d0d0;
}

/*---------------- Layout (Dashboard, Sidebar, Content) ---------------*/
.dashboard {
  display: flex;
  width: 100%;
  min-height: 100vh;
  padding: 1rem;
  gap: 1rem;
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 240px; /* eller hva du bruker */
  background: rgba(255, 255, 255, 0.05); /* glassmorphism */
  border-right: 2px solid rgba(255, 255, 255, 0.2); /* høyre kant */
  padding: 1rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  z-index: 10;
  backdrop-filter: blur(10px);
}

.sidebar ul {
  list-style: none;
  width: 100%;
  flex: 1;
}

.sidebar ul li {
  margin: 1rem 0;
}

.sidebar ul li a {
  color: var(--text-color);
  text-decoration: none;
  font-size: 1.4rem;
  font-weight: bold;
  display: block;
  padding: 1rem;
  border-radius: var(--border-radius);
  text-align: center;
  transition: background 0.3s;
}

.sidebar ul li a:hover,
.sidebar ul li a.active {
  background: var(--card-color);
}

.sidebar ul li a.active {
  border: 2px solid #c9c9c9;
}

/* Main Content */
.content {
  flex: 1;
  padding: 1rem;
  background: var(--content-color);
  border-radius: var(--border-radius);
  margin-left: 240px;
  margin-top: 5rem;
  overflow-y: auto;
  transition: background-color 0.3s ease;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/*--------------- Topbar og Navigasjon ---------------*/
.topbar {
  position: fixed;
  top: 1rem;
  left: calc(var(--sidebar-width) + 0.5rem);
  right: 2rem;
  z-index: 9;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 1.25rem;
  border-radius: var(--border-radius);
  text-align: center;
  transition: background-color 0.3s ease;
}

.topbar h1 {
  font-size: 1.7rem;
}

/*------------- Widgets (Kort/Grid/Kortfarger) ---------------*/
/* Klokke */
.clock {
    position: absolute;
    top: 0.5rem;
    left: 1rem;
    background: var(--card-color);
    padding: 0.5rem 0.75rem;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    z-index: 11;
    /* keep its text styling */
    font-size: 1.1rem;
  }

/* Grid layout */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  width: 100%;
  margin: 0 auto;
}

/* Kort (widgets) */
.card {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 1.5rem;
  border-radius: var(--border-radius);
  transition: transform 0.3s, background-color 0.3s ease;
  height: 100%;
}

.card:hover {
  transform: scale(1.02);
}

.card h2 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  text-align: center;
}

.card p {
  font-size: 1rem;
}

/* Ekstra fargevarianter */
.purple {
  background: linear-gradient(135deg, #764ba2 0%, #8a8e9e 100%);
}

/*-------------- Timeplan-farger ---------------*/
.ctek {
  background-color: rgba(255, 99, 71, 0.6);
}
.cyff {
  background-color: rgba(65, 105, 225, 0.6);
}
.cprg {
  background-color: rgba(50, 205, 50, 0.6);
}
.ceng {
  background-color: rgba(255, 215, 0, 0.6);
}
.cprod {
  background-color: rgba(138, 43, 226, 0.6);
}
.cgym {
  background-color: rgba(255, 127, 80, 0.6);
}
.cnat {
  background-color: rgba(32, 178, 170, 0.6);
}
.cmat {
  background-color: rgba(255, 182, 193, 0.6);
}

/*------------ Input og Knapper --------------*/
/* Input */
input[type="text"] {
  background: var(--input-bg) !important;
  color: var(--input-text) !important;
  border: 1px solid var(--border-color) !important;
}

/* Knapper */
.btn {
  padding: 8px 12px;
  border-radius: 6px;
  border: none;
  background: var(--btn-bg);
  color: var(--text-color);
  cursor: pointer;
  transition: background 0.3s;
}

.btn:hover {
  background: var(--btn-hover);
  transform: scale(1.05);
}

/*------------- Lys/Mørk-tema knapp --------------*/
.theme-toggle {
  background: var(--card-color);
  border: none;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  margin: 1rem auto 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.theme-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.theme-icon {
  font-size: 1.5rem;
  transition: transform 0.3s ease;
}

.theme-toggle:active .theme-icon {
  transform: rotate(180deg);
}

/*----------- Respnsivt design ---------------*/

@media screen and (max-width: 10000px) {
  html {
    touch-action: manipulation;
  }
}

@media (min-width: 1200px) {
  .grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: auto !important;
    height: auto;
    width: 100% !important;
    height: auto !important;
    flex-direction: row !important;
    align-items: center;
    padding: 0.75rem 0 ;
    backdrop-filter: blur(10px);
    justify-content: space-between;
  }

  .sidebar ul {
    flex: 1 1 auto;
    display: flex !important;
    flex-direction: row !important;
    justify-content: center;
    width: 100%;
    margin: 0;
    padding: 0;
  }
  .sidebar ul li {
    margin: 0 !important;
    flex: 1;
    text-align: center;
  }
  .sidebar ul li a {
    padding: 0.6rem 0 !important;
    font-size: 1.1rem !important;
    border-radius: 0 !important;
  }

  .sidebar .theme-toggle {
    position: relative;
    margin-right: 1rem;
    order: 2;
  }

  .clock {
    position: absolute;
    top: 0.5rem;
    left: 1rem;
    margin-left: 1rem;
    background: var(--card-color);
    padding: 0.5rem 0.75rem;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    z-index: 11;
    font-size: 1.1rem;
    order: 1;
  }

  .content {
    margin-left: 0 !important;
    margin-top: calc( (var(--sidebar-height, 3.5rem)) + 1rem ) !important;
  }

  .topbar {
    top: calc((var(--sidebar-height, 3.5rem)) + 2rem) !important;
    left: 1rem !important;
    right: 1rem !important;
  }
}
