body {
  position: relative;

  font-family: Arial, sans-serif;
  background: #f6f8fa;
  margin: 0;
  padding: 0;
}
.container {
  max-width: 400px;
  margin: 40px auto;
  background: #fff;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
  font-size: 1.07em;
}

#top-bar {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5em;
}
.app-title {
  font-size: 1.5em;
  font-weight: bold;
  color: #1976d2;
  letter-spacing: 0.04em;
  cursor: default;
}

#top-bar button {
  background: none;
  padding: 0.25em 0.5em;
}
#top-bar button:hover {
  background: none;
}

ul#item-list {
  list-style: none;
  padding-left: 0;
  padding-right: 0;
  margin-left: 0;
  margin-right: 0;
  margin-top: 2em;
  margin-bottom: 0;
  /* Ensures list aligns with add-form */
}

ul#item-list span {
  cursor: default;
}
ul#item-list input[type="checkbox"] {
  cursor: pointer;
}

.group-box {
  border: 1px solid #ddd;
  border-radius: 8px;
  margin-bottom: 1.5em;
  padding: 0.5em 0.5em 0.25em 0.5em;
  background: #fafbfc;
  transition: box-shadow 0.2s;
}
ul#add-item-list li {
  display: flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.25em 0;
}
.list-actions {
  display: flex;
  align-items: center;
  margin-left: auto;
  gap: 0.25em;
}
ul#add-item-list input[type="checkbox"] {
  transform: scale(1.1);
  margin-right: 0.5em;
}
form {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5em; /* vertical spacing below add item form */
  margin-left: 0;
  margin-right: 0;
  padding-left: 0;
  padding-right: 0;
  /* Ensures form aligns with item-list */
}
form input[type="text"] {
  flex: 1;
  padding: 0.5rem;
  border: 1px solid #ccc;
  border-radius: 4px;
}
button {
  padding: 0.5rem 1rem;
  background: none;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}
button:hover {
  background: #1565c0;
}

form button[type="submit"] {
  background: #fff;
  border: 2px solid #1976d2;
  color: #1976d2;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  transition: background 0.2s, color 0.2s;
}
form button[type="submit"] svg rect {
  fill: #1976d2;
}
form button[type="submit"]:hover {
  background: #e3f0fd;
}

/* Flash (urgent) button styles */
.flash-btn {
  vertical-align: middle;
}
.flash-btn svg {
  transition: filter 0.2s;
}
.flash-btn:hover svg, .flash-btn:focus svg {
  filter: brightness(1.2) drop-shadow(0 0 2px #d32f2f);
}

/* Settings modal styles */
.settings-modal {
  display: flex;
  align-items: center;
  justify-content: center;
  position: fixed;
  z-index: 1000;
  left: 0; top: 0; width: 100vw; height: 100vh;
  background: rgba(0,0,0,0.3);
}
.settings-modal-content {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.10);
  padding: 2em 2.5em 1.5em 2.5em;
  min-width: 270px;
  max-width: 90vw;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
/* Add this to ensure the row containing user info and sign out button is flex and vertically centered */
#settings-modal .settings-modal-content > div:nth-child(3) {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 1em;
  gap: 1em;
}
.settings-close {
  position: absolute;
  top: 0.5em; right: 0.5em;
  background: none;
  border: none;
  font-size: 2em;
  color: #888;
  cursor: pointer;
}
#settings-user-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1em;
  margin-bottom: 0;
  font-size: 0.95em;
  min-width: 0;
}
#user-name {
  font-size: 1em;
  color: inherit;
  line-height: 1.2;
  word-break: break-word;
}
#user-email {
  font-size: 0.90em;
  color: #666;
  line-height: 1.2;
  word-break: break-all;
}
#settings-user-info span {
  font-size: 0.95em;
}
#sign-out-btn {
  background: #fff;
  border: 2px solid #1976d2;
  color: #1976d2;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  font-size: 1em;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5em;
  margin-top: 0; /* Remove extra margin so it aligns vertically */
}
#sign-out-btn:hover {
  background: #1565c0;
}
#sign-out-btn svg {
  vertical-align: middle;
  color: #190000;
}

#sign-in-btn {
  display: none;
}

.text-btn {
  min-width:70px;
  color: #fff;
  background: #1976d2;
}
.text-btn:hover {
  background: #1565c0;
}

.remove-modal-title {
  margin-bottom:1.5em;
  width:100%;
  text-align:center;
}

/* Right-align buttons in remove-modal dialog */
.remove-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5em;
  margin-top: 1em;
  width: 100%; /* Ensure full width for right alignment */
  padding-right: 0; /* Remove if any padding interferes */
}

#remove-confirm-btn {
  background: #d32f2f;
}
#remove-confirm-btn:hover {
  background: #a31f1f;
}

#lists-btn {
  margin-right: 0.5em;
}

.lists-title {
  font-weight:bold;
  margin-bottom:0.3em;
}

.user-list-row {
  width: 100%;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  margin-bottom: 0.7em;
  padding: 0.4em 0.7em;
  background: #eee;
  overflow: hidden; /* Ajouté pour éviter tout débordement */
}

.user-list-row > div {
  margin-left: 0.5em;
  margin-right: 0.5em;
  box-sizing: border-box;
  width: auto;
  max-width: 100%;
}

.user-list-row > div:nth-child(2) {
  display: flex;
  align-items: center;
  width: 100%;
  flex: 1 1 0;
  box-sizing: border-box;
  /* Prevent overflow */
  min-width: 0;
  max-width: 100%;
  padding-left: 0.5em;
  padding-right: 0.5em;
  margin-left: 0;
  margin-right: 0;
}

.user-list-row > div:first-child {
  margin-top: 0.1em;
}

.user-list-row > div:last-child {
  margin-bottom: 0.1em;
}

.user-list-row div:first-child span {
  font-size: 1.08em;
  font-weight: 500;
}

.user-list-row .progress-bar-container {
  flex: 1 1 0;
  height: 1.1em;
  background: #e0e0e0;
  border-radius: 6px;
  overflow: hidden;
  margin-right: 0;
  min-width: 0;
  max-width: 100%;
}

.user-list-row .progress-bar {
  height: 100%;
  background: #43a047;
  transition: width 0.3s;
}

.user-list-row > div:nth-child(2) span {
  cursor: default;
  margin-left: 1em;
  white-space: nowrap;
  flex: 0 0 auto;
  /* This ensures the span is always at the far right */
}

/* Remove extra margin/padding from lists-panel's intermediate modal-content if you move its content up */
#lists-panel > .settings-modal-content {
  padding: 0;
  background: none;
  box-shadow: none;
  border-radius: 0;
  min-width: 0;
  max-width: 100%;
}

/* If you move the content up, ensure #user-lists-container fills width */
#user-lists-container {
  width: 100%;
  margin: 0;
  padding: 0;
}

/* Add margin around user-list-separator */
#user-lists-separator {
  margin: 2em 1em 1.5em 1em;
}

/* Hide lists panel when not logged in */
body.not-logged-in #lists-panel {
  display: none !important;
}
