/* === RESET === */
body, h1, h2, h3, h4, h5, h6, p, ul, ol, li, img, div, section, article, footer, header, nav, aside, table, th, td {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  border: 0;
  font-size: 100%;
  vertical-align: baseline;
}

/* === BASE BODY === */
body {
  background: url('images/grid-bg.png');
  font-family: "Courier New", monospace;
  font-size: 14px;
  line-height: 1.5;
  color: #333;
}

/* === CONTAINER === */
#container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px;
}

/* === HEADER === */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  overflow-x: auto;
  white-space: nowrap;
}

.header-images img {
  max-height: 150px;
  margin-right: 10px;
  border: 2px solid #ddd;
  border-radius: 3px;
}

/* === MAIN CONTENT LAYOUT === */
#main-content {
  display: grid;
  grid-template-columns: 220px 1fr 250px;
  grid-template-areas: 
    "sidebar welcome widgets";
  gap: 15px;
}

/* === SIDEBAR (LEFT NAV) === */
#sidebar {
  grid-area: sidebar;
  background: #f9f1e6;
  border: 2px solid #d89f6a;
  padding: 10px;
  border-radius: 6px;
}

#sidebar h2 {
  font-size: 16px;
  margin-bottom: 8px;
}

#sidebar ul {
  list-style: none;
}

#sidebar li {
  margin-bottom: 6px;
}

#sidebar a {
  text-decoration: none;
  color: #5b3b2a;
}

#sidebar a:hover {
  text-decoration: underline;
}

/* === CALENDAR WIDGET === */
.calendar-widget {
  width: 100%; 
  box-sizing: border-box;
  overflow-x: auto;  
  font-family: Arial, sans-serif;
  border: 1px solid #ccc;
  padding: 6px;
  border-radius: 6px;
  margin-bottom: 10px;
}

.calendar-widget h3 {
  text-align: center;
  margin-bottom: 10px;
}

.calendar {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}

.calendar th, .calendar td {
  width: 14.28%;
  text-align: center;
  padding: 5px;
  border: 1px solid #eee;
}

.calendar td.empty {
  background-color: #f9f9f9;
}

/* === MAIN WELCOME SECTION === */
#welcome {
  grid-area: welcome;
  background: #fffdf9;
  border: 2px solid #ccc;
  border-radius: 6px;
  padding: 15px;
  text-align: center;
}

#welcome h1 {
  font-size: 22px;
  margin-bottom: 10px;
}

#welcome img {
  max-width: 100%;
  height: auto;
  margin-top: 15px;
}

/* === RIGHT SIDEBAR (WIDGETS) === */
#widgets {
  grid-area: widgets;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

#widgets .music-player,
#widgets .goals {
  background: #fef7e7;
  border: 2px solid #d8a657;
  border-radius: 6px;
  padding: 10px;
  width: 100%;
  max-width: 100%;
}

#widgets .music-player audio {
  width: 100%;
  max-width: 100%;
  display: block;
  margin-top: 5px;
  border-radius: 6px;
}

#widgets h3 {
  font-size: 15px;
  margin-bottom: 8px;
}

/* === FOOTER === */
footer {
  margin-top: 20px;
  background: #f2e7d5;
  border: 2px solid #caa76f;
  border-radius: 6px;
  padding: 10px;
  text-align: center;
}

footer h3 {
  font-size: 15px;
  margin-bottom: 5px;
}

footer .credits {
  margin-top: 10px;
  font-size: 12px;
}

/* ===================================== */
/* === MOBILE RESPONSIVE BREAKPOINTS === */
/* ===================================== */

/* Tablet Layout (768px and below) */
@media screen and (max-width: 768px) {
  #container {
    padding: 8px;
  }
  
  #main-content {
    grid-template-columns: 1fr;
    grid-template-areas: 
      "sidebar"
      "welcome"
      "widgets";
    gap: 12px;
  }
  
  .header-images img {
    max-height: 120px;
  }
  
  #welcome h1 {
    font-size: 20px;
  }
  
  /* Make widgets horizontal on tablets */
  #widgets {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 12px;
  }
  
  #widgets .music-player,
  #widgets .goals {
    flex: 1;
    min-width: 250px;
  }
}

/* Mobile Layout (480px and below) */
@media screen and (max-width: 480px) {
  body {
    font-size: 12px;
  }
  
  #container {
    padding: 5px;
  }
  
  /* Header adjustments for mobile */
  header {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  
  .header-images {
    margin-top: 10px;
  }
  
  .header-images img {
    max-height: 80px;
    margin: 5px;
  }
  
  #main-content {
    gap: 10px;
  }
  
  /* Sidebar becomes horizontal navigation on mobile */
  #sidebar {
    padding: 8px;
  }
  
  #sidebar h2 {
    font-size: 14px;
    margin-bottom: 6px;
  }
  
  #sidebar ul {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
  }
  
  #sidebar li {
    margin-bottom: 0;
  }
  
  /* Welcome section adjustments */
  #welcome {
    padding: 12px;
  }
  
  #welcome h1 {
    font-size: 18px;
    margin-bottom: 8px;
  }
  
  #welcome img {
    max-width: 150px;
  }
  
  /* Widgets stack vertically on mobile */
  #widgets {
    flex-direction: column;
    gap: 10px;
  }
  
  #widgets .music-player,
  #widgets .goals {
    padding: 8px;
  }
  
  #widgets h3 {
    font-size: 14px;
  }
  
  /* Calendar responsive adjustments */
  .calendar-widget {
    padding: 4px;
    font-size: 11px;
  }
  
  .calendar th, .calendar td {
    padding: 3px;
    font-size: 10px;
  }
  
  /* Footer adjustments */
  footer {
    padding: 8px;
    margin-top: 15px;
  }
  
  footer h3 {
    font-size: 14px;
  }
  
  footer .credits {
    font-size: 11px;
  }
}

/* Extra small screens (360px and below) */
@media screen and (max-width: 360px) {
  body {
    font-size: 11px;
  }
  
  #container {
    padding: 3px;
  }
  
  .header-images img {
    max-height: 60px;
  }
  
  #welcome {
    padding: 8px;
  }
  
  #welcome h1 {
    font-size: 16px;
  }
  
  #welcome img {
    max-width: 120px;
  }
  
  #sidebar, #widgets .music-player, #widgets .goals {
    padding: 6px;
  }
  
  /* Make calendar even more compact */
  .calendar th, .calendar td {
    padding: 2px;
    font-size: 9px;
  }
}

/* Landscape mobile orientation */
@media screen and (max-width: 768px) and (orientation: landscape) {
  #main-content {
    grid-template-columns: 200px 1fr;
    grid-template-areas: 
      "sidebar welcome"
      "widgets widgets";
  }
  
  .header-images img {
    max-height: 60px;
  }
}

/* Print styles */
@media print {
  body {
    background: none;
    color: #000;
  }
  
  #widgets .music-player audio {
    display: none;
  }
  
  #sidebar, #widgets {
    border: 1px solid #ccc;
  }
}