.modalBackdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(135, 206, 250, 0.74);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modalContent {
  background: var(--card-background);
  background-color: var(--card-background);
  border: 1px solid var(--tile-border);
  border-radius: 8px;
  padding: 2rem;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(135, 206, 250, 0.2);
}

.modalHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modalHeader h2 {
  margin: 0;
  font-size: 1.5rem;
  color: var(--title-color);
}

.closeButton {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-color);
  padding: 5px 10px;
  line-height: 1;
  transition: color 0.2s;
}

.closeButton:hover {
  color: var(--primary-color);
}

.closeButton:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.error {
  background: var(--error-background);
  border: 1px solid var(--error-color);
  border-radius: 4px;
  color: var(--error-color);
  padding: 1rem;
  margin-bottom: 20px;
  font-size: 0.9rem;
}

.formGroup {
  margin-bottom: 24px;
}

.formGroup label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--text-color);
  font-size: 0.95rem;
}

.textInput {
  width: 100%;
  padding: 0.8rem;
  font-size: 1rem;
  border: 1px solid var(--input-border);
  border-radius: 4px;
  background: var(--input-background);
  background-color: var(--input-background);
  color: var(--text-color);
  font-family: inherit;
  transition: border-color 0.2s;
}

.textInput:focus {
  outline: none;
  border-color: var(--primary-color);
}

.inputWrapper {
  display: flex;
  align-items: center;
  width: 100%;
  position: relative;
  border: 1px solid var(--input-border);
  border-radius: 4px;
  background-color: var(--input-background);
}

.inputWrapper:focus-within {
  border-color: var(--primary-color);
}

.inputPrefix {
  padding: 0.8rem 0.8rem 0.8rem 0.8rem;
  font-size: 1rem;
  color: var(--text-color);
  font-weight: 500;
  background-color: var(--input-prefix-background);
  border-right: 1px solid var(--input-border);
  border-radius: 4px 0 0 4px;
}

.inputWithPrefix {
  flex: 1;
  border: none;
  padding: 0.8rem;
  font-size: 1rem;
  background: transparent;
  border-radius: 0 4px 4px 0;
  color: var(--text-color);
  font-family: inherit;
}

.inputWithPrefix:focus {
  outline: none;
  box-shadow: none;
}

.textInput:focus {
  outline: none;
  border-color: var(--primary);
}

.textInput:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.charCount {
  text-align: right;
  font-size: 0.8rem;
  color: var(--timestamp-color);
  margin-top: 0.3rem;
}

.emojiGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
  gap: 0.5rem;
  margin-top: 8px;
  padding: 0.8rem;
  border: 1px solid var(--input-border);
  border-radius: 8px;
  background-color: var(--emoji-grid-bg);
}

.emojiButton {
  background: var(--emoji-button-bg);
  background-color: var(--emoji-button-bg);
  border: 1px solid var(--emoji-button-border);
  border-radius: 4px;
  padding: 0.5rem;
  font-size: 1.3rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1/1;
  min-width: 2rem;
  min-height: 2rem;
}

.emojiButton:hover {
  background: var(--button-hover);
  transform: scale(1.05);
}

.emojiButton.selected {
  background: rgba(91, 173, 240, 0.2);
  border-color: var(--primary-color);
  transform: scale(1.1);
}

.emojiButton:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.modalActions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.rightActions {
  display: flex;
  gap: 12px;
}

.deleteButton {
  background: transparent;
  color: #c62828;
  border: 1px solid #c62828;
  border-radius: 4px;
  padding: 0.8rem 1.5rem;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.deleteButton:hover {
  background: #c62828;
  color: white;
}

.deleteButton:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.cancelButton {
  background-color: var(--button-background);
  color: var(--button-text);
  border: 1px solid var(--input-border);
  border-radius: 4px;
  padding: 0.8rem 1.5rem;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.cancelButton:hover {
  background: var(--button-hover);
}

.cancelButton:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.saveButton {
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 4px;
  padding: 0.8rem 1.5rem;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.saveButton:hover:not(:disabled) {
  background-color: var(--secondary-color);
  transform: translateY(-2px);
}

.saveButton:disabled {
  background-color: var(--button-disabled);
  color: var(--button-disabled-text);
  cursor: not-allowed;
  transform: none;
}

.deleteConfirmation {
  width: 100%;
}

.deleteConfirmation p {
  margin: 0 0 16px 0;
  color: var(--text-color);
  font-size: 0.95rem;
}

.confirmButtons {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.confirmDeleteButton {
  background: #c62828;
  color: white;
  border: none;
  border-radius: 4px;
  padding: 0.8rem 1.5rem;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.confirmDeleteButton:hover {
  background: #a02020;
}

.confirmDeleteButton:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

@media (max-width: 640px) {
  .modalContent {
    padding: 20px;
    max-height: 95vh;
  }

  .modalActions {
    flex-direction: column;
    align-items: stretch;
  }

  .rightActions {
    flex-direction: column;
  }

  .deleteButton,
  .cancelButton,
  .saveButton,
  .confirmDeleteButton {
    width: 100%;
  }
}

