/* base page styles */
body {
  margin: 0;
  padding: 0;
  font-family: Arial, sans-serif;
  background-color: #1f1f1f;
}

/* sidebar navigation */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 200px;
  background-color: #7b0001;
  padding: 1rem;
}

.sidebar a {
  display: block;
  text-decoration: none;
  color: #f1f1f1;
  margin-bottom: 1rem;
  background-color: #800000;
  padding: 0.75rem 1rem;
  border-radius: 4px;
  font-size: 1.1rem; /* a little bigger */
  transition: background-color 0.2s;
}

.sidebar a:hover {
  background-color: #a00000; /* lighter red on hover */
}

/* main content area shifted to make room for sidebar */
main {
  margin-left: 200px;
  padding: 1rem;
  box-sizing: border-box;
}

/* center headings when used */
h1.center {
  text-align: center;
}

/* edit title button */
.btn-edit-title {
  background-color: #007bff;
  color: white;
  border: none;
  padding: 0.5rem 0.8rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  transition: background-color 0.2s;
}

.btn-edit-title:hover {
  background-color: #339cff;
}

/* note editor styling */
#note-container {
  background-color: #2b2b2b; /* slightly lighter than body */
  padding: 1rem;
  margin: 1.5rem auto; /* center horizontally on page */
  border-radius: 4px;
  max-width: 1000px;
}

#note-container textarea {
  width: 100%;
  resize: vertical;
  font-family: inherit;
  font-size: 1rem;
  background-color: #1e1e1e;
  color: #eee;
  border: 1px solid #444;
  padding: 0.5rem;
  box-sizing: border-box;
}

#note-container textarea.readonly {
  background-color: #292929;
}

#note-container .buttons {
  margin-top: 0.5rem;
}

#note-container button {
  padding: 0.5rem 1rem;
  margin-right: 0.5rem;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  font-size: 0.9rem;
  color: white;
}

#save {
  background-color: #007bff;
}

#save:hover {
  background-color: #339cff;
}

#edit {
  background-color: #007bff;
}

#edit:hover {
  background-color: #339cff;
}

#cancel {
  background-color: #dc3545;
}

#cancel:hover {
  background-color: #e2525b;
}

/* grupos page styling */
#grupos-section {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 2rem;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
  align-items: flex-start;
}

.add-grupo-btn {
  background-color: transparent;
  border: 2px dashed rgba(255, 255, 255, 0.2);
  color: #888;
  padding: 1rem;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
  width: 150px;
  flex-shrink: 0; /* prevent shrinking */
  height: fit-content;
}

.add-grupo-btn:hover {
  color: rgba(255, 255, 255, 0.4);
  border-color: rgba(255, 255, 255, 0.3);
}

#grupos-container {
  display: grid;
  grid-template-columns: repeat(3, minmax(140px, 1fr));
  gap: 1rem;
  flex: 1;
}

#integrantes-section {
  padding-left: 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

#itens-section {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 2rem;
  align-items: flex-start;
}

.add-item-btn {
  background-color: transparent;
  border: 2px dashed rgba(255, 255, 255, 0.2);
  color: #888;
  padding: 1rem;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
  width: 150px;
  flex-shrink: 0;
  height: fit-content;
}

.add-item-btn:hover {
  color: rgba(255, 255, 255, 0.4);
  border-color: rgba(255, 255, 255, 0.3);
}

#itens-container {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  flex: 1;
}

.grupo-card {
  background-color: #2b2b2b;
  border: 1px solid #444;
  padding: 1rem;
  border-radius: 4px;
  color: #f0f0f0;
}

.grupo-card h3 {
  margin: 0 0 0.5rem 0;
  color: #f0f0f0;
  font-size: 1rem;
}

.grupo-card p {
  margin: 0.5rem 0;
  font-size: 0.85rem;
  color: #bbb;
}

.grupo-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.grupo-card-header h3 {
  margin: 0;
}

.btn-delete-grupo {
  background-color: transparent;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-edit-grupo {
  background-color: #007bff;
  color: white;
  border: none;
  padding: 0.4rem 0.8rem;
  border-radius: 3px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background-color 0.2s;
  margin-bottom: 0.75rem;
  width: 100%;
}

.btn-edit-grupo:hover {
  background-color: #339cff;
}

.member-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid #444;
  gap: 0.5rem;
}

/* integrante cards */
.integrante-card {
  background-color: #2b2b2b;
  border: 1px solid #444;
  padding: 1.5rem;
  border-radius: 6px;
  color: #eee;
  margin-bottom: 0.75rem;
  text-align: center;
  cursor: pointer;
  min-width: 200px;
}

.integrante-card:hover {
  background-color: #323232;
}

.integrante-img-wrapper {
  position: relative;
  width: 100%;
  height: 120px;
  overflow: hidden;
  background-color: #444;
  border-radius: 6px 6px 0 0;
  cursor: pointer;
  transition: background-color 0.2s;
}

.integrante-img-wrapper:hover {
  background-color: #555;
}

.integrante-img-wrapper:hover .img-placeholder {
  color: #fff;
}
.integrante-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* placeholder text */
.img-placeholder {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #ccc;
  font-size: 0.9rem;
  pointer-events: none;
}

.integrante-card strong {
  display: block;
  margin-bottom: 0.25rem;
}

.member-display span {
  flex: 1;
  font-size: 0.9rem;
  color: #ddd;
}

.btn-edit-member {
  background-color: #007bff;
  color: white;
  border: none;
  padding: 0.3rem 0.6rem;
  border-radius: 3px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: background-color 0.2s;
  flex-shrink: 0;
}

.btn-edit-member:hover {
  background-color: #339cff;
}

.btn-remove-member {
  background-color: transparent;
  border: none;
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}

/* modal styling */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-overlay.hidden {
  display: none;
}

.modal-content {
  background-color: #0d0d0d;
  border-radius: 8px;
  padding: 2rem;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  /* ensure content can scroll if it's taller than viewport */
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}

/* constrain images inside modal so they don't push other fields off screen */
.modal-content img {
  max-width: 100%;
  max-height: 200px;
  object-fit: contain;
  display: block;
  margin: 0 auto 1rem;
}

.modal-input {
  width: 100%;
  padding: 0.75rem;
  margin-bottom: 1rem;
  background-color: #1e1e1e;
  border: 1px solid #444;
  color: #eee;
  border-radius: 4px;
  box-sizing: border-box;
  font-size: 1rem;
}

.modal-input:focus {
  outline: none;
  border-color: #007bff;
}

.member-input-wrapper {
  display: flex;
  align-items: center;
  margin-bottom: 0.75rem;
  gap: 0.5rem;
}

.member-input-wrapper input {
  flex: 1;
  padding: 0.5rem;
  background-color: #1e1e1e;
  border: 1px solid #444;
  color: #eee;
  border-radius: 4px;
  font-size: 0.9rem;
}

.member-input-wrapper input:focus {
  outline: none;
  border-color: #007bff;
}

.remove-member-btn {
  background-color: transparent;
  border: none;
  color: #ff6b6b;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.remove-member-btn:hover {
  color: #ff8888;
}

.modal-btn-secondary {
  background-color: transparent;
  border: 1px solid #666;
  color: #aaa;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.modal-btn-secondary:hover {
  border-color: #999;
  color: #ddd;
}

.modal-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.modal-btn-save {
  background-color: #007bff;
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  transition: background-color 0.2s;
}

.modal-btn-save:hover {
  background-color: #339cff;
}

.modal-btn-cancel {
  background-color: #dc3545;
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  transition: background-color 0.2s;
}

.modal-btn-cancel:hover {
  background-color: #ff6b7a;
}

/* card edit button */
.btn-edit-card {
  background-color: #007bff;
  color: white;
  border: none;
  padding: 0.4rem 0.8rem;
  border-radius: 3px;
  cursor: pointer;
  font-size: 0.85rem;
  position: absolute;
  bottom: 0.5rem;
  right: 0.5rem;
  transition: background-color 0.2s;
}

.btn-edit-card:hover {
  background-color: #339cff;
}

/* card delete button */
.btn-delete-card {
  background-color: transparent;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  position: absolute;
  bottom: 0.5rem;
  right: 4rem;
  transition: all 0.2s;
}

.btn-delete-card:hover {
  transform: scale(1.2);
}

/* modal inputs full width */
.modal-input {
  width: 100%;
  padding: 0.75rem;
  margin-bottom: 1rem;
  background-color: #1e1e1e;
  border: 1px solid #444;
  color: #eee;
  border-radius: 4px;
  box-sizing: border-box;
  font-size: 1rem;
}

/* spacing rule specifically for the description textarea in integrante modal */
#modal-desc {
  margin-top: 0.5rem;
}

/* modal name/group text should be white for visibility */
#modal-name,
#modal-group {
  color: #fff;
}

/* make the "Nome:" and "Grupo:" labels in the modal white too */
#integrante-modal strong {
  color: #fff;
}
