@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap');

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: #f4f7fd;
  color: #333;
}

.navbar {
  width: 100%;
  background: linear-gradient(90deg, #4b6cb7, #182848);
  color: white;
  padding: 1rem 2rem;
  font-size: 1.5rem;
  font-weight: 700;
  box-shadow: 0 4px 8px rgba(24, 40, 72, 0.2);
  user-select: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 1rem;
}

#username {
  font-size: 1rem;
  font-weight: normal;
}

.logout-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.logout-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Main container and widget layout */
.container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.widget-container {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 2rem;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(3, auto);
  grid-gap: 1.5rem;
}

/* Make last widget (ad-widget) span both columns */
.widget-container>*:last-child {
  grid-column: 1 / -1;
}

/* Individual widget styling */
.widget {
  border-radius: 12px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: auto;
  background: white;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  border: 1px solid rgba(75, 108, 183, 0.1);
}

.widget:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 24px rgba(75, 108, 183, 0.2);
  border-color: rgba(75, 108, 183, 0.2);
}

.widget:focus {
  outline: none;
  border-color: #4b6cb7;
  box-shadow: 0 0 0 3px rgba(75, 108, 183, 0.3);
}

/* Weather widget specific styles */
.widget city-weather,
.widget sensor-weather {
  width: 100%;
  height: 100%;
  background: transparent;
}

/* Shopping list and todo widget styles */
.widget shopping-list,
.widget todo-widget {
  width: 100%;
  height: 100%;
  background: transparent;
}

/* Home overview widget style */
.widget home-overview {
  width: 85%;
  height: 300px;
  background: transparent;
}

/* Responsive adjustments */
@media (max-width: 900px) {
  .widget-container {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    padding: 0 1rem;
  }

  .widget-container>*:last-child {
    grid-column: auto;
  }

  .widget {
    height: 200px;
  }

  .widget home-overview {
    height: 250px;
  }

  .navbar {
    padding: 1rem;
  }
}

.side-left,
.side-right {
  background: #e2e8f0;
  padding: 1rem;
  overflow-y: auto;
}

.side-left {
  grid-area: side-left;
  border-right: 1px solid #cbd5e1;
}

.side-right {
  grid-area: side-right;
  border-left: 1px solid #cbd5e1;
}

.middle {
  grid-area: middle;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 1rem;
  padding: 1rem;
  background: white;
  overflow-y: auto;
}

.grid-item {
  background: #fff;
  border: 2px solid #4b6cb7;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgb(75 108 183 / 0.2);
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: 600;
  font-size: 1.1rem;
  color: #2c3e50;
  user-select: none;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.grid-item:hover {
  transform: translateY(-6px);
  box-shadow: 0 8px 20px rgb(75 108 183 / 0.35);
  cursor: pointer;
}

/* Scrollbar for sidebars */
.side-left::-webkit-scrollbar,
.side-right::-webkit-scrollbar,
.middle::-webkit-scrollbar {
  width: 8px;
}

.side-left::-webkit-scrollbar-thumb,
.side-right::-webkit-scrollbar-thumb,
.middle::-webkit-scrollbar-thumb {
  background-color: #4b6cb7;
  border-radius: 4px;
}

/* Responsive adjustments */
@media (max-width: 900px) {
  .container {
    grid-template-columns: 100px 1fr 100px;
  }

  .side-left,
  .side-right {
    padding: 0.5rem;
  }
}

@media (max-width: 700px) {
  .container {
    grid-template-areas:
      "navbar"
      "middle";
    grid-template-columns: 1fr;
    grid-template-rows: 60px 1fr;
  }

  .side-left,
  .side-right {
    display: none;
  }

  .middle {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
    padding: 1rem;
  }
}