/* Base layout */
body {
  margin: 0;
  padding: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: white;
  color: #333;
  overflow-x: hidden;
}

#cy {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: white;
  background-image: 
    linear-gradient(to right, rgba(0, 0, 0, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0, 0, 0, 0.05) 1px, transparent 1px);
  background-size: 20px 20px;
  z-index: 1;
}

/* Title Box */
#title-box {
  position: absolute;
  box-align: center;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  background-color: #2e7d32;
  padding: 10px 20px;
  border-radius: 8px;
  z-index: 15;
  color: white;
  max-width: 250px;
  text-align: center;
}

h1 {
  margin-top: 3px;
  margin-bottom: 3px;
  font-weight: 700;
  font-size: 2.5rem;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
  user-select: none;
}

h1 .subtitle {
  font-size: 1.2rem;
  font-weight: 400;
  opacity: 0.8;
  display: block;
  margin-top: 4px;
}

sup.trademark {
  font-size: 0.5em;
  vertical-align: super;
}

/* Search */
#search-container {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 15;
  background: rgba(255, 255, 255, 0.9);
  padding: 6px;
  border-radius: 6px;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.15);
  display: flex;
  gap: 6px;
  align-items: center;
}

#search-input {
  padding: 6px;
  width: 180px;
  font-size: 14px;
}

#search-button {
  padding: 6px 10px;
  font-size: 14px;
  background-color: #2e7d32;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

#search-button:hover {
  background-color: #388e3c;
}

/* Legend */
#legend {
  position: absolute;
  bottom: 12px !important;
  left: 12px !important;
  background: rgba(30, 30, 30, 0.85);
  padding: 10px 14px;
  border-radius: 8px;
  color: white;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-size: 14px;
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.6);
  user-select: none;
  max-width: 380px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Legend Color Items */
.legend-color {
  display: inline-block;
  width: 18px;
  height: 10px;
  margin-right: 8px;
  vertical-align: middle;
  border-radius: 3px;
  border: 1px solid #ccc;
}

.legend-color.slept_with { background-color: #3070b3; }
.legend-color.pulled     { background-color: #46a64e; }
.legend-color.dated      { background-color: #ff2424; }
.legend-color.hong_dong  { background-color: #FF69B4; }
.legend-color.strava_rizz { background-color: orange; }

/* Footer */
#footer-text {
  position: absolute;
  bottom: 20px;
  right: 20px;
  font-size: 0.9rem;
  background: rgba(255, 255, 255, 0.85);
  padding: 6px 12px;
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  max-width: 300px;
  text-align: right;
  line-height: 1.3;
  z-index: 15;
}

/* Button Container for Save Layout (Desktop) */
.button-container {
  display: none; /* Ensure it's visible by default for desktop */
  text-align: center;
  margin-top: 20px;
  z-index: 100; /* Ensure it's on top of other elements */
}

#save-layout-btn {
  display: none;
  padding: 10px 20px;
  background-color: #2e7d32;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  z-index: 100;
}

#save-layout-btn:hover {
  background-color: #388e3c;
}

/* Media Query for smaller screens (Mobile View) */
@media(max-width: 400px) {
  body {
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
  }

  #title-box,
  #search-container,
  #footer-text {
    left: 50%;
    text-align: center;
    background-color: #2e7d32;
    border-radius: 0;
    width: 100%;
  }

  h1 {
    font-size: 2rem;
  }

  #search-container {
    position: relative;
    align-self: center;
    box-align: center;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
    background: transparent;
    box-shadow: none;
  }

  #search-input {
    width: 60%;
    max-width: 240px;
  }

  #footer-text {
    display: none;
  }
}
