/* CSS style-sheet for the COMP2110 Dashboard 2025 */

/* Reset the spacing for all elements */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Frequently used values */
:root {
  --font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  --main-colour: #ddd;
  --second-colour: #919191;
  --accent-colour: #0a84ff;
  --bg-colour: rgba(25, 25, 25, 0.5);
  --bg-colour-alt: rgba(60, 60, 60, 0.5);
  --shadow: 0 0.1rem 0.25rem rgba(0, 0, 0, 0.5);
  --blur-filter: blur(40px);
  --border-radius: 0.5rem;
  --shadow-hover: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.5);
  --transition: 0.2s ease;
  --small-transition: 0.1s;
}

/* Values for all text and background */
html {
  height: 100%;
  font-family: var(--font-family);
  color: var(--main-colour);
  line-height: 1.5;
  /*Licensed under Creative Commons */
  background: url("https://www.trustedreviews.com/wp-content/uploads/sites/7/2018/11/Build-a-smart-home-extension-13-1024x684.jpg")
    no-repeat center center fixed;
  background-size: cover;
}

/* Header made vertical, stylied and pushed out the way of the advertisement */
header {
  position: fixed;
  top: 1rem;
  left: 1rem;
  bottom: 1rem;
  width: clamp(15rem, 10vw, 18rem);
  overflow-y: scroll;
  padding: 1rem;
  margin-bottom: 18rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg-colour);
  backdrop-filter: var(--blur-filter);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
}

header #logo {
  width: 20%;
  min-width: 5rem;
  max-width: 5rem;
  aspect-ratio: 1/1;
  /*Licensed under Creative Commons */
  background: url("https://cdn.iconscout.com/icon/free/png-256/free-house-emoji-icon-download-in-svg-png-gif-file-formats--home-building-infrastructure-travel-places-twemoji-pack-holidays-icons-30743.png")
    center/cover no-repeat;
  margin-bottom: 1rem;
}

header h1 {
  font-size: 1.5rem;
  text-align: center;
  margin-bottom: 1rem;
  color: var(--accent-colour);
}

#header-date {
  text-align: center;
  color: var(--second-colour);
}

nav ul {
  list-style: none;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
  margin-bottom: 1rem;
}

nav ul li a {
  display: inline-block;
  text-align: center;
  text-decoration: none;
  color: var(--main-colour);
  padding: 0.5rem 0.75rem;
  border-radius: 0.25rem;
  transition: background-color 0.2s ease, box-shadow 0.3s ease, transform 0.1s ease;
}

nav ul li a:hover {
  background: var(--bg-colour-alt);
  box-shadow: 0 0 0.5rem var(--accent-colour);
}

nav ul li a:active {
  transform: scale(0.98);
  box-shadow: 0 0 1rem var(--accent-colour);
}

/* Make advertisement sticky and fixed-size */
#advertising {
  position: fixed;
  left: 1rem;
  bottom: 1rem;
  width: clamp(15rem, 10vw, 18rem);
  max-height: calc(100% - 4rem);
  padding: 1rem;
  text-align: center;
  background: var(--bg-colour);
  backdrop-filter: var(--blur-filter);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
}

#advertising img {
  width: 13rem;
}

#advertising p {
  color: var(--second-colour)
}

/* Use grid layout for entire body */
body {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  padding: 1rem 1rem 4rem calc(clamp(15rem, 10vw, 18rem) + 1rem);
}

.container {
  flex: 1 1 18rem;
  max-width: 30rem;
  min-width: 18rem;
  padding-bottom: 3rem;
}

/* Creates glassy background for cards and hover effects */
.card {
  background: var(--bg-colour);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  padding: 0.5rem;
  backdrop-filter: var(--blur-filter);
  margin-bottom: 1rem;
  transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
  transform: translateY(-0.15rem);
  box-shadow: var(--shadow-hover);
}

.card h2 {
  margin-left: 0.4rem;
  margin-bottom: 0.5rem;
  color: var(--accent-colour);
  font-size: 1.2rem;
}

/* Add padding and transition parameters for all grid elements */
.grid-item {
  padding: 0.4rem;
  border-radius: 0.3rem;
  cursor: pointer;
  transition: background-color 0.2s ease, box-shadow 0.3s ease, transform 0.1s ease;
}

.grid-item:hover {
  background: var(--bg-colour-alt);
  box-shadow: 0 0 0.5rem var(--accent-colour);
}

.grid-item:active {
  transform: scale(0.98);
  box-shadow: 0 0 1rem var(--accent-colour);
}

/* Weather widgets */
.weather-card dl {
  display: grid;
  grid-template-columns: max-content auto;
  gap: 0 1rem;
}

.weather-card dl dt {
  padding-left: 0.4rem;
  padding-bottom: 0.4rem;
}

/* Light widgets */
.light {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.light h3 {
  font-size: 1rem;
  font-weight: normal;
}

/* Create button toggle in place of checkbox */
.toggle {
  position: relative;
  display: inline-block;
  width: 2.5rem;
  height: 1.25rem;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle label {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-colour-alt);
  transition: background-color 0.2s;
  border-radius: 1rem;
}

.toggle label:before {
  content: "";
  position: absolute;
  height: 1rem;
  width: 1rem;
  left: 0.125rem;
  bottom: 0.125rem;
  background-color: #ddd;
  transition: transform 0.2s;
  border-radius: 50%;
}

.toggle input:checked + label {
  background-color: var(--accent-colour);
}

.toggle input:checked + label:before {
  transform: translateX(1.25rem);
}

/* Sensor widgets */
.sensor {
  display: flex;
  justify-content: space-between;
}

/* List widgets */
.list-card ul {
  list-style: none;
  padding-left: none;
}

.list-card li {
  position: relative;
  padding-left: 0.5rem;
  align-items: center;
  margin-bottom: 0.4rem;
}

.list-card li input {
  margin-right: 1rem;
}

/* Make footer float and fixed-position */
footer {
  position: fixed;
  bottom: 1rem;
  max-width: calc(100% - 18rem);
  padding: 0.5rem 1rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  color: var(--second-colour);
  background: var(--bg-colour);
  backdrop-filter: var(--blur-filter);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
}

footer ul {
  list-style: none;
  display: flex;
  gap: 1rem;
  padding: 0;
}

footer ul li a {
  font-size: 1rem;
  color: var(--second-colour);
}

/* Adjust layout for mobile dimensions */
@media screen and (max-width: 950px) {
  header,
  #advertising,
  footer {
    position: static;
    width: 100%;
    max-width: 100%;
    transform: none;
    margin: 0 auto;
  }
  header {
    padding: 1.25rem;
    overflow: hidden
  }
  body {
    flex-direction: row;
    padding: 1rem;
  }
  .container {
    padding-bottom: 0rem;
  }
  footer {
    padding: 0.5rem;
  }
}